The stack trace indicates that you have a NumericSlider.mxml file.  You
should have one called NumericSlider.as for your component, and your
test file should not have the same name.

 

________________________________

From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Firdosh Tangri
Sent: Wednesday, November 29, 2006 2:08 PM
To: [email protected]
Subject: Re: [flexcomponents] Weird error when creating Custom Component

 

ok i changed the event to initialize and now i get stack overflow error

Error: Error #1023: Stack overflow occurred.
    at
mx.managers::LayoutManager/invalidateDisplayList()[C:\dev\GMC\sdk\framew
orks\mx\managers\LayoutManager.as:486] 
    at
mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::updateC
allbacks()[C:\dev\GMC\sdk\frameworks\mx\core\UIComponent.as:4644]
    at mx.core::UIComponent/set
nestLevel()[C:\dev\GMC\sdk\frameworks\mx\core\UIComponent.as:2403] 
    at
mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::addingC
hild()[C:\dev\GMC\sdk\frameworks\mx\core\UIComponent.as:4720]
    at
mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::addingChi
ld ()[C:\dev\GMC\sdk\frameworks\mx\core\Container.as:3306]
    at
mx.core::Container/addChildAt()[C:\dev\GMC\sdk\frameworks\mx\core\Contai
ner.as:2285]
    at
mx.core::Container/addChild()[C:\dev\GMC\sdk\frameworks\mx\core\Containe
r.as:2229] 
    at
NumericSlider/NumericSlider::init()[C:\FlexProjects\NumericSlider\src\Nu
mericSlider.mxml:18]
    at
NumericSlider/___Application1_initialize()[C:\FlexProjects\NumericSlider
\src\NumericSlider.mxml:2]
    at
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEven
tFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/set
processedDescriptors()[C:\dev\GMC\sdk\frameworks\mx\core\UIComponent.as:
1209] 
    at
mx.core::Container/createComponentsFromDescriptors()[C:\dev\GMC\sdk\fram
eworks\mx\core\Container.as:3548]
    at
mx.core::Container/mx.core:Container::createChildren()[C:\dev\GMC\sdk\fr
ameworks\mx\core\Container.as:2643] 
    at
mx.core::UIComponent/initialize()[C:\dev\GMC\sdk\frameworks\mx\core\UICo
mponent.as:4862]
    at
mx.core::Container/initialize()[C:\dev\GMC\sdk\frameworks\mx\core\Contai
ner.as:2580]
    at mx.core::Application/initialize
()[C:\dev\GMC\sdk\frameworks\mx\core\Application.as:910]
    at
NumericSlider/initialize()[C:\FlexProjects\NumericSlider\src\NumericSlid
er.mxml:0]
    at
mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAd
ded ()[C:\dev\GMC\sdk\frameworks\mx\core\UIComponent.as:4759]
    at
mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::childAdde
d()[C:\dev\GMC\sdk\frameworks\mx\core\Container.as:3349]
    at mx.core::Container/addChildAt
()[C:\dev\GMC\sdk\frameworks\mx\core\Container.as:2295]
    at
mx.core::Container/addChild()[C:\dev\GMC\sdk\frameworks\mx\core\Containe
r.as:2229]
    at
NumericSlider/NumericSlider::init()[C:\FlexProjects\NumericSlider\src\Nu
mericSlider.mxml:18] 
    at
NumericSlider/___Application1_initialize()[C:\FlexProjects\NumericSlider
\src\NumericSlider.mxml:2]
    at
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEven
tFunction()
    at flash.events::EventDispatcher/dispatchEvent ()
    at mx.core::UIComponent/set
processedDescriptors()[C:\dev\GMC\sdk\frameworks\mx\core\UIComponent.as:
1209]
    at
mx.core::Container/createComponentsFromDescriptors()[C:\dev\GMC\sdk\fram
eworks\mx\core\Container.as:3548] 
    at
mx.core::Container/mx.core:Container::createChildren()[C:\dev\GMC\sdk\fr
ameworks\mx\core\Container.as:2643]
    at
mx.core::UIComponent/initialize()[C:\dev\GMC\sdk\frameworks\mx\core\UICo
mponent.as:4862]
    at
mx.core::Container/initialize()[C:\dev\GMC\sdk\frameworks\mx\core\Contai
ner.as:2580]
    at
mx.core::Application/initialize()[C:\dev\GMC\sdk\frameworks\mx\core\Appl
ication.as:910]
    at
NumericSlider/initialize()[C:\FlexProjects\NumericSlider\src\NumericSlid
er.mxml:0] 
    at
mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAd
ded()[C:\dev\GMC\sdk\frameworks\mx\core\UIComponent.as:4759]
    at
mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::childAdde
d ()[C:\dev\GMC\sdk\frameworks\mx\core\Container.as:3349]
    at
mx.core::Container/addChildAt()[C:\dev\GMC\sdk\frameworks\mx\core\Contai
ner.as:2295]
    at
mx.core::Container/addChild()[C:\dev\GMC\sdk\frameworks\mx\core\Containe
r.as:2229] 
    at
NumericSlider/NumericSlider::init()[C:\FlexProjects\NumericSlider\src\Nu
mericSlider.mxml:18]
    at
NumericSlider/___Application1_initialize()[C:\FlexProjects\NumericSlider
\src\NumericSlider.mxml:2]
    at
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEven
tFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/set
processedDescriptors()[C:\dev\GMC\sdk\frameworks\mx\core\UIComponent.as:
1209] 
    at
mx.core::Container/createComponentsFromDescriptors()[C:\dev\GMC\sdk\fram
eworks\mx\core\Container.as:3548]
    at
mx.core::Container/mx.core:Container::createChildren()[C:\dev\GMC\sdk\fr
ameworks\mx\core\Container.as:2643] 
    at
mx.core::UIComponent/initialize()[C:\dev\GMC\sdk\frameworks\mx\core\UICo
mponent.as:4862]
    at
mx.core::Container/initialize()[C:\dev\GMC\sdk\frameworks\mx\core\Contai
ner.as:2580]
    at mx.core::Application/initialize
()[C:\dev\GMC\sdk\frameworks\mx\core\Application.as:910]
    at
NumericSlider/initialize()[C:\FlexProjects\NumericSlider\src\NumericSlid
er.mxml:0]
    at
mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAd
ded ()[C:\dev\GMC\sdk\frameworks\mx\core\UIComponent.as:4759]
    at
mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::childAdde
d()[C:\dev\GMC\sdk\frameworks\mx\core\Container.as:3349]
    at mx.core::Container/addChildAt
()[C:\dev\GMC\sdk\frameworks\mx\core\Container.as:2295]
    at
mx.core::Container/addChild()[C:\dev\GMC\sdk\frameworks\mx\core\Containe
r.as:2229]
    at
NumericSlider/NumericSlider::init()[C:\FlexProjects\NumericSlider\src\Nu
mericSlider.mxml:18] 
    at
NumericSlider/___Application1_initialize()[C:\FlexProjects\NumericSlider
\src\NumericSlider.mxml:2]
    at
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEven
tFunction()
    at flash.events::EventDispatcher/dispatchEvent ()
    at mx.core::UIComponent/set
processedDescriptors()[C:\dev\GMC\sdk\frameworks\mx\core\UIComponent.as:
1209]
    at
mx.core::Container/createComponentsFromDescriptors()[C:\dev\GMC\sdk\fram
eworks\mx\core\Container.as:3548] 
    at
mx.core::Container/mx.core:Container::createChildren()[C:\dev\GMC\sdk\fr
ameworks\mx\core\Container.as:2643]
    at
mx.core::UIComponent/initialize()[C:\dev\GMC\sdk\frameworks\mx\core\UICo
mponent.as:4862]
    at
mx.core::Container/initialize()[C:\dev\GMC\sdk\frameworks\mx\core\Contai
ner.as:2580]
    at
mx.core::Application/initialize()[C:\dev\GMC\sdk\frameworks\mx\core\Appl
ication.as:910]
    at
NumericSlider/initialize()[C:\FlexProjects\NumericSlider\src\NumericSlid
er.mxml:0] 
    at
mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAd
ded()[C:\dev\GMC\sdk\frameworks\mx\core\UIComponent.as:4759]



On 11/29/06, Alex Harui <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> >
wrote:

I would try changing creationComplete to initialize.  It shouldn't
really matter (although you are going to waste a few cycles
re-validating the system when you add children in creationComplete), but
maybe there's some behavior in FlexBuilder that doesn't like this.

 

________________________________

From: [email protected]
<mailto:[email protected]>
[mailto:[email protected] <mailto:[EMAIL PROTECTED]> ] On
Behalf Of Firdosh Tangri
Sent: Wednesday, November 29, 2006 10:49 AM


To: [email protected]
<mailto:[email protected]> 
Subject: Re: [flexcomponents] Weird error when creating Custom Component

 

that is very weird 
i get  nothing on the screen and it keeps tracing the two trace
statements in the init function
and another strange bug is I added a count property to see how many
times its calling the function
so it increments it only once but keeps tracing it out, I think it might
be a flex builder bug more then
the frameworks, i`ll try tracing it out using the command line

heres a screenshot of what i get
http://seas.mgmt.purdue.edu/~firdosh/flex/flex.jpg
<http://seas.mgmt.purdue.edu/%7Efirdosh/flex/flex.jpg> 

firdosh

On 11/29/06, Alex Harui <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> >
wrote:

Yeah, then addChild put on one the screen.

 

________________________________

From: [email protected]
<mailto:[email protected]>  [mailto:flexcompone
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ] On Behalf Of Firdosh
Tangri
Sent: Tuesday, November 28, 2006 11:12 PM
To: [email protected]
<mailto:[email protected]> 
Subject: Re: [flexcomponents] Weird error when creating Custom Component

 

so just using 
var c:NumericSlider=new NumericSlider();
calls the trace in the constructor ?? 

I dont think it doesnt return but it keeps calling the same function
again and again
like a setInterval function call...

firdosh 

On 11/29/06, Alex Harui <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> >
wrote:

Hmm.  It worked for me.  Are you saying it never returns from addChild?

 

________________________________

From: [email protected]
<mailto:[email protected]>  [mailto:flexcompone
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ] On Behalf Of Firdosh
Tangri
Sent: Tuesday, November 28, 2006 8:03 PM
To: [email protected]
<mailto:[email protected]> 
Subject: [flexcomponents] Weird error when creating Custom Component

 

Hey all, 
            I am trying to create a custom component by extending the
UIComponent class [ AS3 only ] . I followed it pretty much from the
documents on flex.org. But here is the wierd part. If I add the
component using just mxml it works fine 
traces out the statement in the constructor , shows the component. But
if I create the component using just as3 then it doest call the
constructor. Further more if I add the component it goes into a infinite
loop.



cheers :)
firdosh





//MAIN MXML CLASS

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> " layout="absolute"
creationComplete="init(event);" xmlns:FComponents="org.fcomponents.*">
    <mx:Script>
        <![CDATA[
            import org.fcomponents.Test;
            import mx.containers.Panel;
            import org.fcomponents.NumericSlider;
            import flash.events.Event;
            
            private function init(evt:Event):void{ 
                trace("add");
                var c:NumericSlider=new NumericSlider();
                
                trace("call");
                
                //addChild(c);  // UNCOMMENT THIS FOR INFINITE LOOP 
                //this.addChild(new NumericSlider());
                //<FComponents:NumericSlider />  IF YOU ADD THIS
STATETMENT BELOW IT WORKS FINE
            }
                        
        ]]> 
    </mx:Script>
    
</mx:Application>





//CUSTOM COMPONENT CLASS

package org.fcomponents
{
    import mx.core.UIComponent;
    import mx.controls.Button;
    import mx.controls.VSlider;
    import mx.controls.NumericStepper;
    import flash.events.Event;
    
    [Event (name="change" ,type="flash.events.Event") ]

    public class NumericSlider extends UIComponent 
    {
        private var $stepper:NumericStepper;
        private var $slider:VSlider;
        private var $showSlider:Button;
        private var $valueChanged:Boolean;
        private var $value:Number=0; 
        
        public function NumericSlider(){            
                    
            super();            
            trace("NS Constructor");    
            $valueChanged=false;
        }
        
        override protected function createChildren():void{
            super.createChildren();            
            if(!$stepper){
                $stepper=new NumericStepper();
                addChild($stepper); 
            }
        }
        
        override protected function commitProperties():void{
            super.commitProperties();
            if($valueChanged){
                $valueChanged=false; 
                $stepper.value=$value;
                invalidateDisplayList();
            }
        }    
        
        override protected function measure():void{
            super.measure();
            $stepper.width=100;
            $stepper.height=22;
        }
        
        override protected function
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{
            super.updateDisplayList (unscaledWidth,unscaledHeight);
            
        }
    }
}



 

 

 

 

Reply via email to