4 Replies Latest reply on Nov 27, 2007 6:41 AM by peterent

    AddChild

    DCalisuni Level 1
      Flex 3
      When I'm adding a movieclip to a child, it complains that it is not a IUIComponent.
      I would just add it to a spacer (that seems to work), but I need scrollbars when the image inside gets too large.

      To what can I add a movieclip so it will work?!?!
        • 1. Re: AddChild
          peterent Level 2
          You have to use classes derived from UIComponent (or that implements IUIComponent). So you might as well use a Spacer.
          • 2. Re: AddChild
            Martin_Lehmann_köln Level 1
            Actually the <UIComponent> itself accepts children that are not Flex components, such as MovieClips. Then you can add the UIComponent to any other Flex component.
            • 3. Re: AddChild
              Martin_Lehmann_köln Level 1
              Actually the <UIComponent> itself accepts children that are not Flex components, such as MovieClips. Then you can add the UIComponent to any other Flex component.
              • 4. Re: AddChild
                peterent Level 2
                This is a good tip as you get more advanced with Flex or if you are coming from Flash. UIComponent provides the base for Flex components. It's addChild method differs from the addChild method of Flex containers (eg, Canvas, VBox) in that you can add MovieClip, Sprite, etc as children to a UIComponent.

                But be aware that your UIComponent class must manage those non-Flex children so that your component conforms to the Flex framework. For example, when your UIComponent class's measure method is called, you should take into account how those non-Flex children affect your component's size and layout.