We have a simillar problem with porting from Beta 1 to Beta 2.The following error occurs when we load our FormWindow component:
Error: Multiple sets
of visual children have been specified for this component (component definition
and component instance)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:--
A.mxml:
mx:Canvas xmlns:mx=http://www.macromedia.com/2005/mxml
xmlns:osx=osx.* xmlns=*
osx:FormWindow id=_form width=100% height=100% draggable=true
mx:Button width=100 /
/osx:FormWIndow
/mx:Canvas
--
FormWindow.mxml:
mx:Canvas
xmlns:mx=http://www.macromedia.com/2005/mxml
xmlns:osx=osx.* xmlns=*
...
//-// 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;}
... (other
methods)
mx:VBox id=_contents
marginLeft=0 marginRight=0 marginTop={this.getStyle('captionBarHeight')}
marginBottom=0 width=100% height=100% showEffect=ContentShow
click=this.bringToFront()/mx:VBox
... (other mxml
components)
/mx:Canvas
--
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,DeveloperOutsmart
On 3/24/06, Tony Pujals [EMAIL PROTECTED] wrote:
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:
flexcoders@yahoogroups.com [mailto:
flexcoders@yahoogroups.com] On Behalf Of Basil Hosmer
Sent: Thursday, March 23, 2006
6:48 AM
To: flexcoders@yahoogroups.com
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