# If statements don't work as they should

**URL:** <https://forum.kirupa.com/t/if-statements-dont-work-as-they-should/129506>\
**Category:** Uncategorized\
**Created:** [November 24, 2004, 4:07pm UTC](https://forum.kirupa.com/t/if-statements-dont-work-as-they-should/129506 "2004-11-24T16:07:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![darthmahon](https://avatars.discourse-cdn.com/v4/letter/d/8491ac/32.png) [@darthmahon](https://forum.kirupa.com/u/darthmahon)\
**Post date:** [November 24, 2004, 4:07pm UTC](https://forum.kirupa.com/t/if-statements-dont-work-as-they-should/129506/1 "2004-11-24T16:07:13Z")

</div>

Hi,

Ok I have a flash movie with a graphic that I want to move vertically, then horizontally…

I am using the following actionscript:

[AS]  
// Fade and Position  
MovieClip.prototype.fadeposition = function(endX, endY, endALPHA, speed){

```
      // starting alpha
      this._alpha = 0;

      // perform actions when frame is entered
      this.onEnterFrame = function(){
              
      // fade in
      this._alpha += (endALPHA - this._alpha) / speed;

      // enlarge x value
      this._x += (endX - this._x) / speed;

      // enlarge y value
      this._y += (endY - this._y) / speed;
          
      }

```

}  
[/AS]

I call the above on frame 1 by using the following:

[AS]  
// move image  
mc\_imgdiamond.fadeposition(365, 300, 100, 100);  
[/AS]

I then have another ActionScript function that moves the movieclip horizontally:

[AS]  
// Position  
MovieClip.prototype.pos = function(endX, endY, speed){

```
      // perform actions when frame is entered
      this.onEnterFrame = function(){
          
      // enlarge x value
      this._x += (endX - this._x) / speed;

      // enlarge y value
      this._y += (endY - this._y) / speed;
          
      }

```

}  
[/AS]

Now the next line of code I have on frame 2, I would have thought the following ActionScript would have worked to see if the movieclip’s \_x value had reached 300 or not:

[AS]  
if (mc\_imgdiamond.\_x == 300) {

```
  // move image
  mc_imgdiamond.pos(150, 300, 5);
  
  // delay next frame
  my_interval = setInterval(unpause, 3000);

```

}  
stop();  
[/AS]

However, nothing happens. Any ideas? Am I calling the “\_x” value incorrectly?

Cheers,  
Chris
