Hi
is there a way to gotoAndStop in a timeline and call the onUpdate-Method?
Check this runable example, problem in the last lines:
import com.greensock.*;
import com.greensock.easing.*;
import flash.geom.Matrix;
import flash.display.*;
var myTimeline:TimelineMax = new TimelineMax({paused:true});
var colors:Object = {left:0xB8E46F, right:0x0066CC};
myTimeline.append(new TweenMax(colors, 3, {hexColors:{left:0xff9900, right:0x663399}, onUpdate:drawGradient}));
var mySprite:Sprite = new Sprite();
addChild(mySprite);
function drawGradient():void {
var m:Matrix = new Matrix();
m.createGradientBox(220, 220, 0, 0, 0);
mySprite.graphics.beginGradientFill(GradientType.LINEAR, [colors.left, colors.right], [1, 1], [0x00, 0xFF], m, SpreadMethod.PAD);
mySprite.graphics.drawRect(0,0,220,220);
}
// this doesn't work, because drawGradient is not been calling
myTimeline.gotoAndStop(2);
// my dirty workaround
myTimeline.timeScale=0.001;
myTimeline.gotoAndPlay(2);
// and then stops via event e.g.
Of course, you can call after gotoAndStop the method drawGradient manually. But I call the event in the timeline with parametres which are addicted to the timeline.
Thanks for every help.