Question : What's the best way to do AS3 driven animation in Flash CS4?

I have an array of sprites that I want to scroll across the screen at a constant pace with some padding between them. This is a very simple animation, and I was wondering if there was some stuff in AS3 that made this particularly easy to do.

Answer : What's the best way to do AS3 driven animation in Flash CS4?

Yes,

You need to use a Tween which will take an object and interpolate that object's property or properties between start and ending points.  You can tween the x and y locations, rotation, alpha property, and a number of others.

Here's a link to the Adobe docs:
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/fl/transitions/Tween.html

All you do is instantiate the tween:

var tw:Tween = new Tween(obj, prop, func, begin, finish, duration);

which follows this structure:
Tween(obj:Object, prop:String, func:Function, begin:Number, finish:Number, duration:Number, useSeconds:Boolean = false)


Here's an example of a tween:

http://www.zedia.net/actionscript-3-tweens-tutorial/


make sure your object has an instance name if you created it in the authoring tool, as that is the object you will use as the first argument of the Tween.


Random Solutions  
 
programming4us programming4us