Skip navigation
Currently Being Moderated

Error #1009 in Flash

Feb 12, 2013 9:13 AM

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()

 
Replies
  • kglad
    72,228 posts
    Jul 21, 2002
    Currently Being Moderated
    Feb 12, 2013 9:29 AM   in reply to ukmd1970

    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.

     
    |
    Mark as:
  • kglad
    72,228 posts
    Jul 21, 2002
    Currently Being Moderated
    Feb 12, 2013 10:57 AM   in reply to ukmd1970

    you're welcome.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points