Code:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="434" height="100">
<fx:Script>
<![CDATA[
protected function setState(stateName:String):void
{
this.currentState = stateName;
}
]]>
</fx:Script>
<s:states>
<s:State name="state1" />
<s:State name="state2" />
</s:states>
<s:RichEditableText x="38" y="45" text="Click Me! Set State 1" click="setState('state1')" />
<s:RichEditableText x="38" y="65" text="Click Me! Set State 2" click="setState('state2')" />
<s:Label x="276" y="45" text="Current State: {this.currentState}"/>
</s:Application>