0

i have a flash object in my html file

<embed id="ZeroClipboardMovie_1" src="/assets/811871e8/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="100" height="38" name="ZeroClipboardMovie_1" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=1&amp;width=100&amp;height=38" wmode="transparent">

how can i make click event on this object when a html button is clicked for example ?

2
  • sorry if it wasn't clear @MihaiIorga ... nope html button or java script code Commented Aug 26, 2012 at 11:01
  • 2
    You can communicate between java script and actionscript through External interfaces you can add event listeners in the actionscript side and on event you can call the java script functions Commented Aug 26, 2012 at 17:40

1 Answer 1

1

You can expose (invoke) your flash functions from javascript by using the ExternalInterface class and adding a callback.

AS3 (flash) code:

ExternalInterface.addCallback('nameForJStoCall',flashFunctionName);

JS code:

document.getElementById('ZeroClipboardMovie_1').nameForJStoCall(yourParametersIfNeeded);

For more detailed examples: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/external/ExternalInterface.html

You cannot however

tell flash to dispatch true click events externally (for security reasons). Things like invoking fullscreen mode, or a FileReference box will not work unless an element is actually clicked in flash.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.