flash不同按钮控制不同的链接,xml中加载链接地址

一、xml中的内容:

<?xml version="1.0" encoding="utf-8"?>
<allurl>
 <urla>http://www.163.com</urla>
 <urlb>http://www.qq.com</urlb>
 <urlc>http://www.sina.com</urlc> 
</allurl>

二、flash中有三个按钮,分别命名为_btn1、_btn2、_btn3

三、flash时间轴上写:

var _xml:XML = new XML();
_xml.ignoreWhite = true;
_xml.onLoad = function(success) {
 if (success) {
  var url1:String = this.firstChild.childNodes[0].firstChild.nodeValue;
  var url2:String = this.firstChild.childNodes[1].firstChild.nodeValue;
  var url3:String = this.firstChild.childNodes[2].firstChild.nodeValue;
  _btn1.onRelease = function() {
   getURL(url1);
  };
  _btn2.onRelease = function() {
   getURL(url2);
  };
  _btn3.onRelease = function() {
   getURL(url3);
  };
 }

};
_xml.load("起码.xml");

       在flash5下 action 3.0测试成功

posted @ 2012-11-22 09:23  chinaifne  阅读(186)  评论(0编辑  收藏  举报