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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:20:36+00:00 2026-05-29T09:20:36+00:00

Thanks to the stackoverflow community, I could fix some problems in my flash project

  • 0

Thanks to the stackoverflow community, I could fix some problems in my flash project yesterday. I still get an error message but it is coming from a different behavior in the website. This is the error message I get:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at MethodInfo-6()

This message appears again and again when I leave a page where snow flakes (particles) are falling. When I go back to this page the error message stops. My guess is that is is related to the snow flakes, when I try to remove the child from the parent.

I also get this error code mixed in with the other one but this one does not appear as often:

TypeError: Error #1009: Cannot access a property or method of a null object
reference.at Snowflake/update()[C:\Users\JPL\Documents\ranchleblanc\New Ranch
Leblanc\website 2012\Snowflake.as:27]

Line 27 is this one in the following code: “parent.removeChild(this);”

I have been searching the internet for a way to fix this and I am stuck. Here is the snow flakes code. This movie clip is playing inside another movie clip.

package
{
import flash.display.MovieClip;
import flash.events.Event;

public class Snowflake extends MovieClip
{
    var yVel:Number;
    var xVel:Number;
    var stageheight:Number = 405;

    function Snowflake(xvel:Number, yvel:Number)
    {
        yVel = yvel;
        xVel = xvel;
        this.addEventListener(Event.ENTER_FRAME, update);
    }

    function update(e:Event):void
    {
        this.x += xVel;
        this.y += yVel;

        if (this.y > stageheight)
        {
            this.removeEventListener(Event.ENTER_FRAME, update);
            parent.removeChild(this);
        }
    }
}
}

Anyone can point me in the right direction?

  • 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-29T09:20:37+00:00Added an answer on May 29, 2026 at 9:20 am

    replace the offending line (27) with

    if(parent){
       parent.removeChild(this);
       this.removeEventListener(Event.ENTER_FRAME, update);
    }
    

    make sure parent actually exists first.

    you’ll want to remove the event listener too, to prevent horrifying memory leakage.

    In re MethodInfo-6()

    So, I’ve seen that kind of message before but it’s been a long time. MethodInfo- functions are really internal functions in the Flash Player and should not be bugging you with their errors… If my memory serves me correctly, I encountered this in code someone else wrote in which they were trying to perform an action with a swf that had not yet loaded… or perhaps perform an action from inside the loaded swf that it was not yet actually able to perform at the time the code was called.

    So here, let’s see if we can sort out your problems a little bit.

    Inside your acuiel_fla file, you have a number of things you’re doing on frame 1 that assume that acuiel_fla is the main timeline which it will not be! Try something like this…

    // on frame 1...
    // first, check if you even have a stage.  If not, wait to be added!
    if(stage){
        init();
    }else{
        this.addEventListener(Event.ADDED_TO_STAGE, init);
    }
    
    
    // MOVE THE addEventListener call for ENTER_FRAME here!
    function init(e:Event = null):void{
        this.addEventListener(Event.ENTER_FRAME, newFlake);
        this.addEventListener(Event.REMOVED_FROM_STAGE, removedFromStage);
    }
    
    // AND REMOVE the ENTER_FRAME listener if you are ever removed
    // from the stage.
    function removedFromStage(e:Event):void{
        this.removeEventListener(Event.ENTER_FRAME, newFlake);
    }
    
    function randRange(low:Number, high:Number):Number
    {
        var randNum:Number = Math.random() * (high - low) + low;
        return randNum;
    }
    
    //    DO NOT CALL IT HERE.
    //this.addEventListener(Event.ENTER_FRAME, newFlake);
    
    function newFlake(e:Event):void
    {
        if(!stage) return; // we are not on stage so we can't
                           // do anything here!
    
    
        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);
    }
    
    // do not instantiate your new flake here... just leave it for the enterframe.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Thanks to the answer on this stackoverflow question I was able to get the
Thanks to reading about error handling on StackOverflow , I discovered Mz-Tools. However, I
Firstly, thanks a ton to the StackOverflow community. I am new to C#, and
Greetings StackOverflow community! For this new project I'm required to write a trigger which
This is my first post on StackOverflow. This community has provided me with some
First, thanks for the StackOverflow team, cause it's a very useful website, since i'm
Now that I can make useful user controls in WPF (thanks to this stackoverflow
Thanks to a Q&A on stackoverflow. I just found out how to determine the
I have this regex thanks to another wonderful StackOverflow user /(?:-\d+)*/g I want it
thanks guys.i managed to complete it.million thanks again specially for DAVID,WM-EDDIE and S.LOTT.also STACKOVERFLOW

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.