How to notify the HTML container that the SWF has finished, using swfobject

前端 未结 3 939
萌比男神i
萌比男神i 2020-11-28 00:06

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.

相关标签:
3条回答
  • 2020-11-28 00:29

    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.

    0 讨论(0)
  • 2020-11-28 00:30

    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

    0 讨论(0)
  • 2020-11-28 00:43

    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) :

    • Right click on your swf opened in the browser, then Global Settings... :

    enter image description here

    Which will open this page.

    • Then click on the Global Security Settings panel link at the right side, which will give you this page :

    enter image description here

    • Then, as it's mentioned in the image, click on Edit locations... combo box, and Add location, which will give you this box :

    enter image description here

    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) :

    • Right click on your swf opened in the browser, then Global Settings..., you can also go to your system control panel and open Flash Player :

    enter image description here

    • Then go to Advanced tab and click Trusted Location Settings... button :

    enter image description here

    • Then you have to add the swf location using Add.. button > Add File... or Add folder... button > select your file/dir or partition and press OK, Confirm and close all dialogs.

    enter image description here

    Then you have just to refresh your page.

    0 讨论(0)
提交回复
热议问题