<mx:Canvasxmlns:mx="http://www.adobe.com/2006/mxml" currentState="base" width="100" height="20" creationComplete="currentState='init' " focusEnabled="true" backgroundColor="#ffff00"> <mx:Script> <![CDATA[ [Bindable] privatevar _data:Object; override publicfunction set data(value:Object):void { _data = value; } override publicfunction get data():Object { return _data; } //so that the text of the input field can be set when we first start publicfunction set text(value:String):void { input.text = value; } //this is needed so that the item editor will return the correct value //when the list reads that value back publicfunction get text():String { return input.text; }
]]> </mx:Script> <mx:transitions> <!-- this transition will play when the component is ready to be displayed --> <mx:TransitionfromState="*" toState="init"> <mx:FadealphaFrom="0" alphaTo="1" duration="500" target="{this }"/> </mx:Transition> <mx:TransitionfromState="init" toState="*"> <mx:FadealphaFrom="1" alphaTo="0" duration="500" effectEnd="this .dispatchEvent(new Event('finishTransition' , true ))" target="{this }"/> </mx:Transition> </mx:transitions> <mx:states> <mx:Statename="base"/> <mx:Statename="init"/> </mx:states> <mx:TextInputid="input" creationComplete="input.text = String(_data), input.setFocus()"/> </mx:Canvas>