views:

189

answers:

1

I'm building a Flex/Flash Builder 4 application that loads data using E4X/XML, like this:

I originally build an application that was a single MXML file which loaded this XML file and built a form from the data.

I've now build a main menu screen with a button to load the form screen as a seperate module. How do I get the XML declaration to work in this module without loading it again. Is it as simple as repeating the declaration in the module?

A: 

With Modular Flex apps you need to way to communicate across Modules without creating a tight coupling between the pieces. I usually use a Message Bus approach (see the Architectural Patterns First Steps in Flex screencast for more info) to accomplish this. When the module loads just send a message to the bus asking someone for the data you need. Have a listener on the bus listening for that message so that it can respond with another message containing the needed data.

James Ward
Thanks, James! This is a great introduction to MVC in Flex, this is really how I should be writing the app so I'll follow the suggested conventions to define model/controller classes.
Steve