user1587301
user1587301

Reputation: 3

Flash AS3.0 Error 1119

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)
}

Upvotes: 0

Views: 2048

Answers (2)

Nuthman
Nuthman

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

Florent
Florent

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

Related Questions