FlashでXMLを読み込んでみる
すぐにできると思ったら、はまった。完成形はこんな感じ。
はまった原因はignoreWhite = trueを指定していなかったから。
あと、onLoadのイベントをちゃんとハンドリングしないとダメ。
var x:XML; function test () { x = new XML(); x.onLoad = handleLoad; x.ignoreWhite = true; x.load("test.xml"); } function handleLoad(status){ var rootNode:XMLNode = x.firstChild; var node:XMLNode = rootNode.firstChild; debug.text = node.nodeName + ":" + node.firstChild.nodeValue; }