Followup: Opening a Thickbox iframe in Flash

My previous post, Opening a Thickbox iframe in Flash, became the most commented post in my blog history thanks to Hugo and Jason . =D

I’m really excited to see that people are reading my blog as always, but unfortunately, it seems that the code that I posted wasn’t working for them. I spent some time debugging the files Jason sent me, and I realised that the code I posted indeed didn’t work anymore, although the same code worked for me for another file still.

I haven’t found out why, but I’ve found a new solution to the problem, and this time, I’ve posted source files. The FLA is in Flash 8 format since the ExternalInterface works in Flash 8 onwards anyway. =]

The solution I found to make it work was adding the following param to the swfObject:

so.addParam("allowScriptAccess", "always");

I hope this zip helps people who’re trying to do this!

Source Files: http://www.designfission.com/opening-thickbox-in-flash.zip

34 Responses to “Followup: Opening a Thickbox iframe in Flash”

  1. Andy Ford

    Finally! If only you knew how little there is on this subject. A simple problem with a not-so-simple solution.

    Many thanks for posting the ZIP!!! and hard work on this solution.

    - Andy

  2. theboyofspewn

    Thank you very much for posting this! I was looking for a method to display an iframe either “in” or “above” my flash interface, and this solution worked wonders. I did convert it over to use the Flash/Javascript gateway instead of ExternalInterface, as I already have a gateway open for other functions.

    Small interesting note, in your .zip – the HTML link does not always work, while the flash does. I have noticed in IE6 the HTML link does not work, and sometimes in IE7 it won’t. At first it didn’t work for me in IE7, and then I changed the link to read “http://www.yahoo.com?……” instead of “.com/?” and it started working, but still doesn’t work for me in IE6 for some strange reason.

    Now then, I need to go thank the writer of ThickBox for writing such a nice code…..

  3. GoddeR

    your awsome man. everywhere i looked i saw everyone kept saying not possible. Great solution!

  4. charles

    great tip, thanks. i looked around and this is the advice that finally helped.
    one thing tho…any way to set a title to the thickbox?

  5. DarkSuiyoken

    I’m glad this helped people. =]

    Charles: I’m sure it can be done with some hacking into the CSS and javascript code. I’m pretty busy recently to help you out with this though, try asking around in the Thickbox forums. I’m sure someone would be glad to help you out with this.

  6. Tinker

    DarkSuiyoken:

    Thanks a lot man…
    Your sample is working for now :)
    However there are a couple of points I don’t quite get in the actionscript code.

    - The “tb_show” js-function is followed by “null”. Why?
    - At the end of the “ExternalInterface.call” the call is ended by declaring “false”, why?

    As I wanted a “modal” functionality I have appendend this to my ExternalInterface call and omitted the “false” statement, everything seems to work ok.

    Anyway thanks again :)

  7. DarkSuiyoken

    Hi Tinker,

    The parameters I am passing is what the default Thickbox function is asking for. The tb_show function in thickbox looks like that :

    function tb_show(caption, url, imageGroup)

    The null is for a caption, while the true/false is for the imageGroup.

    I’m glad this helped another person!

  8. Malkauns

    Hi,
    great work – just what I was searching for. It works fine on Firefox and Safari. Are there any ideas, how to get it work on IE6 or IE7?
    Thanks a lot for the solution!

  9. Kemal

    hi…

    I tried your source files… they work perfect…

    but if i wanna change anything it doesnt work anymore….

    This is what I did:
    I changed the base.fla file and modified only the background-color. I saved it as a flash8 fla-file and published it with flashplayer 8…

    but when i edit this line

    var so = new SWFObject(“base.swf”, “sotester”, “550″, “400″, “8″, “#FFFFFF”);

    into base2.swf…. it doesnt work anymore :S

    i really dont know what to do anymore… i tried a lot of different things cant get it to work…

    weird isnt it…

  10. Charles

    Thank you so much for this solution,

    I have been looking for one for over a month and just when I thought of trashing the project, I found your solution. I am a web designer/developer who built a website based on a customers design in Joomla using thickbox to show the link contents. After creating an interactive map in flash, I had to call thickbox through when a link in the map is clicked on…now it works perfectly well…thank you soo much…

    Cheers mate

  11. hugo

    Ahahahah that’s me again :D

    This one is working great for me! Thank you sooooooooo much!

    Greetings from Rio de Janeiro, Brazil :D

  12. Ben

    Thanks a ton for this. It really helped me out.

    One thing though, for anyone trying to load an ASP page into the thickBox frame: you’ll need to leave out the “/” before the question mark. I don’t know why this is, but I couldn’t get my pages to load until I removed it.

  13. Nick

    exactly what I was looking for as we were doing a flash map that needed to popup windows using ThickBox functionality.

    Jus for reference, IE7 gave me fits because of when I put the wmode=transparent but once that was adjusted it ran cross browser with no problems.

    God Bless you sir!

  14. GC

    I have been banging my head on this for some time, thanks so much for posting the zip. Guess I am just not good at following directions!

  15. Tanner

    Does anyone know why this doesn’t work:

    mc.onRelease = function() {
    var link:String = links[1];
    ExternalInterface.call(“tb_special”,link);
    }

    But this works:

    mc.onRelease = function() {
    var link:String = “images/image1.jpg”;
    ExternalInterface.call(“tb_special”,link);
    }

    The string is exactly the same. I don’t get it?!???????

  16. Tanner

    Ok it works :-) But is it possible to call an imagegroup for a gallery? Don’t know how to do this!?

  17. Jon

    Thank you so much for this – I know you posted this a while back but you just saved my bacon

  18. Jack

    My goodness me. You, sir, rock the world.

    I’ve been digging around and your solution came up. Just trying it now with Flash CS4 and it looks like it should work smoothly. I’ll let you know what I find.

    Thank you for posting this solution, and for updating it with new toys.

  19. Ahamed

    THANK GOD FOR CREATING YOU!!!

    i was searching for a way to get this working for the past 6 hrs and with failiure. around an hour ago found ur script and tried it and failed so many times to get it working and FIANLLY!!!! it works now!!!!

    THANK YOU A TRILLION x MILLION TIMES FOR THIS SCRIPT!!!!

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>