Skip to main content
Participant
June 14, 2006
Answered

reversing a clip on a button click

  • June 14, 2006
  • 2 replies
  • 472 views
Hi,

What I want to happen here is that the page go through its load animation backwards (to unload the page) when the user clicks a button on the nav menu.

It kinda worked once or twice, but in the if {} suddenly jumped to main time line from the page clip and only a couple frames worth were reversed.

a trace() after "_parent.gotoAndStop(70)" shows the _parent._currentframe as 70.
breakpoints while debugging don't seem to get close to the if{} now? It is always skipping from " _parent.onEnterFrame = function() {" directly to " _root.gotoAndPlay(_global.pageToPlay);" Breakpoints on and inside the if are not hit?

Can anyone help?

Sue

on (release) {
_global.pageToPlay = 2;//main page
_parent.gotoAndStop(70);
_parent.onEnterFrame = function() {
if (_parent._currentframe > 1) {
this.prevFrame();
}
};
_root.gotoAndPlay(_global.pageToPlay);
}
This topic has been closed for replies.
Correct answer sooz_e
what happens to _parent on its frame 70?:

p.s. movieclip references within the button handler don't change with frame changes, but do change within other handlers like your enterFrame handler.

Hey,

I got this to work!

Couldn't have done it w/o the delete clause in the if/else, so thanks again for your help!

Playing in reverse was slower than forward, so I moved the code to frame 35 from 70 in order to shorten the reverse.
In case anyone else is struggling with this or cares to, the code is attached.

My code is getting pretty dispersed throughout varioous clips' timelines. Could code like this even be managed from the main timeline frame 2?

Sue

2 replies

kglad
Community Expert
Community Expert
June 16, 2006
the code can be used from any frame (with the correct path) and at any time (as long as the objects referenced exist at the time the code executes).
kglad
Community Expert
Community Expert
June 14, 2006
try:
sooz_eAuthor
Participant
June 14, 2006
Hmmm...I see how I wouldn't want that function attached to onEnterFrame outside this if{}. Thank you : )

This didn't fix whatever the trouble is though? The breakpoint stops at the _parent.onEnterFrame, but even a trace before the if{} doesn't print to the output window? It is as if the onEnterFrame has already happened and so the function doesn't get called.

Thanks for taking a look,

Sue
kglad
Community Expert
Community Expert
June 14, 2006
_root and _parent in your onRelease handler are differenet, aren't they? what's the output window show if you use the following: