Learn Flash FS Commands

Home Food Mates • Members Tutorials Forum Buy Templates Contact Us 

 


Flash Tutorials

   

Flash Tutorial - FS Commands

 

Free Flash Tutorial


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

 

Step Two: The JavaScript

  1. Open up your HTML web page editor (i.e. Dreamweaver, FrontPage etc..)

  2. Open up a blank new web page or an existing new web page that you would like to add your buttons to.

  3. Click one the page where you would like the button to appear (Must be within the body section i.e. between the <body> and </body> tags)

  4. Now add the following HTML code in the HTML code view of your web page editor:
  5. <OBJECT id="navbar" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" width="XXX" height="XXX">

    <PARAM NAME="movie" VALUE="
    YourFileName.swf">

    <PARAM NAME="quality" VALUE="high">

    <PARAM NAME="menu" VALUE="true">

    <EMBED src="
    YourFileName.swf" quality="high" menu="true" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="XXX" height="XXX" swLiveConnect="true" NAME="navbar"> </EMBED>

    </OBJECT>

    Note: You MUST use this code or the FSCommand will not work !!

  6. Now change the XXX values for so that the width and height values are how you want your Flash Movie to display.

  7. Then replace YourFileName with the file name of your movie. Be careful this is case sensitive and never use spaces for file names that are used on the web.
  8. Note: The Flash movie that you created earlier (the swf file) must be in the same location as your web page. If it is in the same location as the web page then you only use the button name. If however the file is in a different location you must include the file path. If you don't know about HTML file paths just make sure your Flash Movie is located in the same folder as your web page.

  9. Now whilst still in the HTML code view for your web page builder program add the following code in the head section of your web page (if you add the code just before the </head> tag is best). You will find the <head> tags at the top of your web page and will look something like this:
  10. <head>

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    <title>Your Web Page </title>


    Add the code here

    </head>


  11. In the Head section add the following JavaScript code:
  12. <script language="javascript" type="text/javascript">

    <!--

    // HANDLES FSCOMMAND CALL FOR INTERNET EXPLORER

    if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {

    document.write('<SCRIPT LANGUAGE=VBScript\> \n');

    document.write('on error resume next \n');

    document.write('Sub navbar_FSCommand(ByVal command, ByVal args)\n');

    document.write(' call navbar_DoFSCommand(command, args)\n');

    document.write('end sub\n');

    document.write('</SCRIPT\> \n');

    }

    //-->

    </SCRIPT>



  13. Now in the Body or Head section for your web page add the following code:

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

    <!--

    // Handle all the FSCommand messages in a Flash movie

    function navbar_DoFSCommand(command, args) {

    if ( command == "0" ) {

    if ( args == "click" ) {
    Remove this and add you own javascript function here for when the first flash button is clicked }

    if ( args == "over") {
      Remove this and add you own javascript function here for when the first flash button is rolled over }

    if ( args == "out" ) {
      Remove this and add you own javascript function here for when the first flash button is rolled out of }

    }
    }
    //-->
    </SCRIPT>



  14. For each button you have attached the fscommand to you will need to add extra set of code, like the code form above for that fscommand. So if you have three flash buttons with the fscommand attached to them then your javascript code would look something like this:

    <script language="javascript" type="text/javascript">
    <!--
    // Handle all the FSCommand messages in a Flash movie
    function navbar_DoFSCommand(command, args) {
    if ( command == "0" ) {
    if ( args == "click" ) {
    Add your own javascript function here }
    if ( args == "over") {   Add your own javascript function here }
    if ( args == "out" ) {   Add your own javascript function here }
    }
    if ( command == "1" ) {
    if ( args == "click" ) { Add your own javascript function here }
    if ( args == "over") {   Add your own javascript function here }
    if ( args == "out" ) {   Add your own javascript function here }
    }
    if ( command == "2" ) {
    if ( args == "click" ) { Add your own javascript function here }
    if ( args == "over") {   Add your own javascript function here }
    if ( args == "out" ) {   Add your own javascript function here }
    }

    }
    //-->
    </SCRIPT>



  15. Always start from"0" like in flash and keep adding "1" for each button that you have.
  16. When adding your own customized javascript you can add any function or code that you want to run for when the button of your choice is either clicked, rolled over or rolled out of with the mouse. Simply replace the:

    "remove this and add you own javascript function here for when the first flash button is clicked"

    and replace it with the code or function you wish to run when the mouse is over, out or click on your button.

         

Step 2    <<   Previous      Intro   1   2   3     Next   >>       >>   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.