I only want _xmouse position only when over movie clip

onClipEvent (mouseMove) {
x_pos = _xmouse;
if (x_pos>x_old) {
_root.var_mov = 1;
} else {
_root.var_mov = -1;
}
x_old = x_pos;
}

This works great for my needs. But I want it to only run when mouse is over the movieclip that contains the above script.

I understood by putting the script into this movie clip that it would work this way, but the variables are updated whether I am over the movieclip or elsewhere.

I’ve tried on(rollover) as well.

Can I get the _mouse location of only this clip with something like this: _ClipName._xmouse ?

Please help.

Ron R.

Dynamic event handlers are so cool !

this.onRollOver = function ()
{ 
    this.onMouseMove = function ()
    {
        x_pos = _xmouse; 
        if (x_pos>x_old)
        { 
            _root.var_mov = 1; 
        } else
        { 
            _root.var_mov = -1; 
        } 
        x_old = x_pos; 
    }
}
this.onRollOut = function ()
{
    this.onMouseMove = null;
}

Nice, hue ? =)

pom :asian:

By the way, this code can be shortened… Yours:

onClipEvent (mouseMove) { 
    _root.var_mov = (_xmouse>x_old)?1:-1 ;
    x_old = _xmouse; 
}

And mine:

this.onRollOver = function ()
{ 
    this.onMouseMove = function ()
    {
        _root.var_mov = (x_pos>x_old)?1:-1;
        x_old = _xmouse; 
    }
}
this.onRollOut = function ()
{
    this.onMouseMove = null;
}

x?y:z; means if x is true then y else do z. Watch for an article about AS for further information.

pom :asian:

This one works great:

onClipEvent (mouseMove) {
_root.var_mov = (_xmouse>x_old)?1:-1 ;
x_old = _xmouse;
}

But neither works only when I am over their movie clip. THey both are active even when I am out side of movie clip.

How can I get the script to only be called when I am rolled over the clip?

RR

How can I implement this type of command in the short script form
_root.pano_mov += 1;

Also, when I debugged the top code pano_mov never changed beyond 1 or -1. Why did it not grow 1,2,3,2,1,0,-1-2,etc

I tried

var_mov = (_xmouse>x_old)?+= 1:+= -1 ;

But it no like!!!

RR