Tips and tricks

Multiple ExternalInterface function with the same name in IE8 / IE7

First I’d like to say that I left out IE6 because it’s a stupid browser and does not matter to me.

Recently I have been working on a html5 audio player. Obviously I need to provide a fallback for IE8 browser. But I did not want to redesign the whole player again in flash so the plan was to create a swf container that just plays music and gets commands from the current UI.

All went awesome, the swf totaled a whooping 1.77 kb and was receiving commands fine via ExternalInterface. Tested even in IE8 and worked fine from the first time. But then I decided to place multiple players on the page. Then all broke loose. Only one player worked. So I thought, and thank God I thought well, ExternalInterface does not allow multiple callbacks with the same name. So I passed the id that should be unique of the audio player container via FlashVars to the swf and within the Swf I created functions with ExternalInterface that had the ID appended to their namespaces.

Took a little time, but the story had a happy ending.

{"type":"main_options","images_arr":"'#ffffff'","enable_ajax":"off","soundcloud_apikey":"","bg_isparallax":"off","bg_slideshow_time":"0","bg_transition":"slidedown","site_url":"https:\/\/digitalzoomstudio.net","theme_url":"https:\/\/digitalzoomstudio.net\/wp-content\/themes\/qucreative\/","blur_ammount":"26","width_column":"50","width_section_bg":"","width_gap":"30","border_width":"0","border_color":"#ffffff","translate_cancel_comment":"Cancel reply","translate_leave_a_comment":"Leave a comment","translate_leave_a_comment_to":"Leave a comment to","is_customize_preview":"off","width_blur_margin":"30","gallery_w_thumbs_autoplay_videos":"off","content_enviroment_opacity":"30","menu_enviroment_opacity":"70","base_url":"https:\/\/digitalzoomstudio.net"}
{"type":"darkfull"}