问题:s:Label 上的点击和触摸事件性能不佳。
我使用最新的 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>
点击事件的作用:
protected function makeunvisible(obj:Object):void
{
obj.visible = false;
}
这很简单。
如果有人点击一个字母(s:Label),该字母应该是不可见的。
令人沮丧的事实是,当我单击一个字母时,并不总是调用 make invisible 方法。
有时我必须点击十次才能调用该方法。
我也尝试了触摸事件,但没有更好的结果......