macromedia flash actionscript scripting, php, remoting, webservices, c#, javascript
// Example 1(without toString)Car = function (pHexColor) { this.hexColor = pHexColor;}objAudi = new Car();trace(objAudi); // output: [object Object]// Example 2(with toString)Car = function (pHexColor) { this.hexColor = pHexColor;}Car.prototype.toString = function () { return '[object Car]';}objAudi = new Car();trace(objAudi); // output: [object Car]
So the difference is the Information we get// Example 3Car = function (pHexColor) { // unique-id this.intId = ++arguments.callee.intGeneratedObjects; this.hexColor = pHexColor;}// class-property or static-propertyCar.intGeneratedObjects = 0;Car.prototype.strClassName = 'Car';Car.prototype.toString = function () { return '[object '+this.strClassName+this.intId+']';}objAudi = new Car();trace(objAudi); // output: [object Car1]
Now lets see how easy it is to store our object in// create the listener-hashhashListeners = new Object();// store our object as listenerhashListeners[objAudi] = objAudi;// delete our object from the listener-hashdelete hashListeners[objAudi];
OK, that was not really a big deal, Posted by hOk at April 17, 2003 12:52 PM
Comments (0)
|
You can use <code>code that should be highlightned</code> to highlight code! Optionally you can use the attribut language="php|perl|java" within the code tag, otherwise actionscript-highlightning will be used. |
