You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Follow these instructions to use Flash Builder 4.7 for developing FlexJS applications.

Setup instructions are:

  1. Install Apache Flex 4.9 or later as an SDK in FB.
  2. Shut down FB
  3. Install Google Closure library. You can get a zip from: http://code.google.com/p/closure-library/downloads/list
  4. Set the environment variable GOOG_HOME to point to the folder that contains the closure and third_party folders. This folder's name and location may be different in different version of Google Closure.
  5. Unzip FlexJSOverlay.zip from http://people.apache.org/~aharui/FlexJS/ into a some other folder.
  6. Change to that folder and run deploy.sh or deploy.bat <path to Apache Flex SDK folder> <path to where the script should make a copy of Apache Flex SDK folder>
    Note that the deploy script will neuter the Flex aspects of this folder and replace it with the FlexJS SWC and a new MXML and AS compiler known as Falcon that knows how to compile FlexJS applications.
  7. Run Flash Builder
  8. In the Flash Builder Preferences menu add this new folder as a Flex SDK.
  9. Choose from the File menu, Import, Run/Debug, Launch Configurations
  10. Choose the ide/flashbuilder folder from this modified copy of the Apache Flex SDK.
    There should now be several new configs in the Run menu under External Tools

Creating a FlexJS Application

Flash Builder does not currently know how to create new FlexJS Application. The recommended way to create a new Application is to copy an existing working example and modify it as follows:

  1. Create a new Flex Project
  2. Choose this modified Apache Flex SDK
  3. Do not change the output folder from bin-debug
  4. Hit OK. Flash Builder will generate a new project and a new Application MXML file that has errors. Ignore those errors for now.
  5. Get the example source for the DataBindingTest from http://people.apache.org/~aharui/FlexJS/DataBindingTest/bin-release/srcview/DataBindingTest.zip
  6. Copy the contents of DataBindingTest.mxml into your Application MXML file. The current tools require that the Application name matches the Project name so you can't just copy DataBindingTest.mxml to the source folder and make that the default Application for the project.
  7. Copy the rest of the files to the source folder for your project.
  8. Rename the references to DataBindingTest in the other source files to match your Application's name.

Building and Running/Debugging

As you edit the code, the regular Flex compiler is compiling and reporting errors, but it only knows how to build Flex SWFs so the output SWF won’t run. So, before you debug, select the main MXML file from the Package Explorer and choose from the Run menu the new External Tool: “FlexJS (Debug Build)”. This will run the Falcon compiler with the right options to generate a SWF in the bin-debug folder that overwrites the one that is there. Then you should be able to set breakpoints and debug.

The Falcon compiler cannot currently access your project's settings so any custom compiler options, library and source-paths must be added to the Launch Configuration.

Once you have your app working as a SWF, try the FalconJX tool in the Run menu. It will output a debug version to the bin/js-debug and a minified version to the bin/js-release folder. Run the index.html in a browser.

Converting an Existing Flex Application

The FlexJS prototype is so new, that nobody has attempted to convert an existing application since significant functionality is probably missing. However, the steps should be:

  1. In the Project Properties, change the Flex SDK.
  2. In each MXML file, change the xmlns for mx or s (or both) to library://ns.apache.org/flexjs/basic
  3. You will then have to fix lots of errors in your code where your code uses imports and API from Flex SDK classes that are not currently supported in FlexJS.

Getting Help

Please ask questions on the dev@flex.apache.org mailing list. Please start the subject of your email with "[FLEXJS]". You may file bugs at https://issues.apache.org/jira/browse/FLEX under the component "FlexJS". Remember, Apache projects like Apache Flex is mostly staffed by volunteers so response times may vary and any contributions like patches are welcome.

  • No labels