我收到错误:
flash error 1061:调用可能未定义的方法addlistener 通过静态类型类的引用
我是新手,所以我不确定是什么问题。这个想法是,当用户不在场景1中移动鼠标时,动画将进入并播放场景A(一个在场景1之前)。
以下代码是我尝试过的:
trace("STARTING");
var nStartTime: Number;
var nTimeout: Number = 10;
var nTimerInterval: Number;
var bTiming: Boolean;
nTimerInterval = setInterval(runTimer, 50);
var oMouseListener:Object = new Object();
oMouseListener.onMouseMove = function()
{
trace("THERE IS MOUSE ACTIVITY");
nStartTime = getTimer();
bTiming = true;
};
Mouse.addListener(oMouseListener);
function runTimer(): void
{
if (bTiming)
{
var timePassed = getTimer()-nStartTime;
trace(timePassed/1000);
if (timePassed/1000> nTimeout)
{
gotoAndPlay("1, Scene `enter code here`a");
trace("USER HAS BEEN INACTIVE FOR "+nTimeout+" SECONDS");
bTiming = false;
}
}
}