Preventing From SWF files from showing images or objects out of the FLEX SWFLoader stage

So the story is like this. I was using a FLEX SWFLoader to load some external SWF files, these SWF files have some objects in them and when played the objects(in this case images) appear out of the border of the SWFLoader. It seams that the images expand out of the border and hide other GUI elements that are near the SWFLoader. This was not clear to me and as it was explained to me it is probably since the SWF is programed in a way that these objects are out of the "Stage".

So how do i prevent it? i do not want that the SWF loader will load SWF files that will shoe images that hide or override other elements in the screen.

So i run into an example that talks about something else but it is apparently related to the same subject. In the example the writer wants to make images with round corner using the Mask property of the SWF loader. See link below

So the main idea is to create a rectangle in the size of the "content" of the SWF loader and put it as a mask on the SWFLoader, it will hide any object the "wants" to draw itself out of the stage (or out of the SWFLoader border in our case)

In order to use the same idea in the problem i had i made the following code:

<?xml version="1.0" encoding="utf-8"?>

horizontal = true;

w = Math.min(w,swfLoader.width);


h = Math.max(h,swfLoader.height);


h = Math.min(h,swfLoader.height);
var xPos:Number = (swfLoader.width-w)/2;
var cornerRadius:int = 0;;;, 0,w, h, cornerRadius, cornerRadius);;

swfLoader.mask = roundedMask;


Two events handlers where added:
1. for resize
2. for updateComplete

after updateComplete is called then size of the "inner" content of the SWFLoader is already known. When the size is done and in any other resize events we calculate a rectangle around the area of the SWFLoader in order to hide any objects that appear outside of the SWF Block

OK. Is it a good solution? i would think that there should be a flag of some kind in the SWFLoader class that will allow/prevent such cases

is there?

Does anyone have a better solution?