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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T18:30:40+00:00 2026-05-29T18:30:40+00:00

I am using a SWF(accueil) inside another SWF(ranchleblanc_fr) and this causes the error 1009

  • 0

I am using a SWF(accueil) inside another SWF(ranchleblanc_fr) and this causes the error 1009 to appear:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at accueil_fla::MainTimeline/frame1()"

The first SWF has a particle effect in it and it won’t start when I first load the page. If i click on any button of the main page and return to the accueil page, the effect works. But if I click on another button again, I get another error 1009, but this time it does not only appear once. It appears over and over again until I close the SWF.

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at accueil_fla::MainTimeline/newFlake()"

I will include the code, but before I do, I need to say that I checked the box to permit debugging in the publish settings, and I do not have a line number to locate the error. I used trace and found out that the null variable is flake. I searched the internet to figure out how to fix my problem, and I think I need to use an if statement so make sure that the program runs with a null variable. I think I should check if the flake variable is null and if it is, declare some kind of value to it.

The problem is that I do know how to code that if statement…

Here is my code for accueil_fla, frame 1 (where all the actions for this fla can be found)

for (var i:uint = 0; i < 50; i++)
{
    flake.x = Math.random() * stage.stageWidth;
    flake.y = Math.random() * stage.stageHeight;
    flake.alpha = randRange(.3,1);
    flake.scaleX = flake.scaleY = randRange(.3,1);
    addChild(flake);
} 

function randRange(low:Number, high:Number):Number
{
    var randNum:Number = Math.random() * (high - low) + low;
    return randNum;
}

this.addEventListener(Event.ENTER_FRAME, newFlake);

function newFlake(e:Event):void
{
    var flake:Snowflake = new Snowflake(randRange(-1,1), randRange(2,5));
    flake.x = Math.random() * stage.stageWidth;
    flake.y = -5;
    flake.alpha = randRange(.3,1);
    flake.scaleX = flake.scaleY = randRange(.3,1);
    addChild(flake);
}
var flake:Snowflake = new Snowflake(randRange(-1,1), randRange(2,5));

I can also include the code for the main page to fix why the snow particle effect does not work on the first load.

//----------------initialization---------------\\

extLoader_mc.visible = false;

//--------------------loader------------------------\\

var loader:Loader = new Loader;

loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, preload);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, done);

function preload (e:ProgressEvent):void
{
    extLoader_mc.visible = true;
    var pct:Number = e.bytesLoaded / e.bytesTotal;
    extLoader_mc.extLoaderBar_mc.scaleX = pct;
}

function done (e:Event):void
{
    extLoader_mc.visible = false;
    canvas_mc.addChild(loader);
}

//-----------------------end loader----------------\\


var firstLoad:URLRequest = new URLRequest("accueil.swf");
loader.load(firstLoad);
var currentPage:MovieClip;
currentPage=accueil_mc;
currentPage.gotoAndPlay("down");
accueilHit_mc.targetmc = accueil_mc;
aProposHit_mc.targetmc = aPropos_mc;
animauxHit_mc.targetmc = animaux_mc;
locationHit_mc.targetmc = location_mc;
contactHit_mc.targetmc = contact_mc;

accueilHit_mc.buttonMode = true;
aProposHit_mc.buttonMode = true;
animauxHit_mc.buttonMode = true;
locationHit_mc.buttonMode = true;
contactHit_mc.buttonMode = true;

function el () 
{
    accueilHit_mc.addEventListener(MouseEvent.CLICK, accueilPage);
    accueilHit_mc.addEventListener(MouseEvent.MOUSE_OVER, btnOver);
    accueilHit_mc.addEventListener(MouseEvent.MOUSE_OUT, btnOut);
    //aProposHit_mc.addEventListener(MouseEvent.CLICK, aProposPage);
    aProposHit_mc.addEventListener(MouseEvent.MOUSE_OVER, btnOver);
    aProposHit_mc.addEventListener(MouseEvent.MOUSE_OUT, btnOut);
    //animauxHit_mc.addEventListener(MouseEvent.CLICK, animauxPage);
    animauxHit_mc.addEventListener(MouseEvent.MOUSE_OVER, btnOver);
    animauxHit_mc.addEventListener(MouseEvent.MOUSE_OUT, btnOut);
    locationHit_mc.addEventListener(MouseEvent.CLICK, locationPage);
    locationHit_mc.addEventListener(MouseEvent.MOUSE_OVER, btnOver);
    locationHit_mc.addEventListener(MouseEvent.MOUSE_OUT, btnOut);
    contactHit_mc.addEventListener(MouseEvent.CLICK, contactPage);
    contactHit_mc.addEventListener(MouseEvent.MOUSE_OVER, btnOver);
    contactHit_mc.addEventListener(MouseEvent.MOUSE_OUT,btnOut);
}

function btnOver (e:MouseEvent):void 
{
    e.currentTarget.targetmc.gotoAndPlay("over");
}

function btnOut (e:MouseEvent):void 
{
    e.currentTarget.targetmc.gotoAndPlay("out");
}

function handCursor ()
{
    accueilHit_mc.useHandCursor = true;
    aProposHit_mc.useHandCursor = true;
    animauxHit_mc.useHandCursor = true;
    locationHit_mc.useHandCursor = true;
    contactHit_mc.useHandCursor = true;
    accueilHit_mc.enabled = true;
    aProposHit_mc.enabled = true;
    animauxHit_mc.enabled = true;
    locationHit_mc.enabled = true;
    contactHit_mc.enabled = true;
}
el();

accueilHit_mc.removeEventListener(MouseEvent.CLICK, accueilPage);
accueilHit_mc.removeEventListener(MouseEvent.MOUSE_OVER, btnOver);
accueilHit_mc.removeEventListener(MouseEvent.MOUSE_OUT, btnOut);

handCursor();

accueilHit_mc.useHandCursor = false;
accueilHit_mc.enabled = false;

function accueilPage (e:MouseEvent):void
{    
    currentPage.gotoAndPlay("out");            
    var req:URLRequest = new URLRequest("accueil.swf");
    loader.load(req);
    el();
    accueilHit_mc.removeEventListener(MouseEvent.CLICK, accueilPage);
    handCursor();
    accueilHit_mc.useHandCursor = false;
    accueilHit_mc.enabled = false;
    accueilHit_mc.removeEventListener(MouseEvent.MOUSE_OVER, btnOver);
    accueilHit_mc.removeEventListener(MouseEvent.MOUSE_OUT, btnOut);
    accueil_mc.gotoAndStop("down");
    currentPage=accueil_mc;
}

function aProposPage (e:MouseEvent):void
{
    currentPage.gotoAndPlay("out");    
    var req:URLRequest = new URLRequest("aPropos.swf");
    loader.load(req);
    el();
    aProposHit_mc.removeEventListener(MouseEvent.CLICK, aProposPage);
    handCursor();
    aProposHit_mc.useHandCursor = false;
    aProposHit_mc.enabled = false;
    aProposHit_mc.removeEventListener(MouseEvent.MOUSE_OVER, btnOver);
    aProposHit_mc.removeEventListener(MouseEvent.MOUSE_OUT, btnOut);
    aPropos_mc.gotoAndStop("down");
    currentPage=aPropos_mc;
}

function animauxPage (e:MouseEvent):void
{
    currentPage.gotoAndPlay("out");
    var req:URLRequest = new URLRequest("animaux_fr.swf");
    loader.load(req);
    el();
    animauxHit_mc.removeEventListener(MouseEvent.CLICK, animauxPage);
    handCursor();
    animauxHit_mc.useHandCursor = false;
    animauxHit_mc.enabled = false;
    animauxHit_mc.removeEventListener(MouseEvent.MOUSE_OVER, btnOver);
    animauxHit_mc.removeEventListener(MouseEvent.MOUSE_OUT, btnOut);
    animaux_mc.gotoAndStop("down");
    currentPage=animaux_mc;
}

function locationPage (e:MouseEvent):void
{
    currentPage.gotoAndPlay("out");
    var req:URLRequest = new URLRequest("location.swf");
    loader.load(req);
    el();
    locationHit_mc.removeEventListener(MouseEvent.CLICK, locationPage);
    handCursor();
    locationHit_mc.useHandCursor = false;
    locationHit_mc.enabled = false;
    locationHit_mc.removeEventListener(MouseEvent.MOUSE_OVER, btnOver);
    locationHit_mc.removeEventListener(MouseEvent.MOUSE_OUT, btnOut);
    location_mc.gotoAndStop("down");
    currentPage=location_mc;
}

function contactPage (e:MouseEvent):void
{
    currentPage.gotoAndPlay("out");        
    var req:URLRequest = new URLRequest("contact.swf");
    loader.load(req);
    el();
    contactHit_mc.removeEventListener(MouseEvent.CLICK, contactPage);
    handCursor();
    contactHit_mc.useHandCursor = false;
    contactHit_mc.enabled = false;
    contactHit_mc.removeEventListener(MouseEvent.MOUSE_OVER, btnOver);
    contactHit_mc.removeEventListener(MouseEvent.MOUSE_OUT, btnOut);
    contact_mc.gotoAndStop("down");
    currentPage=contact_mc;
}

Thanks again for your help it is much appreciated.

  • 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-29T18:30:47+00:00Added an answer on May 29, 2026 at 6:30 pm

    Your error is most probably not really in your code, but in your project setup: You seem to reference a movie clip that is not on the stage at the time you’re calling it.

    You have to think of your timeline as an actual timeline: The frames represent time! If your button action triggers functions in another movie clip, it has to be on the stage at that exact moment – it is not enough to have it appear in a later frame (or in another scene, etc.etc.).

    You should include null checks in your program, yes, but it probably would not work as expected anyway, even though it might no longer crash – where there is nothing that could execute a command, there will be no mechanism to actually do the job…

    Also, once a null object reference error has been thrown (or any other error that went uncaught, for that matter), you should no longer use your program – it is broken, you need to fix it, before you can continue! And you certainly cannot trust any error messages after the first one.

    Think of it like a clockwork: If at any point one of the cogwheels stopped turning, none of the other wheels could – but only one of them would be broken, causing all the others to malfunction as well. Only after you fix the first error, you can be sure that there really is another problem.

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

Sidebar

Related Questions

I've embedded a SWF into a class using this syntax above my class definition:
This is in AS2. I'm loading an external AS2 swf using the loadclip function.
I am loading a swf into another swf using swfloader, I want to catch
I am using flvplayer.swf player, it is playing the videos,but before playing the video
I am loading an external SWF using the Loader class, and adding it to
I'm looking for a way to find out the URL of a SWF using
I'm using an external swf containing a number of font classes to load and
I am trying to read the header of an SWF file using NSData. According
I am trying to convert compressed swf files to uncompressed swf files using the
Using The loader class of Adobe Flex, I load an external SWF file. However,

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.