Dead Code Preservation :: Archived AS3 works from wonderfl.net

level0_EventDispatcherTips

@author Takashi Murai(KAYAC)
Get Adobe Flash player
by Murai 03 Jun 2009
/**
 * Copyright Murai ( http://wonderfl.net/user/Murai )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/l3W5
 */

package {
    import flash.display.*;
    import flash.text.*;
    import flash.events.*;
    /*
        @author Takashi Murai(KAYAC)
    */
    [SWF(width="400", height="400", frameRate="24", backgroundColor="#FFFFFF")]
    
	public class Main extends Sprite {
		public var txt:TextField;
	 
		public function Main() {
			init();		 
		}
		 
		public function init():void{
			txt = new TextField();
			txt.width = 400;
			txt.height = 400;
			addChild(txt);
		
			var _d:Sample=new Sample();
			_d.addEventListener(Sample.NOTICE,function(e:DataEvent):void{
				txt.appendText(e.data+"\n");
			})

                _d.setMessage("dispatchEventする時にパラメータを渡すTips.");
                _d.setMessage("http://level0.kayac.com/");
		}
	}
}

import flash.text.*;
import flash.events.*;
class Sample extends EventDispatcher {
	public static var NOTICE:String = "notice";
	public function Sample() {}
	
	public function setMessage(mes:String):void {
		dispatchEvent(new DataEvent(Sample.NOTICE,false,false,mes));
	}
}