Steven Kovar - Interactive Designer

Tech Journal

Latest Entries

Tech and Design

iPhone

Web

Motion

Opening Shadowbox windows from a link in Flash

March 09, 2009

A while back I was presented with the task of opening a link to an image from a flash banner within Shadowbox. For this you’ll need to have Shadowbox installed according to the instructions on the Shadowbox site. The basic concept is that you’ll need to pass some information from the flash file to the Shadowbox scripts to tell it how big the pop-up window should be, the content URL, and what type of content will be displayed. The site I was working on must be accessible to wide range of browsers, so I published the flash banner for flash 7 using Actionscript 2.0.

To make the banner active, I overlayed a transparent movie clip over the entire banner area. The movie clip serves as the active “hot” area to make whole banner clickable. 

The Actionscript

on(release{
getURL
("javascript:Shadowbox.open({title:'title',type:'img',
width:'sbox_width',height:'sbox_height',content:'sbox_contentURL'});"
); 
;

I put the button code directly on the transparent movie clip, but if you want to keep all your code in an actions frame, you could name your button movie clip something like “button_mc”, and assign the action to the movie clip instance in your Actionscript layer. In my case, it made more sense and was faster to just use it as button code. Conceptual example;

button_mc.onRelease.getURL...etcetc 

And that’s pretty much it. It worked great for me. I hope this at least points you in the right direction.


Reader Comments


There are no comments yet.

Leave a Comment

Name:

Email:

Url:

Add your comment

Please enter the word you see in the image below: