Use JavaScript compatible with IE and FF to control Flash operations

Source: Internet
Author: User
Tip: you can modify some code before running

Use JavaScript compatible with IE and FF to control Flash operations<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>Use JavaScript compatible with IE and FF to control Flash operations</title><meta http-equiv="content-type" content="text/html;charset=gb2312"><!--把下面代码加到<head>与</head>之间--><script type="text/javascript">Function getFlashMovieObject (movieName) {if (window.doc ument [movieName]) {return window.doc ument [movieName];} if (navigator. appName. indexOf ("Microsoft Internet") =-1) {if (document. embeds & document. embeds [movieName]) return document. embeds [movieName];} else // if (navigator. appName. indexOf ("Microsoft Internet ")! =-1) {return document. getElementById (movieName) ;}} function StopFlashMovie () {var flashMovie = getFlashMovieObject ("Myflash"); flashMovie. stopPlay ();} function PlayFlashMovie () {var flashMovie = getFlashMovieObject ("Myflash"); flashMovie. play (); // embed. nativeProperty. anotherNativeMethod ();} function RewindFlashMovie () {var flashMovie = getFlashMovieObject ("Myflash"); flashMovie. rewind ();} function NextFrameFlashMovie () {var flashMovie = getFlashMovieObject ("Myflash"); // 4 is the index of the property for _ currentFramevar currentFrame = flashMovie. TGetProperty ("/", 4); var nextFrame = parseInt (currentFrame); if (nextFrame> = 9) nextFrame = 0; flashMovie. gotoFrame (nextFrame);} function ZoominFlashMovie () {var flashMovie = getFlashMovieObject ("Myflash"); flashMovie. zoom (90);} function ZoomoutFlashMovie () {var flashMovie = getFlashMovieObject ("Myflash"); flashMovie. zoom (110);} function SendDataToFlashMovie () {var flashMovie = getFlashMovieObject ("Myflash"); flashMovie. setVariable ("/: mytext", document. getElementById ("data "). value);} function ReceiveDataFromFlashMovie () {var flashMovie = getFlashMovieObject ("Myflash"); document. getElementById ("data "). value = flashMovie. getVariable ("/: mytext"); // document. controller. data. value = message ;}</script></head><body><!--把下面代码加到<body>与</body>之间--><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0" id="Myflash" width="440" height="100"> <param name="movie" value="http://www.zzsky.cn/effect/images/200912271130.swf"> <param name="quality" value="high"> <param name="play" value="false"> <param name="bgcolor" value="#FFFFFF"> <embed play="false" swliveconnect="true" name="Myflash" src="http://www.zzsky.cn/effect/images/200912271130.swf" quality="high" bgcolor="#FFFFFF" width="440" height="100" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed> </object> <br><input type="button" value="播放" onclick="PlayFlashMovie()"><input type="button" value="暂停" onclick="StopFlashMovie()"><input type="button" value="停止" onclick="RewindFlashMovie()"><input type="button" value="下一帧" onclick="NextFrameFlashMovie()"><input type="button" value="放大" onclick="ZoominFlashMovie()"><input type="button" value="缩小" onclick="ZoomoutFlashMovie()"><input type="button" value="发送数据" onclick="SendDataToFlashMovie()"><input type="button" value="接收数据" onclick="ReceiveDataFromFlashMovie()"><input type="text" id="data"></body></html>
Tip: you can modify some code before running
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.