EasyManua.ls Logo

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH - Page 670

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
830 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
670 Working with External Data
This JavaScript code defines three methods. The first method returns a reference to the
embedded SWF file based on whether the users browser is Microsoft Internet Explorer
(IE) or a Mozilla browser. The second function,
makeCall(), calls the asFunc() method
that you defined within the Flash document in the previous example. The
"extint"
parameter in the
thisMovie() function call refers to the object ID and embed name of
the embedded SWF file. If you saved your Flash document with a different name, you
need to change this string to match the values in the object and embed tags. The third
function,
jsFunc(), sets the value of the inField text field in the HTML document.
This function is called from the Flash document when a user clicks the
send_button
Button component.
4. Add the following HTML code before the closing </body> tag:
<form name="outForm" method="POST"
action="javascript:makeCall(document.outForm.outField.value);">
Sending to AS:<br />
<input type="text" name="outField" value="" /><br />
<input type="submit" value="Send" />
</form>
<form name="inForm" method="POST" action="">
Receiving from AS:<br />
<input type="text" name="inField">
</form>
This HTML code creates two HTML forms similar to the forms created in the Flash
environment in the previous exercise. The first form submits the value of the
outField
text field to the
makeCall() JavaScript function defined in an earlier step. The second
form is used to display a value that gets sent from the SWF file when the user clicks the
send_button instance.
5. Save the HTML document and upload both the HTML and SWF files to a web server.
6. View the HTML file in a web browser, enter a string in the out_ti TextInput instance,
and click the Send button.
Flash calls the
jsFunc() JavaScript function and passes the contents of the out_ti text
field, which displays the contents in the HTML form
inForm inField input text field.
7. Type a value into the outField HTML text field and click the Send button.
Flash calls the SWF files
asFunc() function, which displays the string in the in_ti
Text In p ut i n sta n ce.

Table of Contents

Related product manuals