2 Replies Latest reply on May 10, 2011 8:00 AM by m1kal_

    How do make object outside the viewable area hidden?

    cpthk0 Level 1

      I have a borderContainer, I have some objects that part of it may go outside of the  viewable area. How do I make those area outside invisible?

      Thanks.

        • 1. Re: How do make object outside the viewable area hidden?
          ArrowUpRight

          Maybe, you should create a mask for it? Only the objects under the mask will be visible.

           

          For example:

           

          <s:BorderContainer cacheAsBitmap="true" id="bc" mask="{bcMask}" />


          <s:Group id="bcMask" width="{bc.width}" height="{bc.height}" cacheAsBitmap="true" >
               <s:Rect>
                    <s:fill>
                         <s:SolidColor color="gray" /> <!--it's doesn't matter what color-->
                    </s:fill>
               </s:Rect>
          </s:Group>

          • 2. Re: How do make object outside the viewable area hidden?
            m1kal_ Level 2

            Hi,

             

            You can embed the content of your s:BorderContainer in a Group and set the clipAndEnableScrolling property to true

             

            for example :

             

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

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

               xmlns:mx="library://ns.adobe.com/flex/mx">

             

            <s:BorderContainer width="50%" height="50%" verticalCenter="0" horizontalCenter="0" >

            <s:Group width="100%" height="100%" clipAndEnableScrolling="true">

            <s:Rect width="500" height="150">

            <s:fill>

            <s:SolidColor color="0xFF0000" />

            </s:fill>

            </s:Rect>

            </s:Group>

             

            </s:BorderContainer>

            </s:WindowedApplication>

             

            Regards,

            Mich