Calling flash with javascript

I searched for ExternalInterface but didn't know how to implement it.

I want to start / execute flash by clicking on an image element.

<img src="a.png" onclick="runFlash()" />

      

my Flash

<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="16" HEIGHT="16" id="flashUpload" ALIGN="">
 <PARAM NAME=movie VALUE="{swf_upload_url}?UploadSession={upload_session}&AccessKey={AccessKey}&ServerID={ServerID}&ShowTopBtn=1&TopBtnIcon={SKIN_DIR}/images/a.png">
 <PARAM NAME=quality VALUE=high>
 <PARAM NAME=allowScriptAccess VALUE=always>
 <PARAM NAME=bgcolor VALUE=#000000>
 <PARAM NAME=wmode VALUE=transparent>
 <EMBED src="{swf_upload_url}?UploadSession={upload_session}&AccessKey={AccessKey}&ServerID={ServerID}&ShowTopBtn=1&TopBtnIcon={SKIN_DIR}/images/a.png" quality=high bgcolor=#000000  WIDTH="32" HEIGHT="32" NAME="flashUpload" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>
</OBJECT> 

      

Could you help me with a detailed example?

I tried to put the image above the absolute position flash, but when pressed, the flash won't fire.

Thanks.

Hello,

Shishant Todi

0


a source to share


2 answers


You can try SWFObject and add something like this to your runFlash () function:

var so = new SWFObject("movie.swf", "mymovie", "400", "200", "8", "#336699");
so.write("flashcontent");

      



And just place the div on the page named "flashcontent" that originally contains the image.

+2


a source


How your AS3 should look like:

ExternalInterface.addCallback("runFlash", jsCallsRunFlash);

function jsCallsRunFlash()
{
    ...
}

      



//edit

And here's a tutorial on AS2 version

0


a source







All Articles