Jump to content
Search Community

LoaderMax Questions - SWF alignment and SWF cropping

Chris7777 test
Moderator Tag

Recommended Posts

Hi Jack,

 

I've just started retro-fitting LoaderMax into an existing project which loads several SWF's into a master SWF.

 

I've found a few things though, which I didn't pick up when I was doing the beta-testing.

 

Question 1 - SWF Alignment

Let's say a child SWF's stage width and height is 900 x 490 and I have a box (say 100px x 100px, topleft aligned) located at 200, 200. I.e there is a gap of a 200 from the left of the box to the stage left edge, and a 200px gap from the top of the box to the stage top edge.

 

In the master SWF I (let's assume I am only loading in 1 child at the moment) I run this:

 

var loader:SWFLoader = new SWFLoader("child.swf", {container:this, width:900, height:490, scaleMode:"none", centerRegistration:false});

 

The result is the box is 'pushed' all the way to 0, 0. I understand that a published SWF looses its stage to the parent, because only 1 stage can exist, but is there a way to stop this? I understand I could technically place a massive white background on the stage and republish all the children, but I was hoping there might have been a away around this.

 

 

Question 2 - SWF Cropping

This is actually more a request (I know you were asking for requests before release but I didn't think of this at the time :roll: My bad). Is it possible to have some sort of crop, similar to your layout tool. For example, I set the SWFLoader to again height:900, width:490, and maybe (??) set crop:true and it will crop any of the loaded child SWF outside of these dimensions?

 

Thanks

 

 

:!: [Resolved] :!:

 

Update: I combined your AutoFitArea with the SWFLoader as such.

// Container for 
var container:Sprite = new Sprite();
addChild(container);

// 900 x 490 is my desired widths and heights.
var area:AutoFitArea = new AutoFitArea(_mc, 0, 0, 900, 490, 0xFFFFFF);
area.preview = true;

var loader:SWFLoader = new SWFLoader("child.swf", {container:container, centerRegistration:true, onComplete:onComplete});

function onComplete(e:LoaderEvent):void {
   area.attach(e.target.content, ScaleMode.NONE, AlignMode.CENTER, AlignMode.CENTER, true);
}

 

Thanks Jack.

 

I'm not sure where to note this but in the SWFLoader docs under the property 'status' summary that 'LoaderStatus.COMPLETE' but its actually LoaderStatus.COMPLETED.

Link to comment
Share on other sites

Wishes granted. Snag the latest version and you'll notice there's a new "crop" special property for SWFLoader, ImageLoader, and VideoLoader. Just set it to true. And the alignment now factors in the swf's native size instead of its getBounds().

 

Happy?

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...