Call a Simple JQuery from within Flash
This is hopefully really simple for someone but I'm a newbie and trying to learn how to connect to JQuery's on my site from an embedded Flash swf. I'm attempting to do a simple example first to test the connection between Flash and JQuery...
I've embedded an swf onto my page. When I click my button in Flash I'd like it to connect to a JQuery function that produces a popup alert saying "hello world!"
Here's my JQuery function (I need to name the function):
function helloWorld() {
alert('Hello World');
}
I have an eventlistener (which I tested and works) on my button within Flash which tries to call the following:
function AddToBasket(event:MouseEvent):void{
var alert:URLRequest = new URLRequest("javascript:helloWorld();");
navigateToURL(alert);
}
When I 'inspect element' in Chrome I can see the JQuery is there, but when I click my button no popup alert appears. I'm misunderstanding something pretty basic, any help would be appreciated!!!
My Flash SWF is added to my Wordpress page using Kimili Flash Embed, which I've added to my WP page like this:
[kml_flashembed movie="http://www.example.co.uk/upload/ImageUploader.swf" allowscriptaccess="samedomain" height="500" width="728" /]
The following AS3 does produce the popup, but the whole point of the exercise is calling a JQuery outside of Flash:
function AddToBasket(event:MouseEvent):void{
var alert:URLRequest = new URLRequest("javascript:alert('Hello World!')"); //"javascript:helloWorld();"
navigateToURL(alert, "_self");
}
Thanks guys
Dean