0
votes

I am trying to make a square get bigger using tweenlite (from greensock).

Using the following line but it gives an error, any ideas?

      public function getStarted ():void {
        var juiceBox:Shape = new Shape();
        var newValue:Number = new Number();
        newValue = 0;
        juiceBox.graphics.beginFill(0xcccccc);
        juiceBox.graphics.drawRect(0, squareHeight-newValue, squareWidth, newValue);
        juiceBox.graphics.endFill();
        square.addChild(juiceBox);
        var  myTween:TweenLite = new TweenLite(juiceBox.graphics.drawRect, 5, {"y":squareHeight-60,"height":60 });

    }

[Fault] exception, information=ReferenceError: Error #1069: Property y not found on builtin.as$0.MethodClosure and there is no default value. Fault, PropTween() at PropTween.as:58

Thanks any help would be greatly appreciated.

1
Do your tween on the sprite, not the graphics. myTween:TweenLite = new TweenLite(juiceBox, 5, ... - Eric

1 Answers

1
votes

You are tweening "juiceBox.graphics.drawRect" which is a function (class method). That class method has no property named 'y' or 'height'. I'm guessing what you want to tween is juicebox itself (that has such properties) so you would do:

TweenLite.to(juicebox, 5, etc ...

You are supposed to use the form TweenLite.to() (which return an instance) and not the constructor.

var  myTween:TweenLite = TweenLite.to(etc ...)

This keeps the tween from being GC.