【问题标题】:Adobe Animate CC WebGL rollover stateAdobe Animate CC WebGL 翻转状态
【发布时间】:2016-10-20 08:08:24
【问题描述】:

我正在创建一个 WebGL 画布,并且我正在尝试使用 onmousemove sn-p 为影片剪辑按钮创建一个翻转。

首先我将按钮的翻转状态设置为不可见,如下所示:

this.YesHOT.setVisible(false);

然后我使用 onmousemove 函数打开它,使其在按钮上方时可见:

canvas.onmousemove = function(e) { 
    var boundingRect = this.Yes.getBounds(this);
    if(isMouseOverSymbol(e.offsetX, e.offsetY, boundingRect)) {    
        this.YesHOT.setVisible(true);
    }
}.bind(this);

//Function to check whether the specified point lies within the rect.
function isMouseOverSymbol(pointX, pointY, rect) {
    if(rect.left <= pointX && pointX <= rect.left + rect.width)
        if(rect.top <= pointY && pointY <= rect.top + rect.height)
            return true;
    return false;
}

这可行,但翻转状态保持可见并且不会关闭。如何让它重新关闭?

【问题讨论】:

    标签: flash onmousemove animate-cc


    【解决方案1】:

    您从未真正拨打过this.YesHOT.setVisible(false) 电话。如果我理解你的意图,代码应该是这样的:

    canvas.onmousemove = function(e) { 
        var boundingRect = this.Yes.getBounds(this);
        // if mouse cursor is over the "hot" area, show effect. Otherwise hide.
        this.YesHOT.setVisible(isMouseOverSymbol(e.offsetX, e.offsetY, boundingRect));
    }.bind(this);
    
    // also hide the effect when mouse completely leaves the canvas
    canvas.onmouseleave = function () {
        this.YesHOT.setVisible(false);
    }.bind(this);
    

    【讨论】:

      猜你喜欢
      • 2017-11-11
      • 2019-06-28
      • 2018-09-26
      • 1970-01-01
      • 2019-02-26
      • 1970-01-01
      • 2019-10-23
      • 2018-07-23
      • 1970-01-01
      相关资源
      最近更新 更多