Thanks for the suggestions, Johannes. Unfortunately, using an explicit event won't scale well in a big application since every access of a resource string from ActionScript will require this treatment. I've done a -keep-generated-actionscript and tried to grok the ActionScript code the Flex compiler generates when specifying a data binding in MXML and it just doesn't make sense to me just yet. I'm still on the hunt for a code sample using a ChangeWatcher or some means to set up the binding without explicit events. My objective is a single line of code just like using BindingUtils.bindProperty. It seems like I should be able to write a similar class as BindingUtils and expose an API that takes a Function as the chain property, instead of an Object. Anyway, thanks for your suggestion. Erik
________________________________ From: [email protected] [mailto:[email protected]] On Behalf Of Johannes Nel Sent: Wednesday, January 28, 2009 4:01 AM To: [email protected] Subject: Re: [flexcoders] BindingUtils and ResourceManager Question on rereading your post i realise that what you are after is change events (but my post will also help a bit me thinks) a few people did custom annotations which function like an event listener, just google a bit, i think it will make your life easier. ////old post/// ok, i will approach it slightly differently. I would use a presentation model to bind the text to, so <component> <control text="presModel.someText"/> </component> in my pres model class presModel { [Bindable(localChange)] [Bindable (someTextChange)] public function get someText():String [Bindable(localChange)] [Bindable (someOtherTextChange)] public function get someOtherText():String } this way you have groups of text that update at the same time when your local changes (which in the workflow we use would look something like this (still inside this presModel) [Trigger (path="myModel.theLocalleValueIWantToKnowAbout")] public function set localle(localle:String) { dispatchEvent("localChange") } where this localChange event will update all the strings which have a bindable declared with that custom event name. the trigger annotation is basically an event listener and is the same as saying in my local presentation model notify me when the applications localle changes, thus someAppModel.addEventListener("localChange....) jpn On Wed, Jan 28, 2009 at 12:09 AM, Thomas, Erik <[email protected] <mailto:[email protected]> > wrote: Having just localized a medium sized application into Spanish, I ran into a recurring pattern I had to work around that I really shouldn't have to, specifically around data binding localized resources from ActionScript. For example, in MXML, one can data bind a localized resource and when the localeChain is switched dynamically, all bound clients will requery their values and the new language will display: <mx:Label text="{resourceManager.getString(ResourceEnums.COMMON, 'labelAppointments}"/> When the localeChain is switched, the label above will automatically update to the Spanish version, just like magic. This is a very cool feature of Flex 3 resource management. However, there are many use cases where I need to bind to resource bundles from within ActionScript, sort of like this: public class Foo { [Bindable] public var bar:String; public function Foo() { bar = ResourceManager.getString(ResourceEnums.COMMON, 'labelAppointments'); } } When the localeChain is updated, "bar" is obviously not automatically updated because bar is not bound to the resource, it is just a simple assignment. BindingUtil.bindProperty and bindSetter don't appear to offer parameters that will work with ResourceManager. I've experimented a little, but it does not appear possible to use BindingUtils to bind to a resource. I had to work around this by listening for a localeChange event and then reassigning the resource to the variable. This does not scale. So my question is simple: can you bind a variable to a resource in ActionScript? If so, how? Thanks! Erik Erik Thomas | Small Business Group, Intuit | Staff Engineer | 650-944-2602 -- j:pn \\no comment

