forked from: forked from: forked from: forked from: Tween24.pauseAllTweens
♥0 |
Line 40 |
Modified 2012-12-21 16:26:38 |
MIT License
archived:2017-03-10 00:59:29
ActionScript3 source code
/**
* Copyright ProjectNya ( http://wonderfl.net/user/ProjectNya )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/jvhN
*/
// forked from yozamurai's forked from: forked from: forked from: Tween24.pauseAllTweens
// forked from ProjectNya's forked from: forked from: Tween24.pauseAllTweens
// forked from ProjectNya's forked from: Tween24.pauseAllTweens
// forked from yozamurai's Tween24.pauseAllTweens
package {
import flash.display.*;
import flash.events.*;
import a24.tween.*;
public class FlashTest extends Sprite {
private var _tw:Tween24;
private var _box1:Sprite = new Sprite();
private var _box2:Sprite = new Sprite();
public function FlashTest() {
// write as3 code here..
_box1.graphics.beginFill(0xFF0000);
_box1.graphics.drawRect(0,0,100,100);
addChild(_box1);
_box2.graphics.beginFill(0x0000FF);
_box2.graphics.drawRect(0,0,100,100);
addChild(_box2);
_box2.x = 100;
_tw = Tween24.serial(
Tween24.tween(_box1, 4, Tween24.ease.Linear).y(200),
Tween24.tween(_box2, 4, Tween24.ease.Linear).y(200)
);
_tw.play();
_box1.addEventListener(MouseEvent.CLICK , pause);
_box2.addEventListener(MouseEvent.CLICK , pause);
}
private function pause(e:MouseEvent):void{
_box1.removeEventListener(MouseEvent.CLICK , pause);
_box2.removeEventListener(MouseEvent.CLICK , pause);
_box1.addEventListener(MouseEvent.CLICK , play);
_box2.addEventListener(MouseEvent.CLICK , play);
_tw.pause();
}
private function play(e:MouseEvent):void {
_box1.removeEventListener(MouseEvent.CLICK , play);
_box2.removeEventListener(MouseEvent.CLICK , play);
_box1.addEventListener(MouseEvent.CLICK , pause);
_box2.addEventListener(MouseEvent.CLICK , pause);
_tw.play();
}
}
}