I created a simple slideshow type thing that involves two buttons that allow a user to go left or right to view additional pictures. All of the pictures are stored in a single movieclip.
When the buttons are clicked it just changes the x value of the movie clip. Everything works perfectly.
Currently when it reaches the last picture (the very end of the movie clip) it scrolls back to the beginning. But I have to change it so that it appears to loop… Basically creating another instance of the movie clip on the fly.
Any ideas on how to do it?
Here’s a link to see it in action:
http://www.mindfully21.com/about_test.php
And here’s a snippet of the code to give you an idea:
[SIZE=1]A few notes… photo_mc is the movie clip that moves around (and stores all the pics)
All the actionscript is in the first frame.
btn_left & btn_right are the buttons[/SIZE]
final_x=225 ;
speed =3.5;
photo_width = 296;
photo_mc.onEnterFrame = function() {
photo_mc._x += (final_x - photo_mc._x)/speed;
}
btn_right.onRelease = function() {
if(final_x==225){
final_x =-72;
}
else if(final_x==-72){
final_x =-368;
}
else if(final_x==-368){
final_x =-665;
}
else if(final_x==-665){
final_x =-990;
}
else if(final_x==-990){
final_x =-1290;
}
else if(final_x==-1290){
final_x =-1610;
}
else if(final_x==-1610){
final_x =-1881;
}
else if(final_x==-1881){
final_x =225;
}
photo_mc.onEnterFrame = function(){
photo_mc._x += (final_x - photo_mc._x)/speed;
}
}
btn_left.onRelease = function() {
if(final_x==225){
final_x =225;
}
else if(final_x==-72){
final_x =225;
}
else if(final_x==-368){
final_x =-72;
}
else if(final_x==-665){
final_x =-368;
}
else if(final_x==-990){
final_x =-665;
}
else if(final_x==-1290){
final_x =-990;
}
else if(final_x==-1610){
final_x =-1290;
}
else if(final_x==-1881){
final_x =-1610;
}
photo_mc.onEnterFrame = function(){
photo_mc._x += (final_x - photo_mc._x)/speed;
}
}
Any help would be greatly appreciated!! :hr: