website promotion banner
eturnkeys
Your Ad Here
Flash & Swish  Home Flash & Swish Flash Tutorials Use FSCommand With the Browser
rss

Use FSCommand With the Browser

Author: Selteco.com More by this author


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.



Rate this Material: Bad 1 2 3 4 5 Excellent
print this page tell a friend subscribe to newsletter subscribe to rss

Add comments to "Use FSCommand With the Browser"