I’ve stumbled across an interesting error today:
Using the Object.watch can result in a crush of the Flash 7.0 / 7.2 IDE, the Flash 7 stand alone player, and the browser. Apparently this will happen when trying to delete all the properties of an object after one of its properties was assigned to an Object.watch method.


I have tried the script below, at my work, on six different Flash 7.2 machines and two 7.0 machines, all gave the same result of crushing the IDE. If you’ll be able to compile a SWF out of it, it’ll also crush Flash player 7. I have’nt managed to reproduce the error in Flash 8 though, IDE and Player. And sometimes even on Flash 7 it ran as expected without crushing, but, most of the time it’ll crush.
This code will probably crush you’r Flash mx 2004 IDE:
var o = new Object();
o.val = 123;
o.watch(“val”, callFunc);
o.val = 555;
function callFunc(prop, oldVal, newVal){
 trace(“watched”);
 //o.unwatch(prop);
 clearObject();
 return newVal;
}
function clearObject(){
 for(var i in o){
  trace(“o: ” + o[i]);
  delete o[i];
 }
}
Click on the ball to crush it…
If you first can’t get a crush out of it, open and close it a few times.
Related posts:
presizo desse prrogrma
[...] Synchronous: Which mean you can return a value from a Javascript function into flash and vice versa. If you ever used flash-to-javascript communication before flash 8, you’ll understand how useful this is. On previous versions of Flash this couldn’t be done. In order to receive data from javascript, we had to call a javascript setVariable, and that only worked on Object’s/MovieClip’s dynamic properties, and then we had to watch / wait for the data that was written into the MovieClip’s property to arrive to Flash. As opposed to now, communication was asynchronous, the data just wasn’t available instantly, and since the Object.watch sux so much in Flash 7. onEnterFrame or intervals had to be used. (I’ll admit that the Object.watch can be suitable in simple cases, though) [...]
[...] I’ve just came across of a way to kill the Flash player with a few lines of AS 2.0. I know of at least one other way of killing the Flash player along with it’s host, may it be the browser or the Flash IDE, but this was with the old 7th player, this time we’re talking about the latest 9th version. It’s a little awkward, and don’t ask me how I got it, but, it involves a MovieClip, a TextField, Selection, Macromedia’s Delegate, a filter, and a trace, yeah, it won’t work without a call to trace. I think the main trouble maker is the Selection.onSetFocus, but, I couldn’t recreate it without any of the above ingredients, and I have a feeling that AS2’s trace is also problematic in Flash Player 9. (You should anyway “Omit trace actions”, from the settings, when publishing swfs) [...]
[...] had also written about 2 reproducible ways to crash the player, both were fixed by Adobe since then. I don’t remember how fast the fixes were issued [...]