大家好,我是个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兄弟给小弟解答一下,十分感谢!