Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6946995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:38:12+00:00 2026-05-27T13:38:12+00:00

My flash applications is little bit big, so i want to embed a preloader

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:38:12+00:00Added an answer on May 27, 2026 at 1:38 pm

    Update:

    Option 1. Flash IDE, one swf file

    To have an embedded preloader when compiling with Flash IDE, you should move your Document Class code to 2nd frame of your FLA file (without package and class constructor, of course), and remove Document Class .as file from project properties. In the first frame you should place such code:

    stop(); // stops the timeline at preloader frame
    this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
    function onProgress(e:ProgressEvent):void {
        var percent:Number = Math.round(e.bytesLoaded / e.bytesTotal * 100);
        //additional code to update preloader graphics
        //..
        if (percent == 100) onLoaded();
    }
    function onLoaded() {
       this.loaderInfo.removeEventListener(ProgressEvent.PROGRESS, onProgress);
       nextFrame();
    }
    

    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:

    var loader:Loader = new Loader();
    loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
    loader.load(new URLRequest("path/to/application.swf"));
    
    function onProgress(e:ProgressEvent):void
    {
       var percent:Number = Math.round(e.bytesLoaded / e.bytesTotal * 100);
       //additional code to update preloader graphics
       //..
       if (percent == 100) onLoaded();
    }
    function onLoaded():void
    {
       loader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, onProgress);
       var application:DisplayObject = loader.content;
       addChild(application);
    }
    

    Sometimes there are additional issues with this approach, when you try to access stage from your Document Class constructor etc, 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 Class should look like this:

    package {
    
      import flash.display.Sprite;
    
      [Frame(factoryClass='Preloader')] //class name of your preloader
    
      public class Main extends Sprite {
    
         public function Main() {
            //init
         }
      }
    }
    

    Preloader Class:

    package {
    
       import flash.display.DisplayObject;
       import flash.display.MovieClip;
       import flash.events.ProgressEvent;
       import flash.utils.getDefinitionByName;
    
      public class Preloader extends MovieClip {
    
         public function Preloader()
         {
            //add preloader graphics 
    
            //check loading progress
            this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
         }
         private function onProgress(e:ProgressEvent):void 
         {
            var percent:Number = Math.round(e.bytesLoaded / e.bytesTotal * 100);
            if (percent == 100)
            {
              this.loaderInfo.removeEventListener(ProgressEvent.PROGRESS, onProgress);
              onLoaded();
            }
         }
         private function onLoaded():void
         {
           nextFrame(); //go to next frame
           var App:Class = getDefinitionByName("Main") as Class; //class of your app
           addChild(new App() as DisplayObject);
         }
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to find out if a Flash application can create a POST request,
How can i make my flash applications in a browser in full screen mode?
I got this flash application where you can click a link while watching a
I am programming a little software prototype as Flash/Actionscript3 application. Currently I registered some
Does anyone know of a flash projector 'project' or 'framework' that uses a new
Is there a way to display flash applications using Gnash renderer (I'm not averse
I have Java and Flash client applications. What is the best way for the
Is it possible to use CPython to develop Adobe Flash based applications?
Usually Flash and Flex applications are embedded on in HTML using either a combination
Our company does a lot of flash work and occasionally offline / kiosk applications.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.