Anim1
♥0 |
Line 32 |
Modified 2012-12-01 11:37:24 |
MIT License
archived:2017-03-20 14:09:02
ActionScript3 source code
/**
* Copyright Zahurdias.Calimero ( http://wonderfl.net/user/Zahurdias.Calimero )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/tgWF
*/
package
{
import flash.events.Event;
import flash.events.MouseEvent;
import flash.display.Sprite;
public class BasicAnimation extends Sprite
{
// ------- Constructor -------
public function BasicAnimation()
{
_createChildren();
}
// ------- Child display objects -------
//private var _rect:Sprite;
// ------- Private constants -------
private const START:int = 100;
private const END:int = 400;
// ------- Private methods -------
private function _createChildren():void
{
//_rect = new Sprite();
graphics.beginFill(0xff0000, 1);
graphics.drawRect(0, 0, 100, 100);
graphics.endFill();
this.x = START;
addChild(this);
addEventListener(MouseEvent.CLICK, _rect_click);
}
// ------- Event handling -------
private function _rect_click(event:MouseEvent):void
{
// wrong way:
this.x = START;
while (this.x < END)
{
this.x++;
}
}
}
}