?? eventclass.as
字號:
?package
{
//----------------------------------------
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.HTTPStatusEvent;
import flash.events.EventDispatcher;
//----------------------------------------
public class EventClass extends EventDispatcher
{
//----------------------------------------
public function EventClass(url:String)
{
var loader:URLLoader = new URLLoader(new URLRequest(url));
loader.addEventListener(Event.COMPLETE, this.completeHandler);
loader.addEventListener(IOErrorEvent.IO_ERROR, this.ioErrorHandler);
loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, this.httpStatusHandler);
}
public override function toString():String
{
return "[EventClass]";
}
private function completeHandler(evt:Event):void
{
this.dispatchEvent(new Event(Event.COMPLETE));
}
private function ioErrorHandler(evt:IOErrorEvent):void
{
this.dispatchEvent(new IOErrorEvent(evt.type, evt.bubbles, evt.cancelable, evt.text));
}
private function httpStatusHandler(evt:HTTPStatusEvent):void
{
this.dispatchEvent(new HTTPStatusEvent(HTTPStatusEvent.HTTP_STATUS, evt.bubbles, evt.cancelable, evt.status));
}
//----------------------------------------
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -