Thursday, July 31, 2008

Using Components in Flash Develop

To use Flash IDE components in Flash Develop:

  1. Create a new 'Flash File'

  2. Double click on the components you want to use. (Ctrl + F7 to bring up the 'Components' window)

  3. Select a component in the 'Library' window and select 'Export to SWC...'

  4. Decide on a file name and save it


It does not matter which component you choose, it will all be added to the created SWC. Now just make sure to add it for inclusion when you build your code, which ever way you do it.

To double check if the components are there just open the SWC file with a zip program and you should see a list of SWFs and catalog.xml file.

Installing Flex 3 and Ant

Ant install:
Unzip "apache-ant-1.7.1-bin.zip"
into "C:\Program Files\"

Flex 3 SDK install:
Unzip "flex_sdk_3.zip" into "C:\Program Files\flex_sdk_3"

Copy the "C:\Program Files\flex_sdk_3\ant\lib\flexTasks.jar" into
"C:\Program Files\apache-ant-1.7.1\lib\"

Access the environment variables:
(Windows Key + Pause)
Go to the "Advance" tab then the "Environment Variables" button.

Create Environment Variables:
Create new variables called:

ANT_HOME
FLEX_HOME

With values of, respectively:

C:\Program Files\apache-ant-1.7.1
C:\Program Files\flex_sdk_3

Add to your path:
%ANT_HOME%\bin;%FLEX_HOME%\bin

Setup Flash Develop:
We have to tell Flash Develop where to look for the compiler.

Either hit F10 or traverse to Tools::Program Settings...
Select "AS3Context" on the left pane under "Plugins".
Under "Language" in the right pane, select and modify "Flex SDK Location".

For the purpose of this post it is "C:\Program Files\flex_sdk_3".

Under Project::Properties...
Select the "Output" tab.
Check the check box of "No output, only run pre/post build commands."

Select the "Build" tab.
Under the "Pre-Build Command Line" section add "ant.bat".
This is why we need the ANT_PATH variable.
Apply the changes.

When working on a project you ideally would have a "build.xml"
file in the root of your project. To build the project hit F8. This
will produce whatever the build file was told to do.

The FLEX_PATH allows ant to access mxmlc and compc executables.
Flex Tasks allows us to add compiler options as xml nodes. More on that here.

Wednesday, July 16, 2008

Command Line Compiler and Debugger

Open a command prompt here:
C:\Program Files\Adobe\Adobe Flash CS3\en\Configuration\ActionScript 3.0

Compiler

java -jar asc_authoring.jar -help

Debugger:

java -jar fdb.jar

Which will get you this:
(fdb)

Then type "help" or "tutorial".

Enjoy!

More later.