Olá a todos,
Estava desenvolvendo uma aplicação em Flex 4, e gostaria de saber como faço para colocar um componente qualquer dentro do meu componente customizado.
Vou dar um exemplo mais prático.
Criei um componente customizado retangular com BorderContainer e adicionei na minha tela principal. Porém quero colocar um botão dentro desse componente customizado (genérico, pode ser colocado qualquer outro componente dentro) e o Flex mostra um erro.
Ex.:
Tela Principal usando meu componente…
<comp:BorderContainerCustom>
<s:Button/>
</comp:BorderContainerCustom>
ou se eu quiser colocar outro componente dentro
<comp:BorderContainerCustom>
<s:Text/>
</comp:BorderContainerCustom>
Alguém sabe como resolver?
“Multiple sets of visual children have been specified for the PopUpFilter tag”.
Isso acontece quando eu coloco um componente dentro do meu componente e tento visualizar no modo Design
Eu havia achado esses links… mas não resolveram o problema…
mas valeu assim mesmo
[quote]The Solution:
Here is a DEMO APPLICATION with ?View Source? enabled which will assist the explanation that follows.
Step one: create the property within your component which the mxml compiler will assign the set of children defined for this component to. In the example application I have called this property ?children?. Store the value which is passed into this function into a global variable so that it can be obtained later, and call the invalidateProperties() function. Calling invalidate properties will cause flex to call the commitProperties() function on this component sometime in the future, when it next is convenient to do so.
Step two: override the commitProperties() function. Here we simply loop through the components which were passed to us as children, and add them to the correct Container within outselves.
Step three: set the property you created in step one to be the ?default property? of this component. This means that components which we define as children of our custom component will automatically be assigned to this property of the component.[/quote]