Crash Flash in 4 lines of code (more fun than a barrel of monkeys)

Four lines of code are all you need to freeze Flash solid! :) This discovery is brought to you courtesy of a simple flaw in logic.

Warning: Don't try this in the IDE unless you want to restart it. At least publish it for your browser so you'll only have to restart that.

Symptoms: No script timeout message, 100% CPU.

Instructions: Make sure you have a dynamic textfield on stage with the descriptive instance name of "t" and add the following code on to the same frame.
ActionScript:
  1. t.autoSize = true;
  2. t.text = "I love a good crash!";
  3. for (i = 0; i < 100; i++ )
  4. {
  5. t.text += t.text;
  6. }
There was a thread a while back on Flashcoders about different ways to freeze/crash Flash (or was it for bringing up the script timeout message, I can't remember?) I don't know if this was covered there or not as I can't seem to find the thread in the archives.

Comments