xmlConnector + MenuBar 菜单

 使用actionScript写过
[url=http://www.webstudio.com.cn/forum/showthread.php?t=180]
[color="#003366"]menubar+xml[/color]
[/url]
菜单后,使用xmlConnector组件也应当可以做到同样的效查果,经过一系的绑定和代码编写,发现通过直接用绑定的方式好像是不能实现点击打开相应的链接,也许有可能是我没有发现吧,
[img]/Files/BeyondPic/2006-11/16/smile.gif[/img]
仍需要编写一部分代码。经过最优化后。代码如下:
xmlConnector + MenuBar 菜单
代码://copyright by webstudio.com.cn 2005.4.9
xmlConnector.trigger();
//定义侦听事件
var res = function (evt) {

trace("sart run");
//定义menuBar侦听事件
var myObj= new Object();
myObj.change = function(event) {
/*
trace(event.menuBar);
trace(event.menu);
trace(event.menuItem);
trace(event.menuItem.attributes.data);
trace(myArray);
*/
//需将event.menuItem.attributes.data付值,否则会出现undifind.
xpar=event.menuItem.attributes.data;
//打开相应的链接。
myMenubar.getURL(xpar,"_blank");

};
myMenubar.addEventListener("change",myObj);
trace(evt.target.results);
};
//使用xmlConnector.result进行广播,有许多人使用results,它应是能取到结果值,在这里是行不通的。
xmlConnector.addEventListener("result", res);
演示:
BTW:有一点是可以肯定的使用代码编写的要比用组件编写小的多。这可能就是程序员的价值所在吧!
[img]/Files/BeyondPic/2006-11/16/biggrin.gif[/img]
如何绑定xml请参看本站的
[url=http://www.webstudio.com.cn/tutorial/show.php?id=15]
[color="#003366"]flashmx2004数据绑定教程[/color]
[/url]
上传的附件
[img]/Files/BeyondPic/2006-11/16/rar.gif[/img]
[url=http://www.webstudio.com.cn/forum/attachment.php?attachmentid=53]
[color="#003366"]menubarxml.rar[/color]
[/url]
(210.9 KB, 122次查看)
本文转自:http://www.5uflash.com/flashjiaocheng/Flashdonghuajiaocheng/2029.html
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值