I want to call a function in main flex app from the custom preloader code in actionscript before it dispatches complete event.
Also i want to know how to call back to a function in preloader code from application
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
So in the preloader init method you can use the following line to get the application:
we had our preloader implement a custom interface called IPreloader and our App implement a custom interface called IPreloaderApp, IPreloader is defined as:
and for the IPreloaderApp
Also something to note, if the app is added behind the preloader instead of in-front (the default behavior) then you won’t see alerts that are popped up by the application since they’ll be behind the preloader so you’ll want to switch the order. Here’s a bit of code we used to get around that:
after the parentApplication is set within the preloader init handler as shown at the top of this post we add a handler to catch the removal of the preloader by the SystemManager and re-add it (there is no visible flicker)
One other thing to note is that you don’t want to “pollute” your preloader code with any Flex classes, if you include things from the framework you will end up having to load the entire framework into memory before the preloader begins (which can be hefty).