Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 08-27-2007, 07:55 PM   #1
coolburn
Registered User
 
Join Date: Aug 2007
Posts: 19
Red face Dimensions of Loaded SWF vs. those of the Loader

Hello,

I want to use a generic "shell" to load other SWF files. (The shell will load in some needed classes, and then run the loaded SWF.)

The problem I have encountered, is that the loaded SWF loses its original dimensions (and frame rate and background), and instead inherits them from the loader.

What is the best way to get around this? I really want to use the dimensions of the loaded SWF and not the loader.

Here is how the "shell" loads the other SWF file:

Code:
var ldr:Loader = new Loader();
var url:String = "file:///c:/loadme.swf";
var urlReq:URLRequest = new URLRequest(url);

var addedDefinitions:LoaderContext = new LoaderContext();
addedDefinitions.applicationDomain = ApplicationDomain.currentDomain;

ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
ldr.load(urlReq, addedDefinitions);

function loadComplete(event:Event){
	ldr.contentLoaderInfo.removeEventListener(Event.COMPLETE, loadGameComplete);	
	addChild(ldr);
}
This causes the loaded SWF to run just fine, but it now uses the dimensions of the loader instead of its own. =(

Thanks!
coolburn is offline   Reply With Quote
Old 08-28-2007, 12:00 AM   #2
Assertnfailure
as[org].addListener(this)
 
Assertnfailure's Avatar
 
Join Date: Dec 2005
Location: LA, California
Posts: 837
Default

check this out:
http://www.actionscript.org/forums/s...831#post622831

Last edited by Assertnfailure; 08-28-2007 at 12:03 AM.
Assertnfailure is offline   Reply With Quote
Old 08-28-2007, 12:30 AM   #3
coolburn
Registered User
 
Join Date: Aug 2007
Posts: 19
Default

Quote:
Originally Posted by Assertnfailure View Post
Thanks for the reply! That thread was very informative, especially in understanding the difference between actual content dimensions (height, width as reported) vs. the original intended dimensions (which are stage.stageHeight and stage.stageWidth... as authored... not as loaded).

However, even if I'm able to get the intended height and width... through having to set some additional explicit properties in the document class of the external SWF, or what not... I'm still not clear as to how I make the Loader SWF use those dimensions.

It seems like it wants to use whatever it was authored at.

My fundamental problem is that I don't know the dimensions of the Loaded SWF ahead of time... so I obviously can't set the Loader to be those dimensions ahead of time.

And, depending on what it loads, it's going to get different dimensions.

I was hoping I could just set the Loader to 1x1 pixels... and that it would expand to whatever was needed by the Loaded SWF... (or it could expand to whatever dimensions I tell it to expand to)... but I'm not having any luck here.

Any assistance is much appreciated!

Thanks!
coolburn is offline   Reply With Quote
Old 08-28-2007, 04:55 PM   #4
Assertnfailure
as[org].addListener(this)
 
Assertnfailure's Avatar
 
Join Date: Dec 2005
Location: LA, California
Posts: 837
Default

No problem, coolburn

Why are you setting the Loader's dimensions at all, by the way? Setting dimensions is only done to scale the default dimensions of a display object.
Assertnfailure is offline   Reply With Quote
Old 08-28-2007, 05:59 PM   #5
coolburn
Registered User
 
Join Date: Aug 2007
Posts: 19
Default

Quote:
Originally Posted by Assertnfailure View Post
No problem, coolburn

Why are you setting the Loader's dimensions at all, by the way? Setting dimensions is only done to scale the default dimensions of a display object.
I'm not sure to be honest. =P I guess it's because when you create a new flash document, it defaults to a certain size. I just made it a smaller size (like 50x50 pixels). Are you saying it would be best to set the stage to 0x0 pixels?

Edit: I just tried, and it requires you to at least make the stage 1x1 in the document properties.

Thanks!

Last edited by coolburn; 08-28-2007 at 06:23 PM.
coolburn is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Loading a swf within a loaded swf Groady ActionScript 2.0 0 06-24-2007 11:24 PM
Copying loaded image bitmap data to another image loader dgimness ActionScript 2.0 1 05-01-2007 08:21 PM
Controlling loaded swf h4x0r404 ActionScript 2.0 1 04-02-2007 12:39 PM
Use drawing api to edit loaded swf then save to server :S Paul Ferrie Flash 8 General Questions 0 03-09-2007 11:59 AM
Changing dimensions of loaded movie Caramoon ActionScript 1.0 (and below) 2 06-05-2001 01:46 PM


All times are GMT. The time now is 02:05 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.