An easy way to do this is to build your movieClip so that the graphics
inside align in the upper left corner at (0, 0). Then take the width of
your movie and divide it in half. If you take this half-width value and
subtract it from your _xmouse then it should center your movieClip over
the mouse ho
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 chan
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
thanks for the info...very helpful!
cheers
[p]
On 3/2/07, Joshua Sera <[EMAIL PROTECTED]> wrote:
For an arbitrary registration point, use
var b:Object = mc.getBounds(mc._parent);
var offset:Object = {x:(mc._x - b.xMin, y:instance._y
- b.yMin)};
then
mc._x = (_root.xmouse - mc._width/2) - of
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);
myClipToCentre._x=_xm
For an arbitrary registration point, use
var b:Object = mc.getBounds(mc._parent);
var offset:Object = {x:(mc._x - b.xMin, y:instance._y
- b.yMin)};
then
mc._x = (_root.xmouse - mc._width/2) - offset.x;
mc._y = (_root.ymouse - mc._height/2) - offset.y;
--- Karina Steffens <[EMAIL PROTECTED]>
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
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 cl
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
_
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
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 - (toCenterClip._hei
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 (
If your mc's reg point is top left:
mc._x = _root.xmouse - mc._width/2
mc._y = _root.ymouse - mc._height/2
if it's centered you need not bother about the width/2 etc, but if it's
somewhere else, you'll need to change it or do other calcualtions.
Karina
> -Original Message-
> From: [p
13 matches
Mail list logo