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




Reply via email to