Can anyone tell me what I did wrong?

I've been trying to code a game and it kept on giving me "TypeError: Error #1009" on the output whenever I make my player touch the car.
Here's the .as codes:
package {
  import flash.display.*;
  import flash.events.*;
  import flash.utils.*;
  import Game.*;
  public class TouchALife extends MovieClip
  private var Hearts:Number;
  private var jumping, left, right:Boolean;
  private var speedX, speedY: Number;
  private var platformsArray, heartsArray:Array;
  public function TouchALife()
  public function startGame()
  stage.focus = stage;
  Hearts = 0;
  speedX = 0;
  speedY = 0;
  jumping = false;
  left= false;
  right = false;
  platformsArray = new Array();
  heartsArray = new Array();
  setupGame();
  addEventListener(Event.ENTER_FRAME,update);
  stage.addEventListener(KeyboardEvent.KEY_DOWN,keyDownHandler);
  stage.addEventListener(KeyboardEvent.KEY_UP,keyUpHandler);
  private function setupGame()
  //Check for items on the stage and put them into
  //the appropriate array
  for (var i=0; i< MovieClip(root).numChildren; i++)
  var object = MovieClip(root).getChildAt(i);
  if (object is Platform)
  platformsArray.push(object);
  else if (object is Heart)
  heartsArray.push(object);
  private function keyDownHandler(evt:KeyboardEvent)
  if (evt.keyCode == 32) //spacebar
  //Make player jump
  jumping = true;
  else if (evt.keyCode == 37)
  //Move player left
  left = true;
  else if (evt.keyCode == 39)
  //Move player right
  right = true;
  private function keyUpHandler(evt:KeyboardEvent)
  if (evt.keyCode == 37)
  //Stop Moving Left
  left = false;
  else if (evt.keyCode == 39)
  //Stop Moving Right
  right = false;
  public function update(evt:Event)
  //This is the game loop
  //Handle user input
  if (right)
  mcPlayer.moveRight();
  else if (left)
  mcPlayer.moveLeft();
  else
  mcPlayer.stopMoving();
  if (jumping && !mcPlayer.isInAir())
  mcPlayer.jump();
  //reset jump
  jumping = false;
  //Handle game logic
  mcPlayer.update();
  //Check for collision between player and platforms
  if (mcPlayer.isFallingDown())
  for (var i = platformsArray.length - 1; i >= 0; i--)
  if (platformsArray[i].hitTestObject(mcPlayer.hitBox))
  mcPlayer.y = platformsArray[i].y;
  mcPlayer.hitFloor(platformsArray[i]);
  //Exit the loops
  break;
  //Touch the car
  if (mcVehicle.hitTestObject(mcPlayer.hitBox))
  //Hearts += 1;
  gameOver();
  gotoAndPlay("end");
  //Check for collision between player and aliens
  for (i = heartsArray.length - 1; i >= 0; i--)
  if (heartsArray[i].hitTestObject(mcPlayer.hitBox))
  if (mcPlayer.isFallingDown())
  //player jumped on it
  removeChild(heartsArray[i]);
  heartsArray.splice(i,1);
  Hearts += 1;
  else
  //player is hit
  removeChild(heartsArray[i]);
  heartsArray.splice(i,1);
  Hearts += 1;
  //Handle display
  txtHearts.text = String(Hearts);
  private function resetGame()
  mcPlayer.x = 410;
  mcPlayer.y = 575;
  private function gameOver()
  removeEventListener(Event.ENTER_FRAME,update);
  stage.removeEventListener(KeyboardEvent.KEY_DOWN,keyDownHandler);
  stage.removeEventListener(KeyboardEvent.KEY_UP,keyUpHandler);
  }//end class
}//end package
Here's how my .fla timeline looks like
At frame 1:
startGame();
stop ();
So here's what I'm actually planning to do: No matter how many hearts the player decides to collect, as long as they touch the car, there'll be an animation playing after that.
But it's just that when the player touches the car, the type error starts coming out from the Output

  //Touch the car
  if (mcVehicle.hitTestObject(mcPlayer.hitBox))
  //Hearts += 1;
  gameOver();
  gotoAndPlay("end");

Similar Messages

  • Itunes document manager pro will not open a document with .cwk extension. It will catch the document then error message states that it cannot open document. Can anyone tell me what Im doing wrong?

    Itunes document manager pro will not open a document with .cwk extension. It will catch the document then error message states that it cannot open document. Can anyone tell me what Im doing wrong?

    Forgive my ignorance but I have never hear of iTunes Document Manager Pro. If you mean Document Manager Pro, i was able to find that. Back to your problem, have you tried opening one of those files in the iOS iWorks apps? Form the quick read that I did about this, .cwk files can be opened by Pages, Numbers or Keynote, depending on what type of document that it is and those files can be read by Document Manager Pro, after properly saving them. I don't see that you can go directly from the .cwk file in Document Manager Pro without converting them first.
    I took a very quick look at the app, so I may be a missing something about its capability.

  • Hi i have just purchased a mac pro. ive installed word for mac as i wanted to transfer word documents from a windows pc, which are ona usb stick. however i cannot open the usb stick. can anyone tell me what im doing wrong!

    Hi, I've bought a mac pro and installed word for mac, as i wanted to transfer word documents to the new pc. I saved the documents ona usb stick but I cannot open the documents from the stick. What am i doing wrong?
    thanks

    Welcome to the Apple Support Communities
    First of all, check that you are looking for your USB drive in the correct place. To do it, first connect the USB drive. Then, open a Finder window (press the left icon of Dock) and choose your USB drive on the Finder sidebar, under "Devices". Finally, just copy the documents you need to the internal disk.
    If you want to show the USB drive in Desktop, open Finder menu (on the menu bar) > Preferences > General, and tick "External drives"

  • I can no longer log into my Remote Work site with Firefox, and I do not know why (I won a Mac)--can anyone tell me what might be wrong?

    For 1 1/2 years I had been able to log in to my work Remote Access site using Firefox, but I no longer can--it just sits there and does nothing. I have tried deleting the Firefox browser in case of corruption and reloaded from the Mozilla website, but that does not help. I prefer not to give the URL of my company website, but it is possible someone can help me. Might the problem be java, or something else?

    You'll have to call and explain your situation to Adobe Customer Service for your region.

  • I just purchased the ipad I have an itunes account but it tells me I am not connected to the itunes store. can anyone tell me whats wrong

    I have just purchased the ipad and trying to log onto itunes and it tells me I am not connected .  i typed in my apple sign on and it states cannot connect to itunes store. Can anyone tell me whats wrong?

    I'm sort of confused by your response. Did your iPad start up? If I DO understand - you are frozen on the sign in setting for the Store?
    Try this - force quit the settings app.
    Force quit the app by holding down on the sleep button until the red slider appears. Let go of the sleep button and then hold down on the home button until the app quits. Restart the iPad. Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.

  • I have mac os x10.4.11 Tiger , i tried to update and after I did that when I tried to use itunes, but it doesn't open.. can anyone tell me what I have to do to fix this ??

    I have mac os x10.4.11 Tiger , i tried to update and after I did that when I tried to use itunes, but it doesn't open.. can anyone tell me what I have to do to fix this ??

    Hello,
    Leopard requirements/10.5.x...
        *  Mac computer with an Intel, PowerPC G5, or PowerPC G4 (867MHz or faster) processor
    minimum system requirements
        * 512MB of memory (I say 1.5GB for PPC at least, 2-3GB minimum for IntelMacs)
        * DVD drive for installation
        * 9GB of available disk space (I say 30GB at least)
    Classic/OS9 Apps no longer supported.
    Trouble is Apple no longer sells it, check eBay & such for the Retail version, not the Gray Discs...
    http://www.ebay.com/sch/i.html?_nkw=mac+os+x+leopard+retail+10.5
    There are workarounds if the 867MHz CPU is the only hangup...
    http://sourceforge.net/projects/leopardassist/
    http://lowendmac.com/osx/leopard/unsupported.html
    So we know more about it...
    At the Apple Icon at top left>About this Mac, report the version of OSX from that window, then click on More Info, then click on Hardware> and report this upto but not including the Serial#...
    Hardware Overview:
    Model Name: eMac
    Model Identifier: PowerMac6,4
    Processor Name: PowerPC G4 (1.2)
    Processor Speed: 1.42 GHz
    Number Of CPUs: 1
    L2 Cache (per CPU): 512 KB
    Memory: 2 GB
    Bus Speed: 167 MHz
    Boot ROM Version: 4.9.2f1

  • We have a movie downloaded on a laptop connected to the internet pluged into our router in the basement and an apple tv upstairs trying to play the movie through home sharing but it wont play. can anyone tell me whats wrong?

    we have a movie downloaded on a laptop connected to the internet pluged into our router in the basement and an apple tv upstairs trying to play the movie through home sharing but it wont play. can anyone tell me whats wrong? it comes to the last loading page where it shows the desscription of the movie befor it acually plays.

    It can come about without any change done by the user, and it's not just from other networks. The placement of the router can also affect performance. Also make sure router is up to date.
    Apart from that would be the reboots.

  • Today I imported quite a lot of Audio CDs. When I wanted to listen to them I realised that most of them aren't in my library. And they did not appear in the recently added list either. Can anyone tell me what happened and where to find them? Thanks!

    Today I imported quite a lot of Audio CDs. When I wanted to listen to them I realised that most of them aren't in my library. And they did not appear in the recently added list either. Can anyone tell me what happened and where to find them? It's really strange because all the imorts definitely finished. Thanks!

    Greetings,
    I've never seen this issue, and I handle many iPads, of all versions. WiFi issues are generally local to the WiFi router - they are not all of the same quality, range, immunity to interference, etc. You have distance, building construction, and the biggie - interference.
    At home, I use Apple routers, and have no issues with any of my WiFi enabled devices, computers, mobile devices, etc - even the lowly PeeCees. I have locations where I have Juniper Networks, as well as Aruba, and a few Netgears - all of them work as they should.
    The cheaper routers, Linksys, D-Link, Seimens home units, and many other no name devices have caused issues of various kinds, and even connectivity.
    I have no idea what Starbucks uses, but I always have a good connection, and I go there nearly every morning and get some work done, as well as play.
    You could try changing channels, 2.4 to 5 Gigs, changing locations of the router. I have had to do all of these at one time or another over the many years that I have been a Network Engineer.
    Good Luck - Cheers,
    M.

  • TS4009 My iCloud storage is full and I need to delete some stuff.  Can anyone tell me what is important to keep and what not?  I have done all I can but it still says I need to delete before I can back up on iCloud.

    My iCloud storage is full and I need to delete some stuff.  Can anyone tell me what is important to keep and what not?  I'm just not sure what I really should back up each night and what doesn't really matter.  I know my photo's should back up, but other than that, I'm not really sure.
    I have taken some pics off and videos and appt, but it still says I need to delete before I can back up on iCloud.  I'm starting to wonder if its a glitch with my personal phone.  Can anyone help me?
    Thanks!

    Only you can decide what's critical to back up.  One option is to import your photos and videos to your computer (see http://support.apple.com/kb/HT4083), then either delete them from your phone or exclude the camera roll from your backup in settings.
    You might try going to Settings>iCloud>Storage & Backup>Manage Storage, tap the name of your device under Backups, under Backup Options tap Show All Apps, then turn them all to Off (including camera roll), then look at the size of your next backup.  If it doesn't go down significantly, something else is wrong.

  • My pictures are playing out of sequence on my project.  Can anyone tell me what I need to do to get them to play in order?

    Hi.  I'm using iMovie for the first time.  I put in only pictures.  No videos.  When I hit play, my pictures are playing out of order and some repeat.  Can anyone tell me what I'm doing wrong or what I need to change so they play in order?  Thanks!

    Settings > General > Reset > Reset Network Settings

  • I can't get Safari to load period. It quits immediately. According to the troubleshooting, I'm to un-install any third party plug ins. Can anyone tell me what I should be looking for? I don't recall installing anything that wasn't an upgrade.

    I can't get Safari to load period. It quits immediately. According to the troubleshooting, I'm to un-install any third party plug ins. Can anyone tell me what I should be looking for? I don't recall installing anything that wasn't an upgrade.

    Unplug your iBook from the AC power, shut it down and take the main battery out for about fifteen minutes. Then you can put the battery back in, plug the power back in and restart. This should reset the USB and FireWire ports.
    If that doesn't help, you could reset the Power Management Unit. Follow the instructions in Knowledge Base Article #14449 for resetting your PMU.
    You probably should also startup from your Mac OS X install disk and run the Disk Utility to "repair disk" on your hard drive. This will determine if you've got some kind of file directory/software problems with the files on your hard drive.
    I'm not much at decoding kernel panic logs, but this line jumps out:
    Kernel loadable modules in backtrace (with dependencies):
    com.apple.filesystems.udf(1.4.1)@0x28a79000
    Did you have a DVD movie in the drive at the time? DVD movie disks are UDF format, but not much else is.
    -Doug

  • HT201320 When I access my email from the iPhone, hit "inbox", the new messages appear briefly, but then just evaporate.  I can't find them anywhere - not in inbox, not in junk, trash, saved - nowhere.  Can anyone tell me what is happening?

    When I access my email from the iPhone, new messages appear only briefly and then immediately disappear, before I do anything.  Only old messages that were already in my inbox are visible.  I can't find the new messages anywhere -- they have not moved to Saved, Junk, Trash, anything.  IT is like the iPhone just ate them.  Can anyone tell me what I am doing wrong?

    If you have a POP3 account this means that another "client" email program has retrieved the messages and deleted the messages from the server. You need to change the server settings on that device to leave the messages on the server.
    If you have an IMAP or MS Exchange account this means that someone read the messages on another device and either deleted them or moved them to another folder. Or there is an automated script that moved them to another folder.

  • Can anyone tell me what to do my ipad 2 is frozen reset but will not come on seem the apple logo which disappeared and now is frozen

    Can anyone tell me what to do my ipad 2 is frozen reset but will not come on seem the apple logo which disappeared and now is frozen

    I really can't tell from your post but did you try rebooting the iPad?
    Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.

  • Hello People please can anyone tell me what time or day ??? the IOS7 will be released!!!!! thank you

    Hello People please can anyone tell me what time or day ??? the IOS7 will be released!!!!! thank you
    Thanks Guys you resolved my issue !!!!!!!

    September 18th is the day Apple announced iOS 7 would be released. Apple did not specify a time of day. Apple is headquartered in Cupertino, CA USA. So, it is still September 18th in the USA.

  • I have just bought a new laptop with windows 8 and when trying to load itunes was told it was incompatible. Can anyone tell me what I can do to put itunes on my computer? thank you

    I have just bought a new laptop with Windows 8 and cannot load itunes from the existing disc or online as it is incompatible.Can anyone tell me what I can do now to get itunes on to my computer? Thank you

    See the futher information area of Troubleshooting issues with iTunes for Windows updates for download advice and direct links if required.
    See this migrate iTunes library post for advice on moving the library over from a previous computer and this post on deduplication.
    tt2

Maybe you are looking for