The most reliable way to implement Japanese fonts at runtime in a Flex application is to compile the font case as a swf using mxmlc. This permits you create a filter for the font case you want to implement and load the requisite font case swf. In my case I needed to be able to switch between Latin fonts and Japanese fonts depending on the country locale. This method was used for an FDT5 flex project. The development environment is Linux Mint Maya KDE.
The steps are as follows. You will need a terminal to do this:
Create an environment part to the mxmlc compiler in your Flex SDK
- export PATH=${PATH}:/home/ayo/Toolbox/SDKs/3.50.12683/bin
Put the instructions below in the terminal, changing the path in the instructions below to your own *.css document.
- mxmlc -managers=flash.fonts.AFEFontManager /MyClasses/css/navigation_jp.css.
Inside my *,css document this was the @font-face instruction I used for japanese fonts in my style sheet
- @font-face { src: url('../assets/fonts/ARIALUNI.TTF');font-family: Arial; advancedAntiAliasing: true;
unicode-range: U+0020-U+002F,U+0030-U+0039,U+003A-U+0040,U+0041-U+005A,U+005B-U+0060,U+0061-U+007A,U+007B-U+007E;
/* , U+4E00 -U +9FFF, U+30??, U+FF00 -U+FF9F; */
}
The Actionscript 3 DisplayObject behaves in such a manner that if it is in front of another object mouse enabled behaviours on the lower object will not me mouse accessible. This is quite useful and on occasion I have used a simple technique of creating a transparent Movieclip or Sprite and toggled the visible property or just removed it from the display stack.
I remember this because I had to dig deep to temember a time when the way to do this was to create a MovieClip and within it have an invisible button where you set the useHandCursor to false. The good ole days of Actionscript 2.0
I have blogged about this before but, the proof of the pudding is in the eating. This weekend I have been doing some processor hungry development on Windows - no choice in the matter really. I started first on a desktop which is an extremely fast machine with WIndows XP installed. It had more memory and resources allocated than my virtualised XP set up. To my irritation compiling got slower as I worked. The compiled swf started to flicker and changes between Flash Develop and Flash CS3 got harder with each iteration. Every so often to get back to useful work rates I had to restart the machine.
After the first night of this i decided to migrate my work to my virtualized environment in Ubuntu. It has 1.5 G of ram allocated to XP there. To my amazement it seems this performs much better. No flickering images and a fast compile. Weird and definitely wonderful.
In order to get your html address variables into Flash these are the steps you need to take. This solution assumes that you are embeding your flash file with SWFObject 1.5. Please note this is for SWFObject 1.5. SWFObject 2.0 uses and entirely different set of methods to embed and pass variables to the swf.
Step 1:
Embed your swf in the HTML doc
< script type="text/javascript" src="swfobject/swfobject.js" ></ script >
< script type="text/javascript" >
// <![CDATA[
var so = new SWFObject('testload.swf', 's-moderate', '100%', '100%', '10', '#222222');
so.addVariable('shirt', getQueryParamValue("shirt"));
so.useExpressInstall('swfobject/expressinstall.swf');
so.addParam('menu', 'false');
so.write('content');
// ]]>
< /script >
Step 2
Inside your AS3 document retrieve your variables like so
var myshirt:String = this.loaderInfo.parameters.shirt
That's it