1 Reply Latest reply on Oct 9, 2006 10:32 PM by kglad

    userInterface problems

    dlacloche
      As a motion graphic artist who's been working with keyframes forever, it's really blowing my mind that you can create cool animation with just code. Being new to this concept, I can't figure out how to get this to happen:

      onRelease, movieClip1 (where ever it happens to be at the time of click) travels to x=150, y=60 of the stage. And the other movieClips--movieClip2, movieClip3, movieClip4, and movieClip5 move to the left side of the stage, x=75 y=200, 250, 300, and 350 respectively.

      And of course, I want the same to happen to the other movieClips--when you click on them they go to x=150, y=60 and the others go off to the side.

      I have some ActionScript that works on the first click of any movieClip, but if you click any movieClip after that, all the movieClips gravitate to eachother. The more you click the closer they get, until they're all overlapping and jittering around a little.

      I new at all this, and I need help. Thanks.
      Here's the code:

      var startX2 =_root.ball2._x
      var startY2 =_root.ball2._y
      var startX1 =_root.ball1._x
      var startY1 =_root.ball1._y
      var startX3 =_root.ball3._x
      var startY3 =_root.ball3._y
      var startX4 =_root.ball4._x
      var startY4 =_root.ball4._y
      var startX5 =_root.ball5._x
      var startY5 =_root.ball5._y
      var endX1 = 75
      var endY1 = 200
      var endX2 = 150
      var endY2 = 250
      var endY3 = 300
      var endY4 = 350
      var endY5 = 400
      var endY6 = 60

      var speed = 10
      ball2._x = startX2
      ball2._y = startY2
      ball1._x = startX1
      ball1._y = startY1
      ball3._x = startX3
      ball3._y = startY3
      ball4._x = startX4
      ball4._y = startY4
      ball5._x = startX5
      ball5._y = startY5
      function moveMe2(targ){
      targ._x+=(_root.endX1-targ._x)/_root.speed;
      targ._y+=(_root.endY1-targ._y)/_root.speed
      }
      function moveMe1(targ){
      targ._x+=(_root.endX2-targ._x)/_root.speed;
      targ._y+=(_root.endY6-targ._y)/_root.speed
      }
      function moveMe3(targ){
      targ._x+=(_root.endX1-targ._x)/_root.speed;
      targ._y+=(_root.endY2-targ._y)/_root.speed
      }
      function moveMe4(targ){
      targ._x+=(_root.endX1-targ._x)/_root.speed;
      targ._y+=(_root.endY3-targ._y)/_root.speed
      }
      function moveMe5(targ){
      targ._x+=(_root.endX1-targ._x)/_root.speed;
      targ._y+=(_root.endY4-targ._y)/_root.speed
      }

      stop();


      ball1.onRollOver = function () {
      this.reverser_mc.gotoAndStop(1);
      this.play(1);
      }

      ball1.onRollOut = function () {
      this.reverser_mc.gotoAndPlay(2);
      }

      ball1.onPress = function () {
      this.gotoAndStop(15);
      }

      ball1.onRelease = function () {
      this.gotoAndStop(1);
      }
      ball1.onRelease = function () {
      setInterval(moveMe1,30,_root.ball1);
      setInterval(moveMe2,30,_root.ball2);
      setInterval(moveMe3,30,_root.ball3);
      setInterval(moveMe4,30,_root.ball4);
      setInterval(moveMe5,30,_root.ball5);
      }

      ball2.onRollOver = function () {
      this.reverser_mc.gotoAndStop(1);
      this.play(1);
      }

      ball2.onRollOut = function () {
      this.reverser_mc.gotoAndPlay(2);
      }

      ball2.onPress = function () {
      this.gotoAndStop(15);
      }

      ball2.onRelease = function () {
      setInterval(moveMe1,30,_root.ball2);
      setInterval(moveMe2,30,_root.ball3);
      setInterval(moveMe3,30,_root.ball4);
      setInterval(moveMe4,30,_root.ball5);
      setInterval(moveMe5,30,_root.ball1);
      }


      ball3.onRollOver = function () {
      this.reverser_mc.gotoAndStop(1);
      this.play(1);
      }

      ball3.onRollOut = function () {
      this.reverser_mc.gotoAndPlay(2);
      }

      ball3.onPress = function () {
      this.gotoAndStop(15);
      }

      ball3.onRelease = function () {
      setInterval(moveMe1,30,_root.ball3);
      setInterval(moveMe2,30,_root.ball4);
      setInterval(moveMe3,30,_root.ball5);
      setInterval(moveMe4,30,_root.ball1);
      setInterval(moveMe5,30,_root.ball2);
      }


      ball4.onRollOver = function () {
      this.reverser_mc.gotoAndStop(1);
      this.play(1);
      }

      ball4.onRollOut = function () {
      this.reverser_mc.gotoAndPlay(2);
      }

      ball4.onPress = function () {
      this.gotoAndStop(15);
      }

      ball4.onRelease = function () {
      setInterval(moveMe1,30,_root.ball4);
      setInterval(moveMe2,30,_root.ball5);
      setInterval(moveMe3,30,_root.ball1);
      setInterval(moveMe4,30,_root.ball2);
      setInterval(moveMe5,30,_root.ball3);
      }


      ball5.onRollOver = function () {
      this.reverser_mc.gotoAndStop(1);
      this.play(1);
      }

      ball5.onRollOut = function () {
      this.reverser_mc.gotoAndPlay(2);
      }

      ball5.onPress = function () {
      this.gotoAndStop(15);
      }

      ball5.onRelease = function () {
      setInterval(moveMe1,30,_root.ball5);
      setInterval(moveMe2,30,_root.ball1);
      setInterval(moveMe3,30,_root.ball2);
      setInterval(moveMe4,30,_root.ball3);
      setInterval(moveMe5,30,_root.ball4);
      }