tags:

views:

28

answers:

1

I am building a website of songs library using flex, I have made an mxml file for each page, for example the home page, albums listing page, album details page, search result page and so on. I want to know how would I link them all together, for example on the home page there will be some featured albums when I click on an album am supposed to go to the swf file of the album details same if am clicking on an album from the search result page.

I've checked the Adobe Flex Help and found the SWFLoader Control but I understood that it's intended for loading swf files that add graphics or animations but not for something that will have user interaction and in my case there will be user interaction like for example in the album page users can add comments, review comments added by other users, rate the album, buy it and so on.

Thanks in advance.

A: 

The easiest way would probably be to have a main application mxml file in say main.mxml, a la:

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"...
                applicationComplete="launchApplication()">
  <mx:Script><![CDATA[
    function launchApplication() : void { MainApplicationClass.main(); }
  ]]></mx:Script>
</mx:Application>

Then the root elements of your other mxml files should be mx:Module. You can then use the mx.modules.ModuleManager class to load the other modules in ActionScript. The modules can then be added and removed programmatically as needed.

RTBarnard
Well I didn't know about the usage of modules, I'll start reading about them in the help.Thanks
Yasmine
Before you dig too deeply into sub-applications, modules etc. you should ask yourself what the benefit is of doing your project with sub-applications. It will introduce a significant amount of complexity vs. just creating sub-components for the different pages so unless each of your pages is going to be a huge project in and of itself I would not see the benefit of doing this!
Karthik