Hey Guys, I've got ExternalInterface to call a javascript function. But how can I now use jQuery to target the .swf that called the function?
For example, I'm calling the "changeObject" function using ExternalInterface. How would I get jQuery to modify the same flash files object tag? This is what I have and it doesn't work:
function changeObject()
{
jQuery(this).css('height','500px');
};
jQuery(this) get's returned as undefined. I do not know the ID of the object element. It's a dynamic ID. There will be multiple .swf's on a page too.
Thanks!
I had a quick look through the documentation and this doesn't appear to be possible (but I'm quite possibly wrong, and invite anyone with more knowledge on the subject to correct me).
What you can try to do is initiate each swf with an identifier, and then pass that identifier back with every function call (the identifier would match the swf object's ID).
So I set a new Flashvar that was a unique playerID. Like this:
I then setup that Flashvar in actionscript (in Model.as):
Then in Javascript I now have the playerID to use like this:
So I just use the arg playerID instead of the (this) in jQuery. So happy!
I don't think there's any way to get the caller object, but one solution would be to add an attribute to that changeObject function and pass the id of the swf to that from your Flash app.