Re: [flexcoders] Extending MXML components (change from 1.5 to 2)

2006-04-01 Thread Nathan Smith



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:
 
http://www.macromedia.com/2005/mxml
" 
xmlns:osx="osx.*" xmlns="*" >
 
  
  
 
  

 

 
--
FormWindow.mxml:
 
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)
 
    
 
  ... (other mxml 
components)
 
 

--
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  code into the superclass, e.g. A.mxml:

 



/**

 * 
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
defin

RE: [flexcoders] Extending MXML components (change from 1.5 to 2)

2006-03-23 Thread Tony Pujals











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:[EMAIL PROTECTED] 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  code into the superclass, e.g. A.mxml:

 



/**

 * 
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;

  
}

}



 

Basil

 









From: flexcoders@yahoogroups.com
[mailto:[EMAIL PROTECTED] On Behalf
Of Tony Pujals
Sent: Wednesday, March 22, 2006
6:02 PM
To: flexcoders@yahoogroups.com
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









 

 



B.mxml





   




 

 



Test.mxml





   




 

 

 

 

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 "flexcoder

RE: [flexcoders] Extending MXML components (change from 1.5 to 2)

2006-03-23 Thread Basil Hosmer











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  code into the
superclass, e.g. A.mxml:

 



/**

 * 
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;

   }

}



 

Basil

 









From:
flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Tony Pujals
Sent: Wednesday, March 22, 2006
6:02 PM
To: flexcoders@yahoogroups.com
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









 

 



B.mxml





   




 

 



Test.mxml





   




 

 

 

 

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








  
  
SPONSORED LINKS
  
  
  

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.



  









Re: [flexcoders] Extending MXML components (change from 1.5 to 2)

2006-03-22 Thread Manish Jethani
On 3/23/06, Tony Pujals <[EMAIL PROTECTED]> wrote:

> A.mxml
>
> 
>
> http://www.adobe.com/2006/mxml";>
>
> 
>

>
> B.mxml
>
> http://www.adobe.com/2006/mxml";>
>
>  click="mx.controls.Alert.show('Hello')" />
>
> 
>


> Test.mxml
>
> http://www.adobe.com/2006/mxml";>
>
> 
>
> 
>


\> Error: Multiple sets of visual children have been specified for this
> component (base component definition and derived component definition)
[snip]

Do you happen to have children defined inside the B instance in Test.mxml?

 
  
 

That's not allowed: you can add children there only if B is empty.

Manish


--
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

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 




[flexcoders] Extending MXML components (change from 1.5 to 2)

2006-03-22 Thread Tony Pujals











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









 

 



B.mxml





    



 

 



Test.mxml





    



 

 

 

 

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.