-
Call Thickbox from AS3
Hi
I'm trying to get Thickbox working with AS3.
I've seen an example where the external Interface calls a function in the HTML but this example is when Thickbox opens an iFrame.
If I want to use just a simple single image is this still necessary? in AS2 with lightbox which does the same job all you needed was a simple getURL.
The code I have setup is
Code:
import flash.external.ExternalInterface;
test_mc.addEventListener(MouseEvent.CLICK, onClick);
function onClick(event:MouseEvent):void
{
ExternalInterface.call();
}
test_mc.buttonMode = true;
I just need to know how to write the ext call.
-
An example would be the following:
ExternalInterface.call('TB_show', caption, href, group);
I am not exactly sure about ThickBox - haven't used it in ages. I know it works like lightbox, greybox and all the others in that it parses the dom and automagically adds the necessary handlers for each item with class="thickbox" or somethign like that. I just saw a post saying you could call their automagically attached function by using TB_show, but I have not verified this. At any rate, the ExternalInterface.call function takes the javascript function name as the first argument, and the rest of the arguments are the arguments you want to pass to the function... so in this case, the TB_show function signature in the ThickBox js should look similar to this:
function TB_show(_caption, _href, _group) {
...
...
}
-
Thanks for replying so quickly.
I've actually got this working but I'm getting the same problem as I had with Lightbox with AS3, it won't work in Internet Explorer. It just says error on page.
It seems like IE just doesn't like it when an extrenal function is called from flash, could this be the case?
My code that works in Safari and Firefox
Code:
import flash.external.ExternalInterface;
test_mc.addEventListener(MouseEvent.CLICK, onClick);
function onClick(event:MouseEvent):void
{
ExternalInterface.call("tb_show" , null , "images/slideC.jpg?cid=6&height=450&width=560" , false);
}
test_mc.buttonMode = true;
Any one got Thickbox and Flash working with AS3 and IE?
-
2 Things:
1. Which version if IE.
2. I believe the function name is supposed to be TB_show, not tb_show.
-
Its definitely tb_show, tried TB didn't work at all.
It does this in IE 6 & 7 exactly the same error on page in the status bar.
I'd love to find a solution to this its been bothering me for ages, I'm having to use AS2 in some cases just to get it to work.
-
Well, to troubleshoot the problem, try adding a link in your html output like the following
<a href="javascript:void(0);" onclick="tb_show('somecaption', 'someurl');">CLICK</a>
and make sure that works first. If it does, I would be very surprised as I am fairly confident the AS is correct. Regardless, you need to verify that you can call the function in javascript directly.
-
That works mate in IE,
see the page for yourself here
http://www.qwerty-design.co.uk/web_demos/as3test.html
What does that mean then that the AS is wrong? could it not having something to do with the being called from outside of the HTML file?
I'm in your hands your knowledge is greater than mine.
-
Just searched for ExternalInterface.call internet explorer in google and it seems like this is a known error nothing to do with Thickbox,
I check out some of the fixes tomorrow see if I can figure them out
one guy is saying "id" attribute in order to work in the embed swf code do you know what this means?
-
It worked!
Hi, I just got it working in IE!
botonInvisible.addEventListener('mouseUp', function() {
ExternalInterface.call("tb_show" , null , "images/accesorios1.jpg?cid=6&height=450&width=560" , false);
});
I used swfobject to embed the flash movie and added 'transparent' in the parameter "wmode", that should do the trick, also be sure to insert the correct path which is relative to the html document in which the flash is embedded.
I also noticed that even if I erased the part of the string that defines height and width still worked, rendering the image at its normal size.
-
I had to bring this thread back to life since I am having the same problem and even after applying the changes mentioned on this thread, I can't get Thickbox to open on IE (works great on Safari and Firefox).
My situation:
I have a flash movie displaying images that when clicked on, it takes you a web page. The flash movie refers to an XML document to retrieve the path to the image and the link to the page.
Here is my line of code from Flash calling the Thickbox:
Code:
ExternalInterface.call("tb_show","Title of Page",link+"?&keepThis=true&TB_iframe=true&height=550&width=375",false);
The word "link" is just a variable that holds the link to the web page that needs to be launched retrieved from XML document.
I tried adding the 'null' parameter but it actually made not work on Firefox and Safari.
I am using the latest version of Thickbox as well.
Has anyone made this work on IE? If so, can I get some step by step on how you were able to resolve the issue?...
Last edited by nan2graph; 09-28-2009 at 10:50 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|