A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Stage.width Stage.height help

  1. #1
    Member
    Join Date
    Oct 2002
    Location
    England
    Posts
    80

    Stage.width Stage.height help

    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?

  2. #2
    Developing For Dunkets mneil's Avatar
    Join Date
    Mar 2007
    Location
    Lincoln City
    Posts
    2,156
    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?
    http://code.mneilsworld.com/
    Text Effects | Bubbles | Dynamic Resize
    4 weeks , 20 papers ... thats 2 dollars .....Caassshhh!

  3. #3
    AS3 Mod
    Join Date
    Sep 2007
    Location
    O-H-I-O
    Posts
    2,385
    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(mcmc_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"); 

  4. #4
    AS3 Mod
    Join Date
    Sep 2007
    Location
    O-H-I-O
    Posts
    2,385
    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(mcmc_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"); 

  5. #5
    Member
    Join Date
    Oct 2002
    Location
    England
    Posts
    80
    Cheers sstalder.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center