1 Reply Latest reply on Apr 6, 2009 8:48 AM by Cesare Rocchi

    Mxml elements inside custom component

      Hi all, i'm a flex newbie but i know AS3, i've encountered a problem during the development of a custom component: my custom component is a panel with some buttons, but i want that anyone can insert mxml elements (especially form elements) inside this panel in this way:


      ActionScript Code:
      <custom:myDialogBox >    <mx:Form ...>         <mx:TextInput ...> </custom:myDialogBox>

      So i created myDialogBox component:
      ActionScript Code:
      <mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml">     <mx:Metadata>              [DefaultProperty("hboxFirstLine")]         </mx:Metadata>     <mx:Script>         <![CDATA[             import mx.containers.HBox;             import mx.containers.Panel;             import mx.controls.Button;             import mx.controls.Text;             import mx.core.UIComponent;         ]]>     </mx:Script>     <mx:HBox id="hboxFirstLine" width="100%">     </mx:HBox>     <mx:HBox id="hboxSecondLine" width="100%" horizontalAlign="center">                 <mx:Button label="Conferma" />         <mx:Button label="Annulla" />     </mx:HBox>     <mx:ControlBar id="controllBar" horizontalAlign="right">                <mx:Label id="alertFooter" text="sFooter" />         </mx:ControlBar> </mx:Panel>

      I expect that the form goes inside hboxFirstLine... but instead i get this error:
      Error: In initializer for 'hboxFirstLine': type mx.controls.Form is not assignable to target type mx.containers.HBox.


      Any idea?