Function.toString( ) Method | Flash 5 |
returns a string representation of the function object |
A string representing the function object.
The toString( ) method returns a string describing theFunction. By default, all functions return the string "[type Function]". Checking the return value of toString( ) can be useful during debugging, as it distinguishes function objects from other objects. The instanceof and typeof operators can also be used to determine the datatype of a Function object. For example:
function moveClipTo (newX, newY) { this._x = newX; this._y = newY; } trace(moveClipTo.toString()); // Displays: [type Function] trace(typeof moveClipTo); // Displays: function trace(moveClipTo instanceof Function); // Displays: true
To provide a more descriptive return value for toString( ), you can override the toString( ) method for the function:
moveClipTo.toString = function () { return "moveClipTo function"; }; trace(moveClipTo.toString()); // Displays: moveClipTo function
instanceof, Object.toString( ), typeof