Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Playing movie backwards through button

Status
Not open for further replies.

TheAwake

Programmer
Jul 28, 2003
37
Slowly this site becomes my favourite one...

Lets do this quick:
I have a movie, and it includes 3 images with the stop(); function in it.
I added two buttons, one for continue, and one for back.

Now I want that if the user presses the back button (at one of the 3 images), the movie is played backwards until he reaches the last image with the stop(); point (and then the user should decide if he wants to watch forewards (to the stop(); image where he has been before) or still backwards)

Anyone knows a solution?
Thanks!
 
with only 3 images id just use frame labels

frames called image1, image 2, image 3

put them in an array
Code:
my_arr = ["image1","image2","image3"]
first frame 
i = 0;

 buttons

forward.onRelease = function(){
i++
if(i>2)i = 0 
gotoAndStop(my_arr[i])
}
back.onRelease = function(){
i--
if(i<0)i = 2 
gotoAndStop(my_arr[i])
}
 
Well, I think I'm too stupid for that...
Where should I write that array thing into?
Wrote it into scene1, but it just said &quot;Szene=Szene 1, Ebene=Ebene 1, Bild=1: Zeile 2: ;' expected first frame&quot;

And the buttons...if I write that (means half of that) into one button's actionscript, I get some &quot;...has to be in an on function&quot; error in the debug window.

I'm sorry for my unknowledge, but...thats why I'm here, eh?
 
all the code goes on the main timeline

stop();
my_arr = [&quot;image1&quot;,&quot;image2&quot;,&quot;image3&quot;]
i = 0;
forward.onRelease = function(){
i++
if(i>2)i = 0
gotoAndStop(my_arr)
}
back.onRelease = function(){
i--
if(i<0)i = 2
gotoAndStop(my_arr)
}

no code is attached to the buttons. the buttons have instance names forward and back. click the buttons, go to properties and give them the instance names
i very quickly put the above into an fla so download and take apart

 
Good use of the code tags! [bigcheeks]

Regards,

cubalibre2.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top