[]Laya.Pool.getItemByClass 闪退

var fish:CFFish = Laya.Pool.getItemByClass(type,CFFish) as CFFish
console.log(fish)
fish.visible = true
fish.init(type)
调用init方法时候闪退,错误信息是
"fish.init is not a function"
"TypeError: fish.init is not a function
at Function.CFSprite.reusableFishWithType (file:///Users/heboyce/Desktop/Work/Web/CatchFish/bin/js/common/CFSprite.js:28:14)
at GameView.addFinsh (file:///Users/heboyce/Desktop/Work/Web/CatchFish/bin/js/GameView.js:39:29)
at GameView.onLoop (file:///Users/heboyce/Desktop/Work/Web/CatchFish/bin/js/GameView.js:83:26)
at TimerHandler.__proto.run (file:///Users/heboyce/Desktop/Work/Web/CatchFish/bin/libs/laya.core.js:9624:45)
at Timer.__proto._update (file:///Users/heboyce/Desktop/Work/Web/CatchFish/bin/libs/laya.core.js:9357:16)
at Stage.__proto.render (file:///Users/heboyce/Desktop/Work/Web/CatchFish/bin/libs/laya.core.js:18228:15)
at Stage.__proto._loop (file:///Users/heboyce/Desktop/Work/Web/CatchFish/bin/libs/laya.core.js:18186:8)
at loop

CFFish的init方法如下

public init(type:string):void{
this.type = type
}
已邀请:

Apple

赞同来自:

console.log(fish) 输出的是什么

要回复问题请先

商务合作
商务合作