User avatar
torstein.honsi
Site Admin
Posts: 9210
Joined: Thu Nov 09, 2006 11:22 am
Location: Vik i Sogn, Norway

Can I open Highslide from within a Flash movie?

Fri Oct 03, 2008 7:15 am

This is a quick and easy way to call hs from within flash using externalInterface (actionscript 2).

FLASH:
Create a movieclip on your stage and give it an instance name, in this case it's 'btn_details'

In your ActionScript (version 2) layer add:

Code: Select all

import flash.external.ExternalInterface;
btn_details.onRelease = function () {
	ExternalInterface.call("firehs");
};
When you publish, publish to "Flash Player version 8".

In ActionScript version 3 this is done a little differently:

Code: Select all

import flash.external.ExternalInterface;
btn_details.addEventListener(MouseEvent.CLICK, launchhighslide);
function launchhighslide(event: MouseEvent) {
    ExternalInterface.call("firehs");
} 

HTML/JAVASCRIPT:
In the head section of your page add:

Code: Select all

<script type="text/javascript">
function firehs() {
	hs.expand (null, { src: 'image.jpg' } );
}
</script>
That's all, clicking on your flash button will now open highslide. An example can be seen here http://www.mx3design.co.uk/predesign.php (click on the 'VIEW DETAILS' button within the movie at top of page).

Thanks to m3xdesign for the tutorial.

Return to “Highslide FAQ”