Conscious Anima Wandering about in search of the interesting things… contact »

IE, ExternalInterface, and the hybrid DOM objects and __flash__addCallback

For most browsers (read, non-IE) the DOM objects are pure javascript objects. You can clobber them all you want. Your page may act strange, but that’s your call. However, in IE these DOM elements are actually partially-exposed native objects that try valiantly to pretend like they belong to the JS object family. Sort of like a white man in Harlem, really. This is fine most of the time, but a non-obvious set of problems happen when you use Flash/Flex’s ExternalInterface to allow callbacks from JS to Flash. The Flash player injects some code into the page to augment the node with functions that do the actual callback. Now, that part also works fine unless you have a function named “stop” (and there are others, but stop is very common), which actually also exists (albeit invisibly) on the hybrid DOM object. Facing the condition where an un-extensible method is being overwritten, IE will freak out and throw an exception at __flash__addCallback. Solution: don’t call your exported method “stop” 🙂