Hmm, I don't think you should do this:
Viewer = new Viewer;
this will overwrite your class and you can't instantiate it again!

rather:

    initialize: function()
    {
        var self=this;
        $("#thumbs img:first").click(function(){
          self.doX()
        });
    },

or

    initialize: function()
    {
        var self=this;
        $("#thumbs img:first").click(function(){
          var el=this; //this is the element here
          (function(){
               this.doX();  //this refers to your object here
               $(el).something();
          }).call(self);
        });
    },

On Jan 4, 5:57 pm, "Alexandre Plennevaux" <[email protected]>
wrote:
> this worked for me:http://jsbin.com/utahi
>
> On Sun, Jan 4, 2009 at 5:31 PM, [email protected]
>
> <[email protected]> wrote:
>
> > function Viewer()
> > {
>
> > };
>
> > Viewer.prototype.constructor = Viewer;
>
> > Viewer.prototype =
> > {
> >    getFullAreaId: function() { return this._fullAreaId; },
> >    setFullAreaId: function(fullAreaId) { this._fullAreaId =
> > fullAreaId; },
>
> >    initialize: function()
> >    {
> >        $("#thumbs img:first").click(/* execute this.doX on mouse
> > click */);
> >    },
>
> >    doX: function()
> >    {
> >        alert(this.getFullAreaId());
> >    }
> > };
>
> > How can I make the click event execute the doX method?
>
> > Regards,
> > FatSlags2004

Reply via email to