2012-10-22 37 views
0

问题:s:Label上的点击和触摸事件性能不佳。Adob​​e Flash Builder移动点击/触摸事件

我使用最新的AIR版本和Flash Builder 4.6开发移动应用程序。

这是代码:

<s:Group horizontalCenter="10" top="200"> 
    <s:VGroup> 
     <s:VGroup id="wortundtafelstriche"> 
      <s:HGroup id="wortalign" > 
       <s:Label id="wort1" visible="false" textAlign="center" width="43" color="0xffffff" /> 
       <s:Label id="wort2" visible="false" width="30" color="0xffffff" /> 
       <s:Label id="wort3" visible="false" width="30" color="0xffffff" /> 
       <s:Label id="wort4" visible="false" width="30" color="0xffffff" /> 
       <s:Label id="wort5" visible="false" width="30" color="0xffffff" /> 
       <s:Label id="wort6" visible="false" width="30" color="0xffffff" /> 
       <s:Label id="wort7" visible="false" width="30" color="0xffffff" /> 
       <s:Label id="wort8" visible="false" width="30" color="0xffffff" /> 
       <s:Label id="wort9" visible="false" width="30" color="0xffffff" /> 
       <s:Label id="wort10" visible="false" width="30" color="0xffffff" /> 
       <s:Label id="wort11" visible="false" width="30" color="0xffffff" /> 
      </s:HGroup> 
      <s:HGroup id="tafelalign"> 
       <s:Image id="img"/> 
      </s:HGroup> 
     </s:VGroup> 

     <s:Spacer height="10" width="100%" /> 
     <s:VGroup> 
      <s:HGroup> 
       <s:Label text="A" id="txt1" color="0xffffff" width="60" height="40" click="makeunvisible(txt1),check(txt1.text)" /> 
       <s:Spacer height="5" width="100%" /> 
       <s:Label text="B" id="txt2" color="0xffffff" width="60" height="40" click="makeunvisible(txt2),check(txt2.text)" /> 
       <s:Spacer height="5" width="100%" /> 
       <s:Label text="C" id="txt3" color="0xffffff" width="60" height="40" click="makeunvisible(txt3),check(txt3.text)" /> 
       <s:Spacer height="5" width="100%" /> 
       <s:Label text="D" id="txt4" color="0xffffff" width="60" height="40" click="makeunvisible(txt4),check(txt4.text)" /> 
       <s:Spacer height="5" width="100%" /> 
       <s:Label text="E" id="txt5" color="0xffffff" width="60" height="40" click="makeunvisible(txt5),check(txt5.text)" /> 
       <s:Spacer height="5" width="100%" /> 
       <s:Label text="F" id="txt6" color="0xffffff" width="60" height="40" click="makeunvisible(txt6),check(txt6.text)" /> 
      </s:HGroup> 
      <s:Spacer height="15" width="100%" /> 
      <s:HGroup> 
       <s:Label text="G" id="txt7" color="0xffffff" width="60" height="40" click="makeunvisible(txt7),check(txt7.text)" /> 
       <s:Spacer height="5" width="100%" /> 
       <s:Label text="H" id="txt8" color="0xffffff" width="60" height="40" click="makeunvisible(txt8),check(txt8.text)" /> 
       <s:Spacer height="5" width="100%" /> 
       <s:Label text="I" id="txt9" color="0xffffff" width="60" height="40" click="makeunvisible(txt9),check(txt9.text)" /> 
       <s:Spacer height="5" width="100%" /> 
       <s:Label text="J" id="txt10" color="0xffffff" width="60" height="40" click="makeunvisible(txt10),check(txt10.text)" /> 
       <s:Spacer height="5" width="100%" /> 
       <s:Label text="K" id="txt11" color="0xffffff" width="60" height="40" click="makeunvisible(txt11),check(txt11.text)" /> 
       <s:Spacer height="5" width="100%" /> 
       <s:Label text="L" id="txt12" color="0xffffff" width="60" height="40" click="makeunvisible(txt12),check(txt12.text)" /> 
      </s:HGroup> 
      <s:Spacer height="15" width="100%" /> 
      <s:HGroup> 
       <s:Label text="M" id="txt13" color="0xffffff" width="60" height="40" click="makeunvisible(txt13),check(txt13.text)" /> 
       <s:Spacer height="5" width="100%" /> 
       <s:Label text="N" id="txt14" color="0xffffff" width="60" height="40" click="makeunvisible(txt14),check(txt14.text)" /> 
       <s:Spacer height="5" width="100%" /> 
       <s:Label text="O" id="txt15" color="0xffffff" width="60" height="40" click="makeunvisible(txt15),check(txt15.text)" /> 
       <s:Spacer height="5" width="100%" /> 
       <s:Label text="P" id="txt16" color="0xffffff" width="60" height="40" click="makeunvisible(txt16),check(txt16.text)" /> 
       <s:Spacer height="5" width="100%" /> 
       <s:Label text="Q" id="txt17" color="0xffffff" width="60" height="40" click="makeunvisible(txt17),check(txt17.text)" /> 
       <s:Spacer height="5" width="100%" /> 
       <s:Label text="R" id="txt18" color="0xffffff" width="60" height="40" click="makeunvisible(txt18),check(txt18.text)" /> 
      </s:HGroup> 
      <s:Spacer height="15" width="100%" /> 
      <s:HGroup> 
       <s:Label text="S" id="txt19" color="0xffffff" width="60" height="40" click="makeunvisible(txt19),check(txt19.text)" /> 
       <s:Spacer height="5" width="100%" /> 
       <s:Label text="T" id="txt20" color="0xffffff" width="60" height="40" click="makeunvisible(txt20),check(txt20.text)" /> 
       <s:Spacer height="5" width="100%" /> 
       <s:Label text="U" id="txt21" color="0xffffff" width="60" height="40" click="makeunvisible(txt21),check(txt21.text)" /> 
       <s:Spacer height="5" width="100%" /> 
       <s:Label text="V" id="txt22" color="0xffffff" width="60" height="40" click="makeunvisible(txt22),check(txt22.text)" /> 
       <s:Spacer height="5" width="100%" /> 
       <s:Label text="W" id="txt23" color="0xffffff" width="60" height="40" click="makeunvisible(txt23),check(txt23.text)" /> 
       <s:Spacer height="5" width="100%" /> 
       <s:Label text="X" id="txt24" color="0xffffff" width="60" height="40" click="makeunvisible(txt24),check(txt24.text)" /> 
      </s:HGroup> 
      <s:Spacer height="15" width="100%" /> 
      <s:HGroup> 
       <s:Label text="Y" id="txt25" color="0xffffff" width="60" height="40" click="makeunvisible(txt25),check(txt25.text)" /> 
       <s:Spacer height="5" width="100%" /> 
       <s:Label text="Z" id="txt26" color="0xffffff" width="60" height="40" click="makeunvisible(txt26),check(txt26.text)" /> 
       <s:Spacer height="5" width="100%" /> 
       <s:Label text="Ä" id="txt27" color="0xffffff" width="60" height="40" click="makeunvisible(txt27),check(txt27.text)" /> 
       <s:Spacer height="5" width="100%" /> 
       <s:Label text="Ö" id="txt28" color="0xffffff" width="60" height="40" click="makeunvisible(txt28),check(txt28.text)" /> 
       <s:Spacer height="5" width="100%" /> 
       <s:Label text="Ü" id="txt29" color="0xffffff" width="60" height="40" click="makeunvisible(txt29),check(txt29.text)" /> 
      </s:HGroup> 

     </s:VGroup> 

    </s:VGroup> 
</s:Group> 

click事件的功能:

 protected function makeunvisible(obj:Object):void 
     { 
      obj.visible = false; 
     } 

这是很简单的。

如果有人点击一个字母(s:Label),该字母应该是不可见的。

令人沮丧的事实是,当我点击一个字母时,隐形的方法并不总是被调用。

有时我必须在调用该方法之前单击十次。

我也试图与触摸事件,并且没有鼠标事件的发送和仅使用鼠标事件更好的结果...

回答

0

在Flex框架与第一触摸事件一起。与闪光世界中的大多数按钮一样,您的文字可能没有背景,因此只会在实际字体轮廓非常薄的情况下捕捉鼠标

尝试将标签添加到容器或设置它们的背景颜色。

P.S.它是不可见不可见。