LinkButton 鼠标事件问题
你好 我有 2 个 mxml 文件,其中 ....
CustComp.mxml
<mx:LinkButton id="linkbutton" label="ClickMe" click="onLinkClicked()" mouseOver="onMouseOver()" mouseOut="onMouseOut()" />
private function onLinkClicked():void{
dispatchEvent(new CustomEvent("onClick");}
private function onMouseOver(event:CustomEvent):void{
dispatchEvent(new CustomEvent("onMouseOver");}
private function onMouseOut(event:CustomEvent):void{
dispatchEvent(new CustomEvent("onMouseOut");}
Main.mxml
var customComp:CustComp = new CustComp();
customComp.addEventListener(CustomEvent.MOUSE_CLICK1,onLinkClicked111);
customComp.addEventListener(CustomEvent.MOUSE_OVER1,onMouseOver111);
customComp.addEventListener(CustomEvent.MOUSE_OUT1,onMouseOut111);
private function onLinkClicked111(event:CustomEvent):void{
trace("click event");}
private function onMouseOver111(event:CustomEvent):void{
trace("mouse over event");}
private function onMouseOut111(event:CustomEvent):void{
trace("mouse out event");}
当我将鼠标悬停在组件中的链接按钮上或将鼠标移开时,事件将被分派到 main.mxml,并且相应的函数将被完美调用。但是当我单击按钮时, onLinkClicked111() 函数会被调用一次,并且 onMouseOut111() 和 onMouseOver111() 会被重复调用,直到我使光标从链接按钮上移开。 请帮助我,我应该做什么来确保当我单击时,只调用 onLinkclicked111() 函数而不是 mouseOver111() 或 mouseOut111()
Hi
I have 2 mxml files in which ....
CustComp.mxml
<mx:LinkButton id="linkbutton" label="ClickMe" click="onLinkClicked()" mouseOver="onMouseOver()" mouseOut="onMouseOut()" />
private function onLinkClicked():void{
dispatchEvent(new CustomEvent("onClick");}
private function onMouseOver(event:CustomEvent):void{
dispatchEvent(new CustomEvent("onMouseOver");}
private function onMouseOut(event:CustomEvent):void{
dispatchEvent(new CustomEvent("onMouseOut");}
Main.mxml
var customComp:CustComp = new CustComp();
customComp.addEventListener(CustomEvent.MOUSE_CLICK1,onLinkClicked111);
customComp.addEventListener(CustomEvent.MOUSE_OVER1,onMouseOver111);
customComp.addEventListener(CustomEvent.MOUSE_OUT1,onMouseOut111);
private function onLinkClicked111(event:CustomEvent):void{
trace("click event");}
private function onMouseOver111(event:CustomEvent):void{
trace("mouse over event");}
private function onMouseOut111(event:CustomEvent):void{
trace("mouse out event");}
When i am making a mouse over or mouse out on link button in component,the event is getting dispatched to main.mxml and respective functions are getting called perfectly.But When i click the button, onLinkClicked111() function is called once and onMouseOut111(), onMouseOver111() are repeatedly getting called until i make my cursor move away from link button.
Please help me out as what should i do to make sure that when i click, only onLinkclicked111() function should get called not mouseOver111() or mouseOut111()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定您真正需要什么,但这是简化的示例
Not sure what you really need, but here is simplified example