I'm puzzled by this:
Why can't I re-assign a new value to a String instance using a custom constructor method? It seems that the following code should work, but it fails every time. (MX 2004)...
Any ideas? Essentially, I want to be able to alter the instance of String internally just like the behavior of the Array.splice() method.Code:function extendString() { String.prototype.replaceValue = function(newValue:String) { this = newValue; }; } extendString(); var myString = "this is the initial string value"; myString.replaceValue("this is the changed string value"); // myString should now have a different value, but it doesn't! // the following works, but is NOT self-contained: // myString = myString.replaceValue("this is the changed string value");
+Q__


Reply With Quote