Not sure what you are trying to do. Is this supposed to be a menu
oscillating left to right based on mouse position?
Anyhow, based on your condition if _x is under 0 or above 675, it stops
working. Your calculation for the new _x might allow _x to go negative or
above 675, so you have to make sure it doesn't...
I'm not sure of what you are trying to do so this might not be what you're
looking for...
_root.onEnterFrame = function() {
if (menu_mc._x >= 0 && menu_mc._x <= 675) {
var newX = menu_mc._x+(0.5*Stage.width-_root._xmouse)/10 ;
if ( newX < 0 ) newX = 0 ;
if ( newX > 675 ) newX = 675 ;
menu_mc._x = newX ;
}
};
[quoted text, click to view] "Mister Peanut" <webforumsuser@macromedia.com> wrote in message
news:ejl5ni$1f0$1@forums.macromedia.com...
> Hi all,
>
> if anyone could point me in the right direction, I think I have a simple
> problem. I have a scrolling menu graphic containing buttons. I have the
> scrolling function working well, but am trying to make it stop when the
> graphic
> scrolls to its ends. I have surrounded my script in an if statement so
> that
> the code only executes when my menu_mc reaches the end. This doesn't
> work.
>
> Here is the code I am using:
>
> _root.onEnterFrame = function () {
> if (menu_mc._x > 0 && menu_mc._x<675){
> menu_mc._x = menu_mc._x + (0.5 * Stage.width - _root._xmouse)/10;
> }
> }
>
> my menu_mc is behind a mask, and is 675 pixels wide.
> Not sure what my problem is, I have difficulty with AS. Do I need an
> event
> listener to listen to when my mc goes beyond certain boundaries? If so,
> could
> someone help me with how to use this?
>
> Cheers for any tips.
>
> P
>