I'm using Tweenlite and Starling in AS3. Everything is working but on last rewrite compiler just ignores Tweenlite command and just crashes with this error:
[Fault] exception, information=undefined
at com.greensock.core::Animation()[/Active/_Flash/_AS3_v12/src/com/greensock/core/Animation.as:210]
at com.greensock::TweenLite()[/Active/_Flash/_AS3_v12/src/com/greensock/TweenLite.as:445]
at com.greensock::TweenLite$/to()[/Active/_Flash/_AS3_v12/src/com/greensock/TweenLite.as:919]
this is the code where the error occurs:
private function down():void {
TweenLite.to(square, stage.stageHeight / 200, {y: stage.stageHeight - 50, ease: Linear.easeNone});
if (stopped){
TweenLite.to(square, square.y / 200, {y: 50, ease: Linear.easeNone});
stopped = !stopped;
rRight();
} else {
right();
}
}
if I remove if statement Teening happens, if I leave it everything crashes. I don't understand why would compiler skip tweening.
Here's the rest of the code that is relevant:
public class Square extends Sprite implements ISquare {
public const square:Quad = new Quad(100, 100);
private var stopped:Boolean;
public function Square() {
}
public function draw():void{
addChild(square);
square.pivotX = square.width / 2;
square.pivotY = square.height / 2;
square.x = 50;
square.y = 50;
stopped = new Boolean(false);
down();
}
...
public function reverseDirection():void{
stopped = !stopped;
TweenLite.killTweensOf(square);
}
private function down():void {
TweenLite.to(square, stage.stageHeight / 200, {y: stage.stageHeight - 50, ease: Linear.easeNone});
if (stopped){
TweenLite.to(square, square.y / 200, {y: 50, ease: Linear.easeNone});
stopped = !stopped;
rRight();
} else {
right();
}
}
private function right():void {
TweenLite.to(square, stage.stageWidth / 200, {x: stage.stageWidth - 50, ease: Linear.easeNone});
if (stopped){
TweenLite.to(square, square.x / 200, {x: 50, ease: Linear.easeNone});
stopped = !stopped;
rUp();
} else {
up();
}
}
...
Context source: https://www.dropbox.com/sh/9x2q93o2ff1fsna/AADVJgt5nipDE1pdkgozkOc1a (Square.as)