The problem is that the toolbar is not created until the RichTextEditor has 
been added to the screen. Use CallLater to wait for that:

                        private var a:DRTE = new DRTE();
                        
                        private function oncreationComplete():void
                        {
                                this.callLater(doSetItems);
                                addChild(a);
                        }
                        
                        private function doSetItems():void
                        {
                                a.SetItems();
                        }


--- In [email protected], "timgerr" <tgallag...@...> wrote:
>
> Hello all,
> I want to extend the RichTextEitor and I have a problem(s) with doing so.  So 
> I wrote A action script class trying to extend the Rich Text Editor.  I 
> wanted to just add a text box to the toolbar but am getting errors, here is 
> my code:
> ackage com.DaNaTiRTE
> {
>       import mx.controls.RichTextEditor;
>       import mx.controls.TextInput;
> 
>       public class DRTE extends RichTextEditor
>       {
>               public function DRTE()
>               {
>                       //TODO: implement function
>                       super();
>               }
>               
>               private var _width:int;
>               private var _height:int;
>               public function SetItems():void
>               {
>                       var t:TextInput = new TextInput();
>                       t.width = 40;
>                       this.toolbar.addChild(t);
>               }       
>       }
> }
> 
> I wanted to do somthing like this when I call the code
> var a:DRTE = new DRTE();
> a.SetItems();
> addChild(a);
> 
> When I do the (a.SetItems) I get an error "Error #1009: Cannot access a 
> property or method of a null object reference.".
> 
> Can someone tell me what I am doing wrong, and if so what I need to be doing 
> correctly?  I want to not just build this code but understand how to extend 
> components.
> 
> Thanks for the help and read.
> timgerr
>


Reply via email to