4 Replies Latest reply on Sep 14, 2010 8:13 AM by Ned Murphy

    loading file order reverse issue

    Benoitcn Level 1

      I try to load 4 pictures. Loading is fine but the order is reverse.

      This is the code:


      function showThumbnail(id:String, xmllist:XMLList):void{
       var pics:XMLList = xmllist.(@name == id).*;
       for each(var i:XML in pics.pic){
        var loader:Loader = new Loader();
        loader.contentLoaderInfo.addEventListener(Event.INIT, loadPicCompleteHandler);
        loader.load(new URLRequest(i.@url));
      function loadPicCompleteHandler(e:Event):void{
       var mc:MovieClip = new MovieClip();
       if( picIndex == 5 )
        picIndex = 1;
       mc.name = "pic" + picIndex;
       mc.x = firstPicX;
       mc.y = firstPicY + (picIndex-1)*(picHeight+picSeparation);
       trace("I:" + picIndex++);
       trace("mc.x:" + mc.x);
       trace("mc.y:" + mc.y);


      The "I" is the picture index. I think the order should be 1.png 2.png 3.png 4.png just like the order of  the xml ~~


      This is the output:


      I:1 mc.x:11 mc.y:27 file:///D|/works/Flash/thumbnails/4.png I:2 mc.x:11 mc.y:210 file:///D|/works/Flash/thumbnails/3.png I:3 mc.x:11 mc.y:393 file:///D|/works/Flash/thumbnails/2.png I:4 mc.x:11 mc.y:576 file:///D|/works/Flash/thumbnails/1.png