I just realized how faulty with() is in Flash. Well, I knew that it is faulty but I didn’t know that it has an affect on the super Object. Here’s an example:
SuperClass = function(){};
SuperClass.prototype.init = function(){
trace(”SuperClass: init“);
}
SubClass = function(){};
SubClass.prototype = new SuperClass();
SubClass.prototype.init = function(){
trace(”SubClass: init“);
super.init();
}
myObj = new SubClass();
with(myObj){
init();
}
The output is:
SubClass: init
and not like expected:
SubClass: init
SuperClass: init
If you replace the with call with the following code the script works properly:
myObj.init();
