flash/rich HTML coexisting is definately turning up a whole new, fun set of challenges. So far, some of my favorites are: * having rich modal windows appear behind flash elements (fixable using the iframe shim technique) * setting focus of various elements (fixed by creating a variable in our base page class that let me set the default focus to any elment by ID) * today’s, having to do with the ExternalInterface.AddCallback method in flash, and its playing nice with swfobject.
In essence, we have a login function that pops up one of those nifty DHTML layers with a login box. Our top navigation is all flash, and has a login call to action…so having flash call javascript functions isnt hard, but getting javascript to “poke” at the flash and have it run an internal function is a bit trickier. Utilizing the aforementioned callback method, its fairly simple. The problem we had was, in Internet Explorer, order of operations was a bit out of whack.
we got an error on:
__flash__addCallback(coreLoader, "loginNav");
coming from INSIDE the flash…what seemed to be happening was the javascript that set up the object “coreLoader” wasnt running at the right time because of the time it took for swfObject to set up the embed. So, adding
coreLoader = $('coreLoader');
immediately AFTER
so.write("topNav"); set up the object again, this time not filling the object with a null (because swfObject had
correctly identified an embed with id=coreLoader), and allowing the internal flash “addCallback” function to work.
hm, technical writing is difficult. but i felt the need to document this problem (even if it wasnt very well) for my own future reference, and hopefully someone else will find it handy as well.
the more general moral of the story is: pay attention to order of operations, they may save your life some day.