Error #1009 flash game help
I am new 2 flash trying 2 make a flash movie and did a pre loader which was 100 scenes long then i had 2 make a button that went from scene 101 2 102 or a website of mine but i kept getting the error #1009 can any1 help me this is what the code i put in to use the button.
Error #1009 means that you're referencing something in code that doesn't actually exist. For instance, say I wrote these two lines:
var spaceShip : MovieClip = new MovieClip();
spaceship.x = 100;
I would get an error message, because there's no such thing as spaceship. There IS such a thing as spaceShip, with an upper-case S in the middle, but my second line doesn't reference that.
You also can't get away with referencing something that doesn't exist on the same frame as the code:
Frame 1: there's a MovieClip on the Stage called Monster.
Frame 2: Monster is no longer on the stage, but this Frame 2 code is referencing it: Monster.alpha = .5;
Frame 1: the code says mermaid.y = 300; but there's no mermaid on the Stage.
Frame 2: The mermaid appears (too late for the code) on the Stage.
A third way this error often occurs is when people forget to give items instance names. It's easy to think you've done this when you haven't, because you did have to type a name when you added the Symbol to the Library. But you can't reference an item on the Stage by its Symbol name (unless that name also happens to be its instance name).
I've been programming for years, and I STILL make these mistakes. CHECK all your instance names carefully and make sure there's agreement between the Properties Panel and your code. (Sometimes I can't see the problem -- my brain just fails to detect a typo -- so I just copy the name from the Properties Panel and paste it into the code.)
Check to make sure that there's temporal agreement, too -- that code in Frame X is not referencing an object that doesn't appear until Frame Y.
Finally, is the code you pasted in up top the ONLY code in your project? If not, you can't be 100% sure that's the code that's causing the error -- though if you're like most programmers, you'll swear up and down that the problem MUST be in that code, because everything worked fine until you added it.
DON'T TRUST THAT INSTINCT!
I once spent two days trying to debug a problem that I was SURE was in the first ten lines of code -- only to discover that it was actually in the next ten.
So comment out all the code EXCEPT for the code you think is causing the problem. Run the movie again. Are you still getting the error? If so, your instinct is right. If not, it's wrong.
Here are some specific objects to check:
I am a little suspicious of your "102" in quotes and your 101 without quotes. 101 is a reference to frame 101. Is there such a frame in your project. "102" is NOT a reference to frame 102. It's a reference to a frame with the LABEL "102." Does that label exist in your project?
Author "After Effects Expressions"
Co-author "After Effects For Flash, Flash For After Effects"
Artistic Director, Folding Chair Classical Theatre, Inc
Senior Flash Developer, Zeitbyte.com