tinyk
07-08-2004, 08:08 PM
Hello, I'm sure this is super easy, but I cannot figure it out. I would think I would use and if statement, but I'm sort of stuck.
I have a movieClip (we'll call it MC). I want MC to move forward 200 pixels, then once it reaches that point, move back to it's starting point.
My problem is that when I use an if statement, it gets stuck because both statements are true.
Code:
function moveBlock() {
_root.block1.onEnterFrame=function() {
if (this._x>=200) {
this._x+=10;
}
if (this._x<=400) {
this._x-=10;
}
}
}
I know why it's not working, but I can't think of anyway to do it other than this, which doesn't work because both if statements are always true. ???
I have a movieClip (we'll call it MC). I want MC to move forward 200 pixels, then once it reaches that point, move back to it's starting point.
My problem is that when I use an if statement, it gets stuck because both statements are true.
Code:
function moveBlock() {
_root.block1.onEnterFrame=function() {
if (this._x>=200) {
this._x+=10;
}
if (this._x<=400) {
this._x-=10;
}
}
}
I know why it's not working, but I can't think of anyway to do it other than this, which doesn't work because both if statements are always true. ???