|
-
importing javascript files
Hi any help here would be great. I was wondering if some one could direct me on how to import some javascript into my fla.
This is what I would like to bring in
<script type="text/javascript">var lwmwLinkedBy="LiknoWebModalWindows [1]",lwmwName="quickquotepopup",lwmwBN="250";</script>
<script charset="UTF-8" src="jscripts/likno-scripts/quickquotepopup.js" type="text/javascript"></script>
This is what I started with in the actionscript
ExternalInterface.call("document.getElementsByTagN ame('head')[0].appendChild(document.createElement('script'))");
ExternalInterface.call("document.getElementsByTagN ame('script')[document.getElementsByTagName('head')[0].getElementsByTagName('script').length-1].setAttribute('type', 'text/javascript')");
ExternalInterface.call("document.getElementsByTagN ame('script')[document.getElementsByTagName('head')[0].getElementsByTagName('script').length-1].setAttribute('src', 'jscripts/likno-scripts/quickquotepopup.js')");
button_1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage_3);
function fl_ClickToGoToWebPage_3(event:MouseEvent):void
{
navigateToURL(new URLRequest("#"), "quick_quote_popup");
}
quick_quote_popup piece is the target I have to call to run the script
Could not wrap my head around how to bring this in
<script type="text/javascript">var lwmwLinkedBy="LiknoWebModalWindows [1]",lwmwName="quickquotepopup",lwmwBN="250";</script>
Thanks For Any Help
howlinhuskie
-
Senior Member
It all depends if you want to have those values available at start or after a mouse click. This is on start:
PHP Code:
<!-- saved from url=(0014)about:internet --> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>ExternalInterfaceExample</title> <script language="JavaScript"> var jsReady = false; function isReady() { return jsReady; } function pageInit() { jsReady = true; var lwmwLinkedBy="LiknoWebModalWindows [1]" var lwmwName="quickquotepopup"; var lwmwBN="250"; thisMovie("ExternalInterfaceExample").sendToActionScript(lwmwLinkedBy, lwmwName, lwmwBN); } function thisMovie(movieName) { if (navigator.appName.indexOf("Microsoft") != -1) { return window[movieName]; } else { return document[movieName]; } } function sendToActionScript(value1, value2, value3) { thisMovie("ExternalInterfaceExample").sendToActionScript(value1, value2, value3); } </script> </head> <body onload="pageInit();"> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="ExternalInterfaceExample" width="500" height="375" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"> <param name="movie" value="ExternalInterfaceExample.swf" /> <param name="quality" value="high" /> <param name="bgcolor" value="#869ca7" /> <param name="allowScriptAccess" value="sameDomain" /> <embed src="ExternalInterfaceExample.swf" quality="high" bgcolor="#869ca7" width="500" height="375" name="ExternalInterfaceExample" align="middle" play="true" loop="false" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> </embed> </object> </body> </html>
Inside of your movie you have the callback:
PHP Code:
ExternalInterface.addCallback("sendToActionScript", receivedFromJavaScript); private function receivedFromJavaScript(value1:String, value2:String, value3:String):void { output.appendText("JavaScript says: " + value1 + " "+value2+" "+value3+"\n"); }
I modified the flash example from the language reference.
http://help.adobe.com/en_US/FlashPla...nterface.html#
This is an example working:
http://flashscript.biz/test/test/Ext...ceExample.html
- The right of the People to create Flash movies shall not be infringed. -
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|