Skip to main content
Inspiring
September 28, 2010
Question

Simple align

  • September 28, 2010
  • 2 replies
  • 1328 views

Hi

How can do align movieclip to stage dynamically. If i use align panel, Movieclip perfectly aligned to stage. Here i have attached sample image.

For the Movieclip the registration point may be change.

Thanks

Regards

Balasubramaniyan.S

This topic has been closed for replies.

2 replies

Inspiring
September 28, 2010

Use getRect/getBounds to find x/y offsets and align taking offsets into account:

http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/display/DisplayObject.html#getRect()

Inspiring
September 29, 2010

Hi

I tried before.... But doesn't help for me... Can u give simple example?

Thanks

Bala.S

Inspiring
December 3, 2010

Hi

I got solution,

var clickPoint:Point = new Point(mc.getBounds(stage).x, mc.getBounds(stage).y);

mc.x = stage.stageWidth/2 - (mc.width/2 + mc.globalToLocal(clickPoint).x)
mc.y = stage.stageHeight/2 - (mc.height/2 + mc.globalToLocal(clickPoint).y)

Sry for the late update.

Thanks

Regards

Balasubramaniyan.S

September 28, 2010