[LayaAir 2.0]Laya.timer.loop() 报错 Cannot read property 'loop' of null

import { Image } from "laya/ui/Image";
// import { List } from "laya/ui/List";
import { Laya } from "laya";

export default class test_move extends Image{
// /** @prop {name:move_img, tips:"用来移动的箭头", type:Image} */
// public _move_img: Image;
// public _list: List; //创建一个 List 类的实例对象 list 。
private n:number = 0;
private x0:number = 0;
private y0:number = 0;

constructor(){super();}

onEnable():void{
this.x = this.x0;
this.y = this.y0;
Laya.timer.loop(20, this, this.frameWork); // 每 20 ms 执行一次
}

private frameWork():void{
this.y = this.y0 + 10 * (this.n % 3);
alert("move ");
}

}
代码放在一个 Image 组件的 runtime 中,实现图片的循环移动,但是 这句代码 :
Laya.timer.loop(20, this, this.frameWork);
报错,”Uncaught TypeError: Cannot read property 'loop' of null“
希望各位大佬帮忙看下,本人初学菜鸟,实在是不知道哪里有问题,多谢多谢!
已邀请:

要回复问题请先

商务合作
商务合作