开发者

How to Send XML Data to Flash Label Component?

I have parsed 3 nodes of my XML web service and want to populate 3 separate label components with each of the values. I've written the following actionscript 3 code, but when I play the SWF the labels do not appear. How do I place them on the Timeline for visibility only during certain frames?

public class Main extends MovieClip {             
public function Main() {                  
var urlRequest : URLRequest = new URLRequest("http://myurl");             
var urlLoader : URLLoader = new URLLoader(开发者_如何学编程);              
urlLoader.addEventListener(Event.COMPLETE, onXmlLoaded);             
urlLoader.load(urlRequest);          
}          

private function onXmlLoaded(event : Event) : void{
XML.ignoreWhitespace= true;
var urlLoader : URLLoader = event.currentTarget as URLLoader;
var resultXML : XML = XML(urlLoader.data);             
trace(resultXML);         
var lowtemp_label : TextField =  New TextField();
var hitemp_label : TextField = New TextField();
var condicon_label : TextField = New TextField();
lowtemp_label.text = resultXML.minTemp;
hitemp_label.text = resultXML.hiTemp;
condicon_label.text = resultXML.icon;
}
} 
}

Thanks!


You are not adding the label to the display list

var lowtemp_label : TextField =  New TextField();
addChild(lowtemp_label)
var hitemp_label : TextField = New TextField();
addChild(hitemp_label)
var condicon_label : TextField = New TextField();
addChild(condicon_label)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜