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 Text from Flash to HTML Form

This Flash and HTML interactivity example demonstrate how to send text message in Text Field from Flash Movie ActionScript to JavaScript HTML Text Field on webpage.

Please update flash player to view this Flash ActionScript tutorial!


Receive Message from Flash:

Flash Tutorial Content:

This Flash ActionScript and HTML JavaScript interactivity tutorial shows how to call JavaScript in HTML from ActionScript in 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:

Flash Side:

Use ExternalInterface.call( ) method to call to JavaScript functions from ActionScript.

var result:Object = ExternalInterface.call("getTextFromFlash", jsArgument);

The code in Flash Movie will call the JavaScript getTextFromFlash () function with a parameter of jsArgument. You can pass any parameters with the function you like. In this tutorial, we pass the text in the Text Field with the function.


HTML Webpage Side:

Remember that The function must be defined in the HTML page with the same name.


Step 1:
Layout a Text Field on the HTML webpage.

<form name="htmlForm" method="POST" action="javascript:formSend();">
<input type="text" name="receivedField" size="35" value="">


Step 2:
Write the JavaScript function getTextFromFlash. The JavaScript function will be called from ActionScript function when the send button in the Flash Movie is clicked.


<script language="JavaScript">
function getTextFromFlash(str) {
document.htmlForm.receivedField.value = "From Flash: " + str;
return str + " received";

Download Flash Source File:

Flash Source File Awaiting to be released.


This Flash ActionScript tutorial shows how to call HTML JavaScript from Flash ActionScript.