Card = function(value, suit, orientation, set) { MochiKit.Base.bindMethods(self);
^^ self isn't defined here. On Feb 4, 2008 10:54 PM, Akari no ryu <[EMAIL PROTECTED]> wrote: > > I have three files. > var deck = new Deck(); > loadPage = function() > { > var postRequest = new > MochiKit.Async.doSimpleXMLHttpRequest('deck.php', {'method':'post'}); > postRequest.addCallback( > function(request) > { > deck.load(request.responseXML); > } > ); > } > > function debug(obj) > { > str = "{"; > for(i in obj) > { > str+="\t"+i+":"+obj[i]+"+\n"; > } > str+= "}"; > logDebug(str); > } > > MochiKit.Signal.connect(window, 'onload', loadPage); > > which builds a Deck object from the class > > Deck = function() > { > this.set = null; > this.cards = []; > this.md = MochiKit.DOM; > } > > Deck.prototype.load = function(doc) > { > var xml = doc.documentElement; > this.set = xml.getAttribute('set'); > var cardNodes = xml.getElementsByTagName('card'); > for(i=0; i<cardNodes.length; i++) > { > card = new Card( > cardNodes[i].getAttribute('value'), > cardNodes[i].getAttribute('suit'), > cardNodes[i].getAttribute('orientation'), > this.set > ); > this.cards.push(card); > } > this.addCards(); > } > > Deck.prototype.addCards = function() > { > log("here") > } > > The load method of Deck should instantiate Card objects > > Card = function(value, suit, orientation, set) > { > MochiKit.Base.bindMethods(self); > this.md = MochiKit.DOM; > log(this); > this.value = value; > this.suit = suit; > this.orientation = orientation; > this.set = set; > } > > Card.prototype.getXMLString = function() > { > return '<card value="'+this.value+'" suit="'+this.suit+'" > orientation="'+this.orientation+'"/>'; > } > > Card.prototype.rotate=function() > { > this.orientation=(!this.orientation); > } > > Card.prototype.clone=function() > { > return new Card(this.value, this.suit, this.orientation, this.set); > } > > Card.prototype.getSuit = function() > { > return this.suit; > } > > But the log is reporting this, for the class, as Object Window, not > Object Object. I've been racking my brains over this one for a while > now. Any ideas? > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "MochiKit" group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~----------~----~----~----~------~----~------~--~---