is “servicesmask” a valid instance name on that frame?
Also, for events, when you are writing the function you need to give the parameter a name so you can reference it if need be:
Error #1009 is rather infamous in ActionScript 3.0 as it can be incredibly vague without pointing to the real problem. You say it doesn’t occur until you go to add the second event listener so that makes me think you don’t have the “servicesmask” instantiated. Maybe theres a typo where you set it up?
In this case, the parameter probably won’t help you a ton since you know that the MouseEvent is a “MOUSE_OVER” event but consider the following case where its a KeyboardEvent. The “event” parameter lets you test which keyboard key is being pressed down and perform different actions depending on which it was.
addEventListener(KeyboardEvent.KEY_DOWN, key_pressed);
function key_pressed(event:KeyboardEvent):void {
switch(event.keyCode){
case Keyboard.RIGHT:
trace("Right arrow key pressed!");
break;
case Keyboard.LEFT:
trace("Left arrow key pressed!");
break;
}
}
I’m not really sure why moving it to the second frame fixed your error. Did “servicesmask” exist on that first frame? The error was saying that you were referring to an object which didn’t exist.
i’ve got it all figured out. i tried putting all my actionscript onto one frame which has always worked for me in the past. but this time it didn’t work my my particular code.
You should be putting as little code as possible into frames, try and keep as much as you can in external AS3 classes. That keeps your code much more modular and expandable. If its in external classes its a lot easier to reuse the code in new projects. You should pick up a book on object oriented actionscript programming.