第一次加载时的代码,我为selectedIDtext分配一个pageName。当第二次加载时,我想删除数据init并使用新的pageName进行更新。但无论我做了什么,我都无法更改并分配在文本字段中加载的第一个值。
selectedIDmc = new MovieClip();
selectedIDtext = new TextField();
selectedIDtext.defaultTextFormat = selectedIDformat;
selectedIDtext.wordWrap = true;
selectedIDtext.name = "selectedName";
selectedIDtext.opaqueBackground = 0x445566;
selectedIDtext.width = stage.stageWidth / 3;
selectedIDtext.height = 15;
function listClick(event:MouseEvent):void {
if (event.target.parent != listArray[listArray.length - 1]) {
for (var i:Number = clickedIndex + 1; i < listArray.length; i++) {
**selectedIDtext.text = ""**
}
pageName = event.target.getChildByName("listText").text;
selectedIDtext.text = pageName;
}
}
答案 0 :(得分:0)
而不是:
pageName=event.target.getChildByName("listText").text;
selectedIDtext.text=pageName;
试试这个
selectedIDtext.text=TextField(event.target).text;