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 9080399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:04:03+00:00 2026-06-16T20:04:03+00:00

I’m making a simple game in Adobe Flash CS4 using ActionScript 3. I recently

  • 0

I’m making a simple game in Adobe Flash CS4 using ActionScript 3. I recently implemented a new, very small preloader to replace the placeholder that I was using. However, once I did this, I seemed to break everything.

The first frame has only a stop(); in “Actions” and then a DocumentClass external class file (all of my classes are external) that sets up the preloader, which is in its own class file. Once the preloader is done, it fires off an Event to the DocumentClass, which runs a gotoAndStop(3);. On slide three is a movie clip titled Main, with its own class file.

Main imports a bunch of stuff, then loads the opening screen of the game. At this point everything basically breaks down. Any attempts to modify things that are on this opening screen (which has both a class file and MovieClip object) results in “TypeError: Error #1009: Cannot access a property or method of a null object reference.” I thought this code might be running before the MovieClip is on the stage, so I added addEventListener( Event.ADDED_TO_STAGE, onAddtoStage ); and moved the code to an onAddtoStage function; while doing trace("this is the stage: "+stage); and trace("this is my parent: "+this.parent); will return the proper, non-null values, I still can’t modify anything (for example, making a MovieClip object I’d like to hide invisible by setting invisibleBG.alpha = 0; still returns Error #1009).

Furthermore, while the Main MovieClip is visible on the stage, the opening screen MovieClip doesn’t show up. I’m not sure if it’s behind the Main object somehow, but it seems like it’s simply not on the stage at all.

There’s some of my code below. I can add more if this doesn’t show what the problem is. I’ve been really scratching my head over this; of course, it took me two days to figure out I couldn’t modify a TextField because it was stretched out over two frames, so there might be a very simple solution. Thanks in advance for your help!

Here’s most of the class that handles the initial loading:

public class DocumentClass extends MovieClip  
{
    public var loadingScreen:LoadingScreen;

    public function DocumentClass()
    {
        loadingScreen = new LoadingScreen();
        addChild( loadingScreen );

        stage.stageFocusRect = false;

        loadingScreen.addEventListener( Event.COMPLETE, onPreloaderComplete );
        loadingScreen.setLoaderInfo( loaderInfo );
    }

    public function onPreloaderComplete( e:Event ):void
    {
        loadingScreen.removeEventListener( Event.COMPLETE, onPreloaderComplete );
        removeChild( loadingScreen );
        loadingScreen = null;

        gotoAndStop( 3 );
    }
}

Here’s the relevant portion of the Main class:

public class Main extends MovieClip
{
    public function Main()
    {
        showDesktop();
    }
    public function showDesktop():void
    {
        desktopScreen = new DesktopScreen();
        addChild( desktopScreen );

        stage.focus = desktopScreen;
    }
}

And the relevant portion of DesktopScreen, the game’s opening screen:

public class DesktopScreen extends MovieClip
{
    public function DesktopScreen()
    {
        addEventListener( Event.ADDED_TO_STAGE, onAddtoStage );
    }

    public function onAddtoStage( e:Event ):void
    {
        Mouse.show();

        invisibleBG.alpha = 0;
        fakeButton.stop();

        time = new Time;
        time.x = 504;
        time.y = 3;
        addChild( time );
    }
}

TL;DR I’m adding a MovieClip to the stage, and even though I can tell via trace functions that it thinks it’s on the stage, I can’t see it or modify any of it’s contents in a way that would require it to actually be on the stage.

  • 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-06-16T20:04:04+00:00Added an answer on June 16, 2026 at 8:04 pm

    Okay, I managed to fix this today. Here’s what happened.

    When I implemented my new preloader, I attempted to use the three-frame method detailed here. By the way, that’s a great general tutorial on preloaders, if you’re looking for one.

    However, I tried to use the four-frame method later on in the tutorial, but I missed a crucial fact: Flash can’t access assets until it reaches the frame that they’re on. So, frame 1 had only my preloader (and the very small DocumentClass), frame 2 was my class frame, frame 3 had the Main object and its associated code, and frame 4 had my AssetHolder object with all of my library objects.

    The result was that when I ran gotoAndStop(3);, the Main class and object were available, which called the DesktopScreen class and object. But only the DesktopScreen class was available (as it was in frame 2) and the object wasn’t (it wouldn’t be available until frame 4). The result was that the code was run, but since nothing was actually on the stage (even though Flash was telling me it was) it threw a bunch of errors.

    I finally figured this out when I reviewed the extremely informative tutorial by Michael James Williams here. That’s another good tutorial to review if you’re looking to get started with Flash!

    So, this was easy enough to fix; stop using (the unnecessary) frame 4 for my assets, and move them instead to frame 2. Frame 1 still has stop(); in the actions panel, so the game stops as soon as it starts to load, looks to DocumentClass, starts preloading, then goes to frame 3 (after all of the assets and classes are available) once loaded.

    I hope this helps anyone who has a similar, incredibly obscure, problem. If you have any questions, feel free to ask!

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

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I used javascript for loading a picture on my website depending on which small
I have a small JavaScript validation script that validates inputs based on Regex. I
I am using the SimpleRSS gem to parse a WordPress RSS feed. The only
I want use html5's new tag to play a wav file (currently only supported
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am doing a simple coin flipping experiment for class that involves flipping a

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.