Question : Calling FancyBox from Flash Actionscript 3

Hello, I'm attempting to call a Javascript function from Flash in AS3, the function is called FancyBox and uses JQuery. I am unable to change the code that exists in the website, I can only change the Flash file. Here's the site as it stands, you can see that by clicking the "Book your FREE consultation now" button at the top correctly links to the FancyBox: http://www.gatewaycomms.com/gateway_microsite/. The banner at the top is to be replaced with the Flash file I'm creating. Any ideas as to how I can summon the box from Flash? Many thanks in advance :]

Answer : Calling FancyBox from Flash Actionscript 3

ok - there is a manual invocation - $.fancybox();  notice that it's called from the jQuery class directly, not the resultant object of a selector collection.

that said, the code you provided is missing some info.  i looked at the original link you posted, and there is no element with the id of bookconsultation.  there is one for bookconsultationfooter, though.  anyway, that element would have an href attribute that would determine the source of the iframe.  you need that url.  once you have it, you should be able to use this javascript function (which is tailored to the information you do have):

            $.fancybox({
                  'width'                        : 557,
                  'height'                  : 564,
                  'autoScale'                  : false,
                  'transitionIn'            : 'fade',
                  'transitionOut'            : 'fade',
                  'type'                        : 'iframe'
                  'href'                  : 'http://www.experts-exchange.com',
                  'title'               : 'whatever title you want'
            });


i just ran a test using the attached snippet and it works.


1:
2:
3:
4:
5:
6:
7:
8:
var jquery:String = "$.fancybox({'width':557,'height':564,'autoScale':false,'transitionIn':'fade','transitionOut':'fade','type':'iframe', 'href':'http://www.experts-exchange.com','title':'Lorem ipsum dolor sit amet'});";
var method:String = "Function(\"" + jquery + "\")";

whatever.addEventListener(MouseEvent.MOUSE_DOWN, clickHandler);

function clickHandler(event:MouseEvent):void{
	ExternalInterface.call(method);
}
Random Solutions  
 
programming4us programming4us