Can click <s:TextInput> through a <s:label>

117 views Asked by At

I'm trying to overlay a <s:TextInput> with a <s:Label>. The label should get visible=false on click. The problem is that when I click the label above the TextInput the TextInput get activated and the label click event is ignored.

I tried to adjust the depth setting but to no avail. I also tried to use event.PreventDefault() but it did not help either.

It almost seems like the label is transparent.

I cant figure this one out hopefully someone can help me.

Update:

This code shows the problem.

<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
        xmlns:s="library://ns.adobe.com/flex/spark" title="HomeView">
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <s:Label depth="1" width="200" backgroundColor="0xFFFFFF">
    Long boring text repeated a multiple of times. Long boring text repeated a multiple of times.Long boring text repeated a multiple of times. 
    </s:Label>
    <s:TextInput>

    </s:TextInput>

</s:View>
1

There are 1 answers

0
JTtheGeek On

couple things, 1 since the text input is farther down in the mxml it is placed on top of the label. 2, components have properities like mouseEnabled, mouseEnabledWhereTransparent, childrenMouseEnabled, etc. Try setting those to false on the component you don't want to be clickable, and in the event handler swapping which component is mouseEnabled.