Skip to main content
grosssmutttr
Known Participant
October 22, 2012
Answered

Click / Touch event Bug?

  • October 22, 2012
  • 1 reply
  • 562 views

Problem: Bad click and touch event performance on s:Label.

I use the newest air version and Flash Builder 4.6 to develop a mobile app.

This is the code:

<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>

The function of the click event:


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

It is pretty simple.

If someone clicks on a letter (s:Label) the letter should be unvisible.

The frustating fact is that the method makeunvisible is not always called when I click on a letter.

Sometimes I have to click ten times before the method is called.

I also tried with touch events and there were no better results...

If I try it with the simulater on the desktop everything works fine but on the phone there is this strange behaviour.


This topic has been closed for replies.
Correct answer Gaius Coffey

I think it is nothing but a case of fat-fingers...

I copied your code and everything worked fine for me when I clicked _on_the_hotspot_. However, the s:Label is positioned at top left of the square and there is a sizeable gap between each one. _Also_, the touch occurs at the point my finger touches the screen rather than where it _looks_ like my finger touches the screen... This is why so many touchscreens have options to customise for handedness. EG: On my Windows laptop, I can either have left-handed touches or right-handed touches so that the touch is signalled where I _think_ I touched the screen rather than where I _actually_ touched the screen.

So, in summary...

What I would do here is  just make the hotspots bigger and position the letters more centrally in the hotspot.

G

1 reply

Gaius CoffeyCorrect answer
Legend
October 22, 2012

I think it is nothing but a case of fat-fingers...

I copied your code and everything worked fine for me when I clicked _on_the_hotspot_. However, the s:Label is positioned at top left of the square and there is a sizeable gap between each one. _Also_, the touch occurs at the point my finger touches the screen rather than where it _looks_ like my finger touches the screen... This is why so many touchscreens have options to customise for handedness. EG: On my Windows laptop, I can either have left-handed touches or right-handed touches so that the touch is signalled where I _think_ I touched the screen rather than where I _actually_ touched the screen.

So, in summary...

What I would do here is  just make the hotspots bigger and position the letters more centrally in the hotspot.

G