I discovered a funny pheno, which I don't know anyone else has stated
this before.
Say I define a class:

function Cat(){
     this.color = "yellow";
}

Cat.prototype.showColor = function(){
     alert(this.color)
}

Cat.prototype.init(){
     Event.observe("button", "click", this.showColor);
}
////////////////////////////
Now if i do elsewhere,
var cat = new Cat();
Cat.init();
then you click on "button", and you will see the color is undefined
(instead of showing yellow); the observation of events seemed to make
the function lost it's scope.
I have a way to work around this but I would like to listen to what
the developers may think.
Thanks! Prototype is a great package and I love it.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to