0

嗨,这段代码在移动符号(经典补间)上运行良好

var frequency = 3;
stage.enableMouseOver(frequency);
this.movieClip_1.addEventListener("mouseover", fl_MouseOverHandler_9);

function fl_MouseOverHandler_9()
{
    alert("Moused over");
  // this.gotoAndStop(41);
}

但如果我替换为 this.gotoAndStop(41); 这没用

4

1 回答 1

0

事件目标是可访问的(将在事件处理程序参数对象中传递),如下所示:

this.movieClip_1.addEventListener("mouseover", fl_MouseOverHandler_9);

然后在处理函数中:

function fl_MouseOverHandler_9(evt)
{
  // "evt.currentTarget" represents the event-trigger
   evt.currentTarget.gotoAndStop(41);
}

或者您可以将所需 MC 的范围传递给事件处理程序:

this.movi​​eClip_1.addEventListener("mouseover", fl_MouseOverHandler_9.bind(this.movi​​eClip_1));

然后在处理函数中:

    function fl_MouseOverHandler_9(evt)
    {
      // "evt.currentTarget" still represents the event-trigger
      // evt.currentTarget.gotoAndStop(41);

      //but now you can access the referenced scope with "this"

      this.gotoAndStop(41);



    }

干杯迈克

于 2016-09-01T15:11:20.397 回答