0
votes

How can I set the Flex TextInput component to have 100% width, so that it has width fill up the parent width space? I tried with <s:TextInput id="myid" width="100%"/> but didn't work.

Thank you.

3
It should. Probably something with the layout of the parent container. You should provide a little more context.RIAstar

3 Answers

0
votes

You can try to bind to parent width by using

<s:TextInput id="myid" width="{width}"/>

In such situations I usually set different background colors to component so I can see where the problem is. In flex 3 I do it just with setting backgroundColor property, in flex 4 I use rectangle:

<s:Rect height="{height}"
        width="{width}"
        includeInLayout="false">
        <s:fill>
             <s:SolidColor color="{Math.random() * 0xffffff}"/>
        </s:fill>
</s:Rect>

If you still have a problem, maybe post your parent code.

0
votes

<s:TextInput id="myid" width="{myid.text.length * 2}"/> You can dynamically increasing the size of Text Box..

0
votes

What you posted is correct. Most likely something is causing the TextInput's parent container to be smaller than you think. Try setting some explicit width(s) on the container(s) along with either visible borders or background colors so you can see what's going on. It's hard to just guess without any context.