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 user’s 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 file’s
asFunc()
function, which displays the string in the
in_ti
TextInput instance.
Содержание FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Страница 1: ...Learning ActionScript 2 0 in Flash...
Страница 8: ...8 Contents...
Страница 18: ...18 Introduction...
Страница 30: ...30 What s New in Flash 8 ActionScript...
Страница 66: ...66 Writing and Editing ActionScript 2 0...
Страница 328: ...328 Interfaces...
Страница 350: ...350 Handling Events...
Страница 590: ...590 Creating Interaction with ActionScript...
Страница 710: ...710 Understanding Security...
Страница 730: ...730 Debugging Applications...
Страница 780: ...780 Deprecated Flash 4 operators...
Страница 830: ...830 Index...