·您当前的位置:首页 > 技术教程 > AS2与AS3技术 >

[AS3]as3与js通信源代码(3)

时间:2014-10-28 08:55未知
!DOCTYPEhtmlPUBLIC-//W3C//DTDXHTML1.0Transitional//ENhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns = http://www.w3.org/1999/xhtml lang = en xml:lang = en head title TESTASTOJS /

 

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
  2. <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">  
  3.     <head> 
  4.        <title> TEST AS TO JS </title> 
  5.     <head> 
  6.     <script type="text/javascript"> 
  7.         function getSwf(movieName) 
  8.         { 
  9.             if (navigator.appName.indexOf("Microsoft") != -1)  
  10.                   {  
  11.                     return window[movieName];  
  12.                  }  
  13.                   else  
  14.                  {  
  15.                     return document[movieName];  
  16.                 }  
  17.         } 
  18.          
  19.         function addMes(str) 
  20.         { 
  21.            var mes = (str.value == null)?str:str.value; 
  22.            getSwf("myFlash").receiveMes(mes); 
  23.         } 
  24.          
  25.         function sendMes(str) 
  26.         { 
  27.             var mes = (str.value == null)?str:str.value; 
  28.            window.document.myFlash.backMes(mes); 
  29.         } 
  30.          
  31.         //iframe  
  32.         // Major version of Flash required 
  33.         var requiredMajorVersion = 9
  34.         // Minor version of Flash required 
  35.         var requiredMinorVersion = 0
  36.         // Minor version of Flash required 
  37.         var requiredRevision = 0
  38.  
  39.         function moveIFrame(x,y,w,h) 
  40.         { 
  41.             var frameRef=document.getElementById("myFrame"); 
  42.             frameRef.style.left=x
  43.             frameRef.style.top=y; 
  44.             var iFrameRef=document.getElementById("myIFrame");     
  45.             iFrameRef.width=w; 
  46.             iFrameRef.height=h; 
  47.         } 
  48.  
  49.         function hideIFrame() 
  50.         { 
  51.             document.getElementById("myFrame").style.visibility="hidden"
  52.         } 
  53.              
  54.         function showIFrame() 
  55.         { 
  56.             document.getElementById("myFrame").style.visibility="visible"
  57.         } 
  58.  
  59.         function loadIFrame(url) 
  60.         { 
  61.             document.getElementById("myFrame").innerHTML = "<iframe id='myIFrame' src='" + url + "'frameborder='0'></iframe>"; 
  62.         } 
  63.     </script> 
  64.     <body> 
  65.         <center> 
  66.         <object width = "550" height = "400" id = "myFlash"> 
  67.         <param name"allowScriptAccess" value = "always"/> 
  68.         <param name"movie" value = "AsToJs.swf" /> 
  69.         <param name = "quality" value = "high"/> 
  70.         <embed  
  71.             src = "AsToJs.swf"  
  72.             width = "550"  
  73.             height = "400"  
  74.             wmode = "transparent" 
  75.             name = "myFlash" 
  76.             allowScriptAccess = "always" 
  77.             type="application/x-shockwave-flash" 
  78.             pluginspage="http://www.macromedia.com/go/getflashplayer"/> 
  79.         </center> 
  80.         </object> 
  81.          
  82.         <form name = "form1" action = "#"> 
  83.             <input type = "text" name = "sendText" size = "65" maxlength = "200" /> 
  84.             <label> 
  85.                 <input type = "button" name = "button" id = "button" value = "send to Flash" onclick = "addMes(sendText)" /> 
  86.             </label> 
  87.         </form> 
  88.          
  89.         <!-- <iframe name="_history" src="history.htm" frameborder="0" scrolling="no" width="22" height="0"></iframe> --> 
  90.         <div id="myFrame" class = "box" style="top:0px;z-index:6;position:absolute;background-color:transparent;border:0px;visibility:hidden;"></div> 
  91.     <body> 
  92. </html> 

 

热门文章推荐

请稍候...

保利威视云平台-轻松实现点播直播视频应用

酷播云数据统计分析跨平台播放器