Update Textfield in Window
GoogleCodeExporter opened this issue · comments
Google Code Exporter commented
Hello,
Is there any method to refresh a window?
I add TextField content to window.
playinItemWindow = new Window (this, 50, 100, "Playing item");
playinItemWindow.name = "playingitemw";
playinItemWindow.content.addChild(playingItemTextInfo);
After function process it
var tempText = eee.content.getChildByName("playingiteminfo") as TextField;
tempText.text = newstring;
tempText.text trace outputs new string, but added TextField in wondow doesn't
change.
Thank you in advance.
K.
Original issue reported on code.google.com by kestuti...@gmail.com
on 2 Feb 2011 at 12:08
Google Code Exporter commented
your example is very confusing. you are adding a text field to
"playinItemWindow", but looking for it in "eee".
At any rate, there is no need to "refresh a window". If you have a text field
in a window and change its text directly, it will change. There's nothing in
Window that would prevent that from happening.
If you try the following example it works perfectly.
package
{
import flash.events.Event;
import com.bit101.components.PushButton;
import com.bit101.components.Component;
import com.bit101.components.Window;
import flash.display.Sprite;
import flash.text.TextField;
public class Main extends Sprite
{
private var win:Window;
private var tf:TextField;
public function Main()
{
Component.initStage(stage);
tf = new TextField();
tf.text = "hello world";
tf.name = "tf";
win = new Window(this, 50, 100, "Playing item");
win.name = "playingitemw";
win.content.addChild(tf);
new PushButton(this, 200, 100, "click", onClick);
}
private function onClick(event:Event):void
{
var tempText:TextField = win.content.getChildByName("tf") as TextField;
tempText.text = "foobar";
}
}
}
Original comment by k...@bit-101.com
on 2 Feb 2011 at 1:40
- Changed state: Invalid