Flex‎ > ‎

Setting up a Tutorial Flex environment

The best flex development environment are FlexBuilder or Intellij.

However - for tutorial purposes, where you have the code but just want to see it in action, you can set a free environment.
(The above have trial periods you can use as well).

I use  Intellij Community Edition to for tutorials and stuff.
I build my source with Maven.

This page will show you how to hook these with Flex.

  1. Download the Flex SDK (this link need changing for every new version)
  2. I like to add "bin" directory to Path - even this this is not really necessary - you will have to specify it later in the pom.
  3. Use this archetype command template to create new flex project
    1. mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DgroupId=multiModuleProjectId -DartifactId=multiModuleProjectArtifactId -DpackageName=com.mypackage -Dversion=1.0
  4. edit the pom to point to flex home
    <properties><flex.home>${env.FLEX_HOME}</flex.home></properties>

** NOTE : This page shows how to use plugin net.israfil.mojo:maven-flex2-plugin.
First of all - maybe there are newer versions of this plugin for flex 3 and 4, I don't know.
Second of all - there are other plugins, such as Server Box    - however I found it complicated to work with.

Referencing the XSD

I usually define the XSD's location so that intellij will be able to auto-complete my XML.
This would require me to add the following for the mx:Application tag.
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.adobe.com/2006/mxml http://xsd4mxml.googlecode.com/files/flex3.xsd"

However, when I add this - it causes the flex-compiler to fail.. yet another weird thing with flex.
So it is better to download it (Simply use the location specified above) and configure Intellij  manually.


Debugging


It seems that debugging is important even if you don't use IDE. The reason it - error messages won't pop up unless you have a debugger. (This is a weird behavior).

You can find the debugger here. NOTE : it's a different link according to browser type since the debugger is a browser plugin.

Security Level

The tutorials you are using might require you to access local resources (such as XML), it is important to understand the possible values for security levels in flex and how to modify them.
Here is a great link just for that.

However, you should know that the Maven plugin I showed above doesn't behave nicely at all. In order to modify the "use-network" value - you should now wrote
<use-network>true/false</use-network>

but instead do something like :
 <extraParameters>
             <parameter><name>use-network=false</name></parameter>
  </extraParameters>

In the plugin configuration to get the behavior required. (plugin version dependent of course).

References


Comments