4 Replies Latest reply on Feb 7, 2011 5:56 AM by Wakey123

    Set height size for each state enabling browser scrollbar if needed..

    Wakey123

      I'm working on a flex project, completely new to it. I'm trying to resize my application based on the set height size for each state. I'd like the wrapper to resize in the browser so that the  browser's scroll bar appears if needed. hope this makes sense....

       

      My enitial opening page I've set the height to 1000. now when I click on a link to another state from this page, we'll call it 'home' which i have set to 2000

      The page opens in its 2000 height but no scroll bar appears to scroll down in the browser...

       

      If anyone's done this or knows how to, I'd really appreciate your input.

        • 1. Re: Set height size for each state enabling browser scrollbar if needed..
          Pablo Souza

          If you are using some implementation of Group, DataGroup and RichEditableText components, you can just set the Scroller component outside your wrapper.

           

             <s:Scroller width="100" height="100">
                 <s:Group
                     horizontalScrollPosition="50" verticalScrollPosition="50"> 
                     <mx:Image width="300" height="400" 
                         source="@Embed(source='assets/logo.jpg')"/> 
                 </s:Group>                 
             </s:Scroller>

           

           

          Hope it helps you!

           

          Regards,

          Pablo Souza

          • 2. Re: Set height size for each state enabling browser scrollbar if needed..
            mike_morales Level 2

            I've done something similar with a few of my apps, you have to use a little javascript on the html page and the ExternalInterface class in your app. Basically, you need to resize the "browser's" height based on your flash file.  So here's quick example:

             

            In your html template page (which you can edit in your flashbuilder project panel ->html-template->indext.template.html)


            in your html add the jscript function:

            --------------

            <script type="text/javascript">
                     function setWindowHeight(heightVal){
                         document.getElementById('theWindow').style.height=heightVal; // make sure to give the body tag an id of 'theWindow' or whatever
                     }

            </script>

            ---------------

             

            In your flashbuilder app you need to call the javascript fx, you can use the ExternalInterface class for this:

             

              ExternalInterface.call('setWindowHeight',val+'px');

             

            you need to send the jscript fx the height of your container or whatever you want it resized to....

            • 3. Re: Set height size for each state enabling browser scrollbar if needed..
              Wakey123 Level 1

              Hi mike thanks for that it worked perfectly, however now i've added a scrollbar when I scroll down the rest of the content that should be there is hidden. Its as if the apps working on browser height... :s. My app height is set to 100%....

               

              any ideas?

               

              thanks again...

              • 4. Re: Set height size for each state enabling browser scrollbar if needed..
                Wakey123 Level 1

                Hi Mike, sorry also following on from my last reply i've noticed more of my app appears when I make my browser window bigger.... so its as if i need to set my apps height to the size iv set from the code you provided for scrollbar....