PDA

View Full Version : Flash MX Script Execution (Page Tremor/Shake)


SSL
04-12-2002, 12:55 AM
Hi there.

I have Dreamweaver pretty well under control, but I am a complete ignoramus when it comes to Flash.

I have converted a GIF animation to Flash, but I am unable to insert/execute a script on an exact frame during the movie.

I am trying to make the screen shake (as in the website for "3rd Rock" tv show: http://www.3rdrock.com/home.html) on exactly frame 70, but no combination of action scripts seem to have an effect.

I assume the tremor script goes in the HTML and an action script in Flash should trigger it. Am I close..?

Can anyone take pitty and help, or do I need to learn the whole program to get this to work?

Thank you very much (I hope).

JHallam
04-12-2002, 03:25 AM
Okay, well it's mostly done with JS and interactivity with Flash commands.

Stick this code in your HTML page with the SWF you want to interact. Make sure <SWLIVE tag in the embed of the SWF is TRUE

Then you call the JS with functions within Flash.

something like;

on (release) {
fscommand ("send_var", shake_xy);
}
something along them lines.

<SCRIPT LANGUAGE="JavaScript1.2">

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

//-->
</SCRIPT>