Could somebody explain why I am getting this Error #1009 message?

Hi. I am following a tutorial on lynda.com in hopes of learning how to use actionscript 3.0 and my copy of flash CS4 to create games. I wrote my code exactly like it showed in the tutorial, but for some reason I will occasionally receive an error that says
"TypeError: Error #1009: Cannot access a property or method of a null object reference.
at 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 doesn't happen all the time but it will every once in a while. There doesn't really seem to be anything specifically that triggers it either. I also happened to notice that not all of the enemies respond to being 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 code for the monster library item or the code for the main timeline. Thank you in advance for looking at my code.
This is my code for the monster library item:
import fl.motion.Animator;
import fl.motion.MotionEvent;
var this_xml:XML = <Motion duration="30" xmlns="fl.motion.*" xmlns:geom="flash.geom.*" xmlns:filters="flash.filters.*">
<source>
  <Source frameRate="10" x="275" y="200" scaleX="1" scaleY="1" rotation="0" elementType="movie clip" symbolName="monster">
   <dimensions>
    <geom:Rectangle left="-32.5" top="-32.95" width="65.05" height="65.95"/>
   </dimensions>
   <transformationPoint>
    <geom:Point x="0.49961568024596464" y="0.49962092494313876"/>
   </transformationPoint>
  </Source>
</source>
<Keyframe index="0" tweenSnap="true" tweenSync="true">
  <tweens>
   <SimpleEase ease="0"/>
  </tweens>
</Keyframe>
<Keyframe index="29" tweenSnap="true" tweenSync="true" scaleX="2.782" scaleY="2.697">
  <tweens>
   <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 main:MovieClip = MovieClip(this.parent.parent);
main.decreaseEnergy();
this.parent.removeChild(this);
this.addEventListener(MouseEvent.CLICK, killMonster);
function killMonster(event:MouseEvent):void
this_xml = <Motion duration="5" xmlns="fl.motion.*" xmlns:geom="flash.geom.*" xmlns:filters="flash.filters.*">
<source>
  <Source frameRate="10" x="275" y="200" scaleX="1" scaleY="1" rotation="0" elementType="movie clip" symbolName="monster" class="Monster">
   <dimensions>
    <geom:Rectangle left="-32.5" top="-32.95" width="65.05" height="65.95"/>
   </dimensions>
   <transformationPoint>
    <geom:Point x="0.49961568024596464" y="0.49962092494313876"/>
   </transformationPoint>
  </Source>
</source>
<Keyframe index="0" rotateDirection="cw" rotateTimes="1" tweenSnap="true" tweenSync="true">
  <tweens>
   <SimpleEase ease="0"/>
  </tweens>
</Keyframe>
<Keyframe index="4" rotateDirection="cw" rotateTimes="1" tweenSnap="true" tweenSync="true" scaleX="0.416" scaleY="0.378">
  <color>
   <Color alphaMultiplier="0"/>
  </color>
  <tweens>
   <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 main:MovieClip = MovieClip(this.parent.parent);
main.increaseScore();
this_animator.removeEventListener(MotionEvent.MOTION_END, hurtPlayer);
this.parent.removeChild(this);
This is my code for the main timeline:
var monstersInGame:uint;
var monsterMaker:Timer;
var container_mc:MovieClip;
var cursor:MovieClip;
var score:int;
var energy:int;
function initializeGame():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
var monster:MovieClip;
monster = new Monster();
monster.x = Math.random() * stage.stageWidth;
monster.y = Math.random() * stage.stageHeight;
container_mc.addChild(monster);
function increaseScore():void
score ++;
if(score >= monstersInGame)
  monsterMaker.stop();
function decreaseEnergy():void
energy --;
if(energy <= 0)
  monsterMaker.stop();
else
  energy_mc.gotoAndStop(energy);
initializeGame();

Ok. Apparently, I didn't test it enought times to get the error. I went back and tested it again to get the error. When I did this, the
trace(this); revealed [object Monster]
and
trace(this.parent); revealed [object MovieClip].
The only one that was different was the one that gave the error. For that one the
trace(this); revealed [object Monster]
and
trace(this.parent); revealed null.
Then it gave all of the error information.

Similar Messages

  • When I want to scroll through My picks why do I get this Error message (A necessary data reference could not be resolved."

    When I want to scroll through My pictures  why do I get this Error message (A necessary data reference could not be resolved)

    Before anyone can help, they need information to work with. Basic stuff:
    - What version of iPhoto.
    - What version of the Operating System.
    - Details. What were you doing when the problem arose?
    - Did it ever work properly?
    - Are there error messages?
    - What steps have you tried already to solve the issue.
    Anything else you can think of that might allow someone else to understand your issue.
    With this kind of information somebody can develop a starting point for troubleshooting the issue.
    Posts that consist of "iPhoto doesn't work. Help" or "iPhoto won't print" or "Suddenly I have no photos!!!!!!!!!!" mean that any helper is simply guessing. With information, s/he may be able to get your issue resolved sooner.

  • Why am I getting this App Store message for the new OS: The product distribution file could not be verified. It may be damaged or was not signed.

    Why am I getting this App Store message:
    The product distribution file could not be verified. It may be damaged or was not signed.

    I had the same problem. Spoke to Apple support who directed me to Itunes support.  Frustrating to say the least.  Some have said remove virus barrier.  I did and still nothing.  Some posts have said to delete App store.  DON'T DO IT.. App store is tuff to get back.  This did work for me. Go to Finder, then go, pick go to folder, type in, /var/folder, and delete (send to trash).  There were 2 folders I had to delete, KX & XX, and as soon as I sent them to the trash they returned but I was able to download & intall Mountain Lion and working well.  Good luck..

  • Why am I getting this error message......."Adobe Reader could not open 'SBA 413.pdf' because it is e

    why am I getting this error message when I try to open a PDF file?  Adobe Reader could not open 'SBA 413.pdf' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded).

    It's difficult for anyone to say how to fix it. Try getting a new copy of it. Did you download it from a web site, as an email attachment, or something else?
    I donwloaded that form from the SBA web site and it worked fine for me. It is an XFA form created in LiveCycle Designer, but those should work fine with the desktop versions of Adobe Reader. So try downloading it: http://www.sba.gov/sites/default/files/SBA%20413_0.pdf

  • Why am I getting 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 am I getting 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 was working this morning!

    Depends on your operating system
    Go to google, try typing in
    Change permissions Windows
    or
    Change permissions Mac

  • Why do I get this error message when I open Organizer in Photoshop Elements 11 "Elements Organizer has stopped working"? My only option is to Close Program so I am effectively locked out of my photo catalogue.  I have reinstalled the program to no avail.

    Why do I get this error message when I open Organizer in Photoshop Elements 11 "Elements Organizer has stopped working"? My only option is to Close Program so I am effectively locked out of my photo catalogue. I have tried reinstalling the program but it made no difference to the error message.
    Could someone help please?  Steph

    Hi,
    Please give a try to Photoshop Elements (PSE) knowledge base. steps mentioned on this and see if it works.
    Regards
    Kishan

  • I get missing plug-in error when opening my online bill which is in PDF format. I am using a 2010 Macbook with the latest version of Safari and Adobe suite installed in my computer. Why do I get this error? What should I do?

    I get missing plug-in error when opening my online bill which is in PDF format. I am using a 2010 Macbook with the latest version of Safari and Adobe suite installed in my computer. Why do I get this error? What should I do?

    In relation to my previous inquiry regarding inability to view a pdf file using Safari...
    Is it possible that I can view other online bills from other website but not this particular bill from one specific website?
    Sorry if I missed any important point in this article -->Apple Safari 5.1 and Adobe Reader/Acrobat Advisory
    Thanks again!

  • Why do I get this error when trying to use my bluetooth headset as a listening device? There was an error connecting to your audio device. Make sure it is turned on and in range. The audio portion of the program you were using may have to be restarted.

    Why do I get this error when trying to use my bluetooth headset as a listening device? There was an error connecting to your audio device. Make sure it is turned on and in range. The audio portion of the program you were using may have to be restarted.

    I may have already resolved this issue buy removing the device from my computer and re-pairing it. It is currently working just fine.

  • More than maximum 5 filtered album lists trying to register. This will fail,Why i am getting this error when i pick video from Photo library.

    I am able to pick 4 videos from the Photo library in my iPhoneAPP but when i try to pick 5th one it throws an error:
    "More than maximum 5 filtered album lists trying to register. This will fail,Why i am getting this error when i pick video from Photo library."

    Hello Tate r Bulic
    I don't have any idea how to remove this error,can i pick more than 5 videos from the photo library...
    If it's then please help me and gimme idea..Thanks

  • According to my network provider (Amaysim/Optus) Tethering is enabled, so why do I get this error message "to enable personal hotspot on this account, contact OPTUS"

    According to my network provider (Amaysim/Optus) Tethering is enabled, so why do I get this error message "to enable personal hotspot on this account, contact OPTUS"
    Amysim/Optus support can not help.
    I can not check or change any network settings (no APN settings)
    I have synced phone using latest itunes (10.5.3).
    Phone software is up to date (5.0.1).
    Network settings have been reset.
    SIM card has been taken out and put back in.
    Phone has been switched off/on again.
    Another sim card from virgin works ok (hotspot option is visible and can be turned on/off as required)
    The Amaysim/Optus SIM card can be put into another phone (android) and tethering/hotspot works fine.
    Can anyone provide solution to this nightmare?

    I am having the same issue although i have an iphone 5. I have contacted Live connected numerous times an tried everything imaginable to solve the issue. Is it possibly a handset issue? I cant recieve any help from optus as im with live connected, they cant help me and apple keep telling me to contact your carrier ( live connected). Seems to make me want to switch providers pretty shortly..
    please let me know if you can solve your issue and maybe it can help me too..

  • Why am I getting this error?

    Hello,
    I am trying to call my Java class from a JSP page. I am getting this error:
    Generated servlet error:
    C:\Program Files\Apache Tomcat 4.0\work\Standalone\localhost\em\jsp\Test_0005fSummarySBU_0005fscreen$jsp.java:82: Wrong number of arguments in constructor.
    strQuery=new ListReturn(strEssUser, strProcessingMonth, strProcessingYear);
    I don't understand why I am getting this error as I pass three paramters to the Java class, and I accept three parameters in the constructor.
    JSP:
    <!-- META TAG is necessary to ensure page recompiles--------------->
    <META Http-Equiv="Expires" Content="0">
    <META Http-Equiv="Pragma" Content="no-cache">
    <HTML>
    <!-- The two Java Classes used to build the AlphaBlox query -->
    <%@ page import="com.home.tool.reporting.*" %>
    <%@ page errorPage="run_error.jsp" %>
    <%@ page import="java.util.List,
                     java.util.Collection,
                java.net.URLDecoder" %>
    <HEAD>
    <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    <TITLE>Economic Model - Summary SBU Report</TITLE>
    <!--Run the onload here, re-retrieve params BM and Breport, pass to onload---------->
    <BODY bgcolor=#ffffff>
    <%
                    Collection strQuery = null;
                    String strEssUser = "test";
                    String strProcessingMonth = "JUL";
                    String strProcessingYear = "2002";
                    strQuery=new ListReturn(strEssUser, strProcessingMonth, strProcessingYear);
                    System.out.println(strQuery);
    %>
    </BODY>
    </HTML>Java class:
    package com.home.tool.reporting;
    import java.net.URL;
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    public class ListReturn extends ReportQueryBuilder
            public void ListReturn()
            public Collection ListReturn(String userID, String pMonth, String pYear)
                throws ReportQueryBuilderException
                //declare Collection store Value-Object pairs
                Collection c = new ArrayList();
                //declare and initialize variables
                CallableStatement cs = null;
                ResultSet rs = null;
                // declare call for stored procedure to pass in three parameters
                String pass = "{Call dbo.p_rep_srSbuList(?, ?, ?)}";
                try
                    //open CallableStatement using JDBC connection to SQL database
                    cs = con.prepareCall(pass);
                    //set IN parameters
                    cs.setString(1, userID);
                    cs.setString(2, pMonth);
                    cs.setString(3, pYear);
                    //execute call and return result set
                    rs = cs.executeQuery();
                    //loop through result set storing each record as a Value-Object pair
                    while(rs.next())
                        c.add(new ListBoxValueObjects(rs.getString(1), rs.getString(2)));
                catch (SQLException sqle)
              throw new ReportQueryBuilderException(replaceToken("Problems executing query: "+sqle.getMessage(), "'", "\\'"));
                finally
                    try
                        //close the Result Set and CallableStatement
                        rs.close();
                        cs.close();
                    catch(Exception e)
                        System.out.print("\nFATAL   : " + e);
                        System.out.print("\nFATAL   : " + e);
                return c;
    }Does anyone see whay I am getting this error??
    I can't figure out the problem!

    change this:
    <%
         Collection strQuery = null;
         String strEssUser = "test";
         String strProcessingMonth = "JUL";
         String strProcessingYear = "2002";
         strQuery=new ListReturn(strEssUser, strProcessingMonth, strProcessingYear);
         System.out.println(strQuery);
    %>To this:
    <%
         Collection strQuery=null;
         String strEssUser="test";
         String strProcessingMonth="JUL";
         String strProcessingYear="2002";
         lr=new ListReturn(strEssUser, strProcessingMonth, strProcessingYear);
         System.out.println(lr.getQuery())
    %>Then make a new public method in your Java called getQuery()
    public Collection getQuery();Do what you need to do to process it and return the value in getQuery. You will also probably need to make private variables in you declaration to do the processing on.

  • Why am i getting this error? they are not the same?

    1021: Duplicate function definition.
    1021: Duplicate function definition.
    stop();
    import flash.events.MouseEvent;
    // home button definition \\
    // Portfolio button definition \\
    Portfolio_btn.addEventListener(MouseEvent.CLICK, pClick);
    function pClick(event:MouseEvent):void{
        gotoAndStop("getPortfolio");
    // Contact Me button defintion \\
    Contact_btn.addEventListener(MouseEvent.CLICK, cClick);
    function cClick(event:MouseEvent):void{
        gotoAndPlay("contactme");
    why am i getting this error the functions have different names... idk what to do they are for two different buttons I am using action script 3.0

    i did what u said and it said these two lines were the same
    // Portfolio button definition \\
    Portfolio_btn.addEventListener(MouseEvent.CLICK, pClick);
    function pClick(event:MouseEvent):void{                                                         <--------this one
        gotoAndStop("getPortfolio");
    // Contact Me button defintion \\
    Contact_btn.addEventListener(MouseEvent.CLICK, cClick);
    function cClick(event:MouseEvent):void{                                                           <--------and this one
        gotoAndPlay("contactme");
    it gave me the same error but they are not the same

  • Your message was not sent. Tap "try again" to send this message. Why do i get this error?

    your message was not sent. Tap "try again" to send this message. Why do i get this error?

    Hi babychriss,
    Thanks for visiting Apple Support Communities.
    There are several possible reasons why a message might not send. I'd recommend starting with the troubleshooting steps in this article:
    iOS: Troubleshooting Messages
    http://support.apple.com/kb/ts2755
    Regards,
    Jeremy

  • GetLastError: 1392 - why do I get this error message when I try to uninstall Acrobat XI Pro?

    GetLastError: 1392 - why do I get this error message when I try to uninstall Acrobat XI Pro?

    Hi uckldag,
    Please try uninstalling using Acrobat Cleaner tool ( Download Adobe Reader and Acrobat Cleaner Tool - Adobe Labs ) and check.
    Regards,
    Rave

  • Trying to upgrade to 10.6 so my iPhone could synch...I'm getting this error message "Problem with this Windows (XP) Installer package.  A program required for this install to complete could not be run."  Any ideas?

    I had iTunes 10.2.1.1 but needed to upgrade to 10.6 so my iPhone could synch...I'm getting this error message "Problem with this Windows (XP) Installer package.  A program required for this install to complete could not be run."  Any ideas?

    This has been fixed.  Answer is that I needed to go to "Apple Software Update" and repair it.  (From my Control Panel).

Maybe you are looking for