I am creating a custom component in Flex with extends the BorderContainer class, and I would like to be able to place additional content within the tagset when I use it in my main application, like this:
<components:CustomComponent title="Hello">
<s:Label text="If you have one enter it below:"/>
<mx:Spacer height="15" />
<s:HGroup>
<s:TextInput width="250"/>
<s:Button label="Submit"/>
</s:HGroup>
</components:CustomComponent>
This works just fine, except that my component definition had some additional things inside of it, such as a <s:Label/> and styling, which is replaced by the content within the tagset above when I go to use it.
If I do not put anything within the tagset, the content that was originally in the component is not replaced.
Is there a way that I can simply append additional content inside of the component when I go to use it, instead of it being replaced each time?
Thank you for your time!
Not “simply”, you have to work around it.
Here’s a blog post with the gory details, including a sample app with source code: http://www.munkiihouse.com/?p=37 (step 3)
In summary, you script the class to intercept the child components being set to the default “dummy” property, and add them to your “main” property/container later.
The main property is the one you have your existing elements in in your custom component definition. The dummy property is the default property that a component instance will add elements to.
Good luck.