Flash Adobe动画CC WebGL滚动状态
我正在创建一个WebGL画布,并尝试使用onmousemove片段为movieclip按钮创建一个滚动 首先,我将按钮的滚动状态设置为不可见,如下所示:Flash Adobe动画CC WebGL滚动状态,flash,onmousemove,animate-cc,Flash,Onmousemove,Animate Cc,我正在创建一个WebGL画布,并尝试使用onmousemove片段为movieclip按钮创建一个滚动 首先,我将按钮的滚动状态设置为不可见,如下所示: this.YesHOT.setVisible(false); 然后,我使用onmousemove功能在按钮上方旋转使其可见,如下所示: canvas.onmousemove = function(e) { var boundingRect = this.Yes.getBounds(this); if(isMouseOverS
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;
}
canvas.onmousemove=函数(e){
var boundingRect=this.Yes.getBounds(this);
如果(isMouseOverSymbol(e.offsetX,e.offsetY,boundingRect)){
this.yesshot.setVisible(true);
}
}.约束(本);
//函数检查指定点是否位于矩形内。
函数isMouseOverSymbol(pointX、pointY、rect){
如果(rect.left您从未真正调用过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);
您从未真正调用过this.yesshot.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);