Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I control a SWF (AS3) behavior through external Javascript ?

Status
Not open for further replies.

paradisewolf

Programmer
Mar 15, 2007
17
0
0
GB
I am planning to build a web page where external buttons using javascript commands like this <a onClick="javascript:Load_SWF( 1 ) …>< img … > and their code would instruct a SWF parent object ( embedded in the html code ) to load the desired interactive SWF child ( and replace a previous SWF child ) within it, when the user then could play with it.

My doubt however is, can a SWF embedded object receive external instructions from javascript code ? If so, how ?
 
I used the code example that uses the ExternalInterface class from this site:
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html

It only works on IE 7.0 when

1) I set value to “always” in <param name="allowScriptAccess" value="always" /> in the embedded object.

2) I set the Global Security Settings of Adobe Flash Player Settings Manager to “Always allow”.



However these settings seem to be insufficient for Firefox 3.0.5 because it gives this error message:

Initializing...
Adding callback...
A SecurityError occurred: Error #2060: Security sandbox violation: ExternalInterface caller file:///C:/ … /ExternalInterfaceExample.swf cannot access file:///C:/... /JavascriptFlashInterface.html.

How to fix this problem ?

 
I just found out that Firefox does not allow to run a code in a local sandbox.

Thank you anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top