I have the main swf(main) which loads in another swf(loaded). The loaded swf looks at the main swf for the Stage.width and height.
Is there a way for the loaded swf to look at its own Stage.width and height and not main?
Printable View
I have the main swf(main) which loads in another swf(loaded). The loaded swf looks at the main swf for the Stage.width and height.
Is there a way for the loaded swf to look at its own Stage.width and height and not main?
it automatically inherits the stage width and height of the main swf file. Don't know any way to dynamically get it. Maybe if you load it into a movieclip and then get the clips width and height?
You can do this with the MovieClipLoader class, use the loadClip method to load the clip then for example:
PHP Code:var mc_holder:MovieClip; // Being the movieclip on stage your swf files load into
var loadedSwfHeight:Number;
var loadedSwfWidth:Number;
function preloadMovie(mc) {
var myPreloader:MovieClipLoader = new MovieClipLoader();
myPreloader.loadClip(mc, mc_holder);
myPreloader.onLoadInit = function() {
loadedSwfHeight = mc_holder.Stage.height;
loadedSwfWidth = mc_holder.Stage.width;
trace("loadedSwfHeight >> " + loadedSwfHeight);
trace("loadedSwfWidth >> " + loadedSwfWidth);
}
}
// Call by using onRelease = preloadMovie("myfile.swf");
You can do this by using the MovieClipLoader class in the following manner:
PHP Code:var mc_holder:MovieClip; // Being the movieclip on stage your swf files load into
var loadedSwfHeight:Number;
var loadedSwfWidth:Number;
function preloadMovie(mc) {
var myPreloader:MovieClipLoader = new MovieClipLoader();
myPreloader.loadClip(mc, mc_holder);
myPreloader.onLoadInit = function() {
loadedSwfHeight = mc_holder.Stage.height;
loadedSwfWidth = mc_holder.Stage.width;
trace("loadedSwfHeight >> " + loadedSwfHeight);
trace("loadedSwfWidth >> " + loadedSwfWidth);
}
}
// Call by using onRelease = preloadMovie("myfile.swf");
Cheers sstalder.