views:

21

answers:

1

I have assets in external swfs which I load. I would like to know the exact size of the stage and the position of the asset in the fla that created it. If I try to ask the resulting MovieClip for it's size, it turns out it gives me the size when it is trimmed down to the tightest box around the non-transparent pixels. Looking at the contentLoaderInfo, I can get the original width/height that was used by the fla file, which is great. However, I still need to know where to place the asset within the stage.. basically I need an x/y offset for it.

The reason I need this is for a customizable avatar - it has many parts, which are placed in different areas on a stage to create the full avatar. I would like to be able to combine the individual swfs for each part to achieve this.

Thanks in advance for any help!

A: 

I don't believe you can get the stage size of a loaded swf, as there is only one stage in flash when you load a child swf in, it will use the parent stage. As you pointed out a loaded swf will collapse to the bounding box of the items within it.

Might I suggest that all assets have a MovieClip on the stage containing a block the dimensions of the stage, then change the alpha of this clip to 0 so it isn't visible.

Neil
Thanks Neil, I'll try this out and if that doesn't work I'll just have to store the xy offsets separately
sig
You could create an fla with MovieClips on the stage at the points where you want to position the clips you are loading in, we do this if we want to give a designer the control over the positioning. They then put in an instance name and we use that to position the swfs we load in later. The best way is to have them in an xml config file, then you can just tweak them on the fly, without the need to recompile.
Neil