jQuery and ExternallInterface

It seems to be that ExternalInterface will not work if the flash file is referenced with jQuery. Which is odd because the jQuery wil translate to the javascript function getElementById. However the following code gave javascript errors that the function send2Flash could not be found.


if( $("#debaak").length > 0 )
{
$("#debaak").send2Flash(str);
}

After discussing this subject we found the following solutions. JQuery returns an object, with the get function it is possible to get any element in the jQuery object returned by the jQuery selector

$("#debaak").get(0).send2Flash(str);
or
$("#debaak")[0].send2Flash(str);

The javascript way also works perfectly whithout any errors.


if (document.getElementById)
{
flashMovie = document.getElementById("debaak");
}

if (flashMovie)
{
flashMovie.send2Flash(str);
}

Below you can find the necessary code for flash.


public function Main()
{
ExternalInterface.addCallback("send2Flash", callJS);
}
private function callJS(msg)
{
//called from js
trace('call from js:' + msg)
}

Image Carousel: Jquery vs. Flash

I used to build my carousels in flash, but i seemed a good challenge for me to build a nice looking carousel in jQuery. Of course the carousel should have the same functionality as a flash carousel. Thus said the carousel should get all the content from the html itself, include paging, the possibility for some text over the image and have nice transitions.

I searched the web for available plugins and the jQuery Cycle plugin seemed the best start. The only task left for me was finding a way to display text over the images and style the carousel. The result is astonishing and since the content is html it has a lot of advances over flash, SEO, accesibillity and much easier to implement for backend developers. However flash still has to advantage ( or disadvantage ) that it compiles your code which makes it less easy to copy it.

The result and code ( of the jQuery carousel ) can be found here