views:

969

answers:

3

When creating an Actionscript Project in Flex builder 3 an application class is automatically created and dropped in the root of your source folder. In my case my source folder is called src/.

Is it possible to change the default application class to a class which is not directly in the root of the src folder? It seems when right-clicking on class files which are in sub packages the 'Set as Default Application' option is not selectable.

Is this done on purpose by Adobe to enforce all pure AS projects to have their application class residing in the top-most package?

+1  A: 

There is application settings file ".actionScriptProperties" in top directory of the flex project. So you can change path to main .mxml file in it to whatever you want.

zdmytriv
This is an Actionscript project not a Flex project. I had already tried changing the .actionscriptProperties file to point to an AS file in a package other than the root package but Flex Builder was giving me an error along the lines of 'Can't launch application'. Not a particularly descriptive error.
Groady
A: 

Don't know if this helps but looking at http://bugs.adobe.com/jira/browse/FB-14144 and reading the comments it seems like Flex Builder 3 won't do this on some systems. They seem to have fixed it in Flash Builder though. It's the little things that annoy the most.

A: 

You're going to have to make changes to the compiler's "source" directories. Doing this has worked for me in the past...

I'm assuming you're using a structure like this

> MyApp
  > html-template
  > main
    > MyApp.as
  > src

Where main is going to be the location of your default application?

  1. If you do this, right click on your top-level (in my example -- MyApp) or go to the FlexBuilder Menu and click on File and then Properties menu item.
  2. Go to the ActionScript Build Path property

    a. Change your main source folder to 'main'

    b. Then, click on the Add Folder...

    c. Add src, then click Ok

  3. Go to ActionScript Application -- here your runnable applications, and since you changed your main source folder, you might not see anything there.

    a. Add a link to your main/MyApp.as file

That should do it.

Beverly Guillermo