Main Page

Flash Movies

Back to the example, the
getMessageFromApplet()
function does nothing more than display the argu-
ment that was passed. Here’s the complete HTML code for the page:
<html>
<head>
<title>Applet Example</title>
<script>
function getMessageFromApplet(sMessage) {
alert(“Applet says: “ + sMessage);
}
</script>
</head>
<body>
<p>This page defines a function that is called by the applet once
it is loaded.</p>
<object type=”application/x-java-applet” code=”ExampleApplet3.class”
width=”400” height=”50” id=”ExampleApplet”>
<param name=”mayscript” value=”true” />
</object>
</body>
</html>
When this page is loaded, the applet displays the page title (
Applet Example
) and the URL you are
viewing the example from. Then, you should see an alert displaying the message
“Applet says:
Hello from the Java applet!”
You can also use
call()
to execute
getMessageFromApplet()
:
Object[] args = new Object[1];
args[0] = “Hello from the Java applet!”;
window.call(“getMessageFromApplet”, args);
Because
getMessageFromApplet()
is a global function, it’s considered a method of
window
and, there-
fore, can be called using the
call()
method.
Flash Movies
What began as a way to embed small, vector-based animations on Web pages has grown into a develop-
ment environment for entire Web sites and Web applications. Macromedia Flash has evolved into more
than just a tool for animations, but an entire development environment designed for use on the Web.
Flash movies, as they are called, are created using Macromedia’s proprietary Flash and Flash MX devel-
opment environments (although many graphics programs now feature an Export to Flash feature based
on Macromedia’s Open SWF initiative). Because of its ubiquity, the Flash plugin now ships with most
browsers, meaning that most users never have to download the plugin manually to enjoy the benefits
(unless an upgrade is made available, of course).
551
Interacting with Plugins
21_579088 ch18.qxd 3/28/05 11:43 AM Page 551


JavaScript EditorFree JavaScript Editor     Ajax Editor


©