BlueInkAlchemist
10-27-2008, 08:22 PM
Happy Monday, all!
I read over Peter McBride (http://www.actionscript.org/resources/authors/542/Peter-McBride)'s fantastic article (http://www.actionscript.org/resources/articles/745/1/JavaScript-and-VBScript-Injection-in-ActionScript-3/Page1.html) on injecting JavaScript and VBScript into ActionScript, and then noticed he wrote it for Flex. I'm trying to apply the same methodology in Flash CS3, but so far I've run into a bit of a snag.
Here's an example of what the JS looks like as it sits on an HTML page:
<script type="text/javascript"><!--
google_ad_client = "pub-################";
/* 300x250, ad space for whatever */
google_ad_slot = "##########";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://imnotdisplayingtheactualurl.com/itsthatwholendathing/show_ads.js">
</script>
My research and instincts have lead me to believe that the ActionScript method of calling for this JavaScript would look like so:
ExternalInterface.call("http://pagead2.googlesyndication.com/pagead/show_ads.js", google_ad_client, google_ad_slot, google_ad_width, google_ad_height);
...with the four listed variables being strings set to the values in the first script snippet. However, so far all I'm getting is null responses. What am I doing wrong? And how can this call be inserted into a movie clip being added to the timeline via ActionScript?
As always, thanks in advance for your help!
I read over Peter McBride (http://www.actionscript.org/resources/authors/542/Peter-McBride)'s fantastic article (http://www.actionscript.org/resources/articles/745/1/JavaScript-and-VBScript-Injection-in-ActionScript-3/Page1.html) on injecting JavaScript and VBScript into ActionScript, and then noticed he wrote it for Flex. I'm trying to apply the same methodology in Flash CS3, but so far I've run into a bit of a snag.
Here's an example of what the JS looks like as it sits on an HTML page:
<script type="text/javascript"><!--
google_ad_client = "pub-################";
/* 300x250, ad space for whatever */
google_ad_slot = "##########";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://imnotdisplayingtheactualurl.com/itsthatwholendathing/show_ads.js">
</script>
My research and instincts have lead me to believe that the ActionScript method of calling for this JavaScript would look like so:
ExternalInterface.call("http://pagead2.googlesyndication.com/pagead/show_ads.js", google_ad_client, google_ad_slot, google_ad_width, google_ad_height);
...with the four listed variables being strings set to the values in the first script snippet. However, so far all I'm getting is null responses. What am I doing wrong? And how can this call be inserted into a movie clip being added to the timeline via ActionScript?
As always, thanks in advance for your help!