Skip to main content
Participant
November 23, 2010
Answered

trying to find the syntax to clear nameIn text to refresh for new input

  • November 23, 2010
  • 1 reply
  • 335 views

import flash.text.TextField;

import flash.events.MouseEvent;

import flash.text.TextFormat;

var myText:TextField = new TextField();

var myText1:TextField = new TextField();

var myFormat:TextFormat = new TextFormat();

var myFormat2:TextFormat = new TextFormat();

var myClear:String = "";

myFormat.bold = true;

myFormat.font = "Helvetica";

myFormat.size = 24;

myFormat.italic = true;

myFormat2.size = 22;

myFormat2.font ="Comic Sans";

submit.addEventListener(MouseEvent.CLICK, onClick);

reset.addEventListener(MouseEvent.CLICK, removeInfo);

function onClick(e:MouseEvent):void

{

addChild(myText);

myText.text = nameIn.text + myText.text  + " .";

myText.setTextFormat(myFormat);

addChild(myText1);

myText1.setTextFormat(myFormat2);

}

function removeInfo(e:MouseEvent):void

{

nameIn.text = myClear;

removeChild(myText);

}

myText.x = 10;

myText.y = 100;

myText.autoSize = TextFieldAutoSize.LEFT;

myText.background = true;

myText.backgroundColor = 0xFFF000;

//myText.wordWrap = true;

myText1.x = 150;

myText1.y = 200;

myText1.background = true;

myText1.backgroundColor = 0xFFFF8;

myText1.autoSize = TextFieldAutoSize.LEFT;

myText1.text = "JJ is in total agreement with you, YAHOO! ";

myText.text = " Is admiting she is very nice";

This topic has been closed for replies.
Correct answer Ned Murphy

What you have...  

nameIn.text = myClear;

should work if that is all you are trying to do.

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
November 23, 2010

What you have...  

nameIn.text = myClear;

should work if that is all you are trying to do.