flash action 3.0脚本:如何给按钮添加xml数据链接)

import flash.external.ExternalInterface;

var myXml:XML;
var loader:URLLoader=new URLLoader();
var url=new URLRequest("Link.xml");

loader.load(url);
loader.addEventListener(Event.COMPLETE,loadxml);
//设置flash全屏
stage.scaleMode=StageScaleMode.EXACT_FIT;

function loadxml(event:Event){
 myXml=new XML(loader.data);
 myXml.ignoreWhitespace=true;
 ExternalInterface.call(myXml.child(11).child("value"),"ActionScript 3.0 Cookbook");
 ExternalInterface.call(myXml.child(10).child("value"),"ActionScript 3.0 Cookbook");
  //ExternalInterface.call("hello","ActionScript 3.0 Cookbook");
 //trace(myXml);
}
//仓库
btnck.addEventListener(MouseEvent.CLICK,ck);
function ck(event:MouseEvent):void{
 trace(myXml.child(0).child("value"));
 navigateToURL(new URLRequest(myXml.child(0).child("value")),new String("_self"));
}
//外检
btnwj.addEventListener(MouseEvent.CLICK,wj);
function wj(event:MouseEvent):void{
 //trace(myXml.child(1).child("value"));
 navigateToURL(new URLRequest(myXml.child(1).child("value")),new String("_self"));
}
//董事长
btndsz.addEventListener(MouseEvent.CLICK,dsz);
function dsz(event:MouseEvent):void{
 trace(myXml.child(2).child("value"));
 navigateToURL(new URLRequest(myXml.child(2).child("value")),new String("_self"));
}
//销售部门
btnxs.addEventListener(MouseEvent.CLICK,xs);
function xs(event:MouseEvent):void{
 //trace(myXml.child(0).child("value"));
 navigateToURL(new URLRequest(myXml.child(3).child("value")),new String("_self"));
}
//生产内检
btnsc.addEventListener(MouseEvent.CLICK,sc);
function sc(event:MouseEvent):void{
 //trace(myXml.child(0).child("value"));
 navigateToURL(new URLRequest(myXml.child(4).child("value")),new String("_self"));
}
//财务部门
btncw.addEventListener(MouseEvent.CLICK,cw);
function cw(event:MouseEvent):void{
 //trace(myXml.child(0).child("value"));
 navigateToURL(new URLRequest(myXml.child(5).child("value")),new String("_self"));
}
//物流部门
btnwl.addEventListener(MouseEvent.CLICK,wl);
function wl(event:MouseEvent):void{
 //trace(myXml.child(0).child("value"));
 navigateToURL(new URLRequest(myXml.child(6).child("value")),new String("_self"));
}
//装配部门
btnzp.addEventListener(MouseEvent.CLICK,zp);
function zp(event:MouseEvent):void{
 //trace(myXml.child(0).child("value"));
 navigateToURL(new URLRequest(myXml.child(7).child("value")),new String("_self"));
}
//财务部门
btncg.addEventListener(MouseEvent.CLICK,cg);
function cg(event:MouseEvent):void{
 //trace(myXml.child(0).child("value"));
 navigateToURL(new URLRequest(myXml.child(8).child("value")),new String("_self"));
}
//财务部门
btnbh.addEventListener(MouseEvent.CLICK,bh);
function bh(event:MouseEvent):void{
 //trace(myXml.child(0).child("value"));
 navigateToURL(new URLRequest(myXml.child(9).child("value")),new String("_self"));
}

/Files/chinafine/BTNandTXT.rar

/Files/chinafine/XMLandBTN.rar

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