Forked from: beinteractive 's 1. Simple tweens with BetweenAS3 diff:43 Toggle direction of tween with BetweenAS3 Saqoosha forked:0 favorite:1 lines:46 license : MIT License modified : 2009-05-10 21:47:17 // forked from beinteractive's 1. Simple tweens with BetweenAS3 package { import flash.display.Sprite; import flash.events.MouseEvent; import org.libspark.betweenas3.BetweenAS3; import org.libspark.betweenas3.easing.Cubic; import org.libspark.betweenas3.tweens.ITween; public class Sample extends Sprite { private var _tween:ITween; public function Sample() { this._tween = BetweenAS3.parallel( BetweenAS3.tween(addNewBox(50), {x: 455}, {x: 20}, 1, Cubic.easeInOut), BetweenAS3.tween(addNewBox(100), {x: 455}, {x: 20}, 1, Cubic.easeInOut, 0.1), BetweenAS3.tween(addNewBox(150), {x: 455}, {x: 20}, 1, Cubic.easeInOut, 0.2), BetweenAS3.tween(addNewBox(200), {x: 455}, {x: 20}, 1, Cubic.easeInOut, 0.3) ); this._tween.play(); this.stage.addEventListener(MouseEvent.CLICK, this._reverse); } private function _reverse(e:MouseEvent):void { this._tween.stop(); this._tween = BetweenAS3.reverse(this._tween); this._tween.play(); } private function addNewBox(y:Number):Box { var box:Box = new Box(); box.x = 20; box.y = y; addChild(box); return box; } } } import flash.display.Sprite; internal class Box extends Sprite { public function Box(size:int = 20) { graphics.beginFill(0); graphics.drawRect(-size / 2, -size / 2, size, size); graphics.endFill(); } } Code Fullscreen Preview Fullscreen froyd : betweenas3 transition BetweenAS3 transition Cubic.easeInOut BetweenAS3.tween play BetweenAS3.parallel stop BetweenAS3.reverse MouseEvent.CLICK MouseEvent addEventListener addChild int Sprite Number