2010-11-01 65 views
0

我想创建一个组件(从spark面板延伸),在按钮旁边应显示一个按钮(类似于弹出的泡泡或类似于当在Facebook/Twitter上的轮廓链接上悬停时,小盒子开放)。Flex - 在点击鼠标的位置显示面板

我试着创建一个组件,它实现了mx.core.IToolTip并提供了接口所需的方法。 并在toolTipCreate事件上,将此组件设置为工具提示。

这在一定程度上起作用。当我将鼠标放在按钮上时,面板将显示为工具提示,并在我移开鼠标时消失。

我需要的是,面板应该出现在按钮旁边的按钮上,并且只有当我在面板外单击或单击面板内存在的关闭按钮时才应该离开。

您能否就我如何进一步处理提出您的建议?

谢谢

回答

0
//on the first click... 
    addChild(mouseX , mouseY); 

    //or 
    component.x = mouseX; 
    component.y = mouseY; 

    //then tween alpha or make visible 
    component.visible = true; 

    //for the click outside , assuming parent is not null 
    if(event.currentTarget == this.stage || event.currentTarget == this.parent) 
    component.visible = false;