SAP Community
Products and Technology
Additional Blogs by SAP
Blag's Flex 3 Compiler
Additional Blogs by SAP
All community
This category
Blog
Knowledge base
Users
Managed tags
cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
Search instead for
Did you mean:
Blag's Flex 3 Compiler
former_member18
2779
Active Contributor
Options
Subscribe to RSS Feed
Mark as New
Mark as Read
Bookmark
Subscribe
Printer Friendly Page
Report Inappropriate Content
04-07-2008
6:11 AM
0
Kudos
Many of you know that I own Flex Builder 2 thanks to Thomas Jung (
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/profile/thomas%2bjung
). So my next natural step was to upgrade to Flex Builder 3 (
http://www.adobe.com/products/flex/)...However...Adobe
doesn't have an oficce or a shop in Peru, which means that I can't buy it -:( Gladly, Adobe provides a free Flex 3 SDK (
http://labs.adobe.com/technologies/flex/sdk/flex3sdk.html
) which means that we can still develop AIR applications using the command line tools. Use the command line tools it's kind of boring and time consuming, each time you want to compile an App, you must enter the Command Line tool and type all the details, that's why I developed using {code:html}
Ruby
{code} and WxRuby (
http://wxruby.rubyforge.org/
) a small compiler which helps us to automate the process. Just pass the folder that contains your .mxml files, press a couple of button and you're done -;) Let's see the source code first... require 'rubygems' require 'wx' Btn_ChooseFolder = 1000 Btn_CompileSWF = 1001 Btn_TestAIR = 1002 Btn_CompileAIR = 1003 $config_file = File.dirname(__FILE__) << " Flex_Dir.txt" $config = IO.readlines($config_file) SWF = $config[0] + "amxmlc.bat" AIRTest = $config[0] + "adl.exe" AIR = $config[0] + "adt.bat" $Files = Array.new $Flex_Files = Array.new $App_Files = Array.new $XML_File = Array.new $exits_xml = false class Blag_Flex < Wx::Frame def initialize(title) super(nil, :title => title, :size => ( 400, 300 )) panel = Wx::Panel.new(self) m_Folder = Wx::StaticText.new(panel, -1, "Project Folder",Wx::Point.new(10, 12),Wx::Size.new(80, 20)) @mFolder = Wx::TextCtrl.new(panel, -1, "",Wx::Point.new(100, 10),Wx::Size.new(170, 20)) #---- ----------------------------------------------------------------------------------------------------- m_Id = Wx::StaticText.new(panel, -1, "Id",Wx::Point.new(20, 32),Wx::Size.new(80, 20))
@MID
= Wx::TextCtrl.new(panel, -1, "",Wx::Point.new(100, 30),Wx::Size.new(170, 20)) m_Version = Wx::StaticText.new(panel, -1, "Version",Wx::Point.new(20, 52),Wx::Size.new(80, 20)) @mVersion = Wx::TextCtrl.new(panel, -1, "",Wx::Point.new(100, 50),Wx::Size.new(170, 20)) m_Filename = Wx::StaticText.new(panel, -1, "FileName",Wx::Point.new(20, 72),Wx::Size.new(80, 20)) @mFilename = Wx::TextCtrl.new(panel, -1, "",Wx::Point.new(100, 70),Wx::Size.new(170, 20)) m_Content = Wx::StaticText.new(panel, -1, "Content",Wx::Point.new(20, 92),Wx::Size.new(80, 20)) @mContent = Wx::TextCtrl.new(panel, -1, "",Wx::Point.new(100, 90),Wx::Size.new(170, 20)) m_Visible = Wx::StaticText.new(panel, -1, "Visible",Wx::Point.new(20, 112),Wx::Size.new(80, 20)) @mVisible = Wx::TextCtrl.new(panel, -1, "true",Wx::Point.new(100, 110),Wx::Size.new(170, 20)) m_SystemChrome = Wx::StaticText.new(panel, -1, "SystemChrome",Wx::Point.new(20, 132),Wx::Size.new(80, 20)) @mSystemChrome = Wx::TextCtrl.new(panel, -1, "none",Wx::Point.new(100, 130),Wx::Size.new(170, 20)) m_Transparent = Wx::StaticText.new(panel, -1, "Transparent",Wx::Point.new(20, 152),Wx::Size.new(80, 20)) @mTransparent = Wx::TextCtrl.new(panel, -1, "true",Wx::Point.new(100, 150),Wx::Size.new(170, 20)) m_Width = Wx::StaticText.new(panel, -1, "Width",Wx::Point.new(20, 172),Wx::Size.new(80, 20)) @mWidth = Wx::TextCtrl.new(panel, -1, "",Wx::Point.new(100, 170),Wx::Size.new(170, 20)) m_Height = Wx::StaticText.new(panel, -1, "height",Wx::Point.new(20, 192),Wx::Size.new(80, 20)) @mHeight = Wx::TextCtrl.new(panel, -1, "",Wx::Point.new(100, 190),Wx::Size.new(170, 20)) #---- ----------------------------------------------------------------------------------------------------- btnChooseFolder = Wx::Button.new(panel, Btn_ChooseFolder, "Choose", Wx::Point.new(280, 10),Wx::Size.new(80, 20)) btnCompileSWF = Wx::Button.new(panel, Btn_CompileSWF, "Compile SWF", Wx::Point.new(10, 220),Wx::Size.new(80, 20)) btnTestAIR = Wx::Button.new(panel, Btn_TestAIR, "Test AIR", Wx::Point.new(100, 220),Wx::Size.new(80, 20)) btnCompileAIR = Wx::Button.new(panel, Btn_CompileAIR, "Compile AIR", Wx::Point.new(190, 220),Wx::Size.new(80, 20)) evt_button(Btn_ChooseFolder) {|event| onChooseFolder(event,panel) } evt_button(Btn_CompileSWF) {|event| onCompileSWF(event) } evt_button(Btn_TestAIR) {|event| onTestAIR(event) } evt_button(Btn_CompileAIR) {|event| onCompileAIR(event) } end end def GenerateXML() $XML_File.push("") $Dir_Text = @mFolder.get_value $Dir_Text = $Dir_Text << " " << @mFilename.get_value << "-app.xml" $output = File.new($Dir_Text,"w") $XML_File.each {|line| $output.write("#{line}
")} $output.close end def onChooseFolder(event,panel) dir_home = Wx::get_home_dir() dialog = Wx::DirDialog.new(panel, "Choose a folder", dir_home) if dialog.show_modal() == Wx::ID_OK @mFolder.set_value(dialog.get_path()) end end def onCompileSWF(event) $Dir_Text = @mFolder.get_value Dir.foreach($Dir_Text) {|x| $Files.push(x)} for $file in $Files $long = $file.length - 4 $long_xml = $file.length - 8 if($file[$long,4] == 'mxml') $file = $Dir_Text << " " << $file $Dir_Text = @mFolder.get_value $Flex_Files.push($file) end if($file[$long_xml,8] == '-app.xml') $Dir_Text = @mFolder.get_value $file = $Dir_Text << " " << $file $Dir_Text = @mFolder.get_value $App_Files.push($file) $exits_xml = true end end $Cert = @mFolder.get_value $Cert = $Cert << " sampleCert.pfx" system(AIR,"-certificate","-cn","SelfSigned","1024-RSA",$Cert,"samplePassword") for $flex_file in $Flex_Files system(SWF,"-use-network=false",$flex_file) end if($exits_xml == false) GenerateXML() end end def onTestAIR(event) if($App_Files.empty? != true) for $app_file in $App_Files system(AIRTest,$app_file) end else $Dir_Text = @mFolder.get_value Dir.foreach($Dir_Text) {|x| $Files.push(x)} for $file in $Files $long_xml = $file.length - 8 if($file[$long_xml,8] == '-app.xml') $App_Name = $file[$long_xml,8] $Dir_Text = @mFolder.get_value $file = $Dir_Text << " " << $file $Dir_Text = @mFolder.get_value $App_Files.push($file) end end for $app_file in $App_Files system(AIRTest,$app_file) end end end def onCompileAIR(event) if(@mFilename.empty? == true) $Dir_Text = @mFolder.get_value Dir.foreach($Dir_Text) {|x| $Files.push(x)} for $file in $Files $long_xml = $file.length - 8 if($file[$long_xml,8] == '-app.xml') $App_Name = $file[$long_xml,8] $Dir_Text = @mFolder.get_value $file = $Dir_Text << " " << $file $Dir_Text = @mFolder.get_value $App_Files.push($file) end end for $app_file in $App_Files $file = IO.readlines($app_file) $pos = $file[4].rindex("<") - 1 $str_file = $file[4] $str_file = $str_file[10..$pos] $FileName = $str_file $App_Name_AIR = $FileName + ".air" $Dir_Text = $FileName + "-app.xml" $App_Name_SWF = $FileName + ".swf" $Cert = @mFolder.get_value $Cert = $Cert << " sampleCert.pfx" Dir.chdir(@mFolder.get_value) system(AIR,"-package","-storetype","pkcs12","-storepass","samplePassword","-keystore",$Cert,$App_Name_AIR, $Dir_Text,$App_Name_SWF) end else $App_Name_AIR = @mFilename.get_value + ".air" $Dir_Text = @mFilename.get_value + "-app.xml" $App_Name_SWF = @mFilename.get_value + ".swf" $Cert = @mFolder.get_value $Cert = $Cert << " sampleCert.pfx" Dir.chdir(@mFolder.get_value) system(AIR,"-package","-storetype","pkcs12","-storepass","samplePassword","-keystore",$Cert,$App_Name_AIR, $Dir_Text,$App_Name_SWF) end end Wx::App.run do frame = Blag_Flex.new("Blag's Flex 3 Compiler") frame.show end We also need a small file called Flex_Dir with the information about your Flex 3 SDK installation. C: Programacion flex_sdk_3 bin Now, we can take a look at some pictures -:D
alvaro tejadagalindo3
emerging technologies
Retagging Required
ruby
scripting languages
2 Comments
Labels in this area
Business Trends
1
Event Information
1
Expert Insights
1
Related Content
Multitenant CAP app with Portal dependency
in
Technology Q&A
06-03-2021
SAP CAP Sample application display service in Fiori error CORS...
in
Technology Q&A
09-09-2020
Create an On-Off Toggle Button Add-On for SAP BusinessObjects Dashboards 4.0 SP3 or higher
in
Technology Blogs by Members
01-23-2013
Create a Blinking Label Add-On for SAP BusinessObjects Dashboards 4.0 SP3 or higher
in
Technology Blogs by Members
01-22-2013
Maximum size / complexity of ESP Model
in
Technology Q&A
09-11-2012
Popular Blog Posts
Now live: 2014 SAP HANA and SAP HANA Cloud Applications Challenge voting
My Personal Ux, Fiori, Portal and Cloud Cheat Sheet
Web Dynpro ABAP Demonstration Videos
Top kudoed authors
User
Count
leigh_mason
1
View all