Could someone explain to me why I am getting this error message #1009?

Hello. I'm a tutorial on lynda.com hoping to learn how to use actionscript 3.0 and my copy of flash CS4 to create games. I wrote my code exactly as he has shown in the tutorial, but for some reason that I occasionally receive an error that says:

"TypeError: Error #1009: cannot access a property or method of a null object reference."
Monster / die)
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at fl.motion::AnimatorBase/end()
at fl.motion::AnimatorBase/handleLastFrame()
at fl.motion::AnimatorBase/nextFrame()
at fl.motion::AnimatorBase/handleEnterFrame().

It is not all the time but it will be from time to time. It seems really be anything specifically that it triggers either. I was also noticing that all the enemies react to that is clicked on. I don't know if these two things are related or not. I don't know if the error is caused by the monster library item code or code to the main timeline. Thank you in advance for looking at my code.

This is my code for Monster library item:

Import fl.motion.Animator;
Import fl.motion.MotionEvent;
"var this_xml:XML = < time Motion ="30"xmlns =" "fl.motion. *" xmlns:geom = "flash.geom. *" xmlns:filters = "flash.filters. *" >
< source >
< source frameRate = "10" x = "275" y = "200" scaleX = "1" scaleY = rotation '1' = '0' elementType = "movie clip" NomSymbole = "the monster" >
< size >
< geom:Rectangle = left "-32.5" top = "-32.95" width = '65.05' height = "65.95" / >
< / size >
< transformationPoint >
< geom:Point = "0.49961568024596464" x = "0.49962092494313876" / >
< / transformationPoint >
< / source >
< / source >

< keyframe index = "0" tweenSnap = "true" tweenSync = "true" >
<>interpolation
< SimpleEase ease = '0' / >
< / tweens >
< / keyframe >

< keyframe index = "29" tweenSnap = "true" tweenSync = "true" = "2.782" scaleX scaleY = "2.697" >
<>interpolation
< SimpleEase ease = '0' / >
< / tweens >
< / keyframe >
< / motion >;

var this_animator:Animator = new Animator (this_xml, this);
this_animator. Play();

this_animator.addEventListener (MotionEvent.MOTION_END, hurtPlayer);

function hurtPlayer (MotionEvent): void
{
var host: MovieClip = MovieClip (this.parent.parent);
main.decreaseEnergy ();
this.parent.removeChild (this);
}

this.addEventListener (MouseEvent.CLICK, killMonster);

function killMonster(event:MouseEvent):void
{

"this_xml = < time Motion = '5' xmlns =" "fl.motion. *" xmlns:geom = "flash.geom. *" xmlns:filters = "flash.filters. *" >
< source >
< source frameRate = "10" x = "275" y = "200" scaleX = "1" scaleY = rotation '1' = '0' elementType = "movie clip" NomSymbole "Monster" = class = "Monster" >
< size >
< geom:Rectangle = left "-32.5" top = "-32.95" width = '65.05' height = "65.95" / >
< / size >
< transformationPoint >
< geom:Point = "0.49961568024596464" x = "0.49962092494313876" / >
< / transformationPoint >
< / source >
< / source >

< keyframe index = "0" rotateDirection = "cw" rotateTimes = "1" tweenSnap = "true" tweenSync = "true" >
<>interpolation
< SimpleEase ease = '0' / >
< / tweens >
< / keyframe >

< keyframe index = '4' rotateDirection = "cw" rotateTimes = "1" tweenSnap = "true" tweenSync = "true" = "0.416" scaleX scaleY = "0,378" >
< color >
< alphaMultiplier color = '0' / >
< / color >
<>interpolation
< SimpleEase ease = '0' / >
< / tweens >
< / keyframe >
< / motion >;

this_animator = new Animator (this_xml, this);
this_animator. Play();

this_animator.addEventListener (MotionEvent.MOTION_END, die);

}

function die(event:MotionEvent):void
{
var host: MovieClip = MovieClip (this.parent.parent);
main.increaseScore ();
this_animator. RemoveEventListener (MotionEvent.MOTION_END, hurtPlayer);
this.parent.removeChild (this);
}

This is my code to the main timeline:

var monstersInGame:uint;
var monsterMaker:Timer;
var container_mc:MovieClip;
var slider: MovieClip;
var score: int;
var energy: int;

function initialiserLeJeu (): void
{
monstersInGame = 10;
monsterMaker = new timer (1000, monstersInGame);
container_mc = new MovieClip;
addChild (container_mc);

monsterMaker.addEventListener (TimerEvent.TIMER, createMonsters);
monsterMaker.start ();

cursor = new Cursor();
addChild (cursor);
Cursor.Enabled = false;
Mouse.Hide ();
stage.addEventListener (MouseEvent.MOUSE_MOVE, dragCursor);

score = 0;
energy = energy_mc.totalFrames;
energy_mc.gotoAndStop (Energy);
}

function dragCursor(event:MouseEvent):void
{
Cursor.x = this.mouseX;
Cursor.y = this.mouseY;
}

function createMonsters(event:TimerEvent):void
{
Monster of the var: MovieClip;
Monster = new Monster();
Monster.x = Math.Random () * stage.stageWidth;
Monster.y = Math.Random () * stage.stageHeight;
container_mc. AddChild (Monster);
}

function increaseScore (): void
{
Note ++;
If (score > = monstersInGame)
{
monsterMaker.stop ();
}
}

function decreaseEnergy (): void
{
energy-;
If (power < = 0)
{
monsterMaker.stop ();
}
on the other
{
energy_mc.gotoAndStop (Energy);
}
}
initializeGame();

OK, so after withdrawal of an element of the class that you are trying to remove it again.  to avoid that you can use:

{if(this.parent!=null)}

this.parent.removeChild (this);

}

Tags: Adobe Animate

Similar Questions

  • With premiere pro cc2015 why can I get this error message when reading 'timers video and audio are not synchronized?

    With premiere pro cc2015 why can I get this error message when reading 'timers video and audio are not synchronized?

    Hello

    Here are the steps.

    Install a cable Audio virtual on your machine:

    http://virtual-audio-cable.en.softonic.com/

    Under HW Audio Configuration configured Virtual audio cable as default input device

    And value clock maser virtual audio cable and try reading.

    This issue with the message 'Audio material e/s overloaded at 00' can be fixed, follow these steps.

    Vinay

  • Why did I get this error message

    AcroMissingCompWClass.JPG

    Hi superflash26,

    Please uninstall the drive using this cleanup tool Download Adobe Reader and Acrobat cleaning - Adobe Labs tool, reboot your system & reinstall it using this link Adobe - Adobe Acrobat Reader DC Distribution.

    Let me know if it solves your problem.

    Kind regards
    Nicos

  • Why do I get an error message indicating units is not defined?

    Why did I get this error message?

    The unit Bar Delta-P of the string "[1] / IPT_Cylinder_1" is unknown.

    Define a new unit or an alias of the unit.

    Hello J,

    I was able to run your script posted by without error until I got the 'Calculate' button based on the amount in non-controlled ANALYSIS.  At the time wherever I checked it, however, your VBScript even produces on my computer the error you get on your own, to the ChnAverage() command.  Thus, I think somehow this button in the ANALYSIS got recently checked on your computer.  If you have the "Calculate the quantity-based" button checked, you see also avenues of treatment on the data portal:

    Brad Turpin

    Tiara Product Support Engineer

    National Instruments

  • Why I get this error message when I try to import? 'The following files were not imported because they could not be read. (645)"I can see them :(

    Why I get this error message when I try to import? 'The following files were not imported because they could not be read. (645)"I can see them

    Is working this morning!

    Depends on your operating system

    Go to google, try typing in

    Change the Windows permissions

    or

    Change the permissions of Mac

  • I get this error message, "could not not use the tool pen because of a program error."  What should I do to fix this?

    Like the above statement, I get this error message, "could not not use the tool pen because of a program error."  What should I do to fix this?   I use PhotoshopCC a lot for work, so if someone could help me quickly, I would be grateful.

    Please read this and acts accordingly (restoration of preferences after making sure all custom presets, actions, patterns, brushes etc. have been registered may be of special interest):

    t http://blogs.Adobe.com/Crawlspace/2012/07/Photoshop-basic-troubleshooting-steps-to-fix-MOS - issues.html

    http://forums.Adobe.com/docs/doc-2325

  • I get this error message, the backup disk image "/ Volumes/data-1/jackmatz of Air.sparsebundle of MacBook ' could not be found (error (null)).

    Hey get this error message

    The backup disk image "/ Volumes/data-1/jackmatz of Air.sparsebundle of MacBook ' could not be found (error (null)).

    In the context of what?

  • At startup I get this error Message = "error in svchost.exe - application instruction to memory 0x7c919af2 who 0x00000010.the memory could not be written."

    Windows XP

    At startup I get this error Message =

    Svchost.exe - application error the instruction at 0x7c919af2 memory 0x00000010.the memory that could not be written.

    What should I do about it?

    You don't need to "try" things - you need to "do" things:

    It seems that the last update for Windows Media Player may contribute to this problem when the system has the Windows Driver Foundation Service active and running.

    Unless you write your own drivers for XP and using the Windows Driver Foundation Service to help you debug, you should disable the WDF Service.

    Click Start, run and enter in the box:

    services.msc

    Click OK to launch the Services Applet

    Locate the Windows Driver Foundation - User-mode Driver Framework Service, right-click right the Service, select properties and choose disabled and OK your way out of the Services Applet to save the changes.

    Note that you will not be able to 'Stop' Service first, but it's OK.

    Restart your system (the WDF service is now disabled) and check your failure condition now.

  • Why did I get this error C:/User/radyer/AppData/Local/Playto~1/Update.dll?

    Why do I get this error C:/User/radyer/AppData/Local/Playto~1/Update.dll?

    Judging by the place where provenance, like malicious software. I suggest to delete

  • Out of nowhere I get this error message "the application could not start properly (0xc000001g). Click OK ot close the application. "I have uninstalled and reinstalled several times.

    I nowhere hand, I get this error message "the application could not start properly (0xc000001g). Click OK ot close the application. "I have uninstalled and reinstalled several times.

    Hi Kingsberry and almathof,

    Please refer to this thread: Re: Premiere Pro 2015 won't open after the recent update

    Thank you

    Regalo

  • Why do I get an error message when I try to download creative cloud on my new mac laptop?

    Why do I get an error message when I try to download creative cloud on my new mac laptop?

    There are MANY messages of error... which is yours?

    or

    A chat session where an agent can remotely look inside your computer can help

    Cloud creative support chat (all creative cloud customer service problems)

    http://helpx.Adobe.com/x-productkb/global/service-CCM.html

  • Why do I get the error message: NO. CHM with error 2: when you connect windows 7

    My husband clicked on a video from Break.com and after 3 seconds, the screen started jumping and making a static noise then shut down.  It restarts, but we ended up getting a blue screen which eventually do a windows repair, System Restore... etc.  Later, thinking it was a virus, I was able to do a scan, but it did not help.  I took the computer to someone else who tried a few things, anti-virus, one of them, but no virus has shown.    I was trying to get out of fashion "sleep" after using it successfully for months to happen, and you have disabled since this mode.  Now it's blindly for the computer to boot.  I'm not a techie or computer wiz, but I need to know what I can do.  I have an Acer Aspire with Windows 7 64 bit.  Now, when I log in I also get the error message. CHM with error 2:

    Thank you

    Hello

    I suggest you use the scanner online and check if it helps. To do so follow the link below:

    http://www.Microsoft.com/security/scanner/en-us/default.aspx

    Method 1:

    Check the event viewer for the defective program or application that is the source of the problem:

    http://Windows.Microsoft.com/en-us/Windows-Vista/open-Event-Viewer

    Method 2:

    I suggest to start in safe mode and check if the problem persists. To do so follow the link below:

    http://Windows.Microsoft.com/en-us/Windows7/start-your-computer-in-safe-mode

    Step 1:

    You can also put your computer to boot and check for the issue:

    http://support.Microsoft.com/kb/929135

  • Why do I get an error message when you use the windows installer?

    OK, I am trying to install the Chipset drivers using windows install. I go to the gigabyte website and download the drivers from the chipset support and downloads. I go in the config file and click on the chipset of windows file install. It gives me the error "this installation package could not be opened. Contact the application vendor to verify that this is a valid installer package. "I made sure I got the download of the good mother Rev. and the right windows (x 64) option. IM at my wits end. I've asked this question before but cannot get a straight answer from anyone.  He has this annoying 1 cm around my screen black line. This isn't my moniter and it isn't my video drivers. IV update of windows. The only other option is my chipset. Any suggestions on how to work around this error?

    PS - I recently wiped my hard drive with Dban. If this would have anything to do with that.
    CPU: fx 8150 3.6 ghz
    MB: GA-990fxa-ud3 rev.3
    GPU: EVGA GTX 670 ftw
    RAM: Skill G 16 GB Ripjaws
    PSU: Corsair Tx 750
    OS: Windows 7 x 64 service pack 1
    Hardrives - 120 GB samsung ssd
    Western digital 1 TB

    Hi Ricky,.

    ·         You are able to install programs and drivers?

    ·         What is the motherboard Chipset Drivers file extension?

    You may experience this problem if the installer has downloaded file is corrupted. Follow these methods and check if that helps:

    Method 1:

    I suggest to download the drivers to a different location on the computer and see if you can install it from there. I suggest you to install the driver Chipset in high Mode and check if it installs.

     

    http://www.gigabyte.com/products/product-page.aspx?pid=4397#DL

    Method 2:

    Try to update your BIOS and then install the motherboard chipset drivers and all other available device drivers check if you get the error message.

    http://Windows.Microsoft.com/en-in/Windows7/BIOS-frequently-asked-questions

    Warning: BIOS change / semiconductor (CMOS) to complementary metal oxide settings can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the configuration of the BIOS/CMOS settings can be solved. Changes to settings are at your own risk.

    Hope this information helps. Let us now if you would like more support on Windows.

  • Why do I get an Error Message When you use "Embed" to access a file png (for an asset class)?

    I use Flash Builder and Starling to create a new project. I created the initial classes for Starling running. Everything works fine.

    However, I created a class of assets (that will manage all the assets of the project) and I get an error message when you reference the png file. This png will serve as the main screen for the project. See below:

    {

    Import starling.textures.Texture;

    public class active

    {

    [Embed (source = ' assets/screenMain_background.png']

    private static var MainScreen: Class;

    public static var MainScreenTexture:Texture;

    Public Shared function init (): void

    {

    MainScreenTexture = Texture.fromBitmap (new MainSreen());

    }

    }

    }

    I have the file in a folder called 'active' which is in the main project folder. Why I get this error?

    In the "Issues" tab it reads as follows:

    "Couldn't find Embed source" assets/screenMain_background.png"

    Capture1.PNG

    you have a path problem.

    Start by adding the current directory in your src directory.  If this fails, experiement.

  • Why do I get an error message saying "the specific module could not be found" when opening an image?

    original title: RunDLL

    I get the window followed whenever I click on an image or a file:

    There was a problem starting c:\Users\Jim\AppData\Local\Temp\seitybu\sxxqrbw\wow.dll that the specific module could not be found

    Can anyone advise on how to fix?

    Hi Jim,.

    I suggest you to navigate to the location of the file in the error message and check if it doesn't matter what suspicious file is present. There could be opportunities that your antivirus software would have deleted a few infected file, but would have left a few remnants, which is the origin of the problem.

    I suggest you use Microsoft safety scanner and look for viruses in your computer.

    The Microsoft Security Scanner is a downloadable security tool for free which allows analysis at the application and helps remove viruses, spyware and other malware. It works with your current antivirus software. Here is the link to launch the Microsoft safety scanner.

    http://www.Microsoft.com/security/scanner/en-us/default.aspx

    Warning: the data files that are infected must be cleaned only by removing the file completely, which means there is a risk of data loss.

    Note: the Microsoft Safety Scanner expires 10 days after being downloaded. To restart a scan with the latest definitions of anti-malware, download and run the Microsoft Safety Scanner again.

    Let us know the State of the question, so that we can help you.

Maybe you are looking for