I am embedding a flash object (swf file) into an HTML page. The object is written in as3 and built using Flash Builder. Its purpose is to show some animation, then finish.
It was actually a matter of security, due to the local environment, as suggested by @akmozo. I went to the global security settings of Flash Player:
http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html
and added the root folder of the tree contaning all HTML pages / SWF objects to the allowed locations. So now it also works locally.
In case the job of flash code is done and you don't need it anymore, just terminate the javascript in as3:
var exitStr:String = "javascript:terminate()";
navigateToURL(new URLRequest(exitStr),"_self");
And then add a onUnload function in HTML which will be called at that point:
onUnload="flashFinished();"
note: I used this code with swfobject v1.4 not sure about v2.2
To avoid that Flash player blocks your local swf to access to an external URL (internet, ...) or to communicate with javascript or some other actions that fire usually a security sandbox violation error, you have to add it (the swf) to the list of trusted locations like this :
For Flash Player PPAPI (like Opera and Chrome) :
Which will open this page.
You have just to type your swf location, or it's parent directory, or simply the whole partition like what I did in the image. Try to avoid "Browse ..." buttons, sometimes it doesn't work (at least for me). Confirm and close the page and refresh that of your swf.
For Flash Player ActiveX (like IE) and NPAPI (like Firefox) :
Then you have just to refresh your page.