I'm having trouble getting the following code to work properly. Every time I try to access the private testing variable from the priveleged MyMethod it gives an error. Says it can't find testing and that it has no properties so I can't run a push() command on it.
Code:function MyClass() { var testing = new Array(); // define the method function MyMethod() { this.testing.push("hello"); } // make the method priveledged this.MyMethod = MyMethod; } // a test function it ensure the variables declared here are isolated function Start() { var myClass = new MyClass(); myClass.MyMethod(); document.write("[" + myClass.testing + "]"); } Start();


Reply With Quote


Bookmarks