Watch me bleed - Fatal error in Flash 7.0 / 7.2

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.

watch_error.jpg

watch_error_player.jpg

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];
 }
}

Download example.

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.

Guy A

Read more posts by this author.