- Internet & the Web
For example, you have a series of buttons in your Flash movie with instance names “button1”, “button2”, etc. and you each to do something different to your HTML when clicked.
This function will be called by all of our buttons, and will bring up a popup with the name of the button that was clicked.
Step 2: the Actionscript
Now, in your flash file, the first thing to do is import the proper packages. At the top of your Actionscript, add the line:
button2. addEventListener(MouseEvent.CLICK, onClick);
Then define your “onClick” function:
Step 3: Embedding your flash
If you’re using SWFObject version 1.5, your code will looks something like this:
If you’re using SWFObject 2.0, just add the line:
<param name="allowscriptaccess" value="sameDomain" />
inside the <object> tag, or you can use their script generator to set the “allowScriptAccess” parameter. You will find it under “more” under SWF Definition. The whole SWFObject version 2.0 code will looks something like this: