0 Replies Latest reply on Oct 21, 2009 6:00 AM by mwilcox_oxfam

    AS3 Centering XML thumbnails in movieclip


      Hi there, I have an xml thumbnails feed, which I want to center the amount of thumbnails loaded inside a movieclip (thumbstrip_mc).


      The structure is a movie clip (gallerystrip_mc) with a mask inside it (984px wide), which has a movieclip inside it (thumbstrip_mc), which is 2300px wide to scroll the thumbnails. This then has a dynamic movieclip inside it (emptyClip), which has a child (imageLoader).


      ImageLoader holds a thumbnail, and emptyClip is there so I can use buttonmode.


      How can I tell it to center the thumbnails to the middle of thumbstrip_mc? Here is the code for loading the thumbnails.


      // Load thumbnails


      function xmlLoaded(event:Event):void
          xml = XML(event.target.data);
          xmlList = xml.children();
          for(var i:int = 0; i < xmlList.length(); i++)
              imageLoader = new Loader();
              imageLoader.load(new URLRequest(xmlList[i].attribute("thumb")));
              imageLoader.x = i * 110 + 10;
              imageLoader.y = 2;
              imageLoader.name = xmlList[i].attribute("source");
              var emptyClip:MovieClip = new MovieClip;
              emptyClip.name = "thumbHolder_mc" + i;
              emptyClip.buttonMode = true;
              emptyClip.x = 101;
              imageLoader.addEventListener(MouseEvent.CLICK, showPicture);