Bookmark and Share

How to call external JavaScript function?

Print

In Actionscript 3.0, to call external JavaScript function, you need to use function ExternalInterface.call.

To call external JavaScript function in Slide3D Component, please follow below steps:

1. Add import line:

import flash.external.*;

2. Specify event handler function for parameter eventHandlerOnPress.

demoSlide.eventHandlerOnPress = "onPhotoClick";

3. Define event handler function:

function onPhotoClick(index:int):void
{
// call JavaScript only when image is on front
if (index == demoSlide.slideCurrent)
{
if (ExternalInterface.available)
ExternalInterface.call("JSFuncName", JSParameter);
}
}

You can use property slideCurrent of Slide3D component to get the current slide which is on front.

For more details about function ExternalInterface.call, please view the Help document of Adobe Flash CS3/CS4.

The downloaded package includes a demo project: demo_lightbox2.

 

Newsletter





Payment Method


Flash Components Set


Warning: Parameter 1 to modMainMenuHelper::buildXML() expected to be a reference, value given in /usr/www/users/mtoolsft/mtoolcomponents/content/libraries/joomla/cache/handler/callback.php on line 99

Flash Slideshow


Warning: Parameter 1 to modMainMenuHelper::buildXML() expected to be a reference, value given in /usr/www/users/mtoolsft/mtoolcomponents/content/libraries/joomla/cache/handler/callback.php on line 99

Flash Animation Effects


Warning: Parameter 1 to modMainMenuHelper::buildXML() expected to be a reference, value given in /usr/www/users/mtoolsft/mtoolcomponents/content/libraries/joomla/cache/handler/callback.php on line 99

Flash Preloader Components


Warning: Parameter 1 to modMainMenuHelper::buildXML() expected to be a reference, value given in /usr/www/users/mtoolsft/mtoolcomponents/content/libraries/joomla/cache/handler/callback.php on line 99