A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [RESOLVED] Dynamically size stage and display area?

  1. #1
    anyone else hear that? flashpipe1's Avatar
    Join Date
    Jan 2003
    Location
    Upstate NY
    Posts
    1,929

    resolved [RESOLVED] Dynamically size stage and display area?

    I have a slideshow that loads from xml and fades in a variety of sizes of images in random positions. I'm trying to set it up so that the swf (which is in a div tag in an interface) will resize depending on the browser size and will use the NEW stage size to determine the random x/y positions of the images (without resizing them) and will skip any images that are too big for the stage size...

    Any ideas if this is possible? Dynamically sizing and determining the "working area" of a swf based on the browser/div size??

    THANKS!!!!
    Love like you've never been hurt, live like there's no tomorrow and dance like nobody's watching.

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    You may have to reload the movie then. This script shows how to resize the the movie according to the screen settings.
    http://www.flashscript.biz/utilities...en_change.html
    Last edited by cancerinform; 07-13-2008 at 07:32 PM.
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    Something like this?

    PHP Code:
    private function onStageResize(e:Event):void{
        var 
    wid:int stage.stageWidth;
        var 
    ht:int stage.stageHeight;
        var 
    i:int numChildren;
        
        while(
    0){
            
    i--;
            
    with(getChildAt(i)){
                
    Math.random() * wid;
                
    Math.random() * ht;
                if(
    width wid || height htvisible false;
            }
        }

    Or were you thinking of moving everything relative to where it used to be?

  4. #4
    anyone else hear that? flashpipe1's Avatar
    Join Date
    Jan 2003
    Location
    Upstate NY
    Posts
    1,929
    WOOHOO!!! Thanks! I was able to use some of the samples and code from here to accomplish what I was trying to do. I ended up doing it in AS2 since my AS3 isn't up to par yet, and it's not perfect yet, but I've got images randomly appearing on the stage based on the size of the movie in the browser...mostly.

    It works fine when I run the swf locally...works perfect...just the way I want.

    When I run the html locally, I can't get the height of the div to scale even though I have height set to 100% (also tried it with a table)...any ideas? Seems to be stuck at around 200 pixels high. Attached zip with images, swf, html and xml

    And, when I put it up online, it doesn't look like the locally run html and doesn't load any of the images?!

    You can see it at:

    http://www.brianwpiper.com/random/resize.html

    I tried with and without flashobject.js, but can't seem to get the height to change with the browser window. Width seems to work fine...

    Any ideas??

    Here's the html:

    Code:
    <script type="text/javascript" src="flashobject.js"></script>
        
      <div align="center" id="flashcontent" style="width: 100%; height: 100%">
      
    	
    	 <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" height="100%" width="100%" name="if-header">
         <param name="movie" value="scaleStage.swf">
         <param name="quality" value="best">
         <param name="play" value="true">
    <embed height="100%" name="if-header" pluginspage="http://www.macromedia.com/go/getflashplayer" src="scaleStage.swf" width="100%" quality="best" play="true">
    </object>
    
    
    	
      </div>
    Thanks!!

    EDIT - I figured out the local/web version by uploading the xml file JEESH!!! So, now my only problem is making the height of the movie variable...

    Thanks!!!
    Last edited by flashpipe1; 04-30-2009 at 10:42 AM.
    Love like you've never been hurt, live like there's no tomorrow and dance like nobody's watching.

  5. #5
    anyone else hear that? flashpipe1's Avatar
    Join Date
    Jan 2003
    Location
    Upstate NY
    Posts
    1,929
    WOOHOO!!!

    Got it...all in the HTML Publish settings

    http://www.adobe.com/devnet/flash/ar...id_gui_02.html

    THANKS!!!!
    Love like you've never been hurt, live like there's no tomorrow and dance like nobody's watching.

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