That's because you are trying to make a child ControlBar, which expects
to be parented by a Container.

 

In the future, if you get a runtime exception, please add it to your
questions as it focuses the investigation very concisely.  You'll note
that in this thread, the code you posted had nothing to do with the
actual error.

 

________________________________

From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of learner
Sent: Thursday, January 10, 2008 4:50 AM
To: [email protected]
Subject: Re: [flexcomponents] UIcomponent and Container

 

yeah I do ... there is MemberViewList  is a custom class which should
extend uiComponent.. but
if I make it extend uiComponent it gives me this error...
where is if I make it extend "container" it works

Details of the MemberViewList class is 

*/    
    public class MemberViewList extends Container   ///////////// I
wanted to extens UIcomponent ..but it failed...
    {
        /**
         * Constructor 
         */
        private var addMemberButton:Button;
        private var labelField:UITextField
        private var spacer:Spacer;
        private var controlBar:ApplicationControlBar;
        private var vList:List; 
        private var userStatusLabel:UITextField;
        private var _serviceState:String;
        
        [Bindable]
        public var dataProvider:ArrayCollection;
                 
        function MemberViewList(){ 
            super();
        } 
        
        
        override protected function createChildren():void {
            if(visible){
                trace("createChildren")
                 super.createChildren();
                 controlBar = new  ApplicationControlBar();
                  
                 addMemberButton = new Button();
                 addMemberButton.label = "Add"; 
                 addMemberButton.setStyle("fontSize",11);
                 
                 labelField =
UITextField(createInFontContext(UITextField));
                labelField .styleName = "NormalTextBoldSmall"; 
                labelField.text = "Event Members";
                
                 spacer = new Spacer();
                 controlBar.addChild(labelField );
                 controlBar.addChild (spacer);
                 controlBar.addChild(addMemberButton);
                 controlBar.x = 0;
                 controlBar.y = 0;
                 addChild(controlBar);
........................................... 
......................................
............................
.........................................

On Jan 10, 2008 12:26 PM, Alex Harui <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:

That error describes something about MemberViewList not being a
container and having a child that is a ControlBar.  Do you have such a
configuration?

 

________________________________

From: [email protected]
<mailto:[email protected]>
[mailto:[email protected]
<mailto:[email protected]> ] On Behalf Of learner
Sent: Wednesday, January 09, 2008 6:15 AM


To: [email protected]
<mailto:[email protected]> 
Subject: Re: [flexcomponents] UIcomponent and Container

 

I get a run time error:

The stack trace is:

TypeError: Error #1034: Type Coercion failed: cannot convert
ms.chatmodule.view::[EMAIL PROTECTED] to mx.core.Container.
    at mx.containers::ControlBar/invalidateSize
()[E:\dev\flex_3_beta2\sdk\frameworks\projects\framework\src\mx\containe
rs\ControlBar.as:230]
    at
mx.core::UIComponent/styleChanged()[E:\dev\flex_3_beta2\sdk\frameworks\p
rojects\framework\src\mx\core\UIComponent.as:5396] 
    at
mx.core::Container/styleChanged()[E:\dev\flex_3_beta2\sdk\frameworks\pro
jects\framework\src\mx\core\Container.as:3060]
    at
mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::addingC
hild()[E:\dev\flex_3_beta2\sdk\frameworks\projects\framework\src\mx\core
\UIComponent.as:5018] 
    at
mx.core::UIComponent/addChild()[E:\dev\flex_3_beta2\sdk\frameworks\proje
cts\framework\src\mx\core\UIComponent.as:4736]
    at
ms.chatmodule.view::MemberViewList/ms.chatmodule.view:MemberViewList::cr
eateChildren
()[C:\ms\svn\felix\trunk\client\desktop\src\ms\chatmodule\view\MemberVie
wList.as:73]
    at
mx.core::UIComponent/initialize()[E:\dev\flex_3_beta2\sdk\frameworks\pro
jects\framework\src\mx\core\UIComponent.as:5144]
    at
mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAd
ded()[E:\dev\flex_3_beta2\sdk\frameworks\projects\framework\src\mx\core\
UIComponent.as:5041]
    at
mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::childAdde
d
()[E:\dev\flex_3_beta2\sdk\frameworks\projects\framework\src\mx\core\Con
tainer.as:3334]
    at
mx.core::Container/addChildAt()[E:\dev\flex_3_beta2\sdk\frameworks\proje
cts\framework\src\mx\core\Container.as:2258]
    at
mx.core::Container/addChild()[E:\dev\flex_3_beta2\sdk\frameworks\project
s\framework\src\mx\core\Container.as:2188]
    at
mx.core::Container/createComponentFromDescriptor()[E:\dev\flex_3_beta2\s
dk\frameworks\projects\framework\src\mx\core\Container.as:3710] 
    at
mx.core::Container/createComponentsFromDescriptors()[E:\dev\flex_3_beta2
\sdk\frameworks\projects\framework\src\mx\core\Container.as:3522]
    at
mx.core::Container/mx.core:Container::createChildren()[E:\dev\flex_3_bet
a2\sdk\frameworks\projects\framework\src\mx\core\Container.as:2624] 
    at
mx.core::UIComponent/initialize()[E:\dev\flex_3_beta2\sdk\frameworks\pro
jects\framework\src\mx\core\UIComponent.as:5144]
    at
mx.core::Container/initialize()[E:\dev\flex_3_beta2\sdk\frameworks\proje
cts\framework\src\mx\core\Container.as:2561] 
    at
mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAd
ded()[E:\dev\flex_3_beta2\sdk\frameworks\projects\framework\src\mx\core\
UIComponent.as:5041]
    at
mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::childAdde
d
()[E:\dev\flex_3_beta2\sdk\frameworks\projects\framework\src\mx\core\Con
tainer.as:3334]
    at
mx.core::Container/addChildAt()[E:\dev\flex_3_beta2\sdk\frameworks\proje
cts\framework\src\mx\core\Container.as:2258]
    at
mx.core::Container/addChild()[E:\dev\flex_3_beta2\sdk\frameworks\project
s\framework\src\mx\core\Container.as:2188]
    at
mx.core::Container/createComponentFromDescriptor()[E:\dev\flex_3_beta2\s
dk\frameworks\projects\framework\src\mx\core\Container.as:3710] 
    at
mx.core::Container/createComponentsFromDescriptors()[E:\dev\flex_3_beta2
\sdk\frameworks\projects\framework\src\mx\core\Container.as:3522]
    at
mx.containers::Panel/createComponentsFromDescriptors()[E:\dev\flex_3_bet
a2\sdk\frameworks\projects\framework\src\mx\containers\Panel.as:1504] 
    at
mx.core::Container/mx.core:Container::createChildren()[E:\dev\flex_3_bet
a2\sdk\frameworks\projects\framework\src\mx\core\Container.as:2624]
    at
mx.containers::Panel/mx.containers:Panel::createChildren()[E:\dev\flex_3
_beta2\sdk\frameworks\projects\framework\src\mx\containers\Panel.as:1050
] 
    at
ms.imfusion.util.view::MinimizedPanelUtil/ms.imfusion.util.view:Minimize
dPanelUtil::createChildren()[C:\ms\svn\imfusion\trunk\client\desktop\src
\ms\imfusion\util\view\MinimizedPanelUtil.as:46]
    at mx.core::UIComponent/initialize
()[E:\dev\flex_3_beta2\sdk\frameworks\projects\framework\src\mx\core\UIC
omponent.as:5144]
    at
mx.core::Container/initialize()[E:\dev\flex_3_beta2\sdk\frameworks\proje
cts\framework\src\mx\core\Container.as:2561]
    at
ms.chatmodule.view::ChatBox/initialize()[C:\ms\svn\felix\trunk\client\de
sktop\src\ms\chatmodule\view\ChatBox.mxml:0]

On Jan 8, 2008 11:24 PM, Alex Harui < [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:

Maybe you're doing something funky in createChildren?  Are you getting a
compile error or runtime error.  If runtime, what is the full stack
trace?  If compile, what line is it complaining about?

 

________________________________

From: [email protected]
<mailto:[email protected]>
[mailto:[email protected]
<mailto:[email protected]> ] On Behalf Of learner
Sent: Tuesday, January 08, 2008 2:15 AM
To: [email protected]
<mailto:[email protected]> 
Subject: Re: [flexcomponents] UIcomponent and Container

 

custom Panel class:

class myPanel extends Panel{

      override protected function createChildren():void
        {
            // Add  button to Header
        }
}


in mxml 

<local:myPanel> 
      <local:Vlist> // adding a vlist's instance.
</local:myPanel>




custom class : 

class Vlist extends UIComponent{
   //  overriding few methonds like create children
}



Does this helps




On Jan 7, 2008 9:34 PM, Alex Harui <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:

Please post some of your code.

 

________________________________

From: [email protected]
<mailto:[email protected]>
[mailto:[email protected]
<mailto:[email protected]> ] On Behalf Of learner
Sent: Monday, January 07, 2008 1:47 AM
To: [email protected]
<mailto:[email protected]> 
Subject: [flexcomponents] UIcomponent and Container

 

Hi all,
The scenario is like this:
 I have one class which extends the Panel class. I create it's instance
in an mxml file.
 I have one more class which extends a UIComponent Class.
 Whilte trying to add a instance of this class to a instance of extended
Panel class in mxml file. I get a error like can not convert UIComponent
to Container. 
 
I understood this, as Panel internally extends Container class ans
Container class extends UIComponent .

But why i dont get this error when I try to add standard UIcomponent
like Button etc. to standard Panel.?? 

Can somebody explain me this?
Regards
PS


  

 

 

 

 

Reply via email to