Say you have a stage with a rectangular background that is the size of the stage [This is just to make it obvious that the screen shaking work], frame rate of document is 60fps.
And a button, the button name is "btn_mc".

On frame 1 of the main timeline, I enter this:

btn_mc.onEnterFrame = function():Void
{
function shake()
{
shakex = random(20) - 10;
shakey = random(20) - 10;
shakex *= 0.7;
shakey *= 0.7;
if (shakex < 1 && shakey < 1)
{
_root._x = 0;
_root._y = 0;
}
}
setInterval(shake,100);
_root._x -= shakex;
_root._y -= shakey;
};

Test movie, wow it looks so good !
I tried porting it to AS3 but the screen didn't shake, anyone here that can help ?