RE: [Flashcoders] simple math question...

2007-03-14 Thread Rebecca Roberts
. Becky -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [p e r c e p t i c o n] Sent: Thursday, March 01, 2007 6:57 PM To: flashcoders Subject: [Flashcoders] simple math question... good people, how do i move a moviClip to center itself at (_xmouse, _ymouse

[Flashcoders] simple math question...

2007-03-02 Thread [p e r c e p t i c o n]
good people, how do i move a moviClip to center itself at (_xmouse, _ymouse)...i have the onPress part down...i just need to center it on those coordinates thanks ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the

Re: [Flashcoders] simple math question...

2007-03-02 Thread JOR
Try: // movie_mc is the instance name of the movieClip // you want to center on the mouse coords. movie_mc._x = _xmouse - (movie_mc._width/2); movie_mc._y = _ymouse - (movie_mc._height/2); If the movieClip size doesn't change you can optimize this by precalculating the (movie_mc._width/2) and

Re: [Flashcoders] simple math question...

2007-03-02 Thread Yehia Shouman
1) either double click your clip and group everthing and center it manually OR 2) make sure your graphics inside that clip is at 0,0 and then inside your MouseMove handler or onEnterFrame handler; toCenterClip._x = _xmouse - (toCenterClip._width/2); toCenterClip._y = _ymouse -

Re: [Flashcoders] simple math question...

2007-03-02 Thread Yehia Shouman
dont forget updateAfterEvent(); with the MouseMove use. it tells the player to refresh visuals after the calculated mouse move event you catched even if it wasn't time to render that frame. On 3/2/07, Yehia Shouman [EMAIL PROTECTED] wrote: 1) either double click your clip and group everthing

Re: [Flashcoders] simple math question...

2007-03-02 Thread [EMAIL PROTECTED]
MovieClip._width / 2 = its _x center MovieClip._height / 2 = its _y center hope it helps [p e r c e p t i c o n] wrote: good people, how do i move a moviClip to center itself at (_xmouse, _ymouse)...i have the onPress part down...i just need to center it on those coordinates thanks

Re: [Flashcoders] simple math question...

2007-03-02 Thread T. Michael Keesey
On 3/2/07, Karina Steffens [EMAIL PROTECTED] wrote: If your mc's reg point is top left: mc._x = _root.xmouse - mc._width/2 mc._y = _root.ymouse - mc._height/2 Incidentally, there's a neat trick you can do to speed up the calculation AND ensure that the result is an integer (so that the

Re: [Flashcoders] simple math question...

2007-03-02 Thread T. Michael Keesey
On 3/2/07, T. Michael Keesey [EMAIL PROTECTED] wrote: In a test where I ran a calculation a million times, shift right was about 200ms faster than division. Sorry, that's not a helpful metric. I should have said shift right took ~90% as much time. -- Mike Keesey

RE: [Flashcoders] simple math question...

2007-03-02 Thread Joshua Sera
Message- From: [p e r c e p t i c o n] [mailto:[EMAIL PROTECTED] Sent: 01 March 2007 23:57 To: flashcoders Subject: [Flashcoders] simple math question... good people, how do i move a moviClip to center itself at (_xmouse, _ymouse)...i have the onPress part down...i just need

Re: [Flashcoders] simple math question...

2007-03-02 Thread Ian Thomas
It depends where the registration point of your clip is. If it's at top-left or centre, then the calculation is simple - see all the other posts in the thread. If it's unpredictable, use getBounds() - do something like this: var bounds:Object=myClipToCentre.getBounds(this);

Re: [Flashcoders] simple math question...

2007-03-02 Thread [p e r c e p t i c o n]
somewhere else, you'll need to change it or do other calcualtions. Karina -Original Message- From: [p e r c e p t i c o n] [mailto:[EMAIL PROTECTED] Sent: 01 March 2007 23:57 To: flashcoders Subject: [Flashcoders] simple math question... good people, how do i move

Re: [Flashcoders] simple math question...

2007-03-02 Thread JOR
sweet tip, thanks. -- JOR T. Michael Keesey wrote: On 3/2/07, Karina Steffens [EMAIL PROTECTED] wrote: If your mc's reg point is top left: mc._x = _root.xmouse - mc._width/2 mc._y = _root.ymouse - mc._height/2 Incidentally, there's a neat trick you can do to speed up the calculation

Re: [Flashcoders] simple math question...

2007-03-02 Thread T. Michael Keesey
On 3/2/07, JOR [EMAIL PROTECTED] wrote: sweet tip, thanks. -- JOR No prob. Incidentally, I'm pretty sure this is why BlurFilter, etc. are optimized for blur amounts that are powers of 2. -- Mike Keesey ___ Flashcoders@chattyfig.figleaf.com To