Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Javascript control on Safari with Flash 7 and 8



Flash Player 8 added an ExternalInterface object to make methods in your flash file available to _javascript_.

You

import flash.external.ExternalInterface;

then

ExternalInterface.addCallback("whatIWantJavaScriptToSee", null, theFunctionIWantToBeAvailableToJavaScript);

This isn't available before 8, but there are techniques that you can use (which aren't very nice). Google can help with that part :)

Chris

On 3/7/06, Leon Chen <email@hidden> wrote:
My friend asked me this but I could not figure out why. Below is a
html page and include some _javascript_ to control the play and rewind
of the swf file shape.swf. It works in Safari with Falsh plug-in 8
installed but could not work with Flash 7 (would report that obj.play
is not a recognized object etc).

  I also tried it with FireFox 1.5.0 (Flash 8 plug-in)  and it also
reports obj.play is not a function. Can anyone help point out what is
the problem?

Thanks,

Leon



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
         "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=
ISO-8859-1" >

<script type="text/_javascript_">

        function playFlash()
        {
                var obj = document.getElementById("ebooksysflashcontrol");
                obj.Play();
        }

        function stopFlash()
        {
                var obj = document.getElementById("ebooksysflashcontrol");
                obj.Rewind();

        }
</script>

</head>
<body>

<object
id="ebooksysflashcontrol"
classid="">codebase="" href="http://download.macromedia.com/pub/shockwave/cabs/flash/"> http://download.macromedia.com/pub/shockwave/cabs/flash/
swflash.cab#version=6,0,29,0"
width="550" height="400">
   <param name="movie" value="shape.swf">
   <param name="quality" value="high">
   <PARAM NAME="PLAY" VALUE="false">
   <PARAM NAME="LOOP" VALUE="false">
   <PARAM NAME="MENU" VALUE="true">
<embed name="ebooksysflashcontrol" src="" quality="high"
pluginspage="http://www.macromedia.com/go/getflashplayer "
type="application/x-shockwave-flash" PLAY="false" LOOP="false"
MENU="true" QUALITY="high" width="550" height="400">
   </embed>
   </object>
<hr >

<form action="">        <input type="button" name="Button1" value="Start Flash"
>
        <input type="button" name="Button2" value="Stop Flash"
>
</form>

</body>
</html>

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Web-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/web-dev/email@hidden

This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Web-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/web-dev/email@hidden

This email sent to email@hidden

References: 
 >Javascript control on Safari with Flash 7 and 8 (From: Leon Chen <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.