actionscript 3 - How to bind a variable to ResourceManager.getString() in Flex using AS3 -
those day trying find way bind variable localised resource , not have result.
the situation following: have class componenttypes.as, contains public variables of type string. want variables bound translated resource:
package model { import mx.resources.iresourcemanager; import mx.resources.resourcemanager; public class componenttypes { private static var resourcemanagerinstance:iresourcemanager = resourcemanager.getinstance(); //areas , volumes [bindable] public static var heated_area:string = resourcemanagerinstance.getstring('app','phpx.componenttypes.heatedareas'); [bindable] public static var heated_volume:string = resourcemanagerinstance.getstring('app','phpx.componenttypes.heatedvolumes'); } }
however variables not updated when locale changed. clear, not bound.
so question is: there way can bound variables resourcemanager class, updated when locale changed?
setting object using object = value
notation run only once, when execution hits point in code. in event of static
variable, occurs first time variable called (i may wrong , may first time class called or imported, end result here same, though).
so can't bind way. way binding works when bindable
variable physically set, dispatches event objects binded listening for. there set variable once , never touch again.
you can bind 1 of 2 ways:
- in mxml using
{{ property }}
notation - in as3 using
bindingutils
.bindingutils
attaches internal event listener (i.e. don't have attach yourself) , updates provided property. unsure workstatic
object, however.
i did check source code mx.resources.iresourcemanager#getstring()
, verified bindable object, there.
Comments
Post a Comment