MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH Manual page 669

Learning actionscript 2.0 in flash
Table of Contents

Advertisement

The previous code is split into three sections. The first section imports the
ExternalInterface class so you don't have to use its fully qualified class name. The second
section of code defines a callback function,
an HTML document created in an upcoming example. This function sets the text within
a TextInput component on the Stage. The third section of code defines a function and
assigns it as an event listener for when the user clicks the Button component instance on
the Stage. Whenever the button is clicked, the SWF file calls the
function in the HTML page and passes the text property of the
instance.
7.
Select File > Publish Settings and then select the Formats tab and make sure that Flash and
HTML are both selected.
8.
Click Publish to create the HTML and SWF files.
When you're finished, go on to the next procedure to create the container for the
SWF file.
Before you can test the previous Flash document, you need to modify the generated HTML
code and add some additional HTML and JavaScript. The following procedure modifies the
HTML container for the SWF file so the two files can interact when they run in a browser.
To create the HTML container for the SWF file:
1.
Complete the previous procedure.
2.
Open the extint.html file that Flash creates when you publish the application.
It's in the same folder as the Flash document.
3.
Add the following JavaScript code between the opening and closing
<script language="JavaScript">
<!--
function thisMovie(movieName) {
var isIE = navigator.appName.indexOf("Microsoft") != -1;
return (isIE) ? window[movieName] : document[movieName];
}
function makeCall(str) {
thisMovie("extint").asFunc(str);
}
function jsFunc(str) {
document.inForm.inField.value = "AS > Hello " + str;
}
// -->
</script>
, which is called from JavaScript in
asFunc()
out_ti
About the External API
JavaScript
jsFunc()
text input
tags:
head
669

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?

This manual is also suitable for:

Flash 8

Table of Contents