« 固定値から乱数っぽい値を生成する | メイン | 背景色と文字の色について »
2007年12月12日
[as2] 関数にEventDispatcher
意味があるかはまったく不明。使いどころが分からないけど、なんとなくやってみた。
import mx.events.EventDispatcher;
var execute = function( func:Function ):Void
{
arguments.callee.dispatchEvent( { type:"call" } );
func();
arguments.callee.dispatchEvent( { type:"fin" } );
}
EventDispatcher.initialize( execute );
var eventListener = {};
eventListener.call = function():Void
{
trace("Event : call");
}
eventListener.fin = function():Void
{
trace("Event : fin");
}
execute.addEventListener( "call", eventListener );
execute.addEventListener( "fin" , eventListener );
execute( execution );
function execution():Void
{
trace("execution");
}
投稿者 michi : 2007年12月12日 14:04
« 固定値から乱数っぽい値を生成する | メイン | 背景色と文字の色について »
トラックバック
このエントリーのトラックバックURL:
http://system.seyself.com/mt-tb.cgi/218