The "modern" updated way to embed a flash object, according to Adobe:
<object id="theFlash" name="theFlash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
width="400" height="225" align="middle">
<param name="movie" value="theflashfile.swf" />
<param name="allowScriptAccess" value="always" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash"
data="getStreamFrame.swf" width="400" height="225">
<param name="allowScriptAccess" value="always" />
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflash">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
When trying to call an AS3 function in the SWF, from Javascript:
var flashObj = document.getElementById('theFlash');
flashObj.someASFunction();
(and on the AS side:)
import flash.external.*;
function someASFunction() {
//show some text
}
ExternalInterface.addCallback("someASFunction", someASFunction);
This doesn't work in Firefox and Chrome. The flash works and loads. flashObj does get a reference to the object, but someASFunction is undefined and doesn't get called.
If I replace the object tag with an embed tag:
<embed id="theFlash" name="theFlash" height="225" width="400" align="middle"
type="application/x-shockwave-flash" allowscriptaccess="always"
src="theflashfile.swf" />
Then it works on Firefox and Chrome (the AS function is called and works properly) - (it doesn't work in IE though).
How come it doesn't work with an object tag?
How "safe" it is to use the embed tag instead of the object tag? Is it not obsolete?
Note, that it is definitely not a timing issue - If I call the AS function from JS from an onclick function - then the results are the same.