forked from: Simple Animation
/**
* Copyright isekia ( http://wonderfl.net/user/isekia )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/qUc5
*/
// forked from Wataru.Miyazaki's Simple Animation
package {
import flash.display.Sprite;
import flash.events.Event;
public class FlashTest extends Sprite {
public var sampleView:Sprite;
public var flagx:Boolean = true;
public var flagy:Boolean = true;
public function FlashTest() {
// write as3 code here..
sampleView = new Sprite();
sampleView.graphics.lineStyle(10, 0x00aa00);
sampleView.graphics.drawCircle(0, 0, 30);
addChild(sampleView);
addEventListener(Event.ENTER_FRAME, move);
}
private function move(e:Event):void {
var sampleX:Number;
sampleX = sampleView.x;
if(sampleView.x<300 && flagx){
sampleView.x = sampleView.x+1;
}else{
flagx = false;
sampleView.x = sampleView.x-1;
if(sampleView.x == 0){
flagx = true;
}
}
if(sampleView.y<400 && flagy){
sampleView.y = sampleView.y+1;
}else{
flagy = false;
sampleView.y = sampleView.y-1;
if(sampleView.y == 0){
flagy = true;
}
}
}
}
}