I'm writing a behavior that works with sprites. The behavior needs to access the sprite's curFrame object. In reading the docs, it seems the way to get to this is via inst.inst. However, when I try to access this.inst.inst, it says it is undefined. Can anyone tell me what I'm missing?
Thanks!
Try this.inst.curFrame instead.
Hah! I swear I tried that and it didn't work, except now it does. Thanks!
However, my original question still stands. In the event that it is needed, how does one use inst.inst?
Develop games in your browser. Powerful, performant & highly capable.
Do you get this.inst in on create function? It has not been created at that monument yet.
— maybe try setTimeout(fn,0);
Example from pointerpos behavior where this.inst.elem isn't defined yet.
behinstProto.onCreate = function(){ var self = this.inst; setTimeout(function(){ self.elem['onselect'] = function(){ ... }; },0); }; [/code:1d0dx5fe]
I've tried it several places, all outside of on create.
To reproduce:
It seems like this might be a bug!
Ok, you might try to get it by expression of sprite, like that
http://c2plugins.blogspot.tw/2014/02/reuse-ace.html