3

I've been trying to create a custom mxml component that extends another custom mxml component (i.e. MyMXMLComponent -> BaseMXMLComponent -> Group).

I've been reading that trying to add visual children to MyMXMLComponent caused error with Flex 3 but that's no longer the case with Flex 4.

What I want to know is whether this is a supported/fixed/documented feature of Flex 4? or just some undefined behavior in Flex 4 that may get changed with future updates?

if this is supported and documented feature, does anyone have link pointing to adobe document stating it as such?

Sang Park
  • 382
  • 2
  • 17

1 Answers1

3

Sure is supported in Flex 4. You need to use the DefaultProperty metadata tag on a public property of your custom component.

It's as easy as that :)

J_A_X
  • 12,857
  • 1
  • 25
  • 31
  • why do I need to use the DefaultProperty? – Sang Park May 18 '11 at 23:03
  • Well, depending on how you're doing/creating it, you might need to specify it since all nested tags will be bound to that default property. Since you're extending Group, those children will just get added to the component as visual children. If you want to do something else with it however, you can use the metadata to override the original one and do more things. If you're extending Group, it's fine, it'll just be added to the display list. – J_A_X May 19 '11 at 03:24
  • ok.. well i don't think I need to use DefaultProperty in my case. do you know if there's adobe documentation somewhere that states that this is a supported behavior now? – Sang Park May 19 '11 at 17:47
  • It is supported, if you're extending Group, it'll be added to the display list. – J_A_X May 19 '11 at 17:51
  • alright i guess i will take your word for it.. it would be nice if adobe was clear about stuff like these... – Sang Park May 19 '11 at 18:52