Reputation: 6962
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.
Upvotes: 0
Views: 78
Reputation: 2223
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.
Upvotes: 1