Take the 2-minute tour ×

All Im trying to do is get a function in my AS3 to be called from javascript. Ive tried around 20 tuts/codes, nothing.

My Javascript/HTML: http://pastebin.com/vPbu41PN

AS3 Code:

function onBUnloadb(): void {
    xmlSocket.send(MyName+"||"+MyKey+"|| /disconnected "+MyName);
ExternalInterface.addCallback("onBUnload", onBUnloadb);

I am getting the error message in firefox Error: TypeError: flashMovie.onBUnload is not a function

This should really not be this hard :/

share|improve this question

2 Answers 2

up vote 0 down vote accepted

What protocol is the HTML page being loaded from? If it's file:///, there are security restrictions when communicating with JavaScript.

Try calling Security.allowDomain('*') in your SWF.

share|improve this answer
Thanks! That did it –  Cyrus Sep 28 '12 at 8:19

Your AS3 Code is fine, just make sure your javascript code is working. Put an alert inside confirmExit and make sure you are getting the swfobject:

function confirmExit() {
   var flashMovie=getFlashMovieObject("caht");
   alert("calling as3 " + flashMovie);
share|improve this answer
That returns [Object HTMLObjectElement] in the alert box –  Cyrus Sep 28 '12 at 2:21

Your Answer


