1 Reply Latest reply on Sep 21, 2010 8:51 PM by Shongrunden

    What's the best approach for Scrollers?

    alzamabar

      Hi, the video says that the <Scroller> element should be declared with height and width (suggested best practice). However the exercise suggests we define width and height on the <Group id="myGroup" width="300" height="300"> and then use <Scroller viewport="{myGroup}" />. Which is the best way? What are the advantages/disadvantages of the two methods?

       

      Regards,

       

      Marco

        • 1. Re: What's the best approach for Scrollers?
          Shongrunden Adobe Employee

          Can you please post a link to the exercise that suggests doing that?

           

          It's probably not recommended, but I would have to see what they are doing.

           

          There are two ways to size a Scroller...

           

          1. Set a size on it and not on the viewport:

           

          <s:Scroller id="scroller" width="100" height="100">
              <s:Group id="viewport">
                  ...
              </s:Group>
          </s:Scroller>

           

          2. Set a size on the viewport and not on the Scroller:

           

          <s:Scroller id="scroller">
              <s:Group id="viewport" width="100" height="100">
                  ...
              </s:Group>
          </s:Scroller>

           

          But never set a size on BOTH the scroller and the viewport.  This could cause the Scroller and viewport to fight over what sizes they are supposed to be and can cause unexpected behavior.

           

          I always recommend #1.  The main reason to use #2 would be if you want the viewport itself to be a specific size and have the Scroller wrap scrollbars around that (so the Scroller might be roughly 120x120 if scrollbars show up).