actionscript 3 - Flash - Text changing after chaning frame -
i have custom button made using movieclip. have text filed inside display text. show different effect when user over,out , click on button added 3 frames different effects , change frame using mc.gotoandstop(x) when user performs action.
it working fine till yesterday. since ever added effect textfield (with different font color , style) text value of text field reverting default/initial value set in design time.
is expected? there work around other removing effects on text filed?
i have code(listeners) written out side component (inside main class, not in timeline)
flash timelines kind of static state machine; moving frame-to-frame runs of document code @ frame (every time). resets value of content state in during design time (so, frame = design + code). because of headaches model can cause, highly recommend of design & code in single frame.
changing appearance programmatically easy enough, though. use textformat , apply textfield settextformat.
// create textfield var txt:textfield = new textfield(); txt.text = "sample text"; addchild(txt); // create formatting var format:textformat = new textformat(); format.font = "verdana"; format.color = 0xff0000; format.size = 10; format.underline = true; // apply format textfield txt.settextformat(format);
Comments
Post a Comment