tags:

views:

176

answers:

1

Hi All,

I get a ActionScript class for loading the content:

public class LoaderContainer extends Sprite {

    public function LoaderExample() {
        loader = new Loader();      
        loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
        addChild(loader);
        var request:URLRequest = new URLRequest("File://C:/1.swf");
        loader.load(request);
    }
    private function completeHandler(event:Event):void {
        Alert.show(this.x+"/"+this.y+"/"+this.width +"/"+ this.height);
    }

}

And then add the LoaderContainer to a Panel control in main MXML.

What supprise me is that the LoaderContainer's width/height is changing all the way according to the contents that it loaded.

Is there any way that we can limit the content's size right obeying the container's size?

Thanks Michael

A: 

Since you're using Flex, is there any reason why you wouldn't just load it directly into an mx:Image or mx:SWFLoader? Since you're loading it and using addChild it's not being wrangled into the Flex framework where you could control it...

<mx:Image source="File://C:/1.swf" width="100" height="100" />
onekidney