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

  • Home
  • SEARCH
  • 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 4621350
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:41:19+00:00 2026-05-22T02:41:19+00:00

I am building a FLA file that has a document class Main and in

  • 0

I am building a FLA file that has a document class “Main” and in its constructor i have told it to trace(stage). I added an external preloader to load this SWF but what do you know, the trace statement is showing NULL.

Here is the preloader that is currently working.

import flash.display.Loader;
import flash.events.ProgressEvent;
import flash.events.Event;
import flash.net.URLRequest;

var l:Loader = new Loader();
l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
l.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
l.load(new URLRequest("Main.swf"));

function onProgress(e:ProgressEvent):void {
    preloader.mask.height = (e.bytesLoaded / e.bytesTotal) * preloader.lemon.height;
}

function onComplete(e:Event):void {
    removeChildAt(0);
}

For the Main.swf itself here is the document class:

package  {

    import Position;
    import flash.display.*;
    import flash.events.Event;

    public class Main extends MovieClip {

        public function Main():void {
            trace(stage);
        }
    }
}

////SOLVED///
I forgot to add the item to the stage but luckily in phillip’s code i saw this. So just remember once the Event.COMPLETE fires, add the contents of the loader to the stage else the document class for the swf will show null.

  • 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-22T02:41:20+00:00Added an answer on May 22, 2026 at 2:41 am

    you have to wait till your main class is added to the stage( Event.ADDED_TO_STAGE ). The preloader is now the stage owner…

    If you are loading an external SWF throug a loader you have to wait for the Event.INIT first, that is fired by the loader after loading is completed an the constructor of your loaded swf is executed. If you than add the loaders content to the display list the ADDED_TO_STAGE Event is triggered too. Before a display object is added to the Stage, the stage property it’s null.

    ldr //your loader
    

    ldr.loaderInfo.addEventListener( Event.INIT, foo );
    ldr.load();

    function foo( e:Event ):void {
    var content:* e.target.content;
    addChild( content );
    }

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When building an application and you are using a table that has a primary
I'm building this hotsite that relies heavily on 'heavy' images and animations. It has
im building a toolbox application that has panes of items that can be dropped
Building on what has been written in SO question Best Singleton Implementation In Java
When building static libraries with VS2005 I keep getting linker warnings that VC80.pdb cant
In building an ASP.NET 3.5 WAP, I'm always frustrated by the feeling that no
Building my baseclasses for user interface controls is getting there. I have command buttons
Building a test web service and all was working great, so I added the
Building off Does Perl have an enumeration type? , how can I perform dynamic
i building a drawing app that uses openGl. i am new to openGL but

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.