My guess would be these lines:
   var xdiff:Number = _root._xmouse-this._x;
   var ydiff:Number = _root._ymouse-this._y;

Unless the center of your holder mc is at (0,0), then your code will be
off.  Try changing this._x to _parent._x and the same for the _y.

You could also build a more flexible version using the localToGlobal
function.  That would allow you to nest the arrow clip as much as you want.

--
~Trout
http://www.amongtrout.com

On 1/31/06, Flash guru <[EMAIL PROTECTED]> wrote:
>
> Hey all,
>
> Simple question that I just don't get. I have a simple movie clip of an
> arrow and my code works fine when it's on stage. For some reason when i
> put
> the movie clip in a holder clip my code doesn't work as it should. I know
> it's a scope thing just don't know how to fix it. Delagate maybe?
>
> any help would sweet thanks
>
>
>
> //arrow_mc.onMouseMove = lookMouse;
> holder.arrow_mc.onMouseMove = lookMouse;
>
> //function that rotates any object that calls it toward the mouse position
> function lookMouse(){
>     updateAfterEvent();
>     var xdiff:Number = _root._xmouse-this._x;
>     var ydiff:Number = _root._ymouse-this._y;
>     var angle:Number = Math.atan2(ydiff, xdiff);
>     //Convert to degrees
>     angle = angle*180/Math.PI;
>     trace(angle);
>     this._rotation = angle;
> };
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to