[Tweener] possible to tween a variable (not a property of a movie clip)
Francis Turmel
fturmel at gmail.com
Thu Oct 9 16:07:43 PDT 2008
Hey Mike, here's a quick demo showing different approaches, hopefully this
should answer your question.
The most important thing to remember is that the first argument the addTween
takes is the scope where
your properties live. As long as those properties are publicly accessible in
that scope, Tweener can tween them.
package {
import caurina.transitions.Tweener;
import flash.display.Sprite;
public class Application extends Sprite {
public var speed:Number;
private var _speed:Object;
public static var staticSpeed:Number;
public function Application() {
//class public member
speed = 20;
Tweener.addTween(this, {speed:55, time:1,
onUpdate:function():void {trace("public:", speed);}});
//class private member example using Object, could also be done
with any other complex type as long as the tweened properties are publicly
accessible
_speed = {value:20};
Tweener.addTween(_speed, {value:55, time:1,
onUpdate:function():void {trace("private:", _speed.value);}});
//class static public member
Application.staticSpeed = 20;
Tweener.addTween(Application, {staticSpeed:55, time:1,
onUpdate:function():void {trace("static:", Application.staticSpeed);}});
}
}
}
If you're doing this from the timeline in Flash, you don't have to worry
about access modifiers since your variable will be public anyways.
import caurina.transitions.*;
var speed:Number = 22;
Tweener.addTween(this, {speed:55, time:1,
onUpdate:function():void{trace(speed);}});
On Thu, Oct 9, 2008 at 6:13 PM, Mike Heavers
<mheavers at maverickdigital.net>wrote:
>
> Hey - can anyone tell me if there's a way to use tweener to tween variables
> that aren't properties of a movie clip - for example say you have a variable
> like:
>
> var speed:number = 20
>
> and do a tween
>
> Tweener.addTween(?, {speed: 55,time:.5});
>
> to tween the speed variable from 20 to 55?
>
>
> --
>
>
> MIKE HEAVERS
> MAVERICK DIGITAL <http://www.maverickdigital.net>
> 20 W 22ND STREET SUITE 1108
> NEW YORK, NY 10010
> 212.337.8004
> 212.627.2977
> mheavers at maverickdigital.net
>
> _______________________________________________
> Tweener mailing list
> Tweener at lists.caurinauebi.com
> http://lists.caurinauebi.com/listinfo.cgi/tweener-caurinauebi.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.caurinauebi.com/pipermail/tweener-caurinauebi.com/attachments/20081009/232b88ae/attachment.htm>
More information about the Tweener
mailing list