PDA

View Full Version : Figuring out the width of a part of a movieclip



four4swords
May 2nd, 2009, 10:35 PM
Hi,

I have a movieclip which is positioned on the stage at (300,100) . And I have the width of the movieclip itself.

But how do i find out the width of a movieclip from the registration point to one of the edges?

Here's an illustration.
http://img102.imageshack.us/img102/1349/83420868.jpg

Anyone know?

pvsamy
May 6th, 2009, 07:12 AM
yes... it is possible with getBounds method.

assume that your rectangle is '_mc', apply the code below:

var rect:Object = new Object()
rect = _mc.getBounds(this)
firstHalf = _mc._x-rect.xMin
secondHalf = _mc._width-firstHalf

here the firstHalf variable stores the width before registration point
and the secondHalf variable stores the width after registration point