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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Action Script Question...

Status
Not open for further replies.

kokopeli

Technical User
Sep 21, 2004
1
AR
I’ve made a Flash Web Page with a Movie Clip in it which is made of a long row of buttons, some of them are outside the Stage itself. I wanted this row of buttons to move from its center point to the left and to the right so that the client will be able to click all the buttons which exist on that Movie Clip.
To do that I wrote this Action Script code:

onClipEvent (enterFrame) {
if (_root._ymouse > 94 && _root._ymouse < 174) {
_root.yChange = Math.round(_root._ymouse-this._y);
_root.xChange = Math.round(_root._xmouse-this._-300);
_root.yMove = Math.round(_root.yChange/134);
_root.xMove = Math.round(_root.xChange/20);
this._y += _root.yMove;
this._x -= _root.xMove;
}
else {
_root.yChange = Math.round(this._y - 134);
_root.xChange = Math.round(this._x - 300);
_root.yMove = Math.round(_root.yChange/134);
_root.xMove = Math.round(_root.xChange/20);
this._x -= _root.xMove;
this._y -= _root.yMove;
}
}

Now when the Mouse is over the Movie Clip, the buttons start to move to the left or to the right, depends if I put the Mouse over the right side or the left side of the Movie Clip. But the problem is that the buttons keep moving towards the edge of the Stage without a stop and what I want is that when the Movie Clip reaches the last Button it will STOP. How do I write that in the code? Somebody knows how to do that?
Thanks in advance,
Itai
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top