flex与java通信 实现动态birdeye

本文探讨了使用Flex的Birdeye组件时遇到的问题:自定义节点双击事件未能触发。作者尝试通过XML配置监听器并定义处理函数,但未见效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

大家好,我是个javaer,现在项目需求有个flex拓补图,我用的是birdeye.查找了半天,找到了相关源码

protected function nodeDoubleClick(e:MouseEvent):void {
var comp:UIComponent;
var vnode:IVisualNode;

/* get the view object that was klicked on (actually
* the one that has the event handler registered, which
* is the VNode's view */
comp = (e.currentTarget as UIComponent);

/* get the associated VNode */
vnode = lookupNode(comp);
currentNodeId = vnode.node.id;
//Alert.show(currentNodeId.toString(),"提示");
var evt:VisualNodeEvent = new VisualNodeEvent(VisualNodeEvent.DOUBLE_CLICK, vnode.node,e.ctrlKey);
dispatchEvent(evt);
//LogUtil.debug(_LOG, "double click!");

/* Now we change the root node, we go through
* our public setter method to get all associated
* updates done. */
this.currentRootVNode = vnode;
//Alert.show("测试双击1","提示");
//trace("测试双击");
//LogUtil.debug(_LOG, "currentVNode:"+this.currentRootVNode.id);

/* here we still want to implicitly redraw */
draw();
}

这是节点双击事件,其中分发了visualnode双击事件

var evt:VisualNodeEvent = new VisualNodeEvent(VisualNodeEvent.DOUBLE_CLICK, vnode.node,e.ctrlKey);
dispatchEvent(evt);

以上birdeye源码到里应该很清楚怎么做了
我在传入所需xml字符串里的节点增加监听命令,然后添加方法

"<Node id=\"1\" name=\"wwww\" nodeDoubleClick=\"testdouble(event)\" nodeColor=\"0xaf3a99\" nodeSize=\"30\" nodeIcon=\"center\" />"

protected function testdouble(event:VisualNodeEvent):void
{
//将节点id传给java然后再组成新的xml字符串传给flex,应该就可以实现了动态的birdeye
Alert.show(event.node.id.toString(),"rjfi");

}



问题是testdouble没有响应,没有alert,为什么?请flex兄弟给小弟解答一下,十分感谢!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值