Home

Fx2Ant Plugin

image

Contents

1. lt arg value flexlib flex sdk dir frameworks gt lt arg value context root context root gt lt arg value load config flex config xml gt lt arg value output main application out gt lt arg value source path gt lt arg value src dir gt lt arg value library path FRAMEWORKS libs utilities swc gt lt arg value library path FRAMEWORKS libs flex swc gt lt arg value library path FRAMEWORKS libs framework swc gt lt arg value library path FRAMEWORKS libs rpc swc gt lt arg value library path FRAMEWORKS libs charts swc gt lt arg value library path FRAMEWORKS locale locale gt lt arg value external library path S FRAMEWORKS libs playerglobal swc gt lt arg value S main application gt lt java gt lt target gt Finally the last two targets copy wrapper and prepare wrapper create HTML wrapper for the generated swf file The first one copies Flex HTML templates and the second target uses a Ant s standard task replaceregexp to replace the default template values with the ones specific to your swf lt target copy wrapper gt lt target name copy wrapper gt lt copy todir S build dir gt lt fileset dir wrapper dir gt lt copy gt lt target gt lt target prepare wrapper gt
2. lt target name prepare wrapper gt lt move file unnamed output html tofile S output html gt 2007 Farata Systems L L C 15 lt replaceregexp file outpu replace swf width gt lt replaceregexp file outpu replace swf height gt lt replaceregexp file outpu replace swf title encoding lt replaceregexp file outpu match version_major repla lt replaceregexp file outpu match version_minor repla lt replaceregexp file S output match S version_revision r lt replaceregexp file outpu replace swf application gt lt replaceregexp file outpu replace swf bgcolor gt lt replaceregexp file outpu replace swf swf gt lt target gt t html flags gs match width t html flags gs match height t html flags gs match title utf 8 gt t html flags gs ce swf version major gt t html flags gs ce swf version minor gt t html flags gs eplace swf version revision gt t html flags gs match application t html flags gs match bgcolor t html flags gs match sw f If you reconfigure your Flex project for example add new libraries you won t need to modify the file flex2ant build xml manually just re run Fx2Ant gt Generate buil
3. Fx2Ant generates build files using XSL templates You can find the list of all used templates and their location in the Fx2Ant preferences window Windows gt Preferences and then Farata gt Fx2Ant Preferences type Filter text General Ant Data Farata Application servers Databases Fx24nt Flex Fx2Doc Preferences Help Install Update Internet H Java Konus License Management Plug in Development Run Debug Server Team Validation Web and XML Web Services XDoclet DEAH E E E Se Fx2Ant Fx24nt plugin preferences V Use default XSL For build Application project C use default XSL for build Library project ibrary build XSL D Farata Test eclipse workspace com farata F Use default XSL For build Self initializing Library project Use default XSL For build Flex config xml Restore Defaults Apply The table below contains a list of all templates used by Fx2Ant Template name Description Generated XML name flex build xsl An Application build XSL see flex2ant build xml section 6 1 flex lib build xsl A Library build XSL see section 6 2 flex2ant build xml flex self init build xsl Self initializing library build XSL see section 6 4 flex2ant self init build xml flexLib2flexConfig xsl flex config xml template see section 6 2 1 lib2ant flex config xml 2007 Farata Systems L L C 22
4. The table below shows side by side the content of the generated build file flex2ant build xml and the template flex lib build xsl that was used for its generation You can use it as a sample should you decide to create your own template to be used by Fx2Ant flex lib build xsl flex2ant build xml lt xml version 1 0 gt lt xsl stylesheet xmlns xsl http www w3 org 1999 XSL Transform version 1 0 gt lt xsl output indent yes method xml gt lt xsl param name FLEX SDK gt lt xsl param name MAIN APP gt lt xsl param name FLEX CONFIG gt lt xsl template match gt lt xsl for each select actionScriptProperties compiler gt lt xsl variable name SRC_DIR select sourceFolderPath gt lt xsl variable name BUILD_DIR select outputFolderPath gt lt xsl variable name ARGS select additionalCompilerArguments gt lt project name SMAIN_APP default build basedir gt lt property name flex sdk dir location SFLEX_SDK gt lt property name output name value SMAIN_APP gt lt property name src dir location SRC_DIR gt lt property name build dir location BUILD_DIR gt lt property name additional compiler arguments value SARGS gt lt property name flex config xml location FLEX_CONFIG gt lt xsl for each select compiler variables gt lt xsl text di
5. In the section 5 1 1 we ve created just two targets but now we also find such targets as clear copy wrapper prepare wrapper target clear lt target name clear gt lt delete failonerror false gt lt fileset dir build dir includes gt lt delete gt lt target gt lt target init lt target name init gt lt mkdir dir build dir gt lt target gt The first two targets clear and init are replacing the init target from 5 1 1 The only difference is that the target clear is executed first to delete the directory from the old build failonerror false instructs Ant to not generate an error if such directory does not exist And then the target init creates a new empty directory The compilation target is also not the same as in 5 1 1 First we ll start Flex command line compiler not with exec but with java runtime we can do this because Flex compiler is nothing else but executable jar file In the same command line we pass command line parameters for the Java Virtual Machine i e maxmemory and the libraries required for your Flex project Fx2Ant is smart enough to pick them from your project s configurations lt target compile lt target name compile gt lt java jar mxmlc jar 2007 Farata Systems L L C 14 fork true maxmemory 512m failonerror true gt lt arg line S additional compiler arguments gt
6. lt property name compc jar location flex sdk dir lib compc jar gt lt target build lt target name build depends clear init compile description gt Compile flex library gt lt target gt lt property name FRAMEWORKS location flex sdk dir frameworks gt lt property name main application out location build dir S output name swc gt lt property name compc jar location flex sdk dir lib compc jar gt lt target build lt target name build depends clear init compile description gt Compile flex library gt lt target gt To use your own templates instead of the standard ones perform the following steps 1 Create an XSL file that Fx2Ant should use for generation of the build files 2 Select Windows gt Preferences from Eclipse menu 3 Select Farata gt Fx2Ant from the list on the left You ll see a selection of the XSL templates used for generation of Ant build files Un check the Use Defaults checkbox and specify your own XSL template Preferences type filter text Fx2Ant General Fx24nt plugin preferences Use default XSL for build Application project Application servers Databases Fx2Ant Use default XSL for build Library project ibrary build XSL D Farata Test eclipse workspace com farata f Browse Flex Fx2Doc Preferences Use default XSL For build Se
7. 0 gt on value output name gt e output name gt value FFFFFE gt The meaning of the properties generated by Fx2Ant is listed in the table below 20 07 Farata Systems L L C 18 Fx2Ant Property name Description Default value General these parameters can be used both in Flex Projects and in Flex Library Projects flex sdk dir Path to Flex SDK Flex SDK home main application out Name of generated swf file build dir output name s wi src dir Main source folder Project main source folder build dir Output directory Project output directory additional compiler arguments Additional compile arguments Project additional compile arguments FRAMEWORKS Framework directory Flex SDK frameworks DOCUMENTS Eclipse root directory Your eclipse root directory flex config xml flex config xml file flex sdk dir frameworks fle x config xml Flex Project parameters mxmic jar MXML compiler flex sdk dir lib mxmlc jar main application Path to main MXML file src dir main application path mxml output name Name of the output file main application path main application path Main application file name Project main application file name wrapper dir Wrapper directory flex sdk dir resources html templates express installation with history output html name
8. SimpleFlexLibrary gt lt property name src dir location com gt lt property name build dir location bin gt lt property name additional compiler arguments value gt lt property name flex config xml location D Eclipse 3 2 1 workspace SimpleFlexLibrary lib2ant flex config xml gt lt property name FRAMEWORKS location D Adobe Flex Builder 2 Plug in Flex SDK 2 frameworks gt lt property name DOCUMENTS location D Eclipse 3 2 1 workspace gt lt property name FRAMEWORKS location flex sdk dir frameworks gt lt property name main application out location build dir output name swc gt lt property name compc jar location flex sdk dir lib compc jar gt The previous section of this document describes all parameters that can be used in such a project 6 2 1 A sample lib2ant flex config xml This file includes the required namespaces and classes Fx2Ant generates this file from your project s metadata lt flex config xmlns http www adobe com 2006 flex config gt lt compiler gt lt namespaces gt lt namespaces gt lt compiler gt lt include namespaces gt lt include namespaces gt lt include classes gt lt class gt farata samples ArrayFix lt class gt lt include classes gt 2007 Farata Systems L L C 21 lt flex config gt 6 3 Using Your Own Templates
9. gt lt dirs gt lt property name flex config xml location flex sdk dir frameworks flex config xml gt lt files gt lt property name mxmlc jar location flex sdk dir lib mxmlc jar gt lt property name main application location srce dir main application path mxml gt lt property name output name value S main application path gt lt property name main application out location build dir output name swf gt lt wrapper gt lt property name wrapper dir location S flex sdk dir resources html templates express installation with history gt lt property name output html name value output name html gt lt property name output html location build dir output html name gt lt property name unnamed output html location build dir index template htm1 gt 2007 Farata Systems L L C 17 lt property lt property lt property lt property lt property lt property lt property lt property lt property name sw name sw name swf name sw name swf name sw name swf name sw name sw SwW width va height v title va lue 100 gt alue 100 gt version m version mi ue S output name gt ajor value 9 gt nor value 0 gt version r applicati valu bgcolor evision value
10. Output html file name output name htm output html Output html file path build dir output html nam e unnamed output html Path to html template build dir index template ht ml swf width SWF width 100 swf height SWF height 100 swf title Title of html page output name swf version major Flash Player major version Project Flash Player major version swf version minor Flash Player minor version Project Flash Player minor version swf version revision Flash Player version revision Project Flash Player version revision swf application SWF Application name for html wrapper output name swf swf A generated SWF name for the html wrapper output name swf bgcolor SWF background color FFFFFF 2007 Farata Systems L L C Flex Library Project parameters compc jar MXML compiler flex sdk dir lib compc jar output swc name Main application path Project main application path 2007 Farata Systems L L C 20 6 2 The Build File for a Flex Library Project Below is a fragment of a generated Ant build file generated for a Flex Library project lt xml version 1 0 encoding UTF 8 gt lt project name SimpleFlexLibrary default build basedir gt lt property name flex sdk dir location D Adobe Flex Builder 2 Plug in Flex SDK 2 gt lt property name output name value
11. dir value bin gt This means that wherever Ant will encounter dest dir surrounded with and it ll substitute it with the value of this property which is bin in our case 2007 Farata Systems L L C 11 The above project also defines a property called flex mxmlc that tells Ant where mxmlc compiler is located The target compile uses Ant s task exec which will run mxmlc compiler passing it arguments specified in lt arg gt tags Even though your installation of Eclipse contains Ant for training purposes download Ant from http ant apache org Installation is simple just unzip the archive and add the path its bin directory i e C apache ant 1 6 5 bin to the environment variable path of your OS Now we can open a command window get into directory where HelloWorld mxml and build xml are located and enter the command ant that will start the execution of the default target of our project which is compile But since compile target is marked as dependent on init ant will execute the init target first Ant has extensive set of predefined tasks like copy zip jar War FTP Mail Condition and many more described at Ant documentation For example to make our build file work in both Windows and Unix environments we can specify the location of mxmlc compiler as follows lt condition property flex mxmlc value sdkdir bin mxmlc gt lt os family unix gt lt condition gt lt condition propert
12. into Ant scripts so that you can build your modules libraries and applications outside of Eclipse and create larger integrated builds Writing manual Ant scripts is a lengthy process but with Fx2Ant makes it s just a mouse click away As an extra bonus Fx2Ant creates build scripts that optimize the size of your Flex project libraries 2 0 REQUIREMENTS 2 1 Fx2Ant plug in Fx2Ant plugin 1 0 requires Java Development Kit JDK 1 4 2 or later The users of Fx2Ant have to have Flex Builder installed as a plugin in Eclipse 3 2 or later 2 2 Apache Ant Fx2Ant requires Apache Ant 1 6 5 or later which comes with Eclipse IDE and it also can be downloaded at http ant apache org 3 0 INSTALLING FX2ANT 3 1 Installing Fx2Ant from a remote update site 1 Select Help gt Software Updates gt Find and Install from the main menu Window fae G Welcome 2 Help Contents P Search Dynamic Help Ctrl Shift L Key Assist Tips and Tricks Cheat Sheets Software Updates 2 Find and Install About Eclipse SDK 3 Manage Configuration 2007 Farata Systems L L C 3 2 Select Search for new features to install and press Next Install Update Feature Updates Choose the way you want to search for Features to install Search For updates of the currently installed features Select this option if you want to search for updates of the features you already have installed Search For new Feat
13. 0 0 200705150133 pe Core features for myflex org 1 0 0 200705150133 oO Se Logging API support and local logging console 1 0 0 200705150133 Select Required Error Det Gp Fx2 nt Feature 1 0 0 200705150133 o am ClearBI 1 0 0 200705150133 or ails Builds Flex Ant file from the project files based on the customizable templates 2 of 114 selected Show the latest version of a feature only C Filter Features included in other features on the list 5 Read the License agreement and if you want to proceed with the installation select I accept the terms in the license agreements followed by Next 6 Press the Finish button on the wizard s confirmation page Install Installation The following features will be installed You can select a feature and change the location where the Feature will be installed Features to install Feature Name Feature Version Feature Size Installation Directory Core features for my 1 0 0 v200705171546 Unknown D Eclipse 3 2 1 ph Fx2ant Feature 1 0 0 200705171546 Unknown D Eclipse 3 2 1j Install Location D Ecipse 3 2 1 Change Location Required space Unknown Free space 45 35 GB 2007 Farata Systems L L C 5 7 Press the button Install All on the verification window Verification Feature Verification af A Warning You are about to install an unsigned feature D u You may choose to install the Feature or cancel its installation This f
14. Fx2Ant Plugin Version 1 0 User Guide 2007 Farata Systems L L C Table Of Contents 1 0 OVERVIEW 3 2 0 REQUIREMENTS 3 2 1 Fx2Ant plug in 3 2 2 Apache Ant 3 3 0 INSTALLING FX2ANT 3 3 1 Installing Fx2Ant from a remote update site 3 2 Installing Fx2Ant plugin from the local update site 3 3 Installing the license for Fx2Ant 4 0 USING FX2ANT 9 4 1 Creating an Ant build file 4 2 Running the Ant build script 5 0 HELLO WORLD WITH ANT AND FX2ANT 11 5 1 Building HelloWorld with Ant 11 5 2 Building HelloWorld with Fx2Ant 12 6 0 CUSTOMIZING FX2ANT 17 6 1 The Build File for a Flex Project 17 6 2 The Build File for a Flex Library Project 21 6 2 1 A sample lib2ant flex config xml 21 6 3 Using Your Own Templates 22 6 4 Self Initializing Libraries 25 2007 Farata Systems L L C 1 0 OVERVIEW Real world Flex projects include several Flex modules as well as code written in other languages such as Java Creation of the build file for a popular Ant tool helps automating the entire build process of your project While this user manual includes a section describing how to create Ant build files manually this is a time consuming task especially for a mid size or large projects Fx2Ant plugin automatically generates an Ant build file for your Flex project It also creates an HTML wrapper that is required to run swf file in the Web browser Fx2Ant instantly translates the settings of your existing Flex Projects
15. Project Nature gt bc Declaration Search E Properties Alt Enter peay st this time Log4Fx gt Clear Data Builder gt ClearBI gt Fx2Doc gt Fx24nt gt Generate build files After the generation is complete you ll find the file named flex2ant build xml in your project directory 4 2 Running the Ant build script 1 Right click on the generated file name and select Run As gt Ant Build from the popup menu 2007 Farata Systems L L C Example Flex settings amp GR bin H E com html template actionScriptProperties B flexProperties Ei project EE Copy Ctrl C ES Copy Qualified Name Paste Ctrl J Delete Delete Build Path Refactor Alt Shift T sImport eZgExport Refresh Validate Open Javadoc Wizard Set as Default Application Compile CSS to SWF Include Class in Library Run As pl 1 Run on Server Alt Shift Xx R Debug As Profile As Team Compare With Replace With Source 2 Ant Build amp lt Shif Q External Tools Properties Alt Enter Log4Fx Clear Data Builder 2 After the execution of the Ant script completes you ll find the file your project name swf or your_project_name swc in your project directory 2007 Farata Systems L L C 5 0 HELLO WORLD WITH ANT AND FX2ANT This section contains a two HelloWorld examples The first one is a mini primer on how use Ant popular Java based build tool from Apache just and the second one shows how Fx2A
16. cenario all definitions originally contained in the library swf will be upfront loaded into the main applicationDomain during the application startup which is not the case with external linkage e Merge in The objects and resources contained in the library swf get embedded directly into your application s SWF FlexApplication This will only happen for those objects that are explicitly referenced by the application code This is a default option for statically linked applications and guarantees that the definitions of all referenced classes as well as the classes they depend on are loaded into the main application domain A Merge in scenario is often called static linking while External and RSL are the cases of dynamic linking The problem with RSL s though is that if you do not mention in your Flex application a class located in the SWC library you ll get a runtime error Can not access a property or method or a null object reference which means that the Flex application and the library are tightly coupled We offer you a brief description of the workaround that we ll call Self Initializing Libraries and you can find detailed description of this techniques in Chapter 10 of the book Rich Internet Application with Adobe Flex and Java written by creators of Fx2Ant and published by Sys Con Publications see www theriabook com It ll allow your application to use multiple SWC libraries and Flex application will be able to initialize th
17. d files and the build file will be recreated according to your latest settings Nevertheless if you decide to change one of the default settings for example use non standard Flex SDK i e the one that comes with Flex Data Services Just change one of the default flex2ant build xml features as explained in the next section 2007 Farata Systems L L C 16 6 0 CUSTOMIZING FX2ANT This section covers internals of generated Ant files After reading it you ll be able not only modify the process of generation of these files but also generate your own build files using Fx2Ant 6 1 The Build File for a Flex Project Below is a fragment of a generated Ant build file generated for a Flex project lt xml version 1 0 encoding UTF 8 gt lt project name SimpleFlexProject default build basedir gt lt property name flex sdk dir location D Adobe Flex Builder 2 Plug in Flex SDK 2 gt lt property name main application path value SimpleFlexProject gt lt property name src dir location gt lt property name build dir location bin gt lt property name additional compiler arguments value locale en_US gt lt property name FRAMEWORKS location D Adobe Flex Builder 2 Plug in Flex SDK 2 frameworks gt lt property name DOCUMENTS location D Eclipse 3 2 1 workspace gt lt property name FRAMEWORKS location flex sdk dir frameworks
18. dy have installed Search For new features to install Select this option if you want to install new Features from existing or new update sites Some sites may already be available You can add new update site URLs to the search Finish 4 You ll see a popup window with a list of available Web sites with Eclipse related software Press the button New Archived Site select the directory where your update zip is located Enter the name of the site for example myflex org Press OK and then Finish Install Update sites to visit Select update sites to visit while looking for new features Sites to include in search Edit Local Site New Remote Site Name myflex org New Local Site URL jar file D farata Local Update Site update zip New Archived Site Edit is SL LL LL amp amp amp Import sites Export sites V Ignore features not applicable to this environment C Automatically select mirrors Cancel 5 Continue installation starting from step 4 in section 3 1 2007 Farata Systems L L C 7 3 3 Installing the license for Fx2Ant 1 Download a free trial version or purchase the license at www myflex org 2 Select Windows gt Preferences from the main menu 3 Select License Management from the list on the left On the popup window press Install License and select the downloaded license Preferences ty
19. e compile which in turn consist of tasks i e mkdir exec Listing below shows a build xml that will create an output directory bin and compile our HelloWorld application into this directory This Ant build file has two targets init and compile lt project name HelloWorld default compile gt lt property name flex mxmlc location C Program Files Adobe Flex Builder 2 Plug in Flex SDK 2 bin mxmlc exe gt lt property name dest dir value bin gt lt target name init gt lt delete dir S dest dir gt lt mkdir dir S dest dir gt lt target gt lt target name compile depends init gt lt exec executable flex mxmlc failonerror true gt lt arg line output S S dest dir HelloWorld swf gt lt arg line HelloWorld mxml1 gt lt exec gt lt target gt lt project gt The init target performs on the destination directory bin two tasks delete and create The compile target will compile HelloWorld mxml producing bin HelloWorld swf If we d need to manually write a command that compiles HelloWorld mxml into the bin directory itd look like this mxmic output bin HelloWorld swf HelloWorld mxml Besides targets and tasks our build xml contains two property tags One of them defines the property called dest dir that has a value bin which is the name of the output directory for our compiled HelloWorld swf lt property name dest
20. eature has not been digitally signed The provider of this Feature cannot be verified Feature name Core features for myflex org Feature Identifier com farata flex_1 0 0 200702190854 Provider Farata Systems File Identifier com farata flex_1 0 0 200702190854 After the installation is complete reload the workspace Fx2Ant is ready for use 3 2 Installing Fx2Ant plugin from the local update site If your computer is protected by a corporate firewall you might experience difficulties working with remote update site As a workaround to this issue create the local update site and load all required plugins from there 1 Download the zip file at http mantis faratasystems com downloads local update update zip which will become your local update site 2 Start Eclipse IDE and select the menus Help gt Software Updates gt Find and Install Window fae E Welcome z Help Contents P Search Dynamic Help Key Assist Ctrl Shift L Tips and Tricks Cheat Sheets Software Updates 2 Find and Install About Eclipse SDK 3 Manage Configuration 2007 Farata Systems L L C 3 Select Search for new features to install and press Next Install Update Feature Updates A Choose the way you want to search For Features to install D i Search For updates of the currently installed features Select this option if you want to search for updates of the features you alrea
21. eir classes without the need to know class names in advance Ant and Fx2Ant will help us create such self initializing library Instead of using standard routine of creating SWC with compc and extracting SWF out of it Fx2Ant will generate the build script that will create this SWF as if it s not a library but an application that will automatically load all library classes into the currentDomain of the hosting application To minimize the size of the resulting SWF Fx2Ant will mark Flex Framework s classes as external assuming that the main application will load them anyway This size optimizing builds prepared by Fx2Ant can help you cut down the download time of your large applications If you use RSL libraries Fx2Ant will help you to prevent notorious run time exceptions caused by improper dynamic class invocations 2007 Farata Systems L L C 25
22. lf initializing Library project Help Install Update Internet Use default XSL for build flex config xml Java Konus License Management Plug in Development Run Debug Server Team Validation Web and XML Web Services XDaclet 2007 Farata Systems L L C Restore Defaults Apply 24 6 4 Self Initializing Libraries Mid size or large applications can consist of Flex applications SWF and a number of Flex library files SWC An SWC is an archive file much like ZIP or JAR and it contains library swf and catalog xml files The latter describes the hierarchy of dependencies found the former Depending on how you link library files to your application the library swf may be expanded into a SWF file These are the three ways of linking SWC s to your Flex project External The SWC s catalog xml will be used to resolve references however the definitions contained in library swf won t be included in the body of your Flex application SWF The External link type assumes that by the time Flex application needs to create instances of the classes cotained in the library swf the definitions for these classes will be accessible from the current application domain RSL The SWC s catalog xml will be used to resolve references the definitions contained in library swf won t be included in the body of the FlexApplication swf The difference between the RSL and External is that in the RSL s
23. mxml layout absolute gt lt mx Label text Hello World gt lt mx Application gt As you ve learned from section 4 1 you can automatically generate the Ant build file flex2ant build xml using the menus Fx2Ant gt Generate build files 2007 Farata Systems L L C 12 Ee Li New gt Go Into Open in New Window Copy Ctrl C ES Copy Qualified Name Paste Ctrl y X Delete Delete Build Path gt Refactor Alt Shift T gt Remove from Working Set s Import t Export Refresh FS Close Project Close Unrelated Projects Validate Run As Debug As Profile As Team Compare With Restore from Local History Source gt PDE Tools gt Flex Project Nature gt ee ae i i oc Declaration Search display at this time Properties Alt Enter Log4Fx Clear Data Builder ClearBI Fx2Doc ee OF Generate build files 45 Flex Samples Helloworld H E bin gt html template actionScriptProperties flexProperties Eil project x fj nt build xml X flex2ant master xml F Helloworld mxml Let s consider the generated targets in this file we ll omit parameters for brevity 2007 Farata Systems L L C target build lt target name build depends clear init compile copy wrapper prepare wrapper description gt Compile flex application gt lt target gt
24. nt automates creation of Ant build files for HelloWorld Flex project 5 1 Building HelloWorld with Ant Unless your project is as simple as HelloWorld application compilation and deployment of this Flex application has to be automated Creating a build script for any decent size application i e hundreds of files in Flex and server side Java is a project on its own Java programmers typically use one of the open source build tools such as Ant or Maven to formally describe and execute all steps required to build and deploy their projects Even deployment of such simple application as HelloWorld may consists of several steps for example 1 Using mxmlc compile HelloWorld mxml into an swf file 2 Create an HTML wrapper file s from one of the HTML templates 3 Create or clean the directory in your Web server where HelloWorld files will be deployed 4 Copy or ftp HelloWorld swf and supporting files to this directory Now imagine that your HelloWorld application is a part of a larger application that includes Java modules that also need to be compiled and deployed under some server location Deployment process of even a small size project usually involves at least a dozen of dependent tasks that have to be executed in a particular order Creating and maintaining of a build script is well worth the effort With Ant you describe your project in a build file written in xml it s typically called build xml An Ant project consists of targets i
25. pe filter text General Ant Look in 2 Licenses Farata Flex Help Install Update My Recent Documents Java License Management Plug in Development Run Debug Team lFx28nt Trial period 30 days lic File name Fx2 nt Trial period 30 days lic My Network Files of type i Install License Restore Defaults 4 The selected license becomes your default license If you did not read the license agreement please do so by selecting com farata flex2ant in the Products under license section After that press the button OK and restart Eclipse 2007 Farata Systems L L C 4 0 USING FX2ANT To build your Flex or Flex Library project you start with auto generating an Ant build file and then Ant will execute this build script The entire process is described below 4 1 Creating an Ant build file 1 Right click on your Flex Project or Flex Library Project 2 Select Fx2Ant gt Generate build files from the popup menu This will generate Ant build file according to your project settings or H E Exampl X Go Into Open in New Window B Copy Ctrl C 5 Paste Ctrl gt Delete Delete Build Path gt Refactor Alt Shift T gt Remove from Working Set gy Import L Export Refresh FS Close Project Close Unrelated Projects Validate Run As Debug As Profile As Team vvv v v Compare With Restore from Local History Source gt PDE Tools gt Flex
26. sable output escaping yes gt lt CDATA lt property name gt lt xsl text gt lt xsl value of select name gt lt xsl text disable output escaping yes gt lt CDATA location gt lt xsl text gt lt xsl value of select value gt lt xsl text disable output escaping yes gt lt CDATA gt gt lt xsl text gt lt xml version 1 0 encoding UTF 8 gt alue gt lt property name flex config xml location D Eclipse lt project name SimpleFlexLibrary default build basedir gt lt property name flex sdk dir location D Adobe Flex Builder 2 Plug in Flex SDK 2 gt lt property name output name value SimpleFlexLibrary gt lt property name src dir location com gt property name build dir location bin gt lt lt property name additional compiler arguments VvV 3 2 1 workspace SimpleFlexLibrary lib2ant flex config xml gt lt property name FRAMEWORKS location D Adobe Flex Builder 2 Plug in Flex SDK 2 frameworks gt lt property name DOCUMENTS location D Eclipse 3 2 1 workspace gt 2007 Farata Systems L L C 23 lt xsl for each gt lt xsl text disable output escaping yes gt lt CDATA lt property name FRAMEWORKS location flex sdk dir frameworks gt lt property name main application out location build dir S output name swc gt
27. ures to install Select this option if you want to install new features from existing or new update sites Some sites may already be available You can add new update site URLs to the search 3 You ll see a popup window with a list of available Web sites with Eclipse related software Press the button New Remote Site Enter the name of the site for example myflex org and the following URL http mantis faratasystems com downloads update site xml Press OK and then Finish Install Update sites to visit aj Select update sites to visit while looking for new features OLJ Sites to include in search F a Callisto Discovery Site New Remote Site o lt il The Eclipse Project Updates New Local Site New Update Site w Archived Site _myflex org ttp mantis Faratasystems com downloads update site xml Import sites Export sites V Ignore features not applicable to this environment C Automatically select mirrors 2007 Farata Systems L L C 4 4 Select Fx2Ant Feature from the list of features and press the button Select Required for adding required plugins After that press the button Next Search Results D Select Features to install from the search result list 5 Select the features to install o m e myflex org eselect All m 000 Other C E Fx2Doc Feature 1 0 0 v200705150137 More Info e Infe ge Clear Data Builder Plug in 1
28. y flex mxmlc value sdkdir bin mxmlc exe gt lt os family windows gt lt condition gt You can pass the values of the properties from ant command line using Dpropery value option For example if we use the code snippet above the property sdkdir can be passed from a command line ant Dsdkdir opt usr freeflex You can write more sophisticated ant scripts For example you can automate creation of an html wrapper http mxdj sys con com read 310378 htm for swf files with replaceregex task applied to one of the provided html templates You can write build scripts that will merge Flex generated artifacts with Java Web applications Automating builds with Ant can get you pretty far There are lots of online articles and books on Ant but do not miss Ant in Anger by Steve Loughran http ant apache org ant_ in anger html where he discusses some core practices naming conventions and team development process with Ant 5 2 Building HelloWorld with Fx2Ant To start let s create a simple Flex project by selecting the menus File gt New gt Project Flex gt Flex Project and press the button Next On the next window select Basic as the data access type and press Next Enter HelloWorld as the name of your project and press the button Finish This simple project will just show Hello World in a Label control lt xml version 1 0 encoding utf 8 gt lt mx Application xmlns mx http www adobe com 2006

Download Pdf Manuals

image

Related Search

Related Contents

ETXexpress-PM User's Guide - Integrated Exploration Systems GmbH  Philips Pure Essentials Collection Hand blender HR1370/91  ProPanel ProPanel-RF User Manual for:  AKG Q 701  Noise dosimeter  Honeywell R4140G User's Manual  the Leader`s Guide  Bulletin n°39  KitchenAid KEK1522 User's Manual  

Copyright © All rights reserved.
Failed to retrieve file