イベントを発生させるテスト
♥0 |
Line 34 |
Modified 2010-11-08 01:14:24 |
MIT License
archived:2017-03-20 15:44:55
ActionScript3 source code
/**
* Copyright toburau ( http://wonderfl.net/user/toburau )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/8EvX
*/
package {
import flash.display.*;
import flash.events.*;
[SWF(width="465", height="465", backgroundColor="0x0", frameRate="60")]
public class test extends Sprite {
private var eventtest:EventTest = new EventTest();
public function test() {
eventtest.addEventListener(Event.COMPLETE, complete);
eventtest.start();
}
public function complete(e:Event):void {
graphics.beginFill(0xffffff);
graphics.drawCircle(232,232,100);
graphics.endFill();
}
}
}
import flash.display.Sprite;
import flash.events.Event;
class EventTest extends Sprite {
private var count:int = 0;
public function EventTest() {
}
public function start():void {
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function onEnterFrame(e:Event):void {
count++;
if(count > 120) {
dispatchEvent(new Event(Event.COMPLETE));
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
}
}
}