繁体   English   中英

Flash AS3过渡和带有ClickTag的按钮

[英]Flash AS3 rollover and button with ClickTag

我有一个带有ClickTag和悬停功能的横幅。

我的问题是,由于悬停功能,用户无法单击按钮。

我的代码用于ClickTag:

knap1.addEventListener(MouseEvent.CLICK, ADFclicked);

function ADFclicked(event:MouseEvent) { AdfURLNavigator.navigateToUrl( AdfFlashVarsUtil.getParameter("clickTAG"), AdfFlashVarsUtil.getParameter("landingPageTarget")); }

对于悬停功能:

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;
}

有人可以帮忙吗?

我想假设看不到整个代码,但是btn对象覆盖了knap1对象,因此您无法单击btn下面的任何内容。

如果要在整个横幅上都具有悬停功能,请尝试使用MOUSE_LEAVE事件检测鼠标离开,然后使用MOUSE_MOVE跟踪鼠标离开后是否又回到Flash对象上。 至于MOUSE_MOVE事件,您可以在stage上添加侦听器以检测鼠标移动,而无需任何其他容器。

嘿,您正在使用mousevent进行悬停并单击一次。 因此最好删除addeventlistener并将鼠标悬停在按钮中以内联方式编写。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM