Dubaigenius
Dubaigenius

Reputation: 21

Is it possible to open a JQuery lightbox from a Flash movie?

Is it possible to open a JQuery lightbox from a Flash movie?

Upvotes: 1

Views: 2925

Answers (2)

jrharshath
jrharshath

Reputation: 26583

Yes you can do it.

To call a javascript function doIt(), you write:

getURL("javascript:doIt()");

But really, if you are having to do that, there might be better ways to solve your problem.

jrh

Upvotes: 0

jitter
jitter

Reputation: 54615

Try Calling any JS lightbox from Flash using jQuery

Flash:

import flash.external.ExternalInterface;
button.addEventListener(MouseEvent.CLICK, external, false, 0, true);
function external(evt:MouseEvent):void {
 ExternalInterface.call("external", "lightbox/photos/image1.jpg");
}

Javascript:

function external(path) { // pass in the correct path to the function so we only need one <A> for infinite amount of calls from  flash              
// if the lightbox does not exist we will make it               
 if ($('a#lightbox').length == 0) {                 
  $("body").append("</A><A id="lightbox" style="visibility: hidden; position: absolute; left: -9999px;" href="http://www.thetruetribe.com/+path+">calling js lightbox from flash</A>");                
  $('a#lightbox').lightBox();           
// if it already exists but the path is different we will set the new path              
 } else if ($('a#lightbox').attr("href") != path) {                 
  $('a#lightbox').attr("href", path);           
 }      
// now we will simulate the click here.             
 $('a#lightbox').trigger("click");      
}

Or you could port flashLightBoxInjector Start Lightbox from Flash a PrototypeJS class to the jQuery framework without too much trouble if your a somewhat confident in writing javascript

Upvotes: 3

Related Questions