Reputation: 3
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 typeflash.display:SimpleButton
.
Here is my code:
play_mc.onRelease= function ()
{
GotoAndPlay ("Scene 3",1)
}
Upvotes: 0
Views: 2048
Reputation: 106
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");
}
Upvotes: 0
Reputation: 12420
Your code is not AS3 at all! Try something like this:
play_mc.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void {
gotoAndPlay(1, "Scene 3");
});
Upvotes: 1