AS2.0
Quien me ayuda.???
Código ActionScript :
/*Developed by : Md Shahidul Islam Mob: +8801914211890 email: [email protected], [email protected] url: http://www.flex4web.com*/ import fl.transitions.*; import fl.transitions.easing.*; import fl.transitions.TransitionManager; import flash.net.URLLoader; import flash.net.URLRequest; import flash.events.Event; import flash.display.Loader; import flash.display.MovieClip; import flash.events.ProgressEvent; import flash.events.MouseEvent; import flash.display.Bitmap; import flash.utils.Timer; import flash.events.TimerEvent; // var count:Number = 0; var tween_duration = 1; var myTween:Tween; var imgGroup:MovieClip = new MovieClip(); this.addChild(imgGroup); this.addChild(loading); loading.visible = false; // var total:Number = 0; var pic:Number = 0; var i:int; var imgArray:Array = new Array(); var current_no:Number = 0; var previous_no:Number = 0; //image var imgLoader:Loader; //timer var delay:Number = 5;//Change image delay. var timer:Timer; //xml var xml:XML; var xmlList:XMLList; var xmlLoader:URLLoader = new URLLoader(); var xmlPath:String = "xml/images.xml"; xmlLoader.load(new URLRequest(xmlPath)); xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded); function xmlLoaded(event:Event):void { xml = new XML(event.target.data); xmlList = xml.children(); total = xmlList.length(); //trace(xmlList); //trace(total); for (i = 0; i < total; i++) { imgArray.push( { image: xmlList[i].image.toString() } ); } loadImage(); //timer timer = new Timer(5 * 1000); timer.addEventListener(TimerEvent.TIMER, autoSlide); } function loadImage():void { for (i = 0; i < total; i++) { imgLoader = new Loader(); imgLoader.load(new URLRequest(xmlList[i].image)); imgLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadingP); imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded); } } function imageLoaded(event:Event):void { var imgBm:Bitmap = new Bitmap(); var mc:MovieClip = new MovieClip(); imgBm = Bitmap(event.target.content); imgBm.smoothing = true; mc.addChild(imgBm); mc.name = "img_" + imgGroup.numChildren; //trace("mc.name: "+mc.name) mc.x = 0; mc.y = 0; if (imgGroup.numChildren > 0) { mc.alpha = 0; } imgGroup.addChild(mc); loading.visible = false; count = count + 1; //trace(count); if (count == total) { //trace("i am working") timer.start(); } } function loadingP(event:ProgressEvent):void { //trace("Percent"); loading.visible = true; var percent:Number = Math.round(event.bytesLoaded / event.bytesTotal * 100); loading.loadText.text = percent + "%"; } function autoSlide(event:TimerEvent):void { current_no++; if (current_no >= total) { current_no = 0; } effect(); } function effect():void { var prevMc:Object; prevMc = imgGroup.getChildAt(previous_no); var myTM:TransitionManager = new TransitionManager(prevMc as MovieClip); myTM.startTransition({type:PixelDissolve, direction:Transition.OUT, duration:1, easing:None.easeOut, xSections:200, ySections:200}); myTween = new Tween(prevMc,"alpha",Regular.easeIn,1,0,1,true); var nextMc:Object; nextMc = imgGroup.getChildAt(current_no); myTween = new Tween(nextMc,"alpha",Regular.easeIn,0,1,1,true); previous_no = current_no; }