Execute Lightbox Scripts From Flash
This evening I will be showing you how to execute my Lightbox++ script from a Flash movie. You’re not only limited to Lightbox++, as you can use this tutorial with any Lightbox scripts based on Lokesh Dhakars Lightbox class. How is it done? Simple really. We setup something similar to what .NET programmers refer to as a Delegate. This will all be explained in a minute, so lets begin.
We’re going to assume at this point you already have a web document with Lightbox++ or a Lightbox style script installed. If you haven’t done this already, you can read the installation documentation for Lightbox++ by clicking here - Lightbox++
Awesome, so what do I need to do?
1 2 3 4 5 6 7 8 9
This is some sample code taken from the example Flash video above. You’ll notice that we’re calling our LightboxDelegate function, and are specifying two arguments. The first argument is the URL to the image or movie (if using Lightbox++) in which you wish to display. The second argument is simply a caption, in which you can set to whatever you would like.
Next you will need to embed your Flash movie into your document that has your Lightbox script installed. In your object tags, you’re going to need to specify the following params:
<param name="allowscriptaccess" value="samedomain"> <param name="wmode" value="transparent">
In your embed tag you’re going to need to insert the following attribute:
The wmode parameter and attribute allows the Lightbox to appear over the Flash movie. The allowscriptaccess param allows the Flash movie to speak with our Delegate, and we’re using the “samedomain” value to offer up a little bit of security.
You’re done, enjoy your new found skills. Stay tuned for my next post, which will be showing you how to execute Lightbox scripts from you favorite slideshows, namely SlideShowPro and Monoslideshow.
If you wish to download an example to go with todays tutorial you may do so here - Download Example
NOTE: You will need to upload this example to your hosting service for it to work correctly.
Return to: Execute Lightbox Scripts From Flash