I think this is an easy one but I cannot figure it out.  I want to
dynamically crate a text imput box via ActionScript and I get errors
when I do the addChild.  Here is my code:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute">
        <mx:Script>
                <![CDATA[
                import flash.text.*;
                import flash.display.DisplayObjectContainer;
                import flash.display.Sprite;
                

                public function WriteMe():void
                {
                        var field:TextField = new TextField();
                        field.type = TextFieldType.INPUT;
                        field.border = true;
                        field.background = true;
                        addChild(field);
                }
                        
                ]]>
        </mx:Script>
        <mx:Button id="btn" label="press me" click="WriteMe()"/>
</mx:Application>

I am getting a debug error with the addChild(field);

What am I doing wrong???

Thanks for the read and help,
timgerr

Reply via email to