ajoo Posted April 19, 2018 Share Posted April 19, 2018 (edited) Hi all. The code embedding the swf file using AC_RunActiveContent.js looks as below: <script type="text/javascript" > AC_FL_RunContent('codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0','width','800','height','580','align','middle','src','FlashWebsite','quality','high','bgcolor','#ffffff','name','FlashWebsite','allowscriptaccess','sameDomain','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','FlashWebsite' ); </script> 1. I would like to run this off a .js file so that this could be CSP compatible & would replace the above code. 2. I also need to pass two php variables as FlashVars in the above code. For eg like this FlashVars = "var1=$var1&var2=$var2" So I would need to pass these two variables from php into the .js file that i wish to create in 1. i would be much obliged for any help on this. Thanks all !! Edited April 19, 2018 by ajoo Quote Link to comment Share on other sites More sharing options...
Barand Posted April 19, 2018 Share Posted April 19, 2018 Store them in array of key/value pairs $params = Array ( [codebase] => http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0 [width] => 800 [height] => 580 [align] => middle [src] => FlashWebsite [quality] => high [bgcolor] => #ffffff [name] => FlashWebsite [allowscriptaccess] => sameDomain [pluginspage] => http://www.macromedia.com/go/getflashplayer [movie] => FlashWebsite ) Then it's easy to add $params['var1'] = $var1; $params['var2'] = $var2; Then you can json_encode() the $params array to pass it to JS. Quote Link to comment Share on other sites More sharing options...
ajoo Posted April 19, 2018 Author Share Posted April 19, 2018 Hi Guru Barand, Thanks for the reply ! I just tried as follows : In the HTML HEAD block I added <head> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <script language="javascript">AC_FL_RunContent = 1;</script> <script src="AC_RunActiveContent.js" language="javascript"></script> <script type="text/javascript" src="fl.js"></script> </head> & created the fl.js simply as $(document).ready(function(){ if (AC_FL_RunContent == 0) { alert("This page requires AC_RunActiveContent.js."); } else { AC_FL_RunContent( 'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0', 'width', '550', 'height', '400', 'src', 'AS3_swf_php_comm_1', 'quality', 'high', 'pluginspage', 'http://www.macromedia.com/go/getflashplayer', 'align', 'middle', 'play', 'true', 'loop', 'true', 'scale', 'showall', 'wmode', 'window', 'devicefont', 'false', 'id', 'AS3_swf_php_comm_1', 'bgcolor', '#ffffff', 'name', 'AS3_swf_php_comm_1', 'menu', 'true', 'allowFullScreen', 'false', 'allowScriptAccess','sameDomain', 'movie', 'AS3_swf_php_comm_1', 'salign', '' ); } }); leaving aside the flashvars for the moment. If i paste the contents of fl.js using <SCRIPT>tags directly in HTML, all works fine. But with the fl.js as above, I get a perpetually loading fevicon symbol and the disabled flash player symbol saying "Click to enable Adobe Flash Player". There is no other error or anything else in the chrome inspector. If I comment out the params section in the fl.js and simply put an alert, the messages appears and there is no perpetual fevicon. Of-course no running swf either. Please help. Thanks. Quote Link to comment Share on other sites More sharing options...
ajoo Posted April 20, 2018 Author Share Posted April 20, 2018 (edited) Hi Guru Barand & all ! Please can someone help me out with this. @Guru Barand: Then you can json_encode() the $params array to pass it to JS. SIr it's not working even when I put the params directly in the JQuery as in #3. Kindly guide. Thanks all ! Edited April 20, 2018 by ajoo Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.