Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 425
  • Last Modified:

Flash Pro 8 Rewind Button

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
kasilof
Asked:
kasilof
2 Solutions
 
furmigaCommented:
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
 
Aneesh ChopraCommented:
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
 
kasilofAuthor Commented:
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now