In Flex 3, you should not be accessing resources from a ResurceBundle.
Access them through the ResourceManager.
 
- Gordon

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Matt Horn
Sent: Tuesday, September 04, 2007 1:42 PM
To: [email protected]
Subject: RE: [flexcoders] ResourceBundle with ActionScript code -
Problem in Flex 2 & Flex 3



Just to be sure, you are using metadata like this:
 
[ResourceBundle("German")]

and not this:
 
[ResourcBundle("German")]

 
The "e" was missing in your example. 

-matt 

 


________________________________

        From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of mayurrami
        Sent: Tuesday, September 04, 2007 1:30 AM
        To: [email protected]
        Subject: [flexcoders] ResourceBundle with ActionScript code -
Problem in Flex 2 & Flex 3
        
        

        Hi everybody...
        
        I am having few problems for ResourceBundle.
        
        The code is as below
        
        ----------------------------------------------
        mxml code : RB_3.mxml
        ----------------------------------------------
        <?xml version="1.0" encoding="utf-8"?>
        <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> "
        layout="absolute" 
        xmlns:local="*"
        pageTitle=" Resoruce Bundle ">
        <!--<mx:Label text="@Resource(key='txName',bundle='German')" />
-->
        <!-- The above commented line works very well, but when I try to
        achieve the same through Actionscript it gives an Error -->
        <local:RB_B_AS width="200" height="200" borderStyle="solid"
        paddingLeft="10" paddingTop="10" />
        </mx:Application>
        ----------------------------------------------
        Actionscript code : RB_ActionScript.as
        ----------------------------------------------
        package
        {
        import mx.resources.ResourceBundle;
        import mx.containers.VBox;
        import mx.controls.Label;
        import mx.controls.Alert;
        
        [ResourcBundle("German")]
        public class RB_B_AS extends VBox
        {
        private static var rb:ResourceBundle = new ResourceBundle();
        
        public var l:Label;
        
        function RB_B_AS()
        {
        this.width = 300;
        this.height = 300;
        this.setStyle("borderStyle","solid");
        this.setStyle("paddingLeft",10);
        this.setStyle("paddingTop",10);
        
        l = new Label();
        l.width = 100;
        l.height = 30;
        
        /* Error come on Line : 34 
        [
        Error: Key txName was not found in resource bundle null
        at mx.resources::ResourceBundle/::_getObject()
        at mx.resources::ResourceBundle/getString()
        at RB_B_AS$iinit()
        ] */
        l.text = rb.getString("txName");
        
        this.addChild(l);
        
        var child2:Label = new Label();
        child2.name = "Lable2";
        child2.text = "Two";
        this.addChild(child2);
        }
        }
        }
        ----------------------------------------------
        Res.Bundle : German.properties
        ----------------------------------------------
        txName=What is your Name ?
        ----------------------------------------------
        
        If you can provide me any link for ResourceBundle example purely
in
        AS-3, that will be helpful, also.
        
        Thanking you in advance.
        
        - Mayur
        
        

 

Reply via email to