dynamicallyl setting resourcemanager language

840
4
Jump to solution
01-10-2012 10:35 AM
DebbieAlger
New Contributor III
Hi again,

I have successfully added a combobox to the top of my gui in a skin, but getting errors trying to set the resourcemanager..
"Access of undefined property resourcemanager"
I am guessing that it is not accessible in a sparkskin file?? what do I know, I am new..

<?xml version="1.0" encoding="utf-8"?>

<!--
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2009 - 2011 Latitude Geographics Group Ltd., Canada
// All Rights Reserved
//
// This material is owned by Latitude Geographics Group Ltd. and protected by
// copyright law. It may not be reproduced or redistributed in whole or in part 
// without the prior written permission of Latitude Geographics Group Ltd. 
// (www.latitudegeo.com).
//
////////////////////////////////////////////////////////////////////////////////
-->
<s:SparkSkin
xmlns:fx ="http://ns.adobe.com/mxml/2009"
xmlns:mx ="library://ns.adobe.com/flex/mx"
xmlns:s  ="library://ns.adobe.com/flex/spark"
xmlns:flexlib ="flexlib.controls.*"
>

<fx:Metadata>
[HostComponent("com.geocortex.essentials.viewer.components.TextSearchControl")]
</fx:Metadata>

<fx:Script>
  <![CDATA[
   import spark.events.IndexChangeEvent;
   import mx.controls.Alert;
   import mx.resources.resourcemanager;
  
   protected function combobox_changeHandler(event:IndexChangeEvent):void
   {  
   
      var temp:*=ComboBox(event.target).selectedItem;
      Alert.show("You selected " + temp);
      if (ComboBox(event.target).selectedItem = "English") {
       resourcemanager.localeChain = ['en_US'];  // ERROR
      }else{
       resourcemanager.localeChain = ['fr_FR'];   // ERROR
      }
  
   }
  ]]>
</fx:Script>


<!-- Define the skin states. -->
<s:states>    
  <s:State name="normal" />
  <s:State name="disabled" />
</s:states>


<s:HGroup height="100%" gap="-1" horizontalAlign="left" verticalCenter="0">
   <mx:FormItem label="Select Language:">
    <s:ComboBox change="combobox_changeHandler(event)"  selectedIndex="0"   >
     <s:dataProvider>
      <s:ArrayList>
       <fx:String>English</fx:String>
       <fx:String>French</fx:String>      
      </s:ArrayList>
     </s:dataProvider>
    </s:ComboBox> 
  </mx:FormItem>
</s:HGroup>
</s:SparkSkin>
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
4 Replies
DasaPaddock
Esri Regular Contributor
0 Kudos
DebbieAlger
New Contributor III
wow, you a sooooo smart!

I added  import mx.resources.IResourceManager;
and all is good.
0 Kudos
DebbieAlger
New Contributor III
silly me, I spoke too soon, I now get this error

"Access of undefined property resourcemanager"

<fx:Script>
  <![CDATA[
   import spark.events.IndexChangeEvent;
   import mx.controls.Alert;
   import mx.resources.ResourceManager;
   import mx.resources.IResourceManager;
    
   protected function combobox_changeHandler(event:IndexChangeEvent):void
   {  
   
      var temp:*=ComboBox(event.target).selectedItem;
      Alert.show("You selected " + temp);
      if (ComboBox(event.target).selectedItem = "English") {
       resourcemanager.localeChain = ['en_US'];  ==> ERROR
      }else{
       resourcemanager.localeChain = ['fr_FR'];    ==> ERROR
      }
  
   }
  ]]>
</fx:Script>
0 Kudos
DebbieAlger
New Contributor III
Geez, more replies from me than anyone else.
I am the moron here. there should be a capital "M" in resourceManager..

resourceManager.localeChain = ['en_US'];

so sorry for wasting all your time..

thanks Dasi
0 Kudos