Skip to main content
Participant
February 29, 2016
Question

TypeError: Error #2007: Parameter text must be non-null.

  • February 29, 2016
  • 1 reply
  • 1171 views

i have this error and i don't know how to solve it

TypeError: Error #2007: Parameter text must be non-null.

  at flash.text::TextField/set text()

  at glossary_fla::MainTimeline/createbtn()

  at glossary_fla::MainTimeline/letterclick()

this is function createbtn

function createbtn(label:String):MovieClip

{

  var txt:TextField = new TextField();

  txt.defaultTextFormat = new TextFormat('Cooper Black',25,0xFFFFFF);

  txt.text = label;

  txt.autoSize = TextFieldAutoSize.LEFT;

  txt.background = txt.border = false;

  txt.selectable = false;

  var btn:MovieClip = new MovieClip();

  btn.mouseChildren = false;

  btn.buttonMode = true;

  btn.addChild(txt);

  btn.label = label;

  return btn;

}

and this function is letterclick

function letterclick(e:MouseEvent)

{

  myxmllist = new XMLList(myxml.word.(@clas==e.target.name).@wordname);

  for each (var word:XML in myxmllist)

  {

  btn = createbtn(myxmllist);

  btn.x = 600;

  btn.y = 130 + n;

  addChild(btn);

  n +=  50;

  btn.addEventListener(MouseEvent.CLICK,wordclick);

  i++;

  Tweener.addTween(btn, {x:100, scaleX:1, scaleY: 1, time: 2, transition:"easeOut"});

  }

}

could you help me please

This topic has been closed for replies.

1 reply

robdillon
Participating Frequently
February 29, 2016

The error is telling you that a parameter's value is null. It's pointing to the function letterclick(). I'm guessing that the problem lies in the xml file that you are using in this function. I have no way of knowing the actual problem. It could be that the xml reference has a typo, or the xml file contains no data, or that the way that you are parsing the xml has a problem, or...

Participant
February 29, 2016

i want to tell you that on stage i have button from a to z when i click any button for the first time every thing running by the right way but when i click the same button or other one this problem happen so the problem is not lies in the xml file . but by trace i know that the error happen from this statement  
btn = createbtn(myxmllist);
so think i should be delete or remove the last object of btn to can create a new one .. when i used removeChild(btn) output show from the first time

TypeError: Error #2007: Parameter child must be non-null.

  at flash.display::DisplayObjectContainer/removeChild()

  at glossary_fla::MainTimeline/letterclick()

i don't know what can i do , ...

robdillon
Participating Frequently
March 1, 2016

If the problem is with that line, then trace for the value of myxmllist and see what you get.