简体   繁体   中英

Flex 4 XML Declaration available in Modules

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM