Jump to content
Search Community

Question about swfLoader and container

rob_v_5712 test
Moderator Tag

Recommended Posts

Hello all,

I have a question about SWFLoader and its container that the swf gets loaded into.

 

My goal is to have a container that I can move anywhere on the stage I want to, and use SWFloader to put the swfs in there with out having to specific an x and y in the SWFLoader XML.

 

If I have my stage that is say 1000x1000 that has a movie clip on it that is the same size. its named mc_bg_container (just to add gfx to the background)

 

I create my container that I want to hold the swfs at 500x500 positioned in the middle of the stage then put it on top of mc_bg_container:

 

mainSwfContainer.graphics.beginFill(0xFFFFFF);
mainSwfContainer.graphics.drawRect(0, 0, 500, 500);
mainSwfContainer.graphics.endFill();
mainSwfContainer.x = 125;
mainSwfContainer.y = 125;
var idx = getChildIndex(mc_bg_container);
addChildAt(mainSwfContainer, idx + 1);

 

I then assign that container to the loader :

var myXmlLoader:XMLLoader = new XMLLoader("xml/slide_list.xml", {name: "data_xml", maxConnections: 1, container: mainSwfContainer, onComplete: slideListCompleteHandler);

 

The XML :



 

What I would assume would happen is that the swf get added to that container - no matter where it lives on the stage. But what seems to happen is that the swf gets put into the top left of the stage, ignoring the container completely.

 

Im pretty sure its operator error here - but any help would really be appreciated.

 

Thanks

-Rob

Link to comment
Share on other sites

Hi Rob-

 

I think you can use the scaleMode method in the SWFLoaderVars for that. Like:

new SWFLoaderVars()
    .scaleMode("proportionalInside")

 

or in your case scaleMode="proportionalInside" in your xml.

 

If that's going to skew your SWF you can probably use crop="true" too...

 

HTH

Karl

Link to comment
Share on other sites

Tried that but still does not work. If I dont specify a height and width in the XML it will still show items that are off the stage.

if I give it a height and width and set crop=true in the XML - it works fine.

My goal is to just deal w/ the container and have the swf take on the height/width of that container.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...