# \[FMX04\] Need to have if/else statement checked continuously

**URL:** <https://forum.kirupa.com/t/fmx04-need-to-have-if-else-statement-checked-continuously/168665>\
**Category:** flash\
**Created:** [November 9, 2005, 4:30am UTC](https://forum.kirupa.com/t/fmx04-need-to-have-if-else-statement-checked-continuously/168665 "2005-11-09T04:30:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![deesee](https://avatars.discourse-cdn.com/v4/letter/d/f19dbf/32.png) [@deesee](https://forum.kirupa.com/u/deesee)\
**Post date:** [November 9, 2005, 4:30am UTC](https://forum.kirupa.com/t/fmx04-need-to-have-if-else-statement-checked-continuously/168665/1 "2005-11-09T04:30:17Z")

</div>

Hey all,

I’m working on my first flash site and am real stuck. I’m new to flash and trying my best to learn.

I posted here a few days ago what I was trying to accomplish with my site and treaktor pointed me to lostinbeta’s easeTo fla. I have used that as my framework for the site.

Here is the site so you can see what I have so far:  
[http://www.dannycerezo.com/master.html](http://www.dannycerezo.com/master.html)

This is where I am stuck. When I click on “Projects : 01”, an embedded MC slides in (which is essentially another easeTo MC inside the top one). I need the “Projects : 01” button to disable. I have tried several things such as if/then statements, functions, etc and I can only get them to work once: the first time the scene loads. After that, if I click on “Projects : 01”, thereby sliding the embedded mc to the left, it should disable the “Projects : 01” button, but it doesn’t. It’s as if the “if/else” statement is ignored.

That is to say, if I tell it “Hey if THIS exists, then do this” it only does it once. What I am using to check to see if “Projects : 01” should be on or off, is the position of a MC called “h\_section2” (this is the mc that the embedded easeTO Mc is on).

Here is the code I have so far and what I added: BTW, “Projects : 01” is ‘h\_button2’.

```auto
 
//The bulk of this code courtesy of lostinbeta-----------
Stage.scaleMode = "noScale"; 
this.createEmptyMovieClip("centerPoint", depth++);
centerPoint._x = h_sectionContainer.h_section1._x;
centerPoint._y = h_sectionContainer.h_section1._y;
var paddingX = h_sectionContainer._x;
var paddingY = h_sectionContainer._y;
function easeTo(sectionNumber) {
var sX = h_sectionContainer[sectionNumber]._x;
var sY = h_sectionContainer[sectionNumber]._y;
var endX = centerPoint._x-sX+paddingX;
var endY = centerPoint._y-sY+paddingY;
h_sectionContainer.onEnterFrame = function() {
		 this._x += (endX-this._x)/2;
		 this._y += (endY-this._y)/2;
	 };
}
 
//not part of original lostinbeta code-----------------------------------
//this is what I added. 
//h_sectionConatiner is contains 5 mc's: h_section1 thru h_section5
//what I thought I could do is check the x position of it...if it's at 1205,
//the start position, then leave "h_button2" which is the projects button
//enabled, but if its at 405 then disable.
 
**if (h_sectionContainer._x = 1205) {**
**onProjects ();**
**} else if (h_sectionContainer._x = 405) {**
**offProjects ();**
 **}**
 
function offProjects () {
	 this.h_button2._visible = false;
}
 
function onProjects () {
	 this.h_button2._visible = true;
}
//end of the code I added-------------------------------------------
 
 
for (var i = 1; i<=9; i++) {
	 this["h_button"+i].goSection = "h_section"+i;
	 this["h_button"+i].onRelease = function() {
		 easeTo(this.goSection);
	 };
}
//End of lostinbeta code---------------------

```

What you’ll see after checking the site is that when the embedded mc slides in (in effect moving the h\_sectionContainer to the left at \_x = 405) the “Projects : 01” button is still enabled.

Can someone help me out?

thanks,

deesee

P.S. Sorry for the long post. 🙂
