stop();
var sp:Sprite=new Sprite(),url_array:Array=[],title_array:Array=[],getUrl_array:Array=[];
addChild(sp);
//------------- 导入XML数据资料区 --------------------------------------
var XML_URL:String = "http://sxl001.xfyun.com/Images.xml";
var myXMLURL:URLRequest = new URLRequest(XML_URL);
var myLoader:URLLoader = new URLLoader(myXMLURL);
myLoader.addEventListener("complete", xmlLoaded);
var xmlLong:uint;
function xmlLoaded(event:Event):void {
var myXML:XML = XML(myLoader.data);
xmlLong =myXML.image.child("image").length();
for (var i:uint =0; i
}
var getUrlLong:uint =myXML.getUrl.child("getUrl").length();
for (var j:uint =0; j
}
event.target.removeEventListener("complete", xmlLoaded);
init(xmlLong);
}
function init(long:uint) {
for (var j:uint=0; j
initLoad(loader,j);
}
}
function initLoad(loader:Loader,i:uint) {
var target:bg_mc=new bg_mc();
target.x=140*i-(Math.floor(i/5)*700);
target.y=183*Math.floor(i/5);
target.i=i;
sp.addChild(target);
loader.load(new URLRequest(url_array[i][1]));
loader.addEventListener(Event.INIT, initHandler);
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loadComplete);
function loadProgress(event:ProgressEvent):void {
var percent:Number=Math.round(event.bytesLoaded/event.bytesTotal*10000)/100;
target.title_txt.text=percent+" %";
target.title_txt.mouseEnabled=false;
}
function loadComplete(event:Event):void {
var loadBitmap:Loader=Loader(event.target.loader);
var image:Bitmap=Bitmap(loadBitmap.content);
image.;
image.;
target.addChild(image);
target.mc.stop();
loader.contentLoaderInfo.removeEventListener(Event.COMPLETE,loadComplete);
loader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, loadProgress);
}
}