Use Flash as a wrapper to load Flex application and pass URLVars?
I have a problem with preloaders showing up in my flex apps. I've never encountered this issue while developing flash apps, so I got the idea to use the flash app as a wrapper for the sole purpose of showing the preloader when the flex app loads. I'm not sure how to do this and I also need to pass FlashVars from the Flash wrapper app to the flex app. Does anyone know how this can be done?
a source to share
Flex supports preloaders through the Application class, so you don't need to hack. It is detailed in the Flex 3 Developers Guide, chap. 14 ("Application Container"). I've never programmed a pure Flash preloader, but I find it different from what Flex does. Maybe they are in conflict?
a source to share
I'm going to start with Simon's consent, but there are ways to create the hack you're talking about.
Unfortunately, the parent layer for the Flex application overrides numChildren so that it always returns -1. This means that you cannot access the parent swf from flex, and you cannot directly access the SWF stream from Flash (funny if a Flex application loads the Flash swf, this is not a problem).
How to do it:
- Create your own event. Set bbbling to true and cancelable to false.
- Add an event listener for this event at the Flash level.
- Send a message to the application layer of a Flex application. The function that handles this event can now use the target property of the event to access the application layer of the Flex application.
a source to share