Stop rotation

I am having a problem that I swear I was not experiencing when working with this same file the other day. But that is another issue for me to puzzle over.

Anyway in this bit of code, I want this mc (called fall) to move down the screen to a certain y position, which it does and then rotate 90 and move to a certain x position. Problem is I cannot get the rotation += 90 to stop. I know it is just a simple matter but I am more frustrated because it was stopping the other day (I don’t have that file I had added more code and moved on and now I am backtracking) Anyway here is the code: I think it is probably that the delete onEnterFrame is not applying to the rotation, but I’m not sure.

function move() {
	clearInterval(moveInterval);
	_root.fall.onEnterFrame = function() {
		_root.fall._y += 10;
		if (_root.fall._y>= 755) {
			_root.fall._y = 755;
			if(_root.fall._y = 755){
				_**root.fall._rotation += 90;**
				_root.fall._x = 530;
			}
			delete this.onEnterFrame;
		}
	};
}
moveinterval = setInterval(move, 1000);

I suppose I could try setting it up in a loop. I will post if it works.

Well I think I am getting warmer…it now just stops and does not rotate, but I am sure there is a better way of doing this…for now here is what I have and will continue to try and figure out (isn’t nice that I am talking to myself…lol)

function move() {
	clearInterval(moveInterval);
	_root.fall.onEnterFrame = function() {
		_root.fall._y += 10;
		if (_root.fall._y>= 755) {
			_root.fall._y = 755;
			if(_root.fall._y = 755){
				for (i=1; i<3; i++) {
				_root["fall"+i]._rotation += 90;
				_root.fall._x = 530;
				}
			}
			delete this.onEnterFrame;
		}
	};
}
moveinterval = setInterval(move, 1000);

see if this works better

function move() {
	clearInterval(moveInterval);
	_root.fall.onEnterFrame = function() {
		_root.fall._y += 10;
		if (_root.fall._y>=755) {
			_root.fall._y = 755;
			for (i=1; i<3; i++) {
				_root["fall"+i]._rotation += 90;
				_root.fall._x = 530;
				delete this.onEnterFrame;
			}
		}
	};
}
moveInterval = setInterval(move, 1000);

First of all thank you, and second of all I tried this code myself earlier:

//function move() {
	//clearInterval(moveInterval);
	//_root.fall.onEnterFrame = function() {
		//_root.fall._y += 10;
		//if (_root.fall._y>= 755) {
			//_root.fall._y = 755;
			//if(_root.fall._y = 755){
				//for (i=1; i<3; i++) {
				// mc = "fall" + i;
				//_root.mc._rotation += 90;
				//_root.fall._x = 530;
				//}
			//}
			//delete this.onEnterFrame;
		//}
	//};
//}
//moveinterval = setInterval(move, 1000);

(commented out as I was trying your code) and your code is giving me the same results as this was…the objects gets to y position of 755 then shifts to x of 530 without the 90 degree rotation. The biggest frustration I have is that I had this going fine a couple days ago but I messed with other code too much and did not save my working version and now am having problems. I am sure I must have changed something at some point, but I know better than to not save my works in progress.

Thanks for your input =)

i`ve just tried, and “fall” reaches _y=755 and then moves to _x=530 and “fall1” and “fall2” both rotate 90 degrees.Is this not what you want?
You have not told _root.fall to rotate.

No…I am trying to tell _root.fall to rotate. :blush:

function move() {
	clearInterval(moveInterval);
	_root.fall.onEnterFrame = function() {
		this._y += 10;
		if (this._y&gt;=755) {
			this._y = 755;
			this._x = 530;
			this._rotation += 90;
			delete this.onEnterFrame;
		}
	};
}
moveInterval = setInterval(move, 1000);

what is the "for" loop for?

Because I could not get it working the way you just did and was just trying to think of anything I could. I thought maybe if I only told it to rotate once it would work and the only way I could think of was a loop. (my problem was the rotation was not stopping) And I know setting it to 3 was not the solution but it did not work with 1 & 2 so I just kept going and was going to go back and try some other things when I had a chance. But instead you came in and once again rescued me from my lack of knowledge. :smiley:
Thank you!

welcome
main probs -you had “=” instead of “==” and wrong case for moveinterval

appreciate the explanation as well - I try to remember these things for future reference