reference the resource bundle by key instead of the getString()

 

 

such as rb.content["txName"];

 

 

 

you can read more here:

 

http://livedocs.adobe.com/labs/flex/3/html/wwhelp/wwhimpl/common/html/ww
help.htm?context=LiveDocs_Book_Parts&file=l10n_033_1.html

 

 

 

Hope that helps,

 

brian..

 

 

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of mayurrami
Sent: Tuesday, September 04, 2007 10:43 PM
To: [email protected]
Subject: [flexcoders] ResourceBundle - Problem with ActionScript code

 

Hi everybody...

I am having few problems for ResourceBundle.

The code is as below

/* code in Flex 3 (Moxie - Beta) */
----------------------------------------------
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 to me.

Thanking you in advance.

- Mayur 

 



***
The information in this e-mail is confidential and intended solely for the 
individual or entity to whom it is addressed.  If you have received this e-mail 
in error please notify the sender by return e-mail delete this e-mail and 
refrain from any disclosure or action based on the information.
***

Reply via email to