How do I make the browser window shake?

Hello! :afro:
I’ve seen people use this before with flash websites. I have a flash movie that has an ambient sound building up and then a big beat, on that beat i want the browser window to shake, any body know the AS/Javascript i can put into my movie to achieve this effect?

Pweez help

Thanks in advance :slight_smile:

the entire browser or just your inside flash?

if you want your whole browser to shake… maybe something like:


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT LANGUAGE="JavaScript1.2">
<!-- Begin
function shake(n) {
if (parent.moveBy) {
for (i = 10; i > 0; i--) {
for (j = n; j > 0; j--) {
parent.moveBy(0,i);
parent.moveBy(i,0);
parent.moveBy(0,-i);
parent.moveBy(-i,0);
         }
      }
   }
}
// End -->
</script>

</head>

<body>
//flash script here :D
</body>
</html>

otherwise have your main swf inside just do the same thing with AS :smiley:

~ Lacuna :love:

hmmmm that doesnt work :S what i really want to do is insert some Actionscript into a certain keyframe on my timeline where i want the effect to happen…

Yer I need to be able to do that, anyone know a script for it?

Put this on your HTML page :

 
<SCRIPT LANGUAGE="JavaScript1.2">
				 <!-- This script and many more are available free online at -->
				 <!-- The JavaScript Source!! [http://javascript.internet.com](http://javascript.internet.com/) -->
				 <!-- Modified by Flash kit [http://www.flashkit.com](http://www.flashkit.com/) -->
				 function shake_xy(n) {
				 if (self.moveBy) {
						 for (i = 10; i > 0; i--) {
								 for (j = n; j > 0; j--) {
								 self.moveBy(0,i);
								 self.moveBy(i,0);
								 self.moveBy(0,-i);
								 self.moveBy(-i,0);
							 }
						}
					 }
				 }
				 function shake_x(n) {
				 if (self.moveBy) {
						 for (i = 10; i > 0; i--) {
								 for (j = n; j > 0; j--) {
								 self.moveBy(i,0);
								 self.moveBy(-i,0);
							 }
						}
					 }
				 }
				 function shake_y(n) {
				 if (self.moveBy) {
						 for (i = 10; i > 0; i--) {
								 for (j = n; j > 0; j--) {
								 self.moveBy(0,i);
								 self.moveBy(0,-i);
							 }
						}
					 }
				 }
				 //-->
				 </SCRIPT>

You can then call this function from any frame of your flash movie :
getURL (“javascript:shake_xy(2)”);

Credits to :
http://www.michael-thomas.com/tech/flash/examples/ex_flashcalljs.html