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

Compare with Current View Page History

Version 1 Next »

If you want to play with FlexJS and are too lazy to build from the sources, I have hacked together a way for you to try it in Flash Builder.

Setup instructions are:

  1. Get Apache Flex 4.9 working in FB. (I tried it with FB 4.7, but not FB 4.6)
  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 closure/goog folder.
  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 4.9 folder> <path to where the script should make a copy of Apache Flex 4.9 folder>
    Note that the deploy script will neuter the Flex aspects of this folder and replace it with FlexJS stuff.
  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
    #Choose the ide/flashbuilder folder from this copy of Apache Flex 4.9 we are mucking with.
    There should now be four new configs in the Run menu under External Tools

Now for each project:

  1. Create a new Flex Project
  2. Choose this modified Apache Flex SDK
  3. Do not change the output folder from bin-debug
  4. Flash Builder will generate a totally messed up Application tag so replace it with this template:

<?xml version="1.0" encoding="utf-8"?>
<basic:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:basic="library://ns.apache.org/flexjs/basic"
>
</basic:Application>

Source Code

Right now, Application doesn’t contain any UI, it takes another MXML file as the initialView property and a model and a controller. You can reference the example in FlexJSSDKTest.

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 probably won’t run. So, before you debug, 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.

Once you have your app working as a SWF, try one of the FalconJS tools. It will output by default to the binjs-debug or binjs-release folder. If you run the FalconJS debug configuration, see the console output for instructions on how to copy the goog and FlexJS source folders into your binjs-debug folder.

I’m sure there’ll be lots of issues, but feel free to comment or contribute. Remember, this is in its infancy so it will likely fall down easily and poop unexpectedly.

  • No labels