是否可以從Flash電影中打開JQuery燈箱?

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


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

是否可以從Flash電影中打開JQuery燈箱?

2 个解决方案

#1


Try Calling any JS lightbox from Flash using jQuery

嘗試使用jQuery從Flash調用任何JS燈箱

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

或者你可以將flashLightBoxInjector開始Lightbox從Flash一個PrototypeJS類移植到jQuery框架而不會有太多麻煩如果你有點自信寫javascript

#2


Yes you can do it.

是的,你可以做到。

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

要調用javascript函數doIt(),您可以編寫:

getURL("javascript:doIt()");

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

但實際上,如果你不得不這樣做,可能有更好的方法來解決你的問題。

jrh


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2009/06/17/7299f0bc8bd4f3c86074311d0ef312ef.html



 
粤ICP备14056181号  © 2014-2020 ITdaan.com