views:

45

answers:

0

Flex 4 separates the visual components into the skins. So how do we access those visual elements from Skinnable component? Here is my code:

<?xml version="1.0" encoding="utf-8"?>
<s:SkinnableComponent xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"  skinClass="skins.brushedSkin"
xmlns:mx="library://ns.adobe.com/flex/mx">


<fx:Script>
<![CDATA[
import mx.controls.TextInput;

private var txt:String;

public function setText(s:String) {
txt = s;
// the following line doesn't work
var input:TextInput = this.skin.getChildByName("msg") as TextInput;
input.text = s;
}

]]>
</fx:Script>


</s:SkinnableComponent>

I just need to set the text in the TextInput in the brushedSkin skin. But I have no idea how to do this in Flex 4.