Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

rajeesh

macrumors newbie
Original poster
Mar 30, 2009
2
0
Hi,
I have been trying to communicate my flash swf file embeding on a HTML file using external interface method. It is working fine in all flash player in windows and not working in MAC with flash player 8 or later, (sand box security error) and it is working fine in the lower versions of Flash player.

here is my html code:

<HTML>
<HEAD>
<TITLE>MSC MAC Version </TITLE>
</HEAD>

<BODY>

<OBJECT
CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
WIDTH="100%"
HEIGHT="100%"
CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"
ID=testcommand>
<PARAM NAME="MOVIE" VALUE="testfscommand.swf">
<PARAM NAME="PLAY" VALUE="false">
<PARAM NAME="LOOP" VALUE="false">
<PARAM NAME="QUALITY" VALUE="high">
<PARAM NAME="SCALE" VALUE="SHOWALL">
<PARAM NAME="AllowScriptAccess"="ALWAYS">

<EMBED
NAME="testfscommand"
SRC="testfscommand.swf"
WIDTH="100%"
HEIGHT="100%"
PLAY="false"
LOOP="false"
QUALITY="high"
SCALE="SHOWALL"
swLiveConnect="true"
AllowScriptAccess="ALWAYS"
PLUGINSPAGE="http://www.macromedia.com/go/flashplayer/">
</EMBED>
</OBJECT>

<SCRIPT LANGUAGE="JavaScript">
function testfscommand_DoFSCommand(command, args)
{
alert("Fscommand");
callExternalInterface();
return;
}
function callExternalInterface() {
alert("inside");
testfscommand.callPlayBall("test");
}

</SCRIPT>


</BODY>
</HTML>


and My flash code is below:

import flash.external.ExternalInterface;
import flash.external.*;

// The name of the Flash variable to be called in JavaScript
var flashFunction:String = "callPlayBall";
var instance:Object = null;

// Callback function executed by the name of variable
var realFunction:Function = playBall;
ExternalInterface.addCallback(flashFunction, realFunction);
function getTextFromJavaScript(str:String)
{
responceTxt.text = "From JavaScript: " + str;
}


var jsArgument:String = "Command";
responceTxt.text = "Sending to JS";
fscommand("command","command");
var result:Object = ExternalInterface.call("getTextFromFlash", jsArgument);

function callFlash(val:String)
{
responceTxt.text="callflash "+val;
}


function playBall(val:String)
{
responceTxt.text="Call back function "+val;
}


I am looking a solution/correction for solving my problem from you.

Regards
Rajeesh
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.