My flash applications is little bit big, so i want to embed a preloader in my application,
So can anyone please tell me how to create a preloader in new ‘Scene’ and
load another scene in after preloading completed?
Thanks in Advance!
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.
Update:
Option 1. Flash IDE, one swf file
To have an embedded preloader when compiling with Flash IDE, you should move your
Document Classcode to 2nd frame of your FLA file (without package and class constructor, of course), and removeDocument Class.as file from project properties. In the first frame you should place such code:Once swf is loaded, it advances to the next frame and the original application initialization code should be executed.
This works well if you organized your project in a way that the most of the assets (images, etc) are in the Flash IDE Library and are not loaded on the first frame (you can check that in each library item’s properties).
Option 2. Flash IDE, two swf files
Another option, as already recommended by another commenter, is to keep your application swf as it is, and create another lightweight swf that would load the first one.
The code of preloader.swf in first frame:
Sometimes there are additional issues with this approach, when you try to access
stagefrom yourDocument Class constructoretc, but for most cases this should do the job.Option 3. Different IDE, my recommendation: FlashDevelop
If you tried to compile my originally posted code with FlashDevelop, Flash Builder or any other IDE, it should work.
Original post:
Here’s a basic setup for an embedded preloader. Your
Document Classshould look like this:Preloader Class: