The following error occurs when we load our FormWindow component:
at mx.core::Container/initialize()
at osx.controls::FormWindow/initialize()
at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::rawChildAdded()
at mx.core::UIComponent/addChildAt()
at mx.core::Container/addChild()
at mx.core::Container/createComponentFromDescriptor()
at mx.core::Container/createComponentsFromDescriptors()
at mx.core::Container/mx.core:Container::createChildren()
at mx.core::UIComponent/initialize()
at mx.core::Container/initialize()
at LoginForm/initialize()
at mx.managers::SystemManager/::initializeChild()
at mx.managers::SystemManager/addChild()
at mx.managers::PopUpManager$/addPopUp()
at mx.managers::PopUpManager$/createPopUp()
at osx::Application/newForm()
at osx::Application/catchThread()
at flash.util::Timer/flash.util:Timer::tick()
osx.controls.FormWindow is an mxml component we have built that has a number of components within it. We load other components into FormWindow by overriding the addChild() method for FormWindow, enabling us to attach new children within an internal component. This has worked fine up until Beta 2.
Simplified Example:
<mx:Button width="100" / >
// addChild()
// override container addChild function
//-----------------------------------------
override public function addChild(child:DisplayObject):DisplayObject
{
if ( child is mx.core.UIComponent )
{
if ( mx.core.UIComponent(child).parentDocument != this )
{
_contents.addChild(child);
}
else
{
super.addChild(child);
}
}
else
{
super.addChild(child);
}
return null;
}
</mx:VBox>
I have tried adding the setDocumentDescriptor override to osx.controls.FormWindow (and osx.controls.Window which it extends), as suggested by Basil Hosmer, but that did not seem to make a difference.
Any ideas would be hugely appreciated, as we have serveral projects that make use of FormWindow.
Cheers,
Nathan Smith,
Developer
Outsmart
Thank you very much for the response – you have no idea how timely it is for us internally. I've been a strong advocate for Flex 2. Unfortunately, I can't say more on a public list, but I would be very interested in having a private dialog about some of the barriers that are affecting our direction.
Best regards,
Tony
tony pujals| senior engineer | Yahoo! SiteBuilder Express
p. 408.349.6284 | e. tonyp * yahoo-inc * com | y!id tonypujals
From: [email protected] [mailto: [email protected]] On Behalf Of Basil Hosmer
Sent: Thursday, March 23, 2006 6:48 AM
To: [email protected]
Subject: RE: [flexcoders] Extending MXML components (change from 1.5 to 2)
Tony,
Yes, we absolutely intend to continue supporting extending MXML with MXML, with the constraint that only one set of children be specified anywhere in the chain of derived components or the component instantiation.
What you're seeing is a bug in beta 2 – the framework incorrectly raises the "multiple sets of children in base and derived components" error in cases where the superclass (A.mxml in your example) in fact has no children.
This will be fixed for beta 3; the workaround in beta 2 is to insert the following <Script/> code into the superclass, e.g. A.mxml:
<mx:Script>
/**
* This namespace is used for undocumented APIs -- usually implementation
* details -- which can't be private because they need to visible
* to other classes.
* APIs in this namespace are completely unsupported and are likely to
* change in future versions of Flex.
*/
namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal";
override mx_internal function setDocumentDescriptor(desc:mx.core.UIComponentDescriptor):void
{
if (mx_internal::_documentDescriptor && mx_internal::_documentDescriptor.properties.childDescriptors)
{
if (desc.properties.childDescriptors)
{
throw new Error("Multiple sets of visual children have been specified for this component (base component definition and derived component definition).");
}
}
else
{
mx_internal::_documentDescriptor = desc;
mx_internal::_documentDescriptor.document = this;
}
}
</mx:Script>
Basil
From: [email protected] [mailto:[email protected]] On Behalf Of Tony Pujals
Sent: Wednesday, March 22, 2006 6:02 PM
To: [email protected]
Subject: [flexcoders] Extending MXML components (change from 1.5 to 2)
In Flex 1.5, you could create an MXML component and then extend it with another custom component. For example, this would work:
A.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml">
</mx:Canvas>
B.mxml
<A xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Button label="Hello" click="mx.controls.Alert.show('Hello')" />
</A>
Test.mxml
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<B />
</mx:Application>
How was this useful? Well, for example, for an HTML page editor, we had an Element.mxml component subclassed by ImageElement.mxml and TextElement.mxml.
This does not work with any of the Flex 2 alpha/betas. Flash 8.5 displays this diagnostic:
Error: Multiple sets of visual children have been specified for this component (base component definition and derived component definition)
at mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::setDocumentDescriptor()
at A/initialize()
at B/initialize()
at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::rawChildAdded()
at mx.core::UIComponent/addChildAt()
at mx.core::Container/addChild()
at mx.core::Container/createComponentFromDescriptor()
at mx.core::Container/createComponentsFromDescriptors()
at mx.core::Application/createComponentsFromDescriptors()
at mx.core::Container/mx.core:Container::createChildren()
at mx.core::UIComponent/initialize()
at mx.core::Container/initialize()
at mx.core::Application/initialize()
at flextest/initialize()
at mx.managers::SystemManager/::initializeChild()
at mx.managers::SystemManager/::initializeTopLevelWindow()
at mx.managers::SystemManager/::frameEndHandler()
It's not that the error message isn't clear, per se, but since this is different behavior, I'm curious …. Can you only extend mx components but not you're own, or this only possible with ActionScript components and not mxml….?
Thanks,
Tony
tony pujals| senior engineer | Yahoo! SiteBuilder Express
p. 408.349.6284 | e. tonyp * yahoo-inc * com | y!id tonypujals
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service .
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
| Web site design development | Computer software development | Software design and development |
| Macromedia flex | Software development best practice |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

