Hello!
I am building several tweened animations in Flash and then playing them in Adobe Director 11.5. The code I have in Director waits for the timeline to stop playing (playing = false) then advances to the next externally linked SWF.
All of the code I find for the TimelineMax and TweenMax is on one frame, and if I add more frames the tweens restart and act erratically. Is it possible to have the flash timeline longer so Director thinks it's still playing and then jump to a frame label that says stop(); when the Tween is finished? Here is what I have so far:
import com.greensock.*;
import com.greensock.easing.*;
import flash.events.*;
import flash.events.MouseEvent;
//create line
var line:Shape = new Shape();
addChild(line);
// variables for destination
var destx:Number = 1046;
var desty:Number = 480;
//position moving dot at first point
//be sure the instance name is mc
mc.x = p0.x;
mc.y = p0.y;
dest.x = destx;
dest.y = desty;
//kill existing line
line.graphics.clear();
//start new line at first point
line.graphics.lineStyle(5, 0xFF0000, .9);
line.graphics.moveTo(mc.x, mc.y);
var tl:TimelineMax = new TimelineMax({paused:false,onUpdate:drawLine});
tl.appendMultiple([
TweenMax.to(fade2black, 2, {alpha:0}),
TweenMax.to(mc, 2, {x:dest.x, y:dest.y}),
TweenMax.to(blackfadeout, 1, {alpha:1, delay:2, onstart:clearLine, onComplete:endStop})
], 0, TweenAlign.SEQUENCE);
function drawLine()
{
line.graphics.lineTo(mc.x, mc.y);
}
function endStop() {
trace("End of Tween");
gotoAndPlay(20);
}
function clearLine() {
line.graphics.clear();
}