A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: #2007: Parameter child must be non-null.

  1. #1
    Flash Genie letschillout's Avatar
    Join Date
    Feb 2007
    Location
    31.52949, 74.347272
    Posts
    146

    #2007: Parameter child must be non-null.

    am getting error, when i click input text field then only it goes to next scene, i want to use it without click input text... and also getting this error?

    error i.e.
    TypeError: Error #2007: Parameter child must be non-null.
    at flash.display:isplayObjectContainer/addChild()


    myFormat.font = myFont.fontName;

    //myFormat.align = TextFormatAlign.CENTER;

    //creating text filed
    theTextField= new TextField();
    //theTextField.text= "";
    theTextField.defaultTextFormat = myFormat;
    theTextField.type = TextFieldType.INPUT;
    theTextField.border = true;
    theTextField.width = 270;
    theTextField.height = 80;
    theTextField.x = 620;
    theTextField.y = 310;
    theTextField.multiline = true;
    //theTextField.wordWrap = true;
    theTextField.background = true;


    addChild(theTextField);
    theTextField.addEventListener(TextEvent.TEXT_INPUT , inputEventCapture);


    public function createOutputBox(str:String):void {

    var myFont = new cfont();
    var myFormat2:TextFormat = new TextFormat();



    }
    Charag - 3D, Flash Games, Animations,
    Website Development & More...


  2. #2
    Senior Member
    Join Date
    Jul 2008
    Posts
    391
    Did you declare what theTextField is?
    PHP Code:
    var theTextField:TextField = new TextField (); 
    If you want every keystroke to be captured by the TextField you can do
    PHP Code:
    stage.addEventListener (KeyboardEvent.KEY_DOWNonStageKeyDown);
    function 
    onStageKeyDown (e:KeyboardEvent) {
        
    stage.focus theTextField;

    Every button you press on your keyboard will be captured by the TextField regardless of what you click on the stage because the focus will be on the TextField every time you press a key.

  3. #3
    Flash/Flex Developer samac1068's Avatar
    Join Date
    Apr 2007
    Location
    Here, no there
    Posts
    1,813
    Move your addEventListener prior to the addChild command.
    Some people are like Slinkies, not really good for anything, but they bring a smile to your face when pushed down the stairs.

  4. #4
    Flash Genie letschillout's Avatar
    Join Date
    Feb 2007
    Location
    31.52949, 74.347272
    Posts
    146
    actually am putting input text then loading addchild and putting the text there

    in short i can able to properly save value from one movieclip add child to another

    how can save text value in string and later can show it on different addChild
    Charag - 3D, Flash Games, Animations,
    Website Development & More...


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center