# Can someone tell me what im doing wrong?

**URL:** <https://forum.kirupa.com/t/can-someone-tell-me-what-im-doing-wrong/63734>\
**Category:** flash\
**Created:** [September 9, 2004, 4:04pm UTC](https://forum.kirupa.com/t/can-someone-tell-me-what-im-doing-wrong/63734 "2004-09-09T16:04:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pheonix3372001](https://avatars.discourse-cdn.com/v4/letter/p/94ad74/32.png) [@Pheonix3372001](https://forum.kirupa.com/u/Pheonix3372001)\
**Post date:** [September 9, 2004, 4:04pm UTC](https://forum.kirupa.com/t/can-someone-tell-me-what-im-doing-wrong/63734/1 "2004-09-09T16:04:20Z")

</div>

hello,

ok in flash mx 2004 i am trying to setup an action script on frame one that will manipulate an object forward and back but stopping at a certain pixel so it doesnt keep going off the screen.

This is the code that i have and it moves the object but doesnt stop the object at the certain pixel.

the screen resolution is 550x400

stop();  
if (car.\_x \< 458){  
go.onPress = function(){  
car.\_x+=10;  
onEnterFrame = function(){  
car.\_x+=10;  
}  
}  
} else if(car.\_x == 458){  
go.onPress = function(){  
car.\_x+=0;  
onEnterFrame = function(){  
car.\_x+=0;  
}  
}  
}

if you can please let me know what i am doing wrong.

thanks

Albert

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 9, 2004, 6:21pm UTC](https://forum.kirupa.com/t/can-someone-tell-me-what-im-doing-wrong/63734/2 "2004-09-09T18:21:45Z")

</div>

stop();  
if (car.\_x\<458) {  
go.onPress = function() {  
z = setInterval(moveCar, 50);  
};  
}  
function moveCar() {  
if (car.\_x\<458) {  
car.\_x += 10;  
} else {  
clearInterval(z);  
}  
}

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 11, 2004, 7:19pm UTC](https://forum.kirupa.com/t/can-someone-tell-me-what-im-doing-wrong/63734/3 "2004-09-11T19:19:21Z")

</div>

Thanks for your help

albert
