Skip to main content
May 4, 2010
Question

Jumping from one Frame to another

  • May 4, 2010
  • 1 reply
  • 348 views

Hi, I have this problem. I have a piece of code in AS3 but it doesn't work with AS2:

stop();

function login(event:MouseEvent):void

{

this.gotoAndPlay("first_page");

}

log_in_btn.addEventListener(MouseEvent.CLICK, login);

So I rewrote it this way:

stop();

function login()

{

this.gotoAndPlay("first_page");

}

log_in_btn.onRelease = login();

But I still have a problem. I have stops in each key frame but when I play the movie it shows directly the first_page section skipping all other frames before it. What could be the problem?

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
May 4, 2010

Try rewriting that code as follows and see if it helps...

stop();

log_in_btn.onRelease = function(){

     this.gotoAndPlay("first_page");

}

I think having ... = login(); the way you have it is executing that function.

May 4, 2010

Now I see the first frame and the button but when I click on it, I don't proceed to first_page.

Ned Murphy
Legend
May 4, 2010

Try getting rid of "this" in that line of code.  I think it ends up referring to the button rather than the timeline the button is in.