1 Reply Latest reply on Feb 12, 2010 12:05 AM by David_F57

    Adding a child to spark scroller in as


      Tried adding a child (group) to the scroller class by using the viewport function but it didnt seem to work. is there a way to add a scroller via as and then adding a group as its child ? right now the scroller was added to the stage using addElement and the group was added as its viewport. I tested by adding a textarea to the group and it did display. however i didnt see any scrollbars even though the textarea was 3000 pixels high.

        • 1. Re: Adding a child to spark scroller in as
          David_F57 Level 5



          The following code is one way you can set up a scroller, when you add something to the group the scrollbars will appear if that object exceeds the scroller boundaries. When you add the oversized child component(I used a list here for simplicity) the scrollbars will kick in.




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

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





          import mx.controls.List;

          protected function button1_clickHandler(event:MouseEvent):void


          var mylist:List = new List()






          <s:Scroller left="10" top="10" width="400" height="400" id="scroller" minViewportInset="1" hasFocusableChildren="true">

          <s:Group id="grp" top="0" left="0" bottom="0" right="0"/>


          <s:Button x="32" y="446" label="Button" click="button1_clickHandler(event)"/>