0
votes

I have the following error:

Scene 1, Layer 'smashNow', Frame 138, Line 1 1119: Access of possibly undefined property onRelease through a reference with static type flash.display:SimpleButton.

Here is my code:

play_mc.onRelease= function ()
{
    GotoAndPlay ("Scene 3",1)
}
2

2 Answers

1
votes

Your code is not AS3 at all! Try something like this:

play_mc.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void {
    gotoAndPlay(1, "Scene 3");
});
0
votes

You are using Actionscript 2 instead of Actionscript 3. Also, you might think about renaming play_mc to something like play_button, since it's not a movieclip, it's a button (SimpleButton).

The clean way to do it is like this:

play_mc.addEventListener(MouseEvent.CLICK, playMyScene, false, 0, true);

function playMyScene(event:MouseEvent):void
{
    gotoAndPlay(1,"Scene 3");
}