Thursday 6 March 2008

Swf fonts, flex and Unicode characters

If you have developed any scientific or mathematical applications you will know the headaches surrounding superscripts, subscripts and weird greek numerals etc in Flash or Flex. We have discovered a solution to some of these issues (well actually my good developer friend Thierry cracked this one but I thought it is worthy of a posting!)

Basically the situation is that you have found a good Unicode font that contains all the characters that you need to embed into a swf font for exporting into Flex. The problem you will encounter is that not all the characters end up being embeded even though they are included in the actual font. The font we have been using is Arial Unicode MS. I checked on windows using the character map to check whether the font contained the characters needed (which were all numerals sup and sub), it did but they weren't importing. The solution to this problem is fairly simple. What you need to do is add the characters you need to the Autofill box as shown below:

Here are the steps:
1. Go into character map in windows (programs/accessories/system tools/character map) choose the unicode font you want, in this case 'Arial Unicode MS'

2. Click on group by Unicode Subrange then choose super/subscript from the list that appears in the window, once you have selected that you will see the available characters in the main window.

3. Click on each character you need and click 'select' below this will add the selected character to the list.

4. Once you have selected the characters you want copy them all to the clipboard and paste them into a dynamic text box in flash.

5. Select the text box and click on 'embed' in the font properties window, then click on 'Auto Fill', this will add all the characters to the exported movie!

Hope that helps.

States, containers & design mode

Came across an annoying little glitch in flex builder today. If you have a basic application that say has 2 states and the base state contains a VBox componant, it can be difficult to add a new item to the VBox in the second state in design mode.

By default the VBox does not contain any height information, it just takes it's size from the items that are added to the cells of the container. In my application I have an HBox in the top cell and I wanted to add a label to the next VBox cell in the second state. What happens is that you cannot see any visual hint to show you that you are placing your item in the next cell of the VBox (this usually is shown by a blue horizontal line being displayed in the VBox when you drag an item into a potential cell area).

The solution is to go back to your Base State and give the VBox a height value, then go to the state you wish to add your item and you will now see a blue line appear. Once placed you will need to go back to your Base State and remove the height value.

Wednesday 5 March 2008

Flex 3 has arrived

Since this is my first post here I thought I would let you know that Adobe have now released Flex 3. After many months of beta testing (which was good as they allowed the community to beta test too) they have delivered what seems to be a nice application. On top of this, AIR v1.0 has also been released