[]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
}
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
}
没有找到相关结果
已邀请:
要回复问题请先登录
1 个回复
Apple
赞同来自: