Learn Flash FS Commands

Home Food Mates • Members Tutorials Forum Buy Templates Contact Us 

 


Flash Tutorials

   

Flash Tutorial - FS Commands

 

Free Flash Tutorial


Step 3    <<   Previous      Intro   1   2   3    >>       >>   Webwasp Mates

 

JavaScript Functions Used in this Tutorial

In the example above all individual JavaScript functions are in the Head tag except for one. The message that is displayed needs a small amount of additional information in the Body of the web page. Otherwise the Browser would not know where to display the message:

<a id="Words">You can add a start up message here that will show up when the page first loads.</a>

The following is the Java Script functions as listed in the head tag of this page:

<script language="javascript" type="text/javascript">
<!--

// LINKS FOR RANDOM FUNCTION
var links = new Array(4);
links[0] = "http://www.yahoo.com/";
links[1] = "http://www.google.com/";
links[2] = "http://www.altavista.com/";
links[3] = "http://www.webcrawler.com/";

// Handle all the FSCommand messages in a Flash movie
function navbar_DoFSCommand(command, args) {
if ( command == "0" ) {
if ( args == "click" ) { }
if ( args == "over") {
Words.innerHTML = 'This button will display a message on the browser status bar.';
self.status="Hey this is a very long status bar message !";
}
if ( args == "out" ) {
self.status="";
Words.innerHTML = 'Start Up Message';
}
}
if ( command == "1" ) {
if ( args == "click" ) { openWindow('http://www.yahoo.com',350, 295); }
if ( args == "over") { Words.innerHTML = 'This will open Yahoo website in a popup window'; }
if ( args == "out" ) { Words.innerHTML = 'Start Up Message'; }
}
if ( command == "2" ) {
if ( args == "click" ) { }
if ( args == "over") { Words.innerHTML = 'This button will only display a message here on MouseOver'; }
if ( args == "out" ) { Words.innerHTML = 'Start Up Message'; }
}
if ( command == "3" ) {
if ( args == "click" ) { }
if ( args == "over") { Words.innerHTML = '<img src=\"wasp.jpg\"><P>You can display images too'; }
// CHANGE THE ABOVE IMAGE SRC TO YOUR OWN E.G. YourImage.GIF
if ( args == "out" ) { Words.innerHTML = 'Start Up Message'; }
}
if ( command == "4" ) {
if ( args == "click" ) { shake(10); }
if ( args == "over") { Words.innerHTML = 'Click for the EARTH QUAKE !'; }
if ( args == "out" ) { Words.innerHTML = 'Start Up Message'; }
}
if ( command == "5" ) {
if ( args == "click" ) { window.external.AddFavorite('http://www.webwasp.co.uk/','webwasp.co.uk') }
if ( args == "over") { Words.innerHTML = 'Add webwasp.co.uk to your favourites !'; }
// Change the above web address to your own
if ( args == "out" ) { Words.innerHTML = 'Start Up Message'; }
}
if ( command == "6" ) {
if ( args == "click" ) { alert ("This is a Javascript Alert") }
if ( args == "over") { Words.innerHTML = 'Click this button to generate an \'Alert\' message'; }
if ( args == "out" ) { Words.innerHTML = 'Start Up Message'; }
}
if ( command == "7" ) {
if ( args == "click" ) { random(); }
if ( args == "over") { Words.innerHTML = 'Click this button to randomly go to Yahoo, Google, AltaVista or WebCrawler'; }
if ( args == "out" ) { Words.innerHTML = 'Start Up Message'; }
}
if ( command == "8" ) {
if ( args == "click" ) { history.go(-1); }
if ( args == "over") { Words.innerHTML = 'This button will act like your browser\'s back button'; }
if ( args == "out" ) { Words.innerHTML = 'Start Up Message'; }
}
if ( command == "9" ) {
if ( args == "click" ) { window.print(); }
if ( args == "over") { Words.innerHTML = 'Click this button to bring up the print prompt box'; }
if ( args == "out" ) { Words.innerHTML = 'Start Up Message'; }
}
if ( command == "10" ) {
if ( args == "click" ) { top.window.close(); }
if ( args == "over") { Words.innerHTML = 'Click button to close this window'; }
if ( args == "out" ) { Words.innerHTML = 'Start Up Message'; }
}
}

// EARTHQUAKE FUNCTION
function shake(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 openWindow(file,w,h) {
newWindow = window.open(
file,
'newWin',
'top=100,left=150,width='+w+',height='+h+',resizable=yes,toolbar=no,location=no,scrollbars=yes')
}

function random() {
var a = 1+Math.round(Math.random()*4);
var i = a;
location = links[i];
}

function expand() {
for(x = 0; x < 50; x++) {
window.moveTo(screen.availWidth * -(x - 50) / 100, screen.availHeight * -(x - 50) / 100);
window.resizeTo(screen.availWidth * x / 50, screen.availHeight * x / 50);
}
window.moveTo(0,0);
window.resizeTo(screen.availWidth, screen.availHeight);
}

//-->
</SCRIPT>

Further Info about JavaScript

For more information on what JavaScript is and tutorials on how to use it simply go to google and search for “JavaScript” or “JavaScript tutorials”. If you simply spend some time searching the net you'll soon find many sites that give help and advice tutorials on JavaScript for example:

http://www.hotscripts.com
http://www.experts-exchange.com
http://forums.devshed.com/
http://www.allexperts.com
http://javascript.internet.com/
http://www.javascript.com/


For more help and advice please feel free to ask for help on the webwasp massage boards: forum

 

Please indicate what you thought of this tutorial 
10 is the best: 
10 9 8 7 6 5 4 3 2 1

         

Step 3    <<   Previous      Intro   1   2   3    >>       >>   Webwasp Mates


Webwasp Community: Webwasp Mates & Dates

Why not try out webwasp's new community. Meet new people, find friends in your area: Webwasp Mates & Dates

 Top of Page Home Food Mates Members Tutorials Forum Buy Templates Contact Us 
 All material on this site is protected under international copyright © law. DO NOT reproduce any material from this site without written permission. Please ask as permission is often granted.