Solved

Flash Pro 8 Rewind Button

Posted on 2006-06-16
3
420 Views
Last Modified: 2012-06-21
Hi Folks

I am tring to create a rewind and a fast forward button for an animated tutorial in flash. The pause and play functions I now understand and are Ok, But I am struggling with the rewind and FF buttons

Currently the action script code I have for rewind is:

on(release){
     _root.gotoAndPlay(_root._currentframe-5);
}

However what I want to try to achieve is for the animation to rewind (in this case) for as long as the button is held down. I am guessing I have to do something to the downstroke frame on the button. I'm not very good at these things so any help would be appreciated

Lee
0
Comment
Question by:kasilof
3 Comments
 
LVL 7

Accepted Solution

by:
furmiga earned 250 total points
ID: 16923357
Hi there. Here we go

rewind button

on(press)
{
      function rewind()
      {
            _root.gotoAndStop(_root._currentframe-5);
      }
      intervalr = setInterval(rewind,30)
}
on(release, releaseOutside)
{
      clearInterval(intervalr)
}

fast foward button

on(press)
{
      function fastfoward()
      {
            _root.gotoAndStop(_root._currentframe+5);
      }
      intervalf = setInterval(fastfoward,30)
}
on(release, releaseOutside)
{
      clearInterval(intervalf)
}

I hope it helps :)
0
 
LVL 34

Assisted Solution

by:Aneesh Chopra
Aneesh Chopra earned 250 total points
ID: 16926369
Here is another approach using onEnterFrame

just put the following code on Rewind button
---------
on (press) {
      _root.onEnterFrame = function()
      {
            if (_root._currentframe>6)
            {
                  _root.gotoAndPlay(_root._currentframe-5);
            } else
            {
                  _root.gotoAndPlay(1);
            }
      };
}
on (release, releaseOutside) {
      delete _root.onEnterFrame;
}
---------


and copy/paste following code on Forward button
--------------
on (press) {
      _root.onEnterFrame = function()
      {
            if (_root._currentframe<_root._totalframes-6)
            {
                  _root.gotoAndPlay(_root._currentframe+5);
            } else
            {
                  _root.gotoAndPlay(_root._totalframes);
            }
      };
}
on (release, releaseOutside) {
      delete _root.onEnterFrame;
}
---------------

Rgds
Aneesh
0
 

Author Comment

by:kasilof
ID: 16927032
Brilliant

Thanks Guys. this a real break through for a novice like me. I have split the points. I am posting another question about Zooming if you have any ideas.

regards Lee
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question