forked from: flash on 2012-3-20
♥0 |
Line 42 |
Modified 2012-03-22 23:10:49 |
MIT License
archived:2017-03-20 11:11:47
ActionScript3 source code
/**
* Copyright umhr ( http://wonderfl.net/user/umhr )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/dSZJ
*/
// forked from ocan1058's flash on 2012-3-20
package {
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.display.Graphics;
import flash.display.Sprite;
import flash.events.Event;
public class FlashTest extends Sprite {
private var line1:Sprite = new Sprite();
private var rect_length:int;
private var _timer:Timer;
private var haco:Sprite = new Sprite();
private var haco2:Sprite = new Sprite();
private var circle:Sprite = new Sprite();
private var circle_cnt:int = 0;
public function FlashTest() {
//line
line1.graphics.lineStyle(2, 0x000000);
line1.graphics.moveTo(0,0);
line1.graphics.lineTo(10,0);
this.addChild(line1)
// write as3 code here..
this.addEventListener(Event.ENTER_FRAME,onEnter);
//_timer = new Timer(1000);
//_timer.addEventListener(TimerEvent.TIMER,onTimer);
//_timer.start();
this.graphics.beginFill(0xFF0000);
this.graphics.drawRect(0, 0, 465, 465);
this.graphics.endFill();
}
private function onEnter(event:Event):void {
rect_length += 10;
//haco.graphics.clear();
haco.graphics.lineStyle(2, 0x000000);
haco.graphics.drawRect(0,0,rect_length,rect_length);
haco.graphics.endFill();
this.addChild(haco);
haco2.graphics.lineStyle(2, 0x000000);
haco2.graphics.drawRect(460,460,rect_length*-1,rect_length*-1);
haco2.graphics.endFill();
this.addChild(haco2);
if (rect_length > 460) {
rect_length = 0;
haco.graphics.clear();
haco2.graphics.clear();
//_timer.stop();
//this.removeChildAt(0);
//this.removeEventListener(Event.ENTER_FRAME, onEnter);
//stage.addEventListener(Event.EXIT_FRAME, onEnter2);
}
}
}
}