我正在尝试构建一个带有用户交互的二叉树程序。用户可以输入数字。二叉树将以图形方式构建。第一个 if 条件的目的是不允许用户输入相同的数字两次。但它不工作
input_num.restrict="0-9";
input_num.maxChars = 3;
AddButton.addEventListener(MouseEvent.CLICK,clicked);
function clicked(event_object:MouseEvent)
{
var check:Boolean;
check==false;
if(check==true)
{
output_text.text="works"
}
else if(input_num.text=="")
{
output_text.text="Field can not be empty"
}
else
{
output_text.text=""
var number=Number(input_num.text);
output_text.text="You entered "+number+""
check==true;
var root=number;
var newCircle:Shape = new Shape();
newCircle.graphics.lineStyle(4, 0x6D00D9);
newCircle.graphics.beginFill(0xff005E);
newCircle.graphics.drawEllipse(x+225.9, y+68.0, 40, 40);
newCircle.graphics.endFill();
addChild(newCircle);
var tf:TextField = new TextField();
var style:TextFormat = new TextFormat();
style.bold=true;
style.size=24;
style.color=0xFFFF33;
tf.text = root.toString();
tf.x = x+236.9;
tf.y = y+73.0;
addChild(tf);
tf.setTextFormat(style);
}
}