Stop ();
var sp:sprite=new Sprite (), url_array:array=[],title_array:array=[],geturl_array:array=[];
AddChild (SP);
-------------Import XML data extents--------------------------------------
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<xmllong; i++) {
Url_array.push ([Myxml.image.image[i]. @title, Myxml.image.image[i]. @url]);
}
var geturllong:uint =myxml.geturl.child ("GetUrl"). Length ();
for (Var j:uint =0 j<geturllong; J + +) {
Geturl_array.push (Myxml.geturl.geturl[j]. @url);
}
Event.target.removeEventListener ("complete", xmlloaded);
Init (Xmllong);
}
function init (long:uint) {
for (Var j:uint=0 j<long; J + +) {
var loader:loader = new Loader ();
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.width=140;
image.height=183;
Target.addchild (image);
Target.mc.stop ();
Loader.contentLoaderInfo.removeEventListener (Event.complete,loadcomplete);
Loader.contentLoaderInfo.removeEventListener (progressevent.progress, loadprogress);
}
}