Skip to main content
Known Participant
April 1, 2010
Answered

Another odd request...

  • April 1, 2010
  • 2 replies
  • 805 views

Hi Guys,

m2.addEventListener(MouseEvent.CLICK, clickFunction6);

function clickFunction6(evt:MouseEvent):void {

gotoAndPlay(1000);

}

This is my code for my button "m2". After it has played frames 1000 to 1010, is there anyway I can get it to play from fram 1900 without using "gotoAndPlay" at frame 1010?

Thanks

Joe

This topic has been closed for replies.
Correct answer Ned Murphy

Would that go in the frame with the button or 1010. And the coding would just be a gotoandplay to set the variable at 1010 to another value?

Me being thick probably

Joe


In your button's code you have the button assign a value to the variable...

yourVariable = 1900;

gotoAndPlay(1000);  // for starting the transition

then at frame 1010...

gotoAndPlay(yourVariable);

the variable itself should live on an actions layer that extends the full length of the timeline with no keyframes other than in frame 1, where you declare the variable--this makes it accessible to your whole timeline...

var yourVariable:Object;  // can be  a number or string, so Object is used

2 replies

Ned Murphy
Legend
April 1, 2010

Is there a reason for not using gotoAndPlay at frame 1010?  For what appears to be a timeline-based design, it would seem more practical to do that.

RUDDOCKSJAuthor
Known Participant
April 1, 2010

Im trying to make a menu which when one of the 5 links is clicked, it will play the part of the movie which displays the zooming out of the current page and then goes to the zooming in of the page that the link to goes to.

Ned Murphy
Legend
April 1, 2010

Then you could use a variable that you specify (for the frame number to go to) and use that at frame 1010.  When you click the button it sets the value to that variable (to 1900 in this scenario, though it is a better approach to use frame labels).  So in frame 1010 you just have gotoAndPlay(your Variable);

April 1, 2010

You can use ENTER_FRAME event listener at the first frame, and in its handler: if (currentFrame == 1010) gotoAndPlay(1900);

RUDDOCKSJAuthor
Known Participant
April 1, 2010

So what would that look like? Sorry Im new to this...

Basically I want to tell a button to  play one clip and then another all on the same frame so I can make a load of buttons.

Much appreciated.

Thanks

Joe