for anyone who may need this later, i found a work around (not yet
tested in ie):
this.setDelegate=function(v)
{
this.delegate =v;
v.me = this; //refernce back to this class, since we loose scope
in the callbacks
this.checked = v.checked;
$(v).bind("change",this.onChange)
};
this.onChange = function()
{
var val = 1;
(this.checked) ? val = 1 : val = 0;
this.me.swf.toggleProperty(this.me.group,this.me.prop,val);
};
On Nov 19, 2:47 pm, mlecho <saltlessbr...@gmail.com> wrote:
> i am trying to bring jQuery into a custom object... The object will
> manage some logic,callbacks, etc, by assigning a "delegate". In this
> case , it will be a checkbox
> function Toggler()
> {
> this.type = "toggler";
> this.name = null;
> this.delegate = null;
> this.group=0;
> this.checked="checked";
> this.setDelegate=function(v)
> {
> this.delegate =v;
> this.checked = v.checked;
> $(v).bind("change",this.onChange);
> } ;
> this.onChange = function()
> {
> console.log(this)
> };
> this.init = function(){
> }
> }
> my problem is where i "bind" the delegate in "setDelegate"...you can
> see i am trying to bring the handler back to the class that is
> wrapping "v" (the delegate. However, if i log the dispatcher of this
> event, i get not the class, but the delegate...is it possible to bring
> the scope back to the class??