2012-10-22 36 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.它是不可見不可見。