3 Replies Latest reply on May 11, 2010 1:19 AM by Sree_D

    Set scrollbars to appear in IE

    pgpradeep Level 1

      Hi,

       

      I have written a simple mxml app with all sample components thrown in.

      I want IE browser (and not the app) to show vertical and horizontal scrollbars.

      Using horizontalScrollPolicy and verticalScrollPolicy sets scrollbars for the app, not the browser.

      How can I force the browser (IE) to show scrollbars?

       

      Thanks,

      Pradeep.

        • 1. Re: Set scrollbars to appear in IE
          Sree_D

          Scroll bars appear in IE only when the app height exceeds the height available in the browser. This can not be done automatically unless you have fixed height app and set the height value in object tag to it. If your app height varies dynamically due to expan/collapse features etc. you need to calculate the height and reset the height of the div tag enclosing the app widget. For this you can have some thing like below at Application level to claculate new height every tim and pass the value to the browser.

           

          private

           

          var _lastMeasuredHeight:int;

           

          override

           

          protected function measure():void

          {

           

              super.measure();

           

               if (measuredHeight != _lastMeasuredHeight)

               {

                    _lastMeasuredHeight = measuredHeight;

           

                    if (ExternalInterface.available)

                    {

                         ExternalInterface.call(

          "setFlashHeight", measuredHeight);

                    }

               }

          }

           

           

          setFlashHeight is the JavaScript method which recieves the recalculated height and sets the div height to it.

           

           

          • 2. Re: Set scrollbars to appear in IE
            pgpradeep Level 1

            This is my application declaration:

             

            <mx:Application

             

             

            xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600" width="1374" height="909">

             

            I have dropped all components onto the mxml screen. So,it is quite big horizontally and vertically.

            When I run the mxml, the IE window opens showing only some of the components and wihout the scrollbars.

            Where should I add code to the mxml?

             

            Thanks,

            Pradeep.

            • 3. Re: Set scrollbars to appear in IE
              Sree_D Level 2

              make width="100%" height="100%" in <mx:Application

               

              The measure method goes inside the script tag of your mxml file

               

              <?xml version="1.0" encoding="utf-8"?>

              <

               

              mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="init()" backgroundColor="#FFFFFF" backgroundGradientColors="[#FFFFFF,#FFFFFF]" creationComplete="addAuto()"

              width="

              100%" height="100%" horizontalScrollPolicy="off" verticalScrollPolicy="off" >

               

               

               

               

              <mx:Script>

              <![CDATA[

               

               

               

              private

               

               

               

               

               

              var _lastMeasuredHeight:int;

               

              override

               

               

               

               

               

              protected function measure():void

              {

               

               

              super.measure();

               

              //Alert.show("_lastMeasuredHeight"+ _lastMeasuredHeight.toString());

               

               

              //Alert.show("measuredHeight"+ measuredHeight.toString());

               

               

              if (measuredHeight != _lastMeasuredHeight)

              {

              _lastMeasuredHeight = measuredHeight;

               

              if (ExternalInterface.available)

              {

              ExternalInterface.call(

              "setFlashHeight", measuredHeight);

              }

              }

              }

               

               

               

              ]]>

               

              </mx:Script>

               

               

               

              </mx:Application>

               

               

               

              set height="100%" in Object tag in JSP or HTML and your object tag is enclosed in div like below in JSP or HTML

               

               

              <div id="strategiesFlashDiv"><object
                    src="flex/swf/DragDrop.swf"
                    classid="clsid:D27CDB6E-AE6D-11cf-96B8-3540000" id="app"
                    width="860" height="100%"
                    codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
                    <param name="quality" value="high" />
                    <param name="src"
                     value="flex/swf/DragDrop.swf" />
                    <param name="bgcolor" value="white" />
                    <param name="allowScriptAccess" value="sameDomain" />
                    <param name="wmode" value="transparent" />
                    <!-- For taransparent Background --> </object>
              </div>

               

               

               

               

               

               

               

              Add a JavaScript method like below

              function setFlashHeight(newHeight)

              {
                    //assuming strategiesFlashDiv is the name of the div contains flex app.
                    var flashContentHolderDiv = document.getElementById('strategiesFlashDiv');
                    flashContentHolderDiv.style.height = newHeight;
              }