Hi,
Check it carefully for typos. For instance, your original had
> ReadHash.prototyte = {
Where you probably meant
> ReadHash.prototype = {
Of course, this will have changed anyway if you're updating things in
line with Kangax's help; I'm just saying, if it's not working, perhaps
there's a typo in the new version as well...
FWIW.
--
T.J. Crowder
tj / crowder software / com
On Jun 8, 8:43 am, aljvilla <[EMAIL PROTECTED]> wrote:
> Hello kangax thank you for your input
> I am using the version scriptaculous-js-1.8.1
> I probe with your example and continues to give me the same mistake
>
> On 7 jun, 22:12, kangax <[EMAIL PROTECTED]> wrote:
>
> > Are you using 1.6+ ?
> > The correct syntax for defining a "class" has changed since 1.5:
>
> > var ReadHash = Class.create({
> > initialize: function(data){
> > this.data=data;
> > },
> > read: function(){
> > this.data.each(function(pair) {
> > alert(pair.key + ' = "' + pair.value + '"');
> > });
> > }
>
> > });
>
> > var ReadMyData = Class.create(ReadHash, {
> > initialize: function(data){
> > this.data=data;
> > }
>
> > });
>
> > var TestReadHash = new ReadMyData($H({ var1: 'foo1', var2: 'foo2' }));
> > TestReadHash.read(); // works as expected
>
> > Hope this helps.
>
> > P.S. please, post futher question at support mailing
> > listhttp://groups.google.com/group/rubyonrails-spinoffs. This one is
> > development related.
>
> > Best,
> > kangax
>
> > On Jun 7, 9:09 pm, aljvilla <[EMAIL PROTECTED]> wrote:
>
> > > I created this function to read a hash,
>
> > > var ReadHash = Class.create();
> > > ReadHash.prototyte = {
> > > initialize: function(data){
> > > this.data=data;
> > > },
> > > read: function(){
> > > this.data.each(function(pair) {
> > > alert(pair.key + ' = "' + pair.value + '"');
> > > });
> > > }};
>
> > > var ReadMyData = Class.create();
> > > ReadMyData.prototype = Object.extend(new ReadHash(),{
> > > initialize: function(data){
> > > this.data=data;
> > > }});
>
> > > var TestReadHash = new ReadMyData($H({ var1: 'foo1', var2: 'foo2' }));
> > > TestReadHash.read();
>
> > > the problem is that it does not recognize the function
> > > TestReadHash.read ();
> > > It would be helpful if detected the error and spend 4 hours reviewing
> > > and not to understand that I am wrong
> > > thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype: Core" 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/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---