flash中Loader与 URLLoader的应用

Loader: swf,图片(jpg,png,gif)
URLLoader:文本文件(xml,php,jsp…)

 

loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);

private function loadComplete(event:Event){

trace("done");

addChild(loader);

} 

 

 

xmlLoader.dataFormat=URLLoaderDataFormat.TEXT;

xmlLoader.addEventListener(Event.COMPLETE,xmlLoaded);

private function xmlLoaded(event:Event

{

try {myXML = XML(event.target.data);area.text=myXML;}

catch (e:TypeError) {area.text="Load faild:n"+e.message;}

} 

你可能感兴趣的:(loader)