Copy link to clipboard
Copied
This is driving me up the wall, I have yet to finish the problem.
I am creating a presentation that simply scrolls text and a background image from right to left when I click a button. Simple enough, but all hell breaks loose when I want to do this in reverse. I can use the GoToAndPlay command, but this looks pretty unprofessional since it's used in a presentation in the event that I might have to go back. I'd rather flow than snap.
I literally am about to go crazy, and don't tell me to make a layer to fake a reverse.
I was able to start going backwards, but not stop, and I barely know the code yet. Been awhile since I opened this tedious program.
Button is called Backwards1.
The forward code doesn't help show what you did wrong, especially if it works.
As I described, to go backwards along the timeline you need to continuously step back a frame at a time until you reach the destination frame. To continuously process something at the frame rate of your file you can use an ENTER_FRAME event listener.
Backwards1.addEventListener(MouseEvent.CLICK, goBack);
function goBack(evt:MouseEvent):void {
this.addEventListener(Event.ENTER_FRAME, stepBack);
}
function stepBack(e
...Copy link to clipboard
Copied
Show the cvode you are trying to use for this button. It should involve continuously calling a prevFrame() function until you reach a particular frame.
Copy link to clipboard
Copied
Well that's the probelm, I don't have any code since i've scrapped every attempt, but here's the code for the forward:
Forward2.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_32);
function fl_ClickToGoToAndPlayFromFrame_32(event:MouseEvent):void
{
gotoAndPlay(911);
}
Copy link to clipboard
Copied
You could try using Greensock's TimeLineLite; the example on the page has a demo of play and reverse: http://www.greensock.com/timelinelite/
It's only library I use for animating.
Copy link to clipboard
Copied
The forward code doesn't help show what you did wrong, especially if it works.
As I described, to go backwards along the timeline you need to continuously step back a frame at a time until you reach the destination frame. To continuously process something at the frame rate of your file you can use an ENTER_FRAME event listener.
Backwards1.addEventListener(MouseEvent.CLICK, goBack);
function goBack(evt:MouseEvent):void {
this.addEventListener(Event.ENTER_FRAME, stepBack);
}
function stepBack(evt:Event):void {
if(currentFrame == 100){
this.removeEventListener(Event.ENTER_FRAME, stepBack);
} else {
prevFrame();
}
}
Copy link to clipboard
Copied
THANKYOU
Copy link to clipboard
Copied
You're welcome
Copy link to clipboard
Copied
Well now my probelem is I can only use the button once and it won't stop going back, and once it has gone back the forward buttons won't work:
/* Stop at This Frame
The Flash timeline will stop/pause at the frame where you insert this code.
Can also be used to stop/pause the timeline of movieclips.
*/
stop();
/* Click to Go to Frame and Play
Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and continues playback from that frame.
Can be used on the main timeline or on movie clip timelines.
Instructions:
1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.
*/
Forward2.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_9);
function fl_ClickToGoToAndPlayFromFrame_9(event:MouseEvent):void
{
gotoAndPlay(221);
}
Backwards1.addEventListener(MouseEvent.CLICK, goBack);
function goBack_3(evt:MouseEvent):void {
this.addEventListener(Event.ENTER_FRAME, stepBack);
}
function stepBack_3(evt:Event):void {
if(currentFrame == 220){
this.removeEventListener(Event.ENTER_FRAME, stepBack);
} else {
prevFrame();
}
}
Copy link to clipboard
Copied
Hey Mr Murphy just wanna say you rock was able to solve the back issue thank you thank you thank you
Copy link to clipboard
Copied
Mr. Ned Murphy thank you very much. The code work perfectly, you saved my day. To others do not forget to change the name to the correct button "that you have", and change number of frame to one you want to stop at "here 100 and 120". Also if there more than one button the code should have another number like these two examples "to avoid duplicate error"
Backwards1.addEventListener(MouseEvent.CLICK, goBack_1);
function goBack_1(evt:MouseEvent):void {
this.addEventListener(Event.ENTER_FRAME, stepBack_1);
}
function stepBack_1(evt:Event):void {
if(currentFrame == 100){
this.removeEventListener(Event.ENTER_FRAME, stepBack_1);
} else {
prevFrame();
}
}
>>>>>
Backwards1.addEventListener(MouseEvent.CLICK, goBack_2);
function goBack_2(evt:MouseEvent):void {
this.addEventListener(Event.ENTER_FRAME, stepBack_2);
}
function stepBack_2(evt:Event):void {
if(currentFrame == 120){
this.removeEventListener(Event.ENTER_FRAME, stepBack_2);
} else {
prevFrame();
}
}
Copy link to clipboard
Copied