Home
HOME     ABOUT     SERVICES    WORK     WISETALK     NEWS     TOOLS




Internet Sites Internet Sites  
Multimedia Multimedia  
Search Engine Optimization SEO Services  
Self Service Kiosks Kiosks  

 


Bookmark ' Play it Again, Sam: Playing A Timeline Backwards in Flash'  Page Print 'Play it Again, Sam: Playing A Timeline Backwards in Flash' page Send 'Play it Again, Sam: Playing A Timeline Backwards in Flash' page   

 

by Troy Janisch

Sooner or later, every Flash developer is surprised to learn how difficult it is to play a movie backwards in FLASH. When this happens, instinct sends them to one of more than 20 different methods described in online tutorials.

Most methods for playing a Flash movie backwards require the programmer to embed a movieclip containing actionscript that monitors the _root level move and determines when it needs to play backwards and where to stop.

This brief tutorial presents an alternative approach that can be implemented and scaled to virtually any Flash project. The tutorial is brief because only a few lines of code are required. In fact, It’s as easy as 1-2-3.

1. Call to Action
Create an actionscript layer that extends the full length of your movie. In that layer, include the following actionscript:

function Movement() {

if (_root._currentframe > _root.mytarget){
prevFrame();

}else if (_root._currentframe < _root.mytarget){
nextFrame();

}else{
stop();
}

}

this.onEnterFrame= Movement;

2. onPress your buttons
Attach code to your buttons that tells the script the frame to stop on when clicked:

on(Press){
_root.mytarget=59;
}

Using the code above, the movie will play either backwards or forwards to the desired destination.


3. Avoid all Stops
As written, the code eliminates the need to have stop() commands throughout the movie since you can indicate all stopping points within navigation. Movieclips can still be used on stopped frames to create animations as desired.

Over time, you’ll find this method of moving backwards and forwards in the timeline to be very adaptable. Enjoy!

     © 1994-2008 Icon Interactive™   •   Copyright Policy   •   Privacy Policy   •   Terms of Use   •   Madison, Wisconsin   •   WiseTalk RSS Feed