6 Replies Latest reply on Jul 10, 2009 6:35 AM by fenosc

    Adjusting Flash stage size to webbrowser

    fenosc

      Hi there,

       

      In my site I want to make my flash site extends or shrink according to the webbrowser size. This way my flash would always be on "fullwebbrowser size".

      Of course I would like a minimum size too. I don`t think maximum is needed but if you can do one you can do the other right ?

       

      I`ve see this in some sites, here is an example: http://www.grjd.com

      Anyone know how to do this ?

      Thank you

        • 1. Re: Adjusting Flash stage size to webbrowser
          Ned Murphy Adobe Community Professional & MVP

          Here are a couple of links you can look into to see if they will do what you want.

           

          http://www.tutorio.com/tutorial/liquid-flash-layout

          http://www.gotoandlearn.com/play?id=31

          You could also try emailing the person who created that web site.  He was posting it a little while back to see about getting feedback on that site.  Chances are he could share what he did to make it work that way.

          • 2. Re: Adjusting Flash stage size to webbrowser
            taksman

            email me at shinyeit@eciad.bc.ca and I can help you if you still need it.

             

            Cheers

             

            Taksman

            • 3. Re: Adjusting Flash stage size to webbrowser
              AttaBoy2 Level 3

              The tutorial Ned pointed you to uses as2  here's the as3 version.

               

              stage.align = StageAlign.TOP_LEFT;
              stage.scaleMode = StageScaleMode.NO_SCALE;

              var bmp:Tile = new Tile(35, 35);
              var tile:BitmapData = new BitmapData(35, 35);
              tile.draw(bmp);

               

              shelter.x = stage.stageWidth /2;
              shelter.y = stage.stageHeight /2;

              function fillBG(evt:Event = null):void {
                graphics.beginBitmapFill(tile);
                graphics.moveTo(0, 0);
                graphics.lineTo(stage.stageWidth, 0);
                graphics.lineTo(stage.stageWidth, stage.stageHeight);
                graphics.lineTo(0, stage.stageHeight);
                graphics.lineTo(0, 0);
                graphics.endFill();
              shelter.x = stage.stageWidth /2;
              shelter.y = stage.stageHeight /2;
              };
              fillBG();

              stage.addEventListener(Event.RESIZE, fillBG);

               

              shelter is just the name jpg I centered on the stage you don't really need it.

              Tile is just tile is jusr a 35 x 35 pixel gif in the library with the linkage set to export for actionscript and class name Tile

               

              3 things you should do with either the as2 or as3 version

              under publish settings in the html tab set dimensions to percent width 100 height 100

              in the html file set css rule for body tag like  body {margin:0}; padding:0; overflow:auto;}

              • 4. Re: Adjusting Flash stage size to webbrowser
                fenosc Level 1

                I have to confess I`m quite impressed with the effort you guys make to help people in this forum. Never seen such quick answers and so complete too.

                Thanks alot! I really apreciate! I feel even more motivated to learn more about it because I know there are people willing to help me on this.

                 

                Thanks for the tip site Ned! Videotutorials are always helpful.

                 

                Taksman, thanks for making yourself available! I`m sure to bother you if something comes up and I need to learn something that I think you know haha.

                 

                 

                Jim, I have some doubts about your code.

                I`ll copy parts of the code and comment my doubt:

                 

                stage.align = StageAlign.TOP_LEFT;

                //This align property alines the stage where? I mean, if I import the swf in a html, the only align that will matter is the align in the html. That will place the swf wherever I want in my site. So I don`t really know what you are aligning here.

                 

                stage.scaleMode = StageScaleMode.NO_SCALE;

                //I suppose this is needed so the flash site doesn`t have a fixed scale and therefore can adjust to the browser. But if I put it on my flash code it doesn`t work. StageScaleMode doesn`t exist. Am I missing an import?

                 

                The rest I kind of get it, I did work with OpenGL a little and the drawing parte is kind of easy.

                 

                 

                Thanks again everyone.

                • 5. Re: Adjusting Flash stage size to webbrowser
                  AttaBoy2 Level 3

                  The stage.align and stage.scaleMode eettings are published to the

                  AC_FL_RunContent javascript  that goes into the html source. They override

                  the Scale and Flash alignment settings on the html tab of the Publish

                  settings so if you eliminate them from the code be sure to set them in the

                  Publish settings.

                  • 6. Re: Adjusting Flash stage size to webbrowser
                    fenosc Level 1

                    Thank you Jim! I understand it now!