PDA

View Full Version : Individual MXML files for each tab


dave80210
01-04-2009, 06:15 PM
I'm fairly new to flash programming and I can't find what I'm looking for, although it seems like it should be a fairly common practice. Maybe someone out there can help.

I'm building a flash application (there will be a web version and an AIR version) that has six tabs defined in MXML. Each tab will have a layout that I'd like to define in seperate MXML files, each which will have to handle events and data.

So how do I build a project like this where the main MXML file includes the sub MXML files? I'm using Flex 2 and ActionScript 3 from the command line in Linux.

Thanks in advance!

ljuwaidah
01-04-2009, 07:54 PM
You can add the tab components as separate mxml components.

ie: Tab1.mxml, Tab2.mxml

then you can put them in the tab as normal components after adding the folder as a namespace, something like this:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:tabs="org.ljuwaidah.tabs.*">
<tabs:Tab1 id="tab1" width="100%" height="100%"/>
<tabs:Tab2 id="tab2" width="100%" height="100%"/>
</mx:Application>

i haven't used tabs much so i'm not sure how to put components inside tabs but that should be fairly easy for you. Do ask and i'll look it up for you.

dave80210
01-04-2009, 08:49 PM
That works. Thanks ljuwaidah!