Wednesday, August 30, 2006

Shared fonts library and unicode

I was working with a multilingual application where we had to support almost all major languages like russian, thai, french, chinese etc...

My application was working fine with shared fonts with English, german, spanish, latin and french but problem arose when I tried to use cyrillic. I mean UNICODE. After long hours of hair pulling, I got a solution and this was very similar to dembicki's solution.

Let me go through step-by-step.

Open a blank FLA in flash 8.

Create a dynamic textfield. Choose your desired font for the desired language. You can use charmap or any other application that could show all languages supported by the font.









Embed desired gylphs for desired languages.











Select the dynamic textfield and convert it to movie. Give it a name like 'fonts'. Export for runtime sharing and also export for first frame. In URL section provide relative URL of the font swf or exact URL of the font swf.

You have to create seperate movieclips for bold, italic and bold italic....if necessary.









Delete the 'fonts' movie from the stage (Not from the library).









Now create an empty movieclip called 'ForceShared'. Import for runtime sharing. Give URL for the font swf same as given into fonts movie. A question arise here why same URL for both movies? Since source is same here for both (Exported movie and the movie that import the exported font), both URL would be same.










Drag the 'ForceShared' movie onto stage. And publish the swf into fonts folder.

Here your font library is ready for 'Thai' and 'Cyrillic'.
To use it just load dynamically into your application FLA. Create a input textfield dynamically and apply the font. Set embedFont is true. If eveything is gone in right direction.....Your application must show the desired text.

Advantages:

1. Font will be in a single file.
2. Easy to create.
3. Easy to use.
4. A solid solution of UNICODE related problems.
5. The same procedure will be applied for prescribed

Disadvantges:

1. If you have embeded Normal font that you cant use Bold or Italic. You must have to embed others also otherwise these will not work. If embed, could raise filesize so be cautious about it. Better it to define supported format in your font xml file so that you could know which format is supported by the font library. Lets example if we are using Chinese, there are many fonts which support only normal/Italic or bold/italic.

At last I want to tell you as written in quasimondo.com that try to create seperate font library for each languages. Dont mesh all languages.

You can mail me or leave a comment for it. Thanx!

DEL

Thursday, August 10, 2006

Flash 8 and multilingual support

Yesterday I was looking for options to create multilingual application in Flash 8.
I got a handy option to create this using Strings Panel.
Let me describe a-z....
HOW TO CREATE...
First of all we need to create XML language files. Flash 8 reads 2 types of format...*.xml and *.xlf [XML Language File]
First we need to create XLIFF [XML language interchnageable file format]
Here is an example....
[GERMAN]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xliff PUBLIC "-//XLIFF//DTD XLIFF//EN"
"http://www.oasis-open.org/committees/xliff/documents/xliff.dtd" >
<xliff version="1.0" xml:lang="fr">
<file datatype="plaintext" original="combotest.fla" source-language="EN">
<header></header>
<body>
<trans-unit id="001" resname="IDS_GREETINGS">
<source>Willkommen zu unserer Web site!</source>
</trans-unit>
<trans-unit id="002" resname="IDS_MAILING LIST">
<source>Wurdest du magst auf unserer Adressenkartei sein?</source>
</trans-unit>
<trans-unit id="003" resname="IDS_SEE YOU">
<source>bald bis!</source>
</trans-unit>
<trans-unit id="004" resname="IDS_INFO">
<source>Es gibt zwei Arten Gegenstände auf das Stadium (zeichnender Bereich). Einen Gegenstand vorwählen, gerechtes Klicken auf es. Wenn Notwendigkeit, mehrfache Gegenstände vorzuwählen, Maus auf das Stadium schleppen. Alle Gegenstände innerhalb des Bereichs werden vorgewählt. Wenn Gegenstand ein Firmenzeichen und seine internen Elemente vorzuwählen ist, einfach fortfahren, zum Firmenzeichensymbol an zu klicken.</source>
</trans-unit>
<trans-unit id="005" resname="IDS_LINE1">
<source>Linie 1</source>
</trans-unit>
<trans-unit id="005" resname="IDS_LINE2">
<source>Linie 2</source>
</trans-unit>
</body>
</file>
</xliff>

[ENGLISH]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xliff PUBLIC "-//XLIFF//DTD XLIFF//EN"
"http://www.oasis-open.org/committees/xliff/documents/xliff.dtd" >
<xliff version="1.0" xml:lang="en">
<file datatype="plaintext" original="combotest.fla" source-language="EN">
<header></header>
<body>
<trans-unit id="001" resname="IDS_GREETINGS">
<source>welcome to our web site!</source>
</trans-unit>
<trans-unit id="002" resname="IDS_MAILING LIST">
<source>Would you like to be on our mailing list?</source>
</trans-unit>
<trans-unit id="003" resname="IDS_SEE YOU">
<source>see you soon!</source>
</trans-unit>
<trans-unit id="004" resname="IDS_INFO">
<source>There are two types of objects onto the stage (drawing area).
To select an object, just click onto it.
If need to select multiple objects, drag mouse onto the stage. All objects within the area will be selected.
If object is a logo and to select its internal elements, just continue to click on to the logo symbol. </source>
</trans-unit>
<trans-unit id="005" resname="IDS_LINE1">
<source>Line 1</source>
</trans-unit>
<trans-unit id="005" resname="IDS_LINE2">
<source>Line 2</source>
</trans-unit>
</body>
</file>
</xliff>

Now come to flash. Open a document, add 3 dynamic textfield(name is not required).
Go to Window -> Other Panel -> Strings.
Click on setting tab and add desired languages.
(In case of other languages, click on custom language and provide a identifier name that u have given in respected xml or xlf file.)
Click the repalce string option to AUTOMATICALLY AT RUNTIME.
Click on import XML for each given language.
Now select a textfield and choose string identifier from the list, apply, and apply for reach language.
The same process will be repeated for every other textfields.
Close the Strings Panel and come to action panel of first frame....
Write the code...

import mx.lang.Locale;

//Here u can pass the language identifier...
Locale.loadLanguageXML("de");

Now publish the file. If everything is OK, language will be automatically changed.

Hope this will reduce burden of multilingual application.
If anybody have better idea regarding this, APPRECIABLE....im lookin :)

DEL

Thursday, July 13, 2006

Happy day

Today is a cool day of my life. We had just finished our CMS project.
We had spent 3 very tough nights to release it. Yesterday, when I was leaving to home, feel relaxed.
Relaxation was for our hard work, for our work satisfaction. Cyrus could really be a good project manager.

Today, our comp becomes 6 yrs old. I have been attached with this com since last 3 yrs. y...itz rilly a great day.

DEL

Saturday, May 27, 2006

How to access or send data across the domain via flash

Prior to flash player 7, this was not very tough job to load/send data across domain. Now this is little bit tricky and more secure.
As we know, to access data across the domain, we need an XML file known as crossdomain.xml.

But first we need to know about domain comparison.
case 1: www.yourdomain.com == www.yourdomain.com
case 2: http://193.147.45.76 != www.somedomain.com
case 3: www.somedomain.com != http://somedomain.com
case 4 www.sub.somedomain.com != www.somedomain.com

In case of data loading no error will be shown while on loading clips, you will get a warning message.


A crossdomainpolicy file is basically a XML file with a specified format...

/*[ignore these comments]
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="www.somedomain.com" />
<allow-access-from domain="http://somedomain.com" />
<allow-access-from domain="http://195.134.23.67" />
<allow-access-from domain="*.somedomain.com" />
<allow-access-from domain="*" />
<allow-access-from domain="www.FromNonsecureToSecureDomain.com" secure="false" />
</cross-domain-policy>
*/

Its name must be saved as crossdomain.xml and must resides in root folder of the domain.
In flash player version 7r19 or later, one more feature is added and that allows us to keep policy file in arbitrary positions.
System.security.loadPolicyFile
Using this API, one can place policy files in arbitrary locations, rather than the default location at the root. With this API, you can also serve policy files directly from XMLSocket servers and specify XMLSocket connections to ports below 1024.

DEL

Thursday, May 18, 2006

Zoundry blog writer

Hi,
I am using zoundry blog writer. This is marvelous. Try this....and you love it.

DEL

Wednesday, May 17, 2006

Hi, Im here....

Hi,
After a long time again started blogging.
This is all about flash and related technologies.
Thnx.
DEL