views:

124

answers:

2

A DisplayObjectContainer's dimensions change based on its contents.

That can be a LOT of contents, many of them with visible = false or masked, thus making them hidden. Is there a way to get only the visible contents of a DisplayObjectContainer similar to a TextField has the textHeight property, which gives you the exact dimension of what you see on-screen.

A: 

If it's a loaded object you can get the metadata width/height via loader.contentLoaderInfo.width etc.

Theo.T
FYI this was the answer to the first 'revision' of the question, I reckon it doesn't make any sense anymore too. but still not nice to down score it for that :P
Theo.T
+2  A: 

In this article, Colin Moock states that there is no such property for getting the "visible width" of a DisplayObjectContainer. That article does go into detail on the other ways of hiding an object, though, and it's well worth reading.

However, Moock later came up with a workaround: some code to check the actual visible pixels of an object and return the width & height based on that. This deals with masked objects, as well as objects with .visible set to false. His code is available here.

MichaelJW