Hey guys, I’m working on a animation for a charity and i need to make some birds fly around the stage randomly, and change _xscale depending which direction they are moving.
I have an if() statement to check if the new destination point is smaller or bigger than the current _x position of each bird. This works perfectly, but when i use the continueTo() method, that if() statement isnt being called.
could someone please help me and tell me what im doing wrong.
here is the code for the birds.
function flight(){
for (var i=0; i<birds; i++){
var bird:MovieClip = attachMovie(“crane”,“crane”+i,i+1);
bird.gotoAndStop(Math.ceil(Math.random()*10));
bird._x = Math.random()*1200;
bird._y = Math.random()*400;
var birdScale:Number = bird._xscale = bird._yscale = Math.random()*50+20;
var destPointY:Number = Math.random()*500;
var destPointX:Number = Math.random()*1200;
if(destPointX < bird._x){
bird._xscale = -birdScale;
}else{
bird._xscale = birdScale}
var tween1:Object = new Tween(bird,"_x",Regular.easeInOut,bird._x, destPointX, Math.random()*5+2, true);
var tween2:Object = new Tween(bird,"_y",Regular.easeInOut,bird._y, destPointY, Math.random()*5+2, true);
tween1.onMotionFinished = function() {
this.continueTo(destPointX,Math.random()*5+2);
};
tween2.onMotionFinished = function() {
this.continueTo(destPointY,Math.random()*5+2);
};
}
}
Thanx in advance for any help.