Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Key Controls - Stop @ Bottom & Top of movie

Status
Not open for further replies.

N64MARIO64

Technical User
Nov 17, 2002
11
US
How do I make a movie clip stop at the top & bottom of the movie. So far I have this.I have this already haveon
ClipEvent(load){
speed = 5;
}
onClipEvent (enterFrame) {
(Key.isDown(key.DOWN))?(this._y+=speed):null;
(Key.isDown(key.UP))?(this._y-=speed):null;
updateAfterEvent();
}
 
Try this:

Code:
onClipEvent(load){
speed = 50;
top = 0;
bottom = Stage.height;
}
onClipEvent (enterFrame) {
(Key.isDown(key.DOWN))?(this._y+=speed):null;
(Key.isDown(key.UP))?(this._y-=speed):null;
(this._y < top)?(this._y = top):null;
(this._y > bottom)?(this._y = bottom):null;
updateAfterEvent();
}
 
Thank you frozenpeas - It works - a few bugs - but I fixed it up. Thanks :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top