[COLOR=black][FONT=Verdana]Help Please!! [/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Hi, I’ve been stuck on a little problem for some time now. Basically, I have a movieclip on the stage called slide_mc that gets tweened left or right when next_btn or back_btn are pressed. Slide_mc is a long rectangular strip that has different images on it. The idea is, you press next or back to show different parts of this strip. There are two panels on a layer above it to hide the extra parts of the strip from view. I needed the slide_mc to move forwards and backwards seamlessly as if it is one long continuous strip. I did this using actionscript3 and its x coordinate. The images on slide_mc are equally spaced so I just set the tween to move by a certain number of x values. The problem is if you press the next button before the previous tween has finished it progresses again by that same value which ends up moving the slide_mc to a random position, perhaps covering some of the image. How can I disable the next and back buttons until the Actionscript tween has finished what its doing and then enable them again for the next tween? The end product is supposed to be a gallery. Obviously it would be better to use a UiLoader to display the images to keep the file size down, but I couldn’t think of a way to load the right images while still allowing the slide_mc to move forward AND backwards. [/FONT][/COLOR]
[COLOR=black][FONT=Verdana]I have only started using flash so I’m sure there’s probably something obvious that I’m missing. If anybody can help me with my original code or suggest a better way to achieve this effect I would really appreciate it![/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Thanks, [/FONT][/COLOR]
[FONT=Calibri][SIZE=3]here’s my code:[/SIZE][/FONT]
next_Btn.addEventListener(MouseEvent.CLICK,moveLeft);
back_Btn.addEventListener(MouseEvent.CLICK,moveRight);
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
var scrollTween:Tween;
function moveLeft(event:MouseEvent):void{
clock.gotoAndPlay(“play”);
var currentX:Number = slide.x;
var newX:Number = currentX - 385.9;
trace("Current Position is: " + currentX);
//trace(newX);
if(currentX != -702.9){
scrollTween = new Tween(slide,“x”,Regular.easeOut,currentX,newX,59,false);
currentX = newX;
}
trace("Position is Now: " + currentX);
}
function moveRight(event:MouseEvent):void{
var currentX:Number = slide.x;
var newX:Number = currentX + 385.9;
trace("Current Position is: " + currentX);
//trace(newX);
if(currentX != 68.85){
scrollTween = new Tween(slide,“x”,Regular.easeOut,currentX,newX,59,false);
currentX = newX;
}
trace("Position is Now: " + currentX);
}