Skip navigation
Lathika Sreejith
Currently Being Moderated

ExternalInterface In ActionScript 2.0

Apr 12, 2012 2:37 AM

Hi EveryOne, I am trying to use ExternalInterface Class to provide communication between actionscript 2.0


and JavaScript. But I am not able to achieve that.


Following is the code that i used.


Code in FlaFile.fla is as follows:


import flash.external.*;


flash.external.ExternalInterface.addCallback("fnGetVar", fnGetVar);

function fnGetVar(nn: String ):String {

    nn = "100";

    return ("hai");




with (mc)


            beginFill (0xFFFFFF);

            lineStyle(4, 0x0000FF, 100);

            moveTo( 0, 0);

            lineTo (0, 0);

            lineTo (0, 20);

            lineTo (20, 20);

            lineTo (20, 0);

            endFill ();




Code in FlaFile.html is as follows:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "



<html xmlns="" xml:lang="en" lang="en">


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


function fnCall()




    //var flashMovie = window.document.FlaFile;


    var newVar=FlaFile.fnGetVar("value");











<body bgcolor="#ffffff">

<!--url's used in the movie-->

<!--text used in the movie-->

<input type="button" value="click!!!" onclick="fnCall()">

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"


codebase=" rsion=7,0,0,0"


width="550" height="400" id="FlaFile" name="FlaFile" align="middle">

<param name="allowScriptAccess" value="always" />

<param name="movie" value="FlaFile.swf" />

<param name="quality" value="high" />

<param name="bgcolor" value="#ffffff" />

<embed src="FlaFile.swf" quality="high" bgcolor="#ffffff" width="550" height="400" name="FlaFile"


id="FlaFile" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"


pluginspage="" />






Can Somebody tell me where it is going wrong?


The error which i am getting in IE9 is "Object doesn't support property or method 'fnGetVar'" and the


error which i am getting in Chrome is "Object #<HTMLCollection> has no method 'fnGetVar'" and in firefox


the error is "FlaFile is not defined"


fla Editor which i am using is Macromedia Flash MX Professional 2004 Version 7.0

  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Apr 12, 2012 6:53 AM   in reply to Lathika Sreejith

    where's your js FlaFile defined?


    (use the flash help files.  there's sample code that shows how to use the correct reference to your swf.)

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points