You need a bind.
Event.observe(oneElement , 'click', function(){
this.one_method()
}.bind(this));
-B
On Oct 19, 7:02 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> hi boys;
>
> i have a problem with Event.observe .
> i want to assing onclick event into a declaration object.
> something like :
> =======================================================
> miG = Class.create();
> miG.prototype = {
> // ........................................
> initialize: function( oneElement )
> {
> Event.observe( oneElement , 'click', this.one_method ) <-----
> problem at runtime, this is loss
> } ,
> // ........................................
> one_method: function (e) {
> do something ...... .. . . ..
> }
>
> } // end class
>
> o_miG=new miG( $('oneDiv') );
> =======================================================
>
> the problem is the "THIS" object i loss at runtime , any idea ?
>
> thks, all.
>
> regards form spain.
> albert.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---