1 Reply Latest reply on May 10, 2006 6:55 AM by robdodson

    Using a tweening function as a rollover.  Please help me restore functionality!

    robdodson Level 1
      Ok, I have a movieclip with 3 different tweens applied to it by a few functions. The first tween happens on rollover and makes the movieclip a little bigger, the second tween happens on rollout and makes it smaller. The third tween happens on release and makes the clip much bigger. However, when the user clicks the movie clip it deletes all of the rollover/rollout/onrelease commands so that the user can interact with a swf which is loaded into the mc. Here's my code so far:

      //Tweens//
      function grow(who) {
      who.onEnterFrame = function() {
      if (this._xscale<40) {
      this._xscale += 5;
      this._yscale += 5;
      }
      if (this._xscale == 40 && this._yscale == 40) {
      delete this.onEnterFrame;
      }
      };
      }
      function shrink(who) {
      who.onEnterFrame = function() {
      if (this._xscale>16.5) {
      this._xscale -= 5;
      this._yscale -= 5;
      }
      if (this._xscale == 16.5 && this._yscale == 16.5) {
      delete this.onEnterFrame;
      }
      };
      }
      function growBigger(who) {
      who.onEnterFrame = function() {
      if (this._xscale<100) {
      this._xscale += 5;
      this._yscale += 5;
      }
      if (this._xscale == 100 && this._yscale == 100) {
      delete this.onEnterFrame;
      }
      };
      }
      //End Tweens//

      loadMovie("preloader.swf", "preloader_mc");

      preloader_mc._xscale = 21;
      preloader_mc._yscale = 20;

      this.onRollOver = function() {
      grow(this);
      };

      this.onRollOut = function() {
      shrink(this);
      };

      this.onRelease = function() {
      delete onRollOver;
      delete onRollOut;
      delete onRelease;
      _root.MkXpos = _root.touristsMark._x;
      _root.MkYpos = _root.touristsMark._y;
      _root.pan(_root.mapContainer_mc);
      growBigger(this);
      _root.mapContainer_mc.map_mc.dragger_mc._visible = false;
      _root.drag = false;
      }


      All of this works just fine. My only problem is that when the user exits the loaded swf I want the button to shrink back down and have its functionality restored. Basically when someone clicks the exit button on the external swf it runs the shrink(who) function and shrinks everything back down. I put a line of code into the shrink function when it checks to see if "who" is at 16.5, which looked like this:

      if (this._xscale == 16.5 && this._yscale == 16.5) {
      this.onRollOver = function = () {
      grow(this);
      }
      delete this.onEnterFrame;
      }

      However, that didn't restore the functionality. Any help would be greatly appreciated! I'm a poor student on a deadline