HTTPService读取XML(Actionscript)

import mx.rpc.http.HTTPService;

var configService:HTTPService = new HTTPService();
configService.url = "javaServer.xml";    //XML路径
configService.resultFormat = HTTPService.RESULT_FORMAT_TEXT;
                configService.addEventListener(ResultEvent.RESULT, configService_resultHandler);    //回调函数
                configService.addEventListener(FaultEvent.FAULT, myService_faultHandler);    //失败后的函数
configService.send();
/**
 * 读取XML配置文件成功后的回调函数
 */
private function configService_resultHandler(event:ResultEvent):void{
    var configXML:XML = XML(event.result);
    configXML.port
}

XML格式

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <port>http://192.168.9.180:8080/suizhou_visit/messagebroker/amf</port>
</config>

 

posted on 2013-05-22 10:46  看天空的星星  阅读(259)  评论(0编辑  收藏  举报

导航