5 Replies Latest reply on Jun 25, 2007 7:38 AM by kglad

    x and y coordinates

    samwisemcganji
      Ok I posted up asking if anyone could help me with an interactive map tutorial but no replys so I tried my best (I am fairly new to actionscript) to create one out of some existing code.

      I have got it to work but doesnt do exactly what I want the existing code was taken from an image gallery that basically change the y value of a movieclip so it would slide to the right image.

      The problem I am having is changing both the x and y values of the movieclip to allow it to move to any point on the stage. i need to know how to make the target variables point to an x and y coordinates. or maybe this isnt the way to do it?

      I am really stuck with this and I am sure it would be easy for someone who knows actionscript. Any help would be very much appreciated.

      Thank you in advance.

      Here is the code I am using and I have attached the fla

      this.attachMovie("image_0", "image_0", 101);

      target = 100;
      target1 = 120;
      target2 = 175;
      target3 = 200;

      images_0._y = -1000;

      speed = 5;

      for (var i = 0; i<4; i++)
      {
      var thumb = this["thumb_"+i];

      thumb.pos = target;
      thumb.pos1 = target1;
      thumb.pos2 = target2;
      thumb.pos3 = target3;

      thumb_0.onPress = function() {
      target = this.pos;
      };
      thumb_1.onPress = function() {
      target = this.pos1;
      };
      thumb_2.onPress = function() {
      target = this.pos2;
      };
      thumb_3.onPress = function() {
      target = this.pos3;
      };

      thumb._alpha = 80;
      thumb.onRollOver = function() {
      this._alpha = 20;
      };
      thumb.onRollOut = function() {
      this._alpha = 80;
      };
      }
      this.onEnterFrame = function() {
      image_0._y += (target-image_0._y)/speed;
      image_0._x += (target-image_0._x)/speed;
      };