# What is up with my code?

**URL:** <https://forum.kirupa.com/t/what-is-up-with-my-code/155035>\
**Category:** Uncategorized\
**Created:** [July 14, 2005, 9:41am UTC](https://forum.kirupa.com/t/what-is-up-with-my-code/155035 "2005-07-14T09:41:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dst101](https://avatars.discourse-cdn.com/v4/letter/d/5daacb/32.png) [@dst101](https://forum.kirupa.com/u/dst101)\
**Post date:** [July 14, 2005, 9:41am UTC](https://forum.kirupa.com/t/what-is-up-with-my-code/155035/1 "2005-07-14T09:41:01Z")

</div>

I have been writing a few functions, and can not seem to get it working correctly.

```auto

var rotationSpeed = 3.8;
var ScaleLarge = 101;
var ScaleSmall = 25;
var HoverSize = 35;
var Speed = 5;

with(mc1)
{
     _xscale = 25;
     _yscale = 25;
     _rotation = random(90);
}
/ **************************************************************************
FUNCTION OpenWindow
************************************************************************** /
MovieClip.prototype.OpenWindow = function()
{
     this.onEnterFrame = function()
     {
          this._xscale += Math.floor((ScaleLarge - this._xscale))/Speed;
          this._yscale += Math.floor((ScaleLarge - this._yscale))/Speed;
          trace(this._xscale);
          this._rotation += Math.floor((0 - this._rotation))/rotationSpeed;
          if(this._xscale >= ScaleLarge - 1)
          {
               trace("HITTTTTT");
               delete this.onEnterFrame;
               this.mcHit.enabled = false;
          }
     }
}
/ ************************************************************************
FUNCTION CloseWindow
************************************************************************ /
MovieClip.prototype.CloseWindow = function()
{
     this.onEnterFrame = function()
     {
          this._xscale += Math.floor((ScaleSmall - this._xscale))/Speed;
          this._yscale += Math.floor((ScaleSmall - this._yscale))/Speed;
          trace(this._xscale);
          this._rotation += Math.floor((random(90) - this._rotation))/rotationSpeed;
          if(this._xscale <= ScaleSmall)
          {
               delete this.onEnterFrame;
               this.mcHit.enabled = true;
               
          }
     }
}

/ ************************************************************************** /

mc1.onPress = function()
{
     this.OpenWindow();
     trace("Movieclip " +this+ " has been pressed");
}
mc1.mcClose.onPress = function()
{
     mc1.CloseWindow();
}

```

I can’t seem to get this mcHit enabled function to go to false.

I have attached a dummy file, if anyone would like to have a crack at it?

Thanks
