0 Replies Latest reply: May 4, 2012 5:01 PM by stevemcl5 RSS

    When does the horizontalScrollBar get created on a List?

    stevemcl5 Community Member

      When does the horizontalScrollBar get created on a List?

      The scroller is created, but the scrollbar isn't created yet and I get an error:

       

      I have a spark List:

       

      <s:List id="list" creationComplete="creationCompleteHandler(event)">

              <s:layout>

                  <s:HorizontalLayout  />

              </s:layout>

      </s:List>

       

      private function creationCompleteHandler(event:FlexEvent):void {

           (event.currentTarget as List).scroller.addEventListener( FlexEvent.UPDATE_COMPLETE, onScrollerComplete );

      // these don't trigger anything!

      //    (event.currentTarget as List).scroller.addEventListener(FlexEvent.CREATION_COMPLETE , onScrollerComplete );

      //    (event.currentTarget as List).scroller.addEventListener(Event.ADDED_TO_STAGE , onScrollerComplete );

      }

      private function onScrollerComplete(event:Event):void {

           // horizontalScrollBar still null at this point - how can I use it?   

           // I want to set the style, but it's not created yet!

           // event.currentTarget.scroller.horizontalScrollBar.setStyle("repeatInterval", 600);

      }