2 Replies Latest reply on Nov 10, 2008 8:40 PM by studiobrain

    as3 load images into an array from xml

      Code below:


      var startX:Number;
      var startFrame:int;
      var changeDistance:int;
      var travelDistance:int;

      photos.buttonMode = true;
      photos.addEventListener(MouseEvent.MOUSE_DOWN, pressHandler);

      function pressHandler(evt:MouseEvent):void {
      startX = photos.mouseX;
      startFrame = photos.currentFrame;
      photos.addEventListener(MouseEvent.MOUSE_MOVE, moveHandler);
      stage.addEventListener(MouseEvent.MOUSE_UP, releaseHandler);

      function releaseHandler(evt:MouseEvent):void {
      photos.removeEventListener(MouseEvent.MOUSE_MOVE, moveHandler);
      stage.removeEventListener(MouseEvent.MOUSE_UP, releaseHandler);

      function moveHandler(evt:MouseEvent):void {
      changeDistance = Math.round((photos.mouseX - startX) / 4);
      travelDistance = startFrame + changeDistance;
      if (travelDistance > photos.totalFrames) {
      photos.gotoAndStop(travelDistance % photos.totalFrames);
      } else if (travelDistance < 0) {
      photos.gotoAndStop(photos.totalFrames + (travelDistance % photos.totalFrames));
      } else {

      Photos is a movie clip created on the stage. Within photos is a series of sequential images placed on their own keyframes. I would like to load these images in through an xml file, and I would like to load them into an array while keeping all of the functionality of the (photos) movie clip... I understand the concept of arrays (not difficult) and I understand xml (less difficult), but I am not in the know or at least I am overlooking the obviuos, of how to combine the 2...

      Can anyone help me with this?