Re: [flexcoders] New to Flex - dynamic text in mx:Label?
Hi, Alex. Tried your example. It works. %) However, maybe what you need is something like this: [Bindable] protected function get someText() : String { return _someText; } protected function set someText(value : String) : void { _someText = statusToImage(value); } private var _someText : String; and: mx:Label text={someText} / This seems pretty flexible to me. R. On 1/11/07, Alex [EMAIL PROTECTED] wrote: Hi there, Given this function: mx:Script ![CDATA[ private function statusToImage(data:String):String { return test; } ]] /mx:Script How precisely can I set it as text-generator for a label? I've tried: mx:Label text={statusToImage('abc')} / And Flex Builder writes: 1180: Call to a possibly undefined method statusToImage.. Seems it's right above in the same mxml file though! Thanks in advance. Alex
Re: [flexcoders] New to Flex - dynamic text in mx:Label?
Would the problem be the manner in which I am invoking it? mx:DataGridColumn width=90 headerText=Status dataField=status mx:itemRenderer mx:Component mx:VBox width=100% height=100% horizontalAlign=center verticalAlign=middle mx:Label text={statusToImage('abc')} / /mx:VBox /mx:Component /mx:itemRenderer /mx:DataGridColumn - Original Message - From: Roman Protsiuk To: flexcoders@yahoogroups.com Sent: Thursday, January 11, 2007 9:11 AM Subject: Re: [flexcoders] New to Flex - dynamic text in mx:Label? Hi, Alex. Tried your example. It works. %) However, maybe what you need is something like this: [Bindable] protected function get someText() : String { return _someText; } protected function set someText(value : String) : void { _someText = statusToImage(value); } private var _someText : String; and: mx:Label text={someText} / This seems pretty flexible to me. R. On 1/11/07, Alex [EMAIL PROTECTED] wrote: Hi there, Given this function: mx:Script ![CDATA[ private function statusToImage(data:String):String { return test; } ]] /mx:Script How precisely can I set it as text-generator for a label? I've tried: mx:Label text={statusToImage('abc')} / And Flex Builder writes: 1180: Call to a possibly undefined method statusToImage.. Seems it's right above in the same mxml file though! Thanks in advance. Alex
RE: [flexcoders] New to Flex - dynamic text in mx:Label?
Yes. An inline renderer creates a sub-component, with its own scope, and it does not have direct access to its parent scope. Use outerDocument.statusToImage() See this for details: http://livedocs.macromedia.com/flex/2/docs/0843.html Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Alexandre Lemaire Sent: Thursday, January 11, 2007 10:32 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] New to Flex - dynamic text in mx:Label? Would the problem be the manner in which I am invoking it? mx:DataGridColumn width=90 headerText=Status dataField=status mx:itemRenderer mx:Component mx:VBox width=100% height=100% horizontalAlign=center verticalAlign=middle mx:Label text={statusToImage('abc')} / /mx:VBox /mx:Component /mx:itemRenderer /mx:DataGridColumn - Original Message - From: Roman Protsiuk mailto:[EMAIL PROTECTED] To: flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com Sent: Thursday, January 11, 2007 9:11 AM Subject: Re: [flexcoders] New to Flex - dynamic text in mx:Label? Hi, Alex. Tried your example. It works. %) However, maybe what you need is something like this: [Bindable] protected function get someText() : String { return _someText; } protected function set someText(value : String) : void { _someText = statusToImage(value); } private var _someText : String; and: mx:Label text={someText} / This seems pretty flexible to me. R. On 1/11/07, Alex [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi there, Given this function: mx:Script ![CDATA[ private function statusToImage(data:String):String { return test; } ]] /mx:Script How precisely can I set it as text-generator for a label? I've tried: mx:Label text={statusToImage('abc')} / And Flex Builder writes: 1180: Call to a possibly undefined method statusToImage.. Seems it's right above in the same mxml file though! Thanks in advance. Alex