1.使用 Model标签
<mx:Model id="config" source="assets/config.xml"/>
xml:
<config>
<username> Kevin </username>
<psw> 4325d543d32ab34ddd43 </psw>
</config>
在applicationComplete事件里面直读取即可.
Alert.show(config.username + " : " + config.psw);
2. 使用URLLoader.
var loader: URLLoader = new URLLoader(new URLRequest("asset/config.xml");
loader.addEventListener(Event.COMPLETE, handleCompleted);
private function handleCompleted(event: Event): void
{
var loader: URLLoader(event.target);
var configXML: XML = XML(loader.data);
Alert.show(configXML.username);
}