Skip to main content
Participant
September 18, 2013
Question

Adobe Flash Player 11.8.800.174+as3无法读取js对像中中文字符

  • September 18, 2013
  • 2 replies
  • 1617 views

该问题在另一个版块提出,但是没有人回复。所以在该版请求讨论一下

测试环境:window7,IE10,Adobe Flash Player 11.8.800.174

使用var _obj:Object= ExternalInterface.call("jsobject");读取当前页面中js返回的一个函数jsobject(类型为object )

如果是数字和英文,则能正确读取,如果是中文,则出现乱码,如果包含"退出全屏"这四个字符(目前只测试了这四个字符),则直接读取不出来js函数jsobject

以下附上相关代码

actionscript3.0

package  {

import flash.display.MovieClip;

import flash.text.TextField;

import flash.system.System;

import flash.external.ExternalInterface;

public class getobject extends MovieClip {

 

 

  public function getobject() {

   init();

  }

  private function init(){

   var _test:TextField=new TextField();

   _test.width=200;

   _test.height=200;

   addChild(_test);

   if(ExternalInterface.available){

    var _obj:Object= ExternalInterface.call("jsobject");

    var _str:String="";

    for(var k in _obj){

     _str+=k+":"+_obj+"\n";

    }

    _test.text=_str;

   }

  }

}

}

调用页面代码,是使用的帮助手册里提供的示例

<!-- saved from url=(0014)about:internet -->

<!DOCTYPE html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>getobject</title>

</head>

<body>

<script type="text/javascript">

  function jsobject(){

  var _obj={

   a:'1',

   b:'退出全屏'

  }

  return _obj;

}

</script>

     <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="ExternalInterfaceExample" width="550" height="400" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">

         <param name="movie" value="getobject.swf" />

         <param name="quality" value="high" />

         <param name="bgcolor" value="#869ca7" />

         <param name="allowScriptAccess" value="sameDomain" />

         <embed src="getobject.swf" quality="high" bgcolor="#869ca7" width="500" height="375" name="ExternalInterfaceExample" align="middle" play="true" loop="false" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">

         </embed>

     </object>

</body>

</html>

如果 var _obj函数里的b项为英文或数字,则正常。如果为中文则是乱码,如果是“退出全屏”。则直接无法调用js函数。其它浏览器或ie下其它版本的flashplay正常

This topic has been closed for replies.

2 replies

Adobe Employee
October 15, 2013

The issue should be fixed. Pls update your flash player by downloading from page http://get.adobe.com/flashplayer/ to resolve the issue.

If you still ecounter any other issues about Flash Player, you can log bugs on this over at https://bugbase.adobe.com/, thanks.

sinious
Legend
September 18, 2013

(Amusing Google translation to follow) If google reads you correctly, you're having a multibyte issue transferring data over ExternalInterface. Have you tried simply encoding it to Base64 before sending the data? Here's an example JavaScript Base64 converter:

http://www.webtoolkit.info/javascript-base64.html

(google translate):

如果谷歌读取正确的话,你有一个多字节的问题过ExternalInterface的数据传输。您是否尝试过简单的编码为Base64在发送数据前?下面是一个例子JavaScript的使用Base64转换器:

http://www.webtoolkit.info/javascript-base64.html