Flash AS3 Tutorials Center | Interesting Flash Animation Tutorials | Valuing Flash Animation Tutorials | Flash ActionScript and Animation Home

AS3 Beginner Tutorials | AS3 Basic Lessons | AS3 Valuing Courses | AS3 Components Tutorials | AS3 and PHP Interaction Tutorials
AS3 Practical Tutorials | AS3 Animation Techniques | AS3 Transition Effects Tutorials | AS3 Download Upload Files | AS3 Particle Systems
Communication Between Flash Movies with AS3 | AS3 and JavaScript interaction | AS3 Matrix Transformation | AS3 Physics Simulation Tutorials

Send HTML Select Menu Value to Flash

This Flash and HTML interactivity example demonstrate how to send value of HTML Pull-down Menu (Select Menu) to Flash Movie. When the Pull-down Menu is selected, the corresponding value of the Menu is sent to Flash at once.

Please update flash player to view this Flash ActionScript tutorial!


Change color of square box in Flash Movie:

Flash Tutorial Content:

This Flash ActionScript and HTML JavaScript interactivity tutorial show how to interact HTML Pull-down Menu with Flash Movie. The Pull-down Menu is often used in HTML form. This flash example shows how to send the value of Pull-down Menu to Flash.

The completed Flash Movie of this tutorial is shown as above. You may play around to see how it works.

Flash ActionScript and HTML Codes:

HTML Webpage Side:

Step 1:
Layout a Select Menu on the HTML webpage. The JavaScript function changeColor will be executed when the value of Select Menu is changed.

<form action="" id="myform">
Change color of square box in Flash Movie:
<select id="pullDownMenu" onchange="changeColor();">
<option value="1" selected>Red</option>
<option value="2">Green</option>
<option value="3">Blue</option>
<option value="4">Yellow</option>
<option value="5">Black</option>


Step 2:
Write the JavaScript function changeColor. The JavaScript function will make a call to ActionScript function sendColorToFlash.


<script language="JavaScript">
//Get flash movie id (myFlash)
var myFlashMovie;
function init() {
if (document.getElementById) {
myFlashMovie = document.getElementById("myFlash");

//Wait the page to fully load before initializing
window.onload = init;


//This is the function to communicate with Flash
function changeColor() {
if (myFlashMovie) {
//Call the registered ActionScript method (sendColorToFlash)
<!-- access the value of an HTML input by assigning it an id -->
var colorMenu = document.getElementById("pullDownMenu");
var ID = colorMenu.options[colorMenu.selectedIndex].value;


Flash Side:

Step 1:
Use ExternalInterface.addCallback( ) to register the ActionScript function. Once the ActionScript functions is registered, it can be called by the JavaScript function.

ExternalInterface.addCallback("sendColorToFlash", getColorFromJavaScript);


Step 2:
Hook with the ActionScript Function (getColorFromJavaScript)

Download Flash Source File:

Flash Source File Awaiting to be released.


This Flash ActionScript tutorial shows how to send HTML Select Menu value to Flash Movie.