Here's the vector math solution:

Get the vector from the mouse to the MC:

var vToMouse:flash.geom.Point = new
flash.geom.Point();
vToMouse.x = MC._parent._xmouse - MC._x;
vToMouse.y = MC._parent._ymouse - MC._y;

Normalize the vector. This means you set the length of
the vector to 1.

var vectorLength:Number =
Math.sqrt(Math.pow(vToMouse.x, 2),
Math.pow(vToMouse.y, 2));
vToMouse.x /= vectorLength;
vToMouse.y /= vectorLength;

Now, since multiplying a vector by a number means that
you're multiplying the length of that vector by that
number, you can multiply our vector by enough distance
to send it off-screen. Let's say 400 pixels.

vToMouse.x *= 400;
vToMouse.y *= 400;

Lastly, add the vector back to the position of the MC
to the the offscreen position

var vOffScreen:flash.geom.Point = new
flash.geom.Point();

vOffScreen.x = MC._x + vToMouse.x;
vOffScreen.y = MC._y + vToMouse.y;

Now you can use a tween class, or whatever to send the
MC off screen.


--- Kurt Dommermuth <[EMAIL PROTECTED]> wrote:

> Hi all,
> 
> I have what I initially thought was simple problem,
> but I've been racking 
> my brains, searching the web and I just don't get
> it.
> 
> I have a movieclip that the user can rotate .
> 
> When they click the movieclip shoots off in the
> direction it's pointing.
> 
> It's goes off the stage and simply stops.
> 
> the speed is fixed.  there is no gravity.
> 
> How do I determine the _x and _y value somewhere off
> stage?
> 
> I'd appreciate any help.  even if someone could let
> me know what to search for.
> 
> thank you!
> 
> Kurt
> 
> _______________________________________________
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the
> archive:
>
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> 
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
> 



 
____________________________________________________________________________________
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to