LocalConnection/hidden iFrame gotcha, and a bunch of new acronyms

Posted on Saturday 14 May 2005

I spent the better part of the day implementing Martijn de Visser’s ExternalFunction method which allows seamless Flash/JavaScript communication using a FlashVars, an iFrame and LocalConnection. Well apparently if the script is loaded into an iframe and that iframe has a display:none setting in CSS it will fail. This is actually a pretty standard situation if you have an upload form hack for example. Either the browser does not properly send the FlashVars or the loading is never made or I don’t know what… but it just won’t get sent. Using visibility:hidden and moving the iframe off screen solves the issue.

Edit: It solves the issue for Firefox only. Our good old friend IE will choke on visibility:hidden as well. The funny thing is that as soon as the iframe is visible then the FlashVars are executed and you get the message you were supposed to several minutes later. Anyway the solution is to never use either display:none or visibility:hidden, but rather left:-1000px and top:-1000px to move it off screen. This looks like it works perfectly fine on my installation, but more testing is needed imho. I guess what it comes down to is that browsers can sometimes decide not to honour DOM createElement calls or honour it just in time (JIT) on show if the parent element is hidden or not displayed. I guess that makes sense but it’s a bitch to debug nonetheless.

I love these LocalConnection/FlashVars/iFrame hacks, be it for enabling the back button (as I have done recently for the sections of the corporate site), upload forms, flash/javascript communication and whatnot. I may publish the class I use for the history on the corporate site in a few days, it’s quite pretty and useful. I often have to supplement these techniques with PHP for generating tokens so different windows won’t steal localConnections. The great thing about this technique is that it generates wonderful, catchy acronyms depending on your preferred server side language; since making up new acronyms for things that already exist is the latest, greatest fad, let me jumb on the bandwagon with this non-exhaustive list of variations on the theme FlashVars|LocalConnection|iFrame|*:

  • with PHP: FLIP (also works with Python and Perl)
  • with a general Templating engine: LIFT
  • with ColdFusion: CLIFF (the other f is for Flash, dummy)
  • with ASP: FAIL (how very appropriate)
  • with PHP|Python|Perl + SSI|jScript: SPLIFF

You can almost make a story out of all the acronyms too ;)


WordPress database error: [Can't open file: 'wp_comments.MYD'. (errno: 145)]
SELECT * FROM wp_comments WHERE comment_post_ID = '97' AND comment_approved = '1' ORDER BY comment_date

No comments have been added to this post yet.

Leave a comment




Your e-mail address is never displayed. If you run into issues with SpamKarma blocking you, email me at $patrick->5etdemi(com)


RSS feed for comments on this post | TrackBack URI