Use FSCommand With the Browser

This tutorial was written for the Flash Designer software, which allows you to create flash animations in a much easier way than by using Macromedia Flash. You may get Flash Designer here.

SYMPTOMS

FScommand doesn't work when the movie plays in a browser. FScommand works only with Macromedia standalone projector.

This tutorial describes how to create a "quit button" and use fscommand to communicate with the browser

Example of fscommand:quit

SOLUTION

Step 1:

Add the following JavaScript handler to your HTML page:

<SCRIPT LANGUAGE=JavaScript>
<!--

function flashMovie_DoFSCommand(command, args) {

if (command == "quit")
{
window.opener=self;window.close();
}

}
//-->
</SCRIPT>

<SCRIPT LANGUAGE="VBScript">
<!--
Sub flashMovie_FSCommand(ByVal command, ByVal args)
call flashMovie_DoFSCommand(command, args)
end sub
}
//-->
</SCRIPT>

Step 2:

Open your Flash Designer project and program the button. Select the button and choose "Item" > "Actions" > "OnClick". To execute FScommand use one of the following methods:

image 1

Get URL option

image 2

ActionScript option

Step 3:

Export SWF file with "File" > "Export SWF File" command. Choose "File" > "View HTML Code" copy the code and paste it to your HTML page.

Modify the code and add ID (flashMovie) to the OBJECT and EMBED tags and swfliveconnect option to EMBED:

<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ID="flashMovie"
WIDTH="640" HEIGHT="480"
CODEBASE="http://active.macromedia.com/ flash5/cabs/swflash.cab#version=5,0,0,0">
<PARAM NAME="MOVIE" VALUE="flash.swf">
<PARAM NAME="PLAY" VALUE="true">
<PARAM NAME="LOOP" VALUE="true">
<PARAM NAME="WMODE" VALUE="opaque">
<PARAM NAME="QUALITY" VALUE="high">
<EMBED SRC="flash.swf" WIDTH="640" HEIGHT="480" PLAY="true" LOOP="true"
WMODE="opaque" NAME="flashMovie" QUALITY="high" swliveconnect=true
PLUGINSPAGE="http://www.macromedia.com/shockwave/ download/index.cgi?P1_Prod_Version=ShockwaveFlash">
</EMBED>
</OBJECT>

NOTE:

In xxxxx_DoFSCommand(command, args) handler "command" will be the string after FSCommand: and "args" is the target argument

Download source project t1041.zip (9 kb)

Creating "Close" button

1. Choose "Frame" > Inset Symbol" command

2. Choose the following symbol from "Wingding" list:

Click to enlarge
Click to enlarge

3. Choose "Item" > "Actions" > "OnClick"

4. Choose "Get URL" action and enter the code:

FSCommand:quit

Click OK

5. Choose "Item" > "Actions" > "On Over Color", uncheck "No Color" and select your favorite color, click OK

NOTE: The button will work in HTML page only. It doesn't work in preview mode because there is no javascript code to communicate with.


Close    To Top
  • Prev Article-Flash:
  • Next Article-Flash:
  • Now: Tutorial for Web and Software Design > Flash > Special Effect > Flash Content
    Photoshop Tutorial
     

    Special Effect

      3D Effect
      Photoshop Articles
    Programming Tutorial
     

    C/C++ Tutorial

      Visual Basic
      C# Tutorial
    Database Tutorial
     

    MySQL Tutorial

      MS SQL Tutorial
      Oracle Tutorial
    Geek Tutorial
     

    Blogging Tutorial

      RSS Tutorial
      Podcasting Tutorial
    Graphic Design Tutorial
      Coreldraw Tutorial
      Illustrator Tutorial
      3D Tutorials
    Webmaster Articles
     

    Domain Service

      Web Hosting
      Site Promotion
    Java Tutorial/ Articles
     

    Java Servlets

      JavaEE Tutorial
     

    JavaBeans Tutorial

    XML Tutorial/ Articles
     

    XML Style

      AJAX Tutorial
      XML Mobile
    Flash Tutorial/ Articles
     

    Flash Video

      Action Script
      Flash Articles
    OS Tutorial/ Articles
      Linux Tutorial
      Symbian Tutorial
      MacOS Tutorial
    Personal Tech
      Hardware Tutorial
      Software Tutorial
      Online Auction