views:

74

answers:

2

Hello,

I searched ExternalInterface but didnt got to know, how to implement it.

I want to run/execute a flash when clicked 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"&gt;&lt;/EMBED&gt;
</OBJECT>

Can you please help me with a detail example?

I tried placing an image above the flash with absolute position but when clicked the flash doesn't run.

Thank You.

Regards,

Shishant Todi

+2  A: 

You could try using SWFObject and put something like this in your runFlash() function:

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

And just put a div on the page named "flashcontent" which initially contains the image.

Jason Miesionczek
It actually embeds the flash replacing image i want to run the flash when clicked on image.
Shishant
ok so you can just put the image somewhere else, and the flash will still get loaded into the "flashcontent" div.
Jason Miesionczek
A: 

That's how your AS3 should look like:

ExternalInterface.addCallback("runFlash", jsCallsRunFlash);

function jsCallsRunFlash()
{
    ...
}

//edit

And here's AS2 version tutorial

Michal M