Quick Tip: Activating jQuery from Flash

Posted by & filed under Quick tips.

Calling a javascript function from within Flash is pretty simple. Here’s how you can use it to run some jQuery effects .

I used this technique when creating the Snowberrybeauty.com website. With this website the background was entirely done in flash with the HTML elements stacked over the top.

For the homepage of the site I hid most of the HTML elements with CSS … then just before the Flash intro has finished playing, I called the javascript function below. This faded in the HTML elements just as the intro came to a stop.

Here’s what you need.

1. In your web page set up a javascript function to fade in the desired elements.

function showHtmlElements(){
$('#element1').fadeIn(1000);
$('#element2').fadeIn(1000);
}

2. In flash, when you want to activate the function, just use some simple actionscript like this.

getURL("javascript:showHtmlElements();")

That’s all there is to it. Easy.

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>