3 Replies Latest reply on Aug 24, 2011 9:30 AM by archemedia

    Custom component graphics

    archemedia Level 4

      Hi all,


      I have created a custom component which extends UIComponent (or Canvas).


      I place this component on the stage and give it a width and height of 100%


      Now in my updateDisplayList function, I draw a rect in the graphics object which is partly offscreen. The rect draws fine but outside my component's border!.

      What I really want is that scrollbars appear when the graphics content is larger than the visible protion of my component.


      Any help would be appreciated!





        • 1. Re: Custom component graphics
          miguel8312 Level 3

          are you drawing the rectangle as well in your custom compoent? or are you doing through mxml? It would seem to me like you can listen to the end of the drawing of the rectangle and if the rectangle is larger then its parent then add the scroll bars.

          you might benefit from reading a little about clipping. The Spark group has this property and you can set it to through or false.


          1 person found this helpful
          • 2. Re: Custom component graphics
            _spoboyle Level 4

            Yeah miguel is right if you are subclassing UIComponent you will have to manually add the scrollbars when needed.


            If you subclass GroupBase (or any of it's subclasses e.g. Group) you ca use clipAndEnableScrolling.

            1 person found this helpful
            • 3. Re: Custom component graphics
              archemedia Level 4

              Hi Miguel and spoBoyle,


              Clipping is indeed the problem.

              I managed to solve it by adding a box component to my custom component and do the graphics work on the graphics object of the box component. This triggered correct clipping! Thanks for putting me on the right track!