我有一个带有ClickTag和悬停功能的横幅。
我的问题是,用户不能点击按钮,因为悬停功能。
我的代码是针对ClickTag的:
knap1.addEventListener(MouseEvent.CLICK, ADFclicked);
function ADFclicked(event:MouseEvent) { AdfURLNavigator.navigateToUrl( AdfFlashVarsUtil.getParameter("clickTAG"), AdfFlashVarsUtil.getParameter("landingPageTarget")); }而对于hover函数:
var holder:MovieClip = new MovieClip();
btn.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
btn.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
btn.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
function mouseOverHandler(e:MouseEvent):void{
//creating a new tooltip instance
var tooltip:Tooltip = new Tooltip();
//we tell the holder to hold our tooltip
holder = tooltip;
//positioning the tooltip on the stage
holder.x = 190;
holder.y = 280;
//adding the tooltip to the stage
addChild(tooltip);
}
function mouseOutHandler(e:MouseEvent):void{
//we remove the holder when the cursor is outside our button
removeChild(holder);
}
function mouseMoveHandler(e:MouseEvent):void{
holder.x = 190;
holder.y = 280;
}有人能帮上忙吗?
发布于 2013-11-18 21:19:43
我假设,在看不到完整代码的情况下,btn对象覆盖了knap1对象,所以您不能单击btn下面的任何内容。
如果你想在整个横幅上有悬停功能,尝试使用MOUSE_LEAVE事件来检测鼠标离开,并使用MOUSE_MOVE来跟踪鼠标离开后是否回到闪存对象上。对于MOUSE_MOVE事件,您可以在stage中添加侦听器来检测鼠标移动,而不需要任何额外的容器。
发布于 2013-11-22 16:45:08
嘿,你正在使用鼠标事件同时悬停和点击。所以最好删除addeventlistener,并将mouseover in按钮写成内联。
https://stackoverflow.com/questions/20048061
复制相似问题