Solved

Flash Pro 8 Rewind Button

Posted on 2006-06-16
3
415 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now