Here's an example of how I'd do: import fl.transitions.Tween; import fl.transitions.easing.None; var path:String="l4d_published"; var currentPage:uint; var insArray:Array=[tn1,tn2,tn3,tn4,tn5,tn6,tn7,tn8,tn9,tn10,tn11,tn12,tn13,tn14,tn15]; var imgArray:Array; var tweenArray:Array=[]; for (var i:uint = 0, len:uint = insArray.length; i < len; i++) { insArray.visible=false; insArray.addEventListener(Event.COMPLETE, imageLoadComplete); } pagefwd.visible=pagebwd.visible=false; pagefwd.addEventListener(MouseEvent.CLICK, fwdClick); pagebwd.addEventListener(MouseEvent.CLICK, bwdClick); function fwdClick(e:MouseEvent):void { setPage(++currentPage); } function bwdClick(e:MouseEvent):void { setPage(--currentPage); } var myTextLoader:URLLoader = new URLLoader(); myTextLoader.dataFormat=URLLoaderDataFormat.VARIABLES; myTextLoader.addEventListener(Event.COMPLETE, textLoadComplete); myTextLoader.load(new URLRequest("l4d.txt")); function textLoadComplete(e:Event):void { imgArray=e.target.data.images.split(".jpg,"); setPage(1); } function setPage(page:uint):void { currentPage=page; pagebwd.visible=(currentPage!=1); pagefwd.visible = (currentPage<Math.ceil(imgArray.length/insArray.length)); for (var j:uint = 0, tc:uint = tweenArray.length; j < tc; j++) { tweenArray .fforward(); } tweenArray=[]; for (var i:uint = 0, len:uint = insArray.length; i < len; i++) { var imgID:uint = (currentPage - 1)*len + i; if (imgID>=imgArray.length-1) { insArray.visible=false; } else { insArray.visible=true; insArray.alpha=0; insArray.source=path+"/"+imgArray[imgID]+"_tn.jpg"; } } } function imageLoadComplete(e:Event):void { tweenArray.push(new Tween(e.currentTarget,"alpha",None.easeOut,0,1,1,true)); }
... View more