k tried using the fdb debugger and it crashed on addChild....
could there be something weird with my namespace ??
On 11/29/06, Firdosh Tangri <[EMAIL PROTECTED]> wrote:
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] > wrote:
>
> Yeah, then addChild put on one the screen.
>
>
> ------------------------------
>
> *From:* [email protected] [mailto:[EMAIL PROTECTED]
> *On Behalf Of *Firdosh Tangri
> *Sent:* Tuesday, November 28, 2006 11:12 PM
> *To:* [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]> wrote:
>
> Hmm. It worked for me. Are you saying it never returns from addChild?
>
>
> ------------------------------
>
> * From:* [email protected] [mailto:[EMAIL PROTECTED]
> *On Behalf Of *Firdosh Tangri
> *Sent:* Tuesday, November 28, 2006 8:03 PM
> *To:* [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"
> 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);
>
> }
> }
> }
>
>
>
>
>
>
>