TheFrenchGuy
TheFrenchGuy

Reputation: 233

Custom TextInput and variable size in Flex

I want to create a custom textinput component in flex. The component is made of one background rectangle (spark.primitive.Rect) and one inside rectangle that will contain the text.

My problem is that I want my component to be sizable like I want. For example if I want to create one textinput with a size of 200/100 I write :

<s:TextInput x="10" y="10" width="200" height="100" skinClass="Component.MyTextInputSkin"/>

And I have only the width and height to change if I want to create another textinput with different size.

My skin mxml contains two rect but I want to do this:

<s:Rect width="{this.width}" height="{this.height}" .....

and for the other one (the one that will contain the text)

<s:Rect width="{this.width * 0.80}" height="{this.height * 0.80}" .....

The problem is that flashbuilder displays an error message of incompatibilty on my two "Rect" lines. And when I launch my app, nothing is displayed.

Is there another way to do what I want?

Upvotes: 0

Views: 689

Answers (1)

Maxim Kachurovskiy
Maxim Kachurovskiy

Reputation: 3022

In this case you usually create a skin based on default TextInputSkin from SDK and modify the parts you need.

Since skins are very big I packaged the sample application in FXP.

Upvotes: 1

Related Questions