To the good samaritan in you fellow flashers,
I am making a butterfly using the Drawing API and have created movieclips for body, leftwing_mc and rightwing_mc. Butterfly draws beautifully and swf is 346 bytes (cool cool cool)
Now, I want to flap the wings by using easing class on each wing. I wrote the code below and it successfuly flaps halfway and pauses. On debugging using trace (), the second trace() is read and output but not the second tween. The wingstate var is updating as intended as well. Obviously I am not much of a programmer but I’m still trying! I’m thinking that something in the tween class is preventing the second tween from executing, OR,(and more likely) there is an obvious flaw to the repeating scrip I have so painstakingly written. Any suggestions on how to go about this or tutorials with similar requirements would be greatly appreciated!
this.createEmptyMovieClip(“body”,1);
body._x = 285;
body._y = 280;
with (body) {
body.lineStyle(2,0xFF0000,100);
body.beginFill(0xFF0000,100);
body.moveTo(0,0);
body.curveTo(15,-25,30,0);
body.curveTo(50,75,30,130);
body.curveTo(15,160,0,130);
body.curveTo(-20,75,0,0);
body.endFill();
};
import mx.transitions.Tween;
import mx.transitions.easing.*;
var wingstate = 0;
this.onEnterFrame = function() {
if(wingstate == 0) {
Tween = new Tween(leftwing_mc,"_xscale",Elastic.easeOut, -100, -25, 60, false);
wingstate = 1;
trace(“I have been set to 1”)
}else if(wingstate == 1){
Tween = new Tween(leftwing_mc,"_xscale",Elastic.easeIn, -25, -100, 60, false);
wingstate = 0;
trace(“I have been set to 1”)
}
};