4 Replies Latest reply on Feb 1, 2012 8:12 AM by ShardulSingh

    How to make horizontalScrollPosition working in Panel?

    AdobeLearner321

      In my panel definition, I set the horizontalScrollPosition to some int value, such as

      horizontalScrollPolicy="off"

      horizontalScrollPosition="30"

       

      But seems it never works. the horizontal position always set to "0".

      I also tried to set horizontalScrollPosition to a binding variable, such as

       

      horizontalScrollPosition="{mypos}"

       

      then change the value of mypos. The scroll bar and area does not change.

       

      Is there anyway to debug the application to see why the position not changing?

      Thanks.
        • 2. Re: How to make horizontalScrollPosition working in Panel?
          ShardulSingh

          Hi things are working perfect here at my end,I think you have just some issue in the ordering of different containers which you are using.

          Below is the code for example it will run perfectly.

           

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

          <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

                         xmlns:s="library://ns.adobe.com/flex/spark"

                         xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"

                         >

              <fx:Script>

                  <![CDATA[

                      import mx.events.FlexEvent;

                     

                      protected function onPnlCreationComplete(event:FlexEvent):void

                      {

                          pnl.horizontalScrollPosition = 500;

                      }

                     

                  ]]>

              </fx:Script>

             

                  <mx:Panel id="pnl"  width="500" height="300" backgroundColor="0xFF0000" top="20"

                            creationComplete="onPnlCreationComplete(event)" horizontalScrollPolicy="off">

                      <mx:HBox width="1200" height="800" verticalGap="0">

                          <s:Label width="280" text="This is just Position1"/>   

                          <s:Label width="280" text="This is just Position2" />

                          <s:Label width="280" text="This is just Position3"/>

                          <s:Label width="280" text="This is just Position4"/>

                      </mx:HBox>

                  </mx:Panel>

             

          </s:Application>

           

           

          Hope this helps.

           

           

          With Regards,

          Shardul

          • 3. Re: How to make horizontalScrollPosition working in Panel?
            AdobeLearner321 Level 1

            Thanks for the problem. But seems that's may not fit my need. The program shows message "This is just Position3" on top, while the scrollbar's position is 0.

             

            I need to set the scrllbar position to be on some non-zero position.

             

            Also, in my app, I can't even get the effort from your sample app.

             

            My app structure is:

            <mx:Panel>

            // then programmly added

            <mx:UIComponent> // with size 1, 1,

            <s:Spite>   with big size.

             

             

            Thanks.

            • 4. Re: How to make horizontalScrollPosition working in Panel?
              ShardulSingh Level 3

              Hi,

               

              This is working fine.Dont see the vertical scroll bar, this is code for the horizontal scroll bar and I have made

              it non scrollable.

              If you want to see the scroll bar too then remove the code

              horizontalScrollPolicy="off"

               

              you will able to see the horizonatl scroll bar at exact position.

               

               

               

              **Shardul**