/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
package code.utils { import flash.events.Event; import flash.events.IOErrorEvent; import flash.net.URLRequest; import flash.net.URLLoader; public class LoaderXml { public static function load(url:String, completeFun:Function, errorFun:Function = null){ var loadXml:URLLoader = new URLLoader(); loadXml.addEventListener(Event.COMPLETE, completeFun); errorFun == null ? null : loadXml.addEventListener(IOErrorEvent.IO_ERROR, errorFun); loadXml.load(new URLRequest(url)); } } }