• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Reverse Button Action from Frame 130 to 100

Explorer ,
Apr 17, 2013 Apr 17, 2013

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.

TOPICS
ActionScript

Views

4.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Apr 17, 2013 Apr 17, 2013

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

...

Votes

Translate

Translate
LEGEND ,
Apr 17, 2013 Apr 17, 2013

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 17, 2013 Apr 17, 2013

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);

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 17, 2013 Apr 17, 2013

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 17, 2013 Apr 17, 2013

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();

      }

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 17, 2013 Apr 17, 2013

Copy link to clipboard

Copied

THANKYOU

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 17, 2013 Apr 17, 2013

Copy link to clipboard

Copied

You're welcome

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 17, 2013 Apr 17, 2013

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();

      }

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 30, 2015 Aug 30, 2015

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 31, 2016 Jan 31, 2016

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();

      }

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 15, 2019 Sep 15, 2019

Copy link to clipboard

Copied

LATEST
Hi, there! the example was so usefull!!! can you show us the same code for forward?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines