Apache flex 如何使用ExternalInterface和invoke在MovieClip中显示非ascii字符?

Apache flex 如何使用ExternalInterface和invoke在MovieClip中显示非ascii字符?,apache-flex,externalinterface,non-ascii-characters,Apache Flex,Externalinterface,Non Ascii Characters,我有一些关于TextField的电影。我希望这些文本字段显示非ascii字符 我的问题:我应该如何逃避\发送特殊角色,以便我能在电影剪辑中很好地看到它们 当我简单地输入这些字符时,它们会被剪裁。只能看到ascii字符 [见下文,HTML代码中的备注] 当我尝试使用Unicode转义时,我只看到原始的转义字符串。尽管这应该按照中的[使用文本变量创建多语言文档]实现 我更喜欢发送想要的字符(在我这边),而不是更改actionScript代码(我没有简单的权限更改此代码。只有在我必须…) 谢谢

我有一些关于TextField的电影。我希望这些文本字段显示非ascii字符

我的问题:我应该如何逃避\发送特殊角色,以便我能在电影剪辑中很好地看到它们

当我简单地输入这些字符时,它们会被剪裁。只能看到ascii字符

[见下文,HTML代码中的备注]

当我尝试使用Unicode转义时,我只看到原始的转义字符串。尽管这应该按照中的[使用文本变量创建多语言文档]实现

我更喜欢发送想要的字符(在我这边),而不是更改actionScript代码(我没有简单的权限更改此代码。只有在我必须…)

谢谢

阿塔拉

我的HTML代码:

  . . .
  <input type="text" size="45" id="txt0" value="Facoltà di Français montrés contrôleurs très María Mª ">
  <!--
  Does not work. 
  The MovieClip show [Facolt di Franais montrs contrleurs trs Mara M]
  It skips non-ascii characters.
  -->
  <br>
  <input type="text" size="45" id="txt1" value="greek small letters entities: &#945; &#946; &#960; &#961;">
  <!--
  Does not work. 
  The MovieClip show [greek small letters entities:]
  It skips non-ascii characters.
  -->
  <br>
  <!--  <input type="text" size="45" id="txt2" value="greek in unicode: U+03B1 U+03B2 U+03C0 U+03C1 "> 
  Does not work. 
  The MovieClip show the original [greek in unicode: U+03B1 U+03B2 U+03C0 U+03C1]
  without escaping
  -->
  <input type="text" size="45" id="txt2" value="greek in unicode: \u03B1 \u03B2 \u03C0 \u03C1 ">  
  <!-- 
  Does not work. 
  The MovieClip show the original [greek in unicode: \u03B1 \u03B2 \u03C0 \u03C1]
  without escaping.          
  -->
  <br>
  <INPUT TYPE="BUTTON" style="width:250px" OnClick="fRunSetFirstScreen();" VALUE="Run SetFirstScreen()">
  . . .



. . .
我的JavaScript代码:

// - - - - - - - - - - - - - - -
function fRunSetFirstScreen(){
// - - - - - - - - - - - - - - -
   alert("fRunSetFirstScreen()");

   objF = mcGetObjF("mySwf1");
   obj0 = document.getElementById("txt0");
   obj1 = document.getElementById("txt1");
   obj2 = document.getElementById("txt2");

   var strRequest = "";
   strRequest = strRequest + "<invoke name='RunSetFirstScreen' returntype='void'>";
   strRequest = strRequest + "<arguments>";
   strRequest = strRequest + "<string>" + obj0.value + "</" + "string>";
   strRequest = strRequest + "<string>" + obj1.value + "</" + "string>";
   strRequest = strRequest + "<string>" + obj2.value + "</" + "string>";
   strRequest = strRequest + "</" + "arguments>";
   strRequest = strRequest + "</" + "invoke>";
    alert(strRequest);
   objF.CallFunction(strRequest);
}
// ==============================================
public class myroot extends MovieClip {
// ==============================================

  private var lines:Array=new Array("","","");

  ExternalInterface.addCallback("RunSetFirstScreen", fSetFirstScreen);

  // ==============================================
  public function fSetFirstScreen(l0, l1, l2):void {  // External Interface.
  // ==============================================
    lines[0]=l0;
    lines[1]=l1;
    lines[2]=l2;
  }

  // ==============================================
  public function setRightMenu() { 
  // ==============================================
    . . .
    for (i = 0; i < lines.length; i++) {
        itemM = new itemMenu();
        itemM.ptxt = lines[i];
        itemM.psize = psize1;
        itemM.x = x1;
        itemM.y = y1+dy*i;
        addChild(itemM);
        itemM.setParam();
        arrRightMenu.push(itemM);
       }
       . . .
   }



// ================================================
public class itemMenu extends MovieClip {
// ================================================
   . . .
  public var txt1:TextField;
  public var ptxt:String = "";
  public var psize:int = 0;
  . . .


  // ==============================================
  public function setParam() {
  // ==============================================
    txt1.text = ptxt1;
    . . .
/------
/-------- 函数fRunSetFirstScreen(){ // - - - - - - - - - - - - - - - 警报(“fRunSetFirstScreen()”; objF=mcGetObjF(“mySwf1”); obj0=document.getElementById(“txt0”); obj1=document.getElementById(“txt1”); obj2=document.getElementById(“txt2”); var strequest=“”; strRequest=strRequest+“”; strRequest=strRequest+“”; strRequest=strRequest+“”+obj0.value+“”; strRequest=strRequest+“”+obj1.value+“”; strRequest=strRequest+“”+obj2.value+“”; strRequest=strRequest+“”; strRequest=strRequest+“”; 警报(strRequest); 对象调用函数(strRequest); } 操作脚本代码:

// - - - - - - - - - - - - - - -
function fRunSetFirstScreen(){
// - - - - - - - - - - - - - - -
   alert("fRunSetFirstScreen()");

   objF = mcGetObjF("mySwf1");
   obj0 = document.getElementById("txt0");
   obj1 = document.getElementById("txt1");
   obj2 = document.getElementById("txt2");

   var strRequest = "";
   strRequest = strRequest + "<invoke name='RunSetFirstScreen' returntype='void'>";
   strRequest = strRequest + "<arguments>";
   strRequest = strRequest + "<string>" + obj0.value + "</" + "string>";
   strRequest = strRequest + "<string>" + obj1.value + "</" + "string>";
   strRequest = strRequest + "<string>" + obj2.value + "</" + "string>";
   strRequest = strRequest + "</" + "arguments>";
   strRequest = strRequest + "</" + "invoke>";
    alert(strRequest);
   objF.CallFunction(strRequest);
}
// ==============================================
public class myroot extends MovieClip {
// ==============================================

  private var lines:Array=new Array("","","");

  ExternalInterface.addCallback("RunSetFirstScreen", fSetFirstScreen);

  // ==============================================
  public function fSetFirstScreen(l0, l1, l2):void {  // External Interface.
  // ==============================================
    lines[0]=l0;
    lines[1]=l1;
    lines[2]=l2;
  }

  // ==============================================
  public function setRightMenu() { 
  // ==============================================
    . . .
    for (i = 0; i < lines.length; i++) {
        itemM = new itemMenu();
        itemM.ptxt = lines[i];
        itemM.psize = psize1;
        itemM.x = x1;
        itemM.y = y1+dy*i;
        addChild(itemM);
        itemM.setParam();
        arrRightMenu.push(itemM);
       }
       . . .
   }



// ================================================
public class itemMenu extends MovieClip {
// ================================================
   . . .
  public var txt1:TextField;
  public var ptxt:String = "";
  public var psize:int = 0;
  . . .


  // ==============================================
  public function setParam() {
  // ==============================================
    txt1.text = ptxt1;
    . . .
//==============================================
公共类myroot扩展了MovieClip{
// ==============================================
私有变量行:数组=新数组(“,”,“);
addCallback(“RunSetFirstScreen”,fSetFirstScreen);
// ==============================================
公共函数fSetFirstScreen(l0,l1,l2):void{//外部接口。
// ==============================================
行[0]=l0;
行[1]=l1;
行[2]=l2;
}
// ==============================================
公共函数setRightMenu(){
// ==============================================
. . .
对于(i=0;i
两个猜测,1 actionscript端用于文本显示的字体没有指定包含您试图显示的unicode字符的字体。2使用\u0020语法指定的unicode字符在从javascript传递到actionscr时可能会以某种方式转义其前导斜杠ipt.如果跟踪obj2.value或在javascript控制台中查看它,不确定它在读取时是否被转义,或者可能在传递到as函数时是否被转义,会发生什么情况。font:MovieClip使用的是字体“Arial”转义:在javascript中使用警报时,我仍然可以看到斜杠[\u03B1\u03B2\u03C0]好的,我在windows字符映射中签出了Arial,实际上它有上面评论中列出的unicode标志符号。我认为这需要对actionscript端进行更改,因为在下面的示例中,unicode范围可用于指定嵌入字体时要包含的标志符号,但是我想不出有这样的情况看到它们在标签或textfields文本值中使用。不确定最终将这些传入值分配给哪个组件,但尝试扫描文档中的TextField,我看到的唯一引用\u是restrict属性,因此我认为上面的链接可能是唯一的解决方案。