Kun Janos around Adobe’s <Flex> and <Flash>

about me, my life and my work

Archive for the 'Uncategorized' Category


Using Locales in Flex

Posted by admin on 24th February 2010

Locales are used to display localized(in English or Hungarian, French…) information(labels, messages,…) in our Flex application. Localized info can be used for Flex components or our custom components too.

Flex SDK arrives with en_US default locale but we can create our own locales for hu_HU(hungarian), fr_FR(french) or any other language we would like to use in our application.

Assume we would like to have the application in hungarian. We will have to create the framework locales for hungarian and also our custom resource locales in hungarian too.

Create framework locales for hu_HU
First step is to copy the locales from en_US to hu_HU. For this step, we will go to flex sdk bin directory(on my computer it’s located at C:\Program Files\Adobe\Flex Builder 3\sdks\3.5.0.12683\bin\) and will launch the command:
> copylocale en_US hu_HU
This will copy framework locales from en_US to hu_HU. At this point, all locales for hu_HU are in english language, but framework is compiled and can be used.

If we would like to use our hu_HU in hungarian language, then we have to edit the resource files for hu_HU and recompile the framefork swcs.
Our hu_HU resource files are located in the sdk directory(C:\Program Files\Adobe\Flex Builder 3\sdks\ 3.5.0.12683):
\frameworks\projects\airframework\bundles\hu_HU\src
\frameworks\projects\framework\bundles\hu_HU\src\
\frameworks\projects\rpc\bundles\hu_HU\src\
The compiled swc files for hu_HU are located in: frameworks\locale\hu_HU\

After modifying the framework src files for hu_HU, we can recompile the framework swcs using the following commands, launched from the sdk directory(C:\Program Files\Adobe\Flex Builder 3\sdks\3.5.0.12683\):
>bin\compc -locale=hu_HU -source-path+=frameworks/projects/framework/bundles/hu_HU/src -include-resource-bundles=collections,containers,controls,core,effects,formatters,logging,SharedResources,skins,states,styles,utils,validators -output=frameworks/locale/hu_HU/framework_rb.swc

>bin\compc -locale=hu_HU -source-path+=frameworks/projects/airframework/bundles/hu_HU/src -include-resource-bundles=aircontrols -output=frameworks/locale/hu_HU/airframework_rb.swc

>bin\compc -locale=hu_HU -source-path+=frameworks/projects/rpc/bundles/hu_HU/src -include-resource-bundles=messaging,rpc -output=frameworks/locale/hu_HU/rpc_rb.swc

Create custom locales for hu_HU
Create locale\hu_HU directory in our main application. Add new file myResources.properties and add properties like:
GREETING=Udvozollek
Save the file and go to Project properties->Flex Compiler and edit the Additional Compiler Arguments like: -locale=en_US,hu_HU -source-path=../locale/{locale}
Keep in mind, you have to create the framework swcs in hu_HU first.

Add the following code in the MXML:
<mx:Metadata>
[ResourceBundle("myResources")]
</mx:Metadata>
Now we can use the following mxml syntax to get our custom local: <mx:Label text=”{resourceManager.getString(’myResources’, ‘GREETING’)}” fontSize=”48″/>

Posted in Uncategorized | No Comments »

Hiding a tab in the Flex TabNavigator component

Posted by admin on 22nd June 2009

After searching for a lot of time, I found out that tab navigator tabs in the Flex TabNavigator component can be hided easily by using the following lines:

var tabIndex:int = 1;
customTabNabNavigator.getTabAt(tabIndex).visible = false;//hides the tab
customTabNabNavigator.getTabAt(tabIndex).enabled = false; //don't let the user to choose the tab using the keyboard

Posted in Uncategorized | No Comments »

http://swxformat.org/

Posted by kunjanos on 18th September 2008

I just came accross http://swxformat.org/…

Posted in Uncategorized | No Comments »