PDA

View Full Version : button problem



tenspeedtodd
September 16th, 2009, 08:44 AM
Hey all,
AS3 is doing my head in, it is so much more complex trying to do the most basic stuff.
I have a button with and instance name of "a" so I can't possibly get the instance name wrong in the script. I'm just trying to make it gotoAndPlay frame 46 when the button is clicked but I'm getting a 1120 error.
Here is my code:

--------------------------------------------------
stop();

function playMovie(evt:MouseEvent):void {
gotoAndPlay(46);
}

a.addEventListener(MouseEvent.CLICK, playMovie);
--------------------------------------------------

have I done something wrong?

Cheers.

tenspeedtodd
September 16th, 2009, 08:54 AM
Don't worry, I have just worked it out.
In the properties panel of the button I changed the drop down menu from 'Track as button' to 'Track of menu item'. I don't know what that means but it works properly now :hugegrin:

tenspeedtodd
September 16th, 2009, 10:17 AM
Sorry for posting for a third time in my own thread, but I've come back to the problem.
The first button work fines, however I have added additional buttons down the timeline, and I have set them all to 'Track as menu item'. When I click them it takes it back to the point that the original button takes it to, even though I have definately set the gotoAndPlay for a later frame. I then set the later button to 'Track as button' and now I get an error saying
"TypeError: Error #1009: Cannot access a property or method of a null object reference.
at banner1_fla::MainTimeline/banner1_fla::frame134()"

Any help?