The code is as follows:
Stop ();
var g_filters:glowfilter=new glowfilter (0xffffff,1,3,3,5,bitmapfilterquality.low);
var d_filters:dropshadowfilter = new Dropshadowfilter (3, 0x000000, 60, 8, 8);
var url_array:array =[],btn_array:array =[],myxml:xml = new XML (), J:uint=0,masksprite:sprite=new Sprite (), MySprite: Sprite=new Sprite (), Title_txt:textfield=new TextField ();
Draw (Masksprite);
AddChild (Masksprite);
MASKSPRITE.X=STAGE.STAGEWIDTH/2-MASKSPRITE.WIDTH/2;
MASKSPRITE.Y=STAGE.STAGEHEIGHT/2-MASKSPRITE.HEIGHT/2;
function Draw (sprite:sprite,w:uint=400,h:uint=300, bgcolor:uint=0xffff00): void {
Sprite.graphics.beginFill (bgcolor);
Sprite.graphics.drawRect (0, 0, W, h);
Sprite.graphics.endFill ();
}
Title_txt.width = 100;
title_txt.x=150;
title_txt.y=280;
Title_txt.autosize=textfieldautosize.center;
AddChild (Mysprite);
Mysprite.mask=masksprite;
AddChild (Title_txt);
var xml_url:string = "Http://sxl001.xfyun.com/xmlImages.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 {
myXML = XML (Myloader.data);
Xmllong =myxml.child ("image"). Length ();
for (var i:uint =0; i<xmllong; i++) {
Url_array.push ([Myxml.image[i]. @title, Myxml.image[i]. @url]);
}
Event.target.removeEventListener ("complete", xmlloaded);
Init ();
}
function init () {
var loader:loader = new Loader ();
Loader.load (New URLRequest (url_array[j][1));
Loader.contentLoaderInfo.addEventListener (progressevent.progress, loadprogress);
Loader.contentLoaderInfo.addEventListener (Event.complete,loadcomplete);
function Loadprogress (e:progressevent): void {
var percent:number=math.round (e.bytesloaded/e.bytestotal*10000)/100;
title_txt.text=url_array[j][0]+ "" +percent+ "%";
Title_txt.filters=[g_filters];
Title_txt.mouseenabled=false;
}
function LoadComplete (event:event): void {
var loadbitmap:loader=loader (Event.target.loader);
var image:bitmap=bitmap (loadbitmap.content);
image.x=j*400;
image.width=400;
image.height=300;
Mysprite.addchild (image);
Loader.contentLoaderInfo.removeEventListener (Event.complete,loadcomplete);
Loader.contentLoaderInfo.removeEventListener (progressevent.progress, loadprogress);
j + +;
if (J<xmllong) {
mysprite.x=stage.stagewidth/2-j*400;
MYSPRITE.Y=STAGE.STAGEHEIGHT/2-MYSPRITE.HEIGHT/2;
Init ();
} else {
TITLE_TXT.TEXT=URL_ARRAY[0][0];
var mybg:bg=new bg ();
Mybg.x=stage.stagewidth;
Mybg.y=stage.stageheight;
AddChild (MYBG);
mysprite.x=0;
MYSPRITE.Y=STAGE.STAGEHEIGHT/2-MYSPRITE.HEIGHT/2;
for (var i:uint=0; i<xmllong; i++) {
var mybtn:btn=new btn ();
Mybtn.i=i;
Mybtn.t.text= "" +uint (i+1);
Mybtn.mousechildren=false;
mybtn.x=stage.stagewidth-mybtn.width* (xmllong-i);
Mybtn.y=stage.stageheight-mybtn.height;
Btn_array.push (MYBTN);
AddChild (MYBTN);
Mybtn.addeventlistener (Mouseevent.click,onclick);
}
}
}
}
var endx:uint;
function OnClick (event:mouseevent) {
var mc:movieclip=event.target as MovieClip;
Mc.m.gotoandstop (2);
for (var i:uint=0; i<btn_array.length; i++) {
var tempbtn:movieclip=btn_array[i];
if (TEMPBTN!=MC) {
Tempbtn.m.gotoandstop (1);
}
}
Endx=int (MC.I) *400;
Mysprite.addeventlistener (Event.enter_frame,onmove);
}
function OnMove (event:event) {
var disx:number = (endx-event.target.x)/12;
EVENT.TARGET.X=DISX;
if (Math.Abs (EVENT.TARGET.X+ENDX) <=5) {
Event.target.x=-endx;
Event.target.removeEventListener (Event.enter_frame,onmove);
}
}