Don’t extend RichTextEditor.  It is an mxml file.  Just copy it and edit the 
mxml.


On 2/18/10 10:12 AM, "valdhor" <[email protected]> wrote:






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] <mailto:flexcoders%40yahoogroups.com> , 
"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
>






--
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui

Reply via email to