Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-25969

unable to bind "this.resourceManager" in MXML code

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Later
    • Affects Version/s: Adobe Flex SDK 4.1 (Release)
    • Fix Version/s: None
    • Component/s: Data Binding
    • Labels:
      None
    • Environment:
      Affected OS(s): All OS Platforms
      Affected OS(s): All OS Platforms
      Language Found: English

      Description

      Steps to reproduce:
      1. Use this code to reproduce:
      <?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" minWidth="955" minHeight="600"
      preinitialize="application1_preinitializeHandler(event)"
      applicationComplete="application1_applicationCompleteHandler(event)">
      <fx:Script>
      <![CDATA[
      import mx.binding.utils.BindingUtils;
      import mx.events.FlexEvent;
      import mx.resources.IResourceManager;
      import mx.resources.ResourceBundle;
      import mx.resources.ResourceManager;
      protected function application1_preinitializeHandler(event:FlexEvent):void

      { BindingUtils.bindSetter(this.test, this.resourceManager, ['getString']); var bundle:ResourceBundle = new ResourceBundle('en_US', 'app'); bundle.content.value = 'Some text'; this.resourceManager.addResourceBundle(bundle); this.resourceManager.localeChain = ['en_US']; }

      private function test(...args):void

      { trace('LOCALIZATION CHANGED:', this.resourceManager.getString('app', 'value')); //trace((new Error()).getStackTrace()); }

      protected function
      application1_applicationCompleteHandler(event:FlexEvent):void

      { var bundle:ResourceBundle = new ResourceBundle('lc', 'app'); bundle.content.value = 'Some localization text'; var manager:IResourceManager = this.resourceManager; manager.addResourceBundle(bundle); manager.localeChain = ['lc']; }

      ]]
      >
      </fx:Script>
      <s:layout>
      <s:VerticalLayout paddingLeft="20" paddingTop="20"/>
      </s:layout>
      <s:Label text="

      {this.resourceManager.getString('app', 'value')}

      " width="100%"/>
      </s:Application>

      2. test it

      Actual Results:
      Method "test" will be called every time when localization changed, but label will display text for previous locale and will never change

      Expected Results:
      Label text changed and binded method called

      Workaround (if any):
      Remove "this" from, MXML
      <s:Label text="

      {resourceManager.getString('app', 'value')}

      " width="100%"/>

        Attachments

          Activity

            People

            • Assignee:
              adobejira Adobe JIRA
              Reporter:
              adobejira Adobe JIRA
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: