Ian,
You're going through the same stuff that I've gone through over the
last few months. Most of my initial apps were in a single MXML file.
I've since learned to spread them out quite a bit.
For example.. let's say I've got a tab navigator with 4 tabs in my
"main" app. You've got this:
<mx:TabNavigator ...>
<mx:Canvas ...>
<!--- code --->
</mx:Canvas>
<mx:Canvas ...>
<!--- code --->
</mx:Canvas>
<mx:Canvas ...>
<!--- code --->
</mx:Canvas>
<mx:Canvas ...>
<!--- code --->
</mx:Canvas>
</mx:TabNavigator>
So what you do is you create 4 individual MXML components based on
Canvas.. one for each tab.
In my world, I have a views folder where I store these components.
You add this to your <mx:Application> tag in the main app:
xmlns:v="views.*"
Let's say your 4 views are named viewOne.mxml, viewTwo.mxml,
viewThree.mxml, and viewFour.mxml.
Now, you change your main app tab navigator code to look like this:
<mx:TabNavigator ...>
<v:viewOne id="mytab1" ... />
<v:viewTwo id="mytab2" ... />
<v:viewThree id="mytab3" ... />
<v:viewFour id="mytab4" ... />
</mx:TabNavigator>
And now you can put relevant actionscript code into the tabs
themselves rather than the main document.
Anything that DOESN'T get referenced outside of the tab, you can make
private... anything that needs to be referenced from outside the tab..
make public.
If your parent documents need to access public variables - or MXML
components - just use the IDs "mytab1" "mytab2" etc... And from any of
the individual tabs, you could reference public variables and
components of the main app with the parentApplication reference...
obj = parentApplication.mytab1.myComboBox.selectedItem;
Rick
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ
Archive: http://www.houseoffusion.com/groups/Flex/message.cfm/messageid:3970
Subscription: http://www.houseoffusion.com/groups/Flex/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.37