AnsweredAssumed Answered

dynamicallyl setting resourcemanager language

Question asked by GoogleGirl on Jan 10, 2012
Latest reply on Jan 12, 2012 by GoogleGirl
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>

Outcomes