I'm making a plugin and in the edittime.js i'm using AddObjectParam to add a object to my action. Then in runtime.js in the action function i would like to be get the object width and height. I could only fine the following method as a reference.
var inst = this.runtime.createInstance(obj, layer,parseInt(temp[0]),parseInt(temp[1])); var width = inst.width; var height = inst.height;
I would like to not have to create a instance of the object to just get the width and height.
Develop games in your browser. Powerful, performant & highly capable.
All instances have width and height properties - why not just access the ones from the object type given to you in the parameter?
Ashley
I tried
var width = obj.width;
var height = obj.height;
and i got a assertion failure. I think i'm still not doing something wrong.
I just figured it out.
var width = obj.instances[0].width;
var height = obj.instances[0].height;
THANK YOU!!!
AddObjectParam is to get the "type", not an instance. See the structure of "type" in firebug for more detail.