Hi All,

  I wrote a simple ResourceBundle which is listed below..

  [CODE]
public class MyResourceBundle
{

  private var resourceManager:ResourceManager = null;
  private static var myResourceBundle:MyResourceBundle = null;
  public function MyResourceBundle():void{
                init();
  }
  private function init():void{
        resourceManager = new ResourceManager();
        var resourceBundle:ResourceBundle = new
ResourceBundle("en_US","myBundle1");
resourceManager.addResourceBundle(resourceBundle);

                }
public static function getInstance():MyResourceBundle{
   if(dpaResourceBundle==null){
        myResourceBundle = new MyResourceBundle();
   }
   return myResourceBundle;
}
private function getResourceBundle():ResourceBundle{
        var resourceBundle:ResourceBundle = null;
        if(resourceManager!=null){
                resourceBundle =ResourceBundle
(resourceManager.getResourceBundle("en_US","myBundle1"));
                                return resourceBundle;
                        }
                        else{
                                trace("Unable to get the ResourceManager 
!!!!!");
                                return null;
                        }

                }

                public function getValue(key:String):String{
                        var value:String = null;
                        if(getResourceBundle()!=null){
                                if(getResourceBundle().hasOwnProperty(key)){
                                        value = 
getResourceBundle().getString(key);
                                        trace("key ="+key+"value ="+value);
                                        return value;
                                }
                                else{
                                        trace("Property ="+key+" Doesn't Exists 
!!!");
                                        return "";
                                }
                        }
                        else{
                                trace("Unable to get the ResourceBundle");
                                return "";
                        }
                }


        }
  [/CODE]

   Now i have placed the properties file myBundle1_en_US.properties in
the same folder as the Above File..

   When i try to read the values from this file i am not getting any
info as the hasOwnProperty() is always returning false;

Thanks
Kumar

Reply via email to