javascript - creating new property - JS / Edge Animate -
i trying create property of object can access function. i've been trying figure out dot / bracket notation i'm not getting it. 1 of please me figure how make objects state readable function.
function twophaseswitch(object,state) { var obj = $(object); stage.getsymbol(obj).stop(state); obj.click(function(e) { if(obj.state == 'off') { stage.getsymbol(obj).stop('on'); obj.state = 'on'; }else{ stage.getsymbol(obj).stop('off'); obj.state = 'off'; }; }); }; function conditionsarray(obj) { (var i=obj.length;i--;) { alert(obj[i].state); }; };
i'm not sure if correct answer works. ended using jquery's .data() call.
//in switch function obj.data('state',state); //in conditionarray alert($(obj[i]).data('state'));
Comments
Post a Comment