3 Replies Latest reply: Feb 12, 2013 10:57 AM by kglad RSS

    Error #1009 in Flash

    ukmd1970

      Hello All, I am having some unexpected issues in Flash. I wanted to build a basic Button, TextArera and TextInput. The code appears to be correct. When i pressed ctrl+Enter I got a rather long message in the output panel. To be honest i dont  fully understand what it means.

      Below i have typed the code and part of the message i received in the output panel its way too big to show it full.

      Any suggestions to fix this would be much appreciated.

       

      import flash.text.TextFormat;

      import fl.controls.TextInput;

      import fl.controls.TextArea;

      import fl.controls.Button;

      import flash.events.MouseEvent;

       

      var tf:TextFormat = new TextFormat();

      tf.font = "Arial";

      tf.size = 14;

      tf.color = "0xff0000;

       

      var ti:TextInput = new TextInput();

      ti.setSize(429.00, 50.00);

      ti.move(96.00, 286.00);

      ti.editable = true;

      ti.enabled = true;

      ti.setStyle("textFormat", tf);

      addChild(ti);

       

      var ta:TextArea = new TextArea();

      ta.setSize(96.00, 430.00);

      ta.move(246.00, 20.00);

      ta.editable = false;

      ta.enabled = true;

      ta.setStyle("textFormat", tf);

      addChild(ta);

       

      var mybutton:Button = new Button();

      mybutton.setSize(11.00, 25);

      mybutton.move(21, 287);

      mybutton.label = "submit";

      mybutton.toggle = true;

      addChild(mybutton);

       

      mybutton.addEventListener(MouseEvent.CLICK, btnHandler);

       

      function btnHandler(event:MouseEvent):void{

          trace("Success");

      }

       

      Type error: Error #1009: cannot access a property  or method of a null object reference

        at fl.controls::TextArea/drawLayout()

        at fl.controls::TextArea/draw()

        at fl.core::uicComponent/callLaterDispatcher()

      Type error: Error #2007 Parameter child must be non-null

        at flash.display::Displayobjectcontainer/addChildat()

      at fl.controls::Basebutton/drawbackground()

      at fl.controls::BaseButton/draw()

      at fl.controls::uicComponent/drawNow()

      at fl.controls::scrollBar/draw()

      at fl.controls::uicscrollBar/draw()

        • 1. Re: Error #1009 in Flash
          kglad CommunityMVP

          first, fix:

           

          tf.color = "0xff0000;

           

          which should be:

           

          tf.color = "0xff0000";

           

          or

           

          tf.color = 0xff0000;

           

           

          next, make sure you have a textarea component in your library.  (ie, drag from the component panel to the stage and then delete it).

           

          if that doesn't solve the problem click file>publish settings>swf and tick "permit debugging".  retest.

           

          the problematic line number will be in the error message.  that will indicate the object that doesn't exist when your code executes.

           

          if you don't understand the above and how to solve the problem, indicate the problematic line number in your code.

          • 2. Re: Error #1009 in Flash
            ukmd1970 Community Member

            Thanks Kglad.I put the TextArea component and it worked perfectly. You're the man.

            • 3. Re: Error #1009 in Flash
              kglad CommunityMVP

              you're welcome.