1 Reply Latest reply on Jan 7, 2010 4:59 PM by Jason Szeto

    How to clip child after rotation

    chandu3107 Level 2

      Hi ,

       

      I have some child on my canvas.

       

      Canvas has clipcontent property to true.

       

      When any child goes out of canvas it is clipped. But if i rotate child near to canvas border it goes out of canvas and it is not being clipped.

       

      Is there any way to clip child after rotating?

        • 1. Re: How to clip child after rotation
          Jason Szeto Level 3

          Chandu,

           

          Halo containers don't take into account rotation when determining if it needs clipping. You'll have to perform your own clipping. You can do this by turning off clipping and scrolling (scrollPolicy="off") and then applying your own mask to the container. Or you can use this mx_internal property called forceClipping.

           

          Here's a working example:

           

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
              <mx:Script>
                  <![CDATA[
                      import mx.events.FlexEvent;
                      import mx.core.mx_internal;
                     
                      protected function canvas1_creationCompleteHandler(event:FlexEvent):void
                      {
                          main.mx_internal::forceClipping = true;
                      }

           

                  ]]>
              </mx:Script>
             
              <mx:Canvas id="main" width="100" height="100" borderStyle="solid" clipContent="true"
                         horizontalScrollPolicy="off" verticalScrollPolicy="off"
                         creationComplete="canvas1_creationCompleteHandler(event)">
                  <mx:Button label="Really long button" rotation="-15"/>
              </mx:Canvas>
             
          </mx:Application>

           

          Jason