daveclark5
04-04-2002, 11:12 PM
I have created a movieclip called MovieBar that is made of buttons. I wanted to make it move left and right depending on the cursor, so this is the code I have assigned:
onClipEvent (enterFrame) {
_parent.mousePOSx = _xmouse; // find the mouses X position
_parent.diff = (_parent.horizontal)*-1; // find the center position
_parent.mousePOSxADJ = _xmouse-_parent.diff; // adjust from center position
// Determine what direction the nav will move.
if (_parent.mousePOSxADJ>0) { // if you're on the right, move the bar right
_parent.MovieBar._x = _parent.MovieBar._x+3;
} else if (_parent.mousePOSxADJ<0) { // if you're on the left, move the bar left
_parent.MovieBar._x = _parent.MovieBar._x-3;
}
}
There are a couple of issues. First, when the mouse is not moving and the "midpoint" is reached, the bar jiggles back and forth, rather than stopping. How can I eliminate this?
Secondly, I'd like to have the midpoint of the stage determine left or right, rather than the midpoint of the bar. What do I need to change?
Finally, I wanted the bar to stop on rollover, so I added an on(rollOver) stop to each of the buttons inside the MC, but it had no effect. Sorry this is so long, but can anyone help? Thanks.
Dave
onClipEvent (enterFrame) {
_parent.mousePOSx = _xmouse; // find the mouses X position
_parent.diff = (_parent.horizontal)*-1; // find the center position
_parent.mousePOSxADJ = _xmouse-_parent.diff; // adjust from center position
// Determine what direction the nav will move.
if (_parent.mousePOSxADJ>0) { // if you're on the right, move the bar right
_parent.MovieBar._x = _parent.MovieBar._x+3;
} else if (_parent.mousePOSxADJ<0) { // if you're on the left, move the bar left
_parent.MovieBar._x = _parent.MovieBar._x-3;
}
}
There are a couple of issues. First, when the mouse is not moving and the "midpoint" is reached, the bar jiggles back and forth, rather than stopping. How can I eliminate this?
Secondly, I'd like to have the midpoint of the stage determine left or right, rather than the midpoint of the bar. What do I need to change?
Finally, I wanted the bar to stop on rollover, so I added an on(rollOver) stop to each of the buttons inside the MC, but it had no effect. Sorry this is so long, but can anyone help? Thanks.
Dave