Hello, I am trying to migrate from AS2 because AS3 looks more practical.
However with actionscript 2, I would just create a new dynamic textfield, set it to variable testvar and simply write at a frame or button press,
**var **testvar = testvar+2
That would increase the variable +2 each time and the textfield would just show it.
How I can achieve the same effect with Actionscript 3? I am well aware that components like textarea cannot have actionscript assigned to them anymore.
Create in the work field dynamic textfield
set Instanse name, exsample my_txt
in first frame code
var testvar:int=0;
var stop_trigger:int=1;
//frame chalenger
addEventListener(Event.ENTER_FRAME, EntFr);
dispatchEvent(new Event(Event.ENTER_FRAME));
function EntFr(e:Event):void {
if (stop_trigger==1) {my_txt.text=my_txt.text+" This_mega_good_"+testvar++;
if (testvar>25) {my_txt.text="";testvar=0;}
}
}
//button mode
my_mc.buttonMode=true;
my_mc.addEventListener(MouseEvent.MOUSE_UP,my_mc_press);
function my_mc_press(MouseEvent)
{
if (stop_trigger==0) {my_mc.gotoAndStop(1); stop_trigger=1;}
else {my_mc.gotoAndStop(2);stop_trigger=0;}
}
Example test need
http://murmadillo.tut.su/fla/Text_chalenger.swf
http://murmadillo.tut.su/fla/text_chalenger.rar
Thank you, it’s all clearer now.