Hi all,
So, excuse my code…I haven’t gotten to the level yet where I can write super efficiently. My problem, which I had working this morning, but not now, is that I have a Tween set up on a loader, and immediately upon defining the Tween, I call out a .stop(); so the Tween doesn’t start immediately. The problem is that the loader seems to be sitting at the endpoint of the Tween when the movie starts, instead of the x and y positions I have defined. When I click the next button, the loader pops back to where it should be, tweens away, and then my next image tweens back…after that everything works like it should. Help?
import flash.display.*;
import flash.events.Event;
import fl.transitions.easing.*;
import fl.transitions.Tween;
import fl.transitions.TweenEvent;
var loader:Loader = new Loader;
loader.x = loader.y = 30;
var request1:URLRequest = new URLRequest("img.jpg");
var request2:URLRequest = new URLRequest("img2.jpg");
loader.load(request1);
var masker:MovieClip = new MovieClip();
masker.graphics.beginFill(0x000000);
masker.graphics.drawRect(30,30,400,300);
masker.graphics.endFill();
addChild(masker);
loader.mask = masker;
var outTween:Tween = new Tween(loader, "x", Strong.easeIn, 30, -530, .5, true);
outTween.stop();
outTween.addEventListener(TweenEvent.MOTION_FINISH, nextImage);
var inTween:Tween = new Tween(loader, "x", Strong.easeOut, -530, 30,1.5,true);
inTween.stop();
inTween.addEventListener(TweenEvent.MOTION_FINISH, finishLoad);
var nextImageB:nextB = new nextB();
nextImageB.x = 500;
nextImageB.y = 350;
nextImageB.buttonMode = true;
nextImageB.addEventListener(MouseEvent.MOUSE_UP, unloadImage);
addChild(nextImageB);
function unloadImage(e:Event):void{
outTween.start();
}
function nextImage(e:Event):void{
loader.load(request2);
inTween.start();
removeChild(nextImageB);
}
function finishLoad(e:Event):void{
addChild(nextImageB);
}
addChild(loader);
inTween.start();
Thanks,
varPBR:Tasty