3 Replies Latest reply on May 18, 2007 6:42 PM by retrocane

    onEnterFrame problem

    retrocane Level 1
      I have a button and a movie clip. When the button is pressed, the movie clip scales up and moves on the stage while animation within the movie clip occurs. At the end of the animation, the user can click a close button in the movie clip. Close returns the movie clip to its original size and position, as well as returns the movie clip animation to the first frame.

      Everything works fine up until the close button, where for a moment the movie clip does go where it should, but the scaling and movement restarts. Scaling and moving should only occur when the button is pressed.

      Here is the code I'm using:

      var records_array:Array = new Array();
      records_array[0] = record_1_mc;
      records_array[1] = record_2_mc;
      records_array[2] = record_3_mc;

      record_1_btn.onPress = function() {
      moveRecord(0);
      spinRecord(0);
      }

      function moveRecord(record) {
      records_array[record].onEnterFrame = function() {
      if (this._xscale < 105) {
      this._xscale += 3;
      }
      if (this._yscale < 105) {
      this._yscale += 3;
      }

      if (this._x < 125) {
      this._x += 8.5;
      }
      if (this._y < 100) {
      this._y += 5;
      }
      }
      }

      function spinRecord(record) {
      records_array[record].gotoAndPlay("ease-in");
      }

      record_1_mc.label_1_mc.close_1_btn.onPress = function() {
      restoreRecord();
      }

      function restoreRecord() {
      record_1_mc._width = 85;
      record_1_mc._height = 85;
      record_1_mc._x = 40;
      record_1_mc._y = 50;
      record_1_mc.gotoAndStop(1);
      }

      Suggestions are appreciated!