Skip to main content
Participating Frequently
November 10, 2011
Answered

Moving around a single presentation

  • November 10, 2011
  • 1 reply
  • 8481 views

Hello.

I am trying to do something in particular in Flash. I have an entire presentation in the frame, and when you click on a certain part of it, you zoom in to said part. This I can do.

However, I also want it so that in each part of the presentation, there are buttons taking you to the other parts. The issue is that I'd like it if, when moving from part to part, you simply move past any other parts that are in the way in the main, zoomed out presentation. As in, taking the entire block and sliding it around to where I want to go. I am not sure if this is possible using AS2?

Another option that I considered was that, on hitting the button, the presentation would zoom out and then back in… but then the question is this: can I make a button that plays the next frame (in this case the zoom out animation) and THEN, upon reaching the final point of that animation, gives the command to go to part I chose? (zooming in to said part).

in other words, if I go something like…

on (Release) {

          gotoAndPlay(2);

}

can I add a command on that same button that, upon reaching the end of said animation (lets say frame 30), it goes

gotoAndPlay(81);

where 81 is the start frame for the animation that goes into the zoom of the part I wanted to go to.

is this possible?

This topic has been closed for replies.
Correct answer kglad

that should be:

kglad wrote:

1.  no code should be attached to objects.  for your button, give it an instance name (eg, btn) and use:

btn.onRelease=function(){

gotoAndPlay(2);

}

2.  to execute code after frame 30 is reached you need to start a loop that repeatedly checks the current frame and when it equals 30, execute your gotoAndPlay(81) and stop the loop:

var tl:MovieClip=this;

btn.onRelease=function(){

tl.gotoAndPlay(2);

tl.endFrame=30;

tl.jumpFrame=81

tl.onEnterFrame=checkCurrentFrameF;

}

function checkCurrentFrameF():Void{

if(this._currentframe==this.endFrame){

delete this.onEnterFrame;

this.gotoAndPlay(this.jumpFrame);

}

}

1 reply

kglad
Community Expert
Community Expert
November 10, 2011

1.  no code should be attached to objects.  for your button, give it an instance name (eg, btn) and use:

btn.onRelease=function(){

gotoAndPlay(2);

}

2.  to execute code after frame 30 is reached you need to start a loop that repeatedly checks the current frame and when it equals 30, execute your gotoAndPlay(81) and stop the loop:

var tl:MovieClip=this;

btn.onRelease=function{

tl.gotoAndPlay(2);

tl.endFrame=30;

tl.jumpFrame=81

tl.onEnterFrame=checkCurrentFrameF;

}

function checkCurrentFrameF():Void{

if(this._currentframe==this.endFrame){

delete this.onEnterFrame;

this.gotoAndPlay(this.jumpFrame);

}

}

KerzoroAuthor
Participating Frequently
November 10, 2011

Getting this error:

Scene0Scene 1, layer=Layer 2, frame=2, Line 2 | Function name expected

I think this means that the movie clip that is zooming in and out needs an instance name. Is that after var tl: in the beggining of the code?

also, I guess I have to have another action layer with the stop(); so that it actually stops in the place I need it to. Having the stop(); and the code in the same frame doesn't seem to stop the animation. Or is there a way to have that in the same frame?