Sorry, I forgot a line. The example should read:

var thisProxy = this;

$$(someClass).addEvent('click', function(){
        this.addClass('someOtherClass');
        thisProxy.someFunction();
});

On Sep 17, 3:06 pm, VirtuosiMedia <[EMAIL PROTECTED]> wrote:
> Is there a better way to do have multiple 'this' references inside an
> addEvent function? Right now I'm using a variable called thisProxy to
> refer the global this and the this inside the function will refer to
> that instance. I don't want to use bind because I need them both. Is
> there a more elegant method?
>
> Here's an example:
>
> var thisProxy = this;
>
> $$(someClass).addEvent('click', function(){
>         this.addClass('someOtherClass');
>         thisProxy.someFunction();
>
> });

Reply via email to