Tim Walling

Scripted Tweening for Flash Lite 1.1 (aka Flash 4)

Developing for Flash Lite 1.1 can be a little frustrating at times and lots of us are used handling most of our animations via actionscript now. I tried thinking about how I could best encapsulate some similar functionality for Flash 4 and came up with this today. I honestly don't remember what I used to do back in the day but this works and I don't think it will be too difficult to integrate into your projects if you'd like to play with it.

[![Get Adobe Flash player](http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif)](http://adobe.com/go/getflashplayer)

Here's a download to a zip containing this swf and the fla. Just drop the tween movieclip into your movie and try it out.

Flash4Tween.zip

I released it with a very open Creative Commons license. Basically you can do what you want with it. I learned more about the various licenses available at FlashForward and wanted to try out Creative Commons one. Very easy to use!

Here are the comments from the fla:

Flash 4 Scripted Tween(cc)  
2005 Tim Walling.  
Some rights reserved.http://creativecommons.org/licenses/by-sa/2.5/

One approach to encapsulating some tween functionality. Basically it consists of a movieclip that is in a resting state. Once some variables are set such as the target movieclip, x and y value, tween ratio, etc you tell the movieclip to play. The movieclip then goes into a loop. It takes the current position and the target position, divides the difference by the tweenRatio, then moves the movieclip to the new point. When the difference becomes small (less than zero) the tween is ended and the movieclip is moved to the final point.

Usage:

Example:

tween_mc.targetClip = "box_mc";
tween_mc.tweenRatio = 2;
tween_mc.targetX = 340;
tween_mc.targetY = 140;
tellTarget("tween_mc") { gotoAndPlay("tween") };

Please post other methods you might be using or if there are any suggestions, questions regarding this one.