ggkmath
ggkmath

Reputation: 4246

how to use Flash Builder to run multiple mxml files in one project

I imported an .fxp project into a Flash Builder and then observed there are 5 .mxml files in the src/(default package) directory. Silly question -- how to run each of these five files?

Since I've named the project differently than any of the .mxml files, whenever I try to run something it uses the default (empty) .mxml file named after the project. Deleting that empty mxml file didn't help anything. I also tried to clean the project, but nothing changes (although I see the directories refresh with the same contents). There are no html files in the bin-debug directory.

There must be some simple way to run those .mxml files that I'm missing. I'm fairly new to Flex so it is probably something obvious. Thanks in advance for any hints.

Upvotes: 1

Views: 1821

Answers (2)

JeffryHouser
JeffryHouser

Reputation: 39408

If you have multiple main application files, then:

Right click on the file and select "set as default application." This will allow you to create a run/debug profile for that main application file. Once you have created a run/debug profile; you can move onto the next main application file and do the same. Repeat until you're out of main application files.

If you only have one main application file, you can bring up project properties, go to the Flex Application tab, select your main application file, and use the "set as default" button.

Upvotes: 4

Peter Hall
Peter Hall

Reputation: 58735

Usually you will have one main application in its own mxml file, and many other components in their own MXML files, which can be nested inside each other.

e.g:

<!-- file: MyApplication.mxml -->
<s:Application xmlns:s="library://ns.adobe.com/flex/spark">

   <s:layout>
      <s:VerticalLayout />
   <s:layout>


   <MyComponent1 width="100%" />

   <MyComponent2 width="100%" />

   <s:Button label="click me" />
</s:Application>


<!-- file: MyComponent1.mxml -->
<s:Group xmlns:s="library://ns.adobe.com/flex/spark">

   <s:Label text="this is a label inside component 1" />
</s:Group>


<!-- file: MyComponent1.mxml -->
<s:Group xmlns:s="library://ns.adobe.com/flex/spark">

   <s:Label text="this is a label inside component 2" />
</s:Group>

You can also compile modules and load them into your main application at runtime. You might need to be a bit clearer about exactly what you want to do, if you want to get more specific help.

Upvotes: 0

Related Questions