External Interface Callbacks with Jquery
So first off, NEVER use this most lazy of hacks to reference the flash object when calling a method in a flash file:
1 2 3 4 | // some code function test() { flashID.ner("hello"); // BAAAAAAD! } |
For some reason it works… Some of the time. On Safari when testing running from Flex. On my Mac.
I was being lazy and not really thinking back to how things work in Javascript at the time, then having recently started using Jquery, I tried:
1 2 3 4 5 | // some code function test() { var flashMovie = $('#flashID'); flashMovie.ner("hello"); // ALSO BAAAAAAD! } |
Also doesn’t work, for some reason Jquery removes the methods associated with the embed tag that is written, and replaces them with only the Jquery methods. So in order for this to work the code needs to be simply:
1 2 3 4 | function test() { var flashMovie = document.getElementByID("flashID"); flashMovie.ner("hello"); // FINALLY! It worked. } |
