1 Reply Latest reply on May 6, 2009 5:01 AM by m_hartnett

    HBox and Scroll Buttons

    manofspirit Level 1

      Hello Guys


      I have a HBox of 300px and i did off the horizontal scroll policy. as i dnt want to show scrollbars


      it contains almost 10-20 labels and i want to add two arrow buttons one button will scroll right and second will scroll left.


      But i dn know how could i do that?

      So im again here to ask from you guys


      Please Help



        • 1. Re: HBox and Scroll Buttons
          m_hartnett Level 3

          Here is a quick sample of how to control your scroll with buttons.



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


          xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"

          width="100%" height="100%" borderStyle="solid">




          private function moveLeft() : void {

          hbx.horizontalScrollPosition = hbx.horizontalScrollPosition + 20;


          private function moveRight() : void {

          if(hbx.horizontalScrollPosition > 20)

          hbx.horizontalScrollPosition = hbx.horizontalScrollPosition - 20;






          <mx:HBox id="hbx" height="93" width="218" horizontalGap="0" horizontalScrollPolicy="off">

          <mx:Canvas width="107" height="92" backgroundColor="#A51F1F">


          <mx:Canvas width="107" height="92" backgroundColor="#1FA538">


          <mx:Canvas width="107" height="92" backgroundColor="#1F3BA5">



          <mx:Button id="btnLeft" label="Left" width="118" height="41" click="moveLeft()"/>

          <mx:Button id="btnRight" label="Right" width="118" height="41" click="moveRight()"/>