# Lightbox with AS3

**URL:** <https://forum.kirupa.com/t/lightbox-with-as3/268841>\
**Category:** Uncategorized\
**Created:** [August 19, 2008, 4:28pm UTC](https://forum.kirupa.com/t/lightbox-with-as3/268841 "2008-08-19T16:28:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![custo](https://avatars.discourse-cdn.com/v4/letter/c/5e9695/32.png) [@custo](https://forum.kirupa.com/u/custo)\
**Post date:** [August 19, 2008, 4:28pm UTC](https://forum.kirupa.com/t/lightbox-with-as3/268841/1 "2008-08-19T16:28:16Z")

</div>

I’m trying to use lightbox from AS3, but I can’t make it to work…

The code I have is:

```auto

_contenedor.but.addEventListener(MouseEvent.CLICK,callJS);

function callJS(event:MouseEvent):void {
     ExternalInterface.call("PopFromFlash", "images/thumbs.jpg");
}

```

but it doesn’t work. The screen goes black and that’s it, it doesn’t show any picture. I already have added params.allowscriptaccess = “always”; in the swfobject…

And this is the js function that calls the lightbox, which it’s actually called because it popups the alert

\<script type=“text/javascript”\>  
function PopFromFlash(url) {  
var imgLink = document.createElement(‘a’);  
imgLink.setAttribute(‘href’, url);  
imgLink.setAttribute(‘rel’,‘lightbox’);  
Lightbox.prototype.start(imgLink);  
alert(“Test function”);

}  
\</script\>

Any help will be really appreciated. 😉
