# Moodle 2.0 and externalInterface call

**URL:** <https://forum.kirupa.com/t/moodle-2-0-and-externalinterface-call/324004>\
**Category:** flash\
**Created:** [July 27, 2011, 8:56pm UTC](https://forum.kirupa.com/t/moodle-2-0-and-externalinterface-call/324004 "2011-07-27T20:56:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![m2244](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@m2244](https://forum.kirupa.com/u/m2244)\
**Post date:** [July 27, 2011, 8:56pm UTC](https://forum.kirupa.com/t/moodle-2-0-and-externalinterface-call/324004/1 "2011-07-27T20:56:26Z")

</div>

Hello,

I am having a problem with an externalInterface call from a SWF to a javascript function. i am on a new Moodle 2.0 LMS which I am not too familiar with yet.

Any help would be greatly appreciated.

```auto

function reenableMainConsole():void
{
	txtErrors.text = "In reenableMainConsole function. 
";
	if (ExternalInterface.available)
	{
		txtErrors.text += "In extInterface. 
";

		try
		{
			ExternalInterface.addCallback("sidetrackStop", receivedFromJavaScript);
			if (checkJavaScriptReady())
			{
				txtErrors.text += "JavaScript is ready.
 ";
			}
			else
			{
				txtErrors.text += "JavaScript is not ready.
";
			}
		}
		catch (error:SecurityError)
		{
			txtErrors.text += "A SecurityError occurred: " + error.message + "
";
		}
		catch (error:Error)
		{
			txtErrors.text += "An Error occurred: " + error.message + "
";
		}

		function receivedFromJavaScript(value:String):void
		{
			txtErrors.text += "JavaScript says: " + value + "
";
		}
		function checkJavaScriptReady():Boolean
		{
			var isReady:Boolean=ExternalInterface.call("isReady");
			txtErrors.text += "isReady: " + isReady;
			return isReady;
		}
	}
	else
	{
		txtErrors.text += "Not in extInterface.";
	}
}

```
