0 Replies Latest reply on May 21, 2007 3:23 AM by zibber

    actionscript 3 problems

    zibber Level 1
      Hi All

      Wondered if someone could help as Im struggling to get my head around moving form as2 to as3. At the moment im struggling wiht how movieclips are handled. All i want to do currently is dynamcially create movieclips to house images, thse then need to be clickable to reveal a larger versionof the image in another clip.

      For now the code below is based around doing the first bit, namely pulling int he images and displaying them.
      Now what Ims truggling with here is how to dynamically name the thumb clip in the loop. as ideally i want it it to go thumb0, thumb1...... I have tried numerous ways but none of them seem to work, does anyone have any ideas why?


      function xmlLoaded(event:Event) {

      imagesXML = XML(myLoader.data);
      trace(imagesXML);
      var ImageCount:int = imagesXML.image.length();
      trace(imagesXML.image[0].@src);

      for (var i = 0; i < ImageCount; i++) {
      var thumb:MovieClip = new MovieClip();
      var ldr:Loader = new Loader();
      var url:String = "images/thumbs/" + imagesXML.image .@src;
      var urlReq:URLRequest = new URLRequest(url);
      ldr.load(urlReq);
      thumb.addChild(ldr);
      addChild(thumb)
      thumb.x = i * preview_spacing;

      }
      thumb.addEventListener(MouseEvent.CLICK, clickHandler);

      }

      thansk in advance
      a