getBounds() with mask?

Hey there.

I need help for a stupids things ^^

The situation :

  • I have a FLA who contains a “simpleClip” composed with :
  • a bitmap 100x100px set up at 0/0 position
  • a subClip (or shape, same situation) use as a mask (on a mask layer) with 100x50px set up at 0/0 position.

export to swf, transform into bundle.
Instantiate the “simpleClip”
addChild(myMainScene) at 0/0
the display result show me only the upper part of the clip (because of the mask).
So a w/h of 100x50

but when call getBounds(myMainScene) the result is : x:0 y:0 w:100 h:100.
It seems to take all element of the DisplayObject.

Try with getRect() but it call getBounds() …

Any easy way to getBounds() only the Render part ?
I miss something ?

i’m using :
haxe 4.1.2
lime 7.8.0
openfl 8.9.7
target : html5

Thx !

As far as I can remember you can’t obtain the rendered width & height of a masked object - getBounds will always return the entire bounding box.
What you can do however is calling getBounds on the mask instead of It’s parent.

Yes, i use this trick but does’nt work in this case : (dumb exemple)

  • blue rect : bitmap
  • red rect : Mask
  • yellow : Render Zone (bounds needed)


Simple dumb exemple with rect mask, but with pentatoid mask with offset…

Using rect.intersect did the trick ?