Arabic text

35 views
Skip to first unread message

Sam

unread,
Apr 30, 2012, 9:20:19 AM4/30/12
to bristol-flas...@googlegroups.com
Hello,

I am doing some research into converting a project to accomodate Arabic right-to-left text. Text content would be stored in XML and displayed using predominantly runtime generated textfields. I haven't used TLF before and was wondering if anyone had any advice about usage, pitfalls, resources etc that might be helpful.

Much thanks!

Sam

Sam

unread,
Apr 30, 2012, 11:38:04 AM4/30/12
to bristol-flas...@googlegroups.com
UPDATE - so, a little more detail in this one....

I gather that I will/might (?) need to use the TLF architecture but through my research I have found many potential problems with this when it is used in loaded swfs (which all of mine will be). A lot of the issues stem from the change in structural relationship that including TLF as a runtime shared library brings i.e. event bubbling issues, preloading issues, font embedding issues. However it seems that Adobe have released the proloader class set (to replace the earlier safeloader class set) and that this tackles a lot of the issues that were occurring. However… you need to change your import settings to use proloader instead of the loader class and this doesn't seem like a big deal BUT our framework uses Bulkloader to handle all the loading. Can anyone please shed any light on:- 


- Is using TLF the way to go for joined, right to left Arabic text or is there another viable solution?


- What are the major pain points to look out for and what are good solutions?


- Will Bulkloader be able to handle the use of TLFs without breaking apart (I have googled this but had no luck)?


Much thanks!

Sam

Ben Bath

unread,
May 3, 2012, 10:43:51 AM5/3/12
to Bristol Flash User Group
I think that you will need TFL as there is no way to achieve RTL for
text input and you may find that all characters will be reversed in
normal text fields.

I have just added Hebrew to a project and am soon to add Arabic.
Issues I encountered were:
Loosing TextFormat for input texts
Listening for focus events on TLFTextFields stoped text entry.

As our project already dealt with multiple languages and fonts, all
our TextFields just contained a reference to an xml node, and the
TextFields were all swapped out at runtime. The extension for Hebrew
was to change the swap out for a TLFTextField instead of a TextField
and then just resolve the bugs. Personally I would have wanted Adobe
to make a common interface for TLFTextfields and TextFields as in some
cases I still needed to manipulate a text field in a loaded swf, but
did not want to bother with linking to TLFTextField classes in the
swf. Currently I have these references as untyped but you could extend
TFLTextField and TextField to include a common interface, and then
only reference the interface.

The main.swf in this project is the only swf that contained
references to the TFL classes, loaded swfs are compiled against a
main.swc with the library property of exclude. Currently I have
complied the TLF classes into the main.swf but I will be referencing
the RSL.

Hope this helps

Ben Bath

Sam

unread,
May 4, 2012, 4:25:58 AM5/4/12
to bristol-flas...@googlegroups.com
Hi Ben,

Thanks so much for this info, it's very helpful indeed. Much appreciated! I might come back to you with a couple of questions when I actually get to implementation stage if that's okay?

Cheers,

Sam :-)

Sam

unread,
May 18, 2012, 9:49:54 AM5/18/12
to bristol-flas...@googlegroups.com
Hi Ben,

Once again, thanks for your help! I had a couple of follow up questions....

- Can you expand a little on how your runtime textfield substitution worked please?

- What was your exclude library setting in the loaded swfs? 

- Did you use the Proloader classes from Adobe?

Thanks!

Sam :-)

Ben Bath

unread,
May 21, 2012, 8:58:10 AM5/21/12
to bristol-flas...@googlegroups.com
Sam,

Sorry for that late reply. I haven't got much time at the moment but I'll add some more details tonight.

Ben

Ben Bath

unread,
May 22, 2012, 1:08:59 PM5/22/12
to bristol-flas...@googlegroups.com
Textfield substitution:

Currently all our textfields are dynamic and contain references to an xml node: 

ie "pages.home.title"
<pages><home><title textFormat="myFormat">My title</title></home></pages>

These textFields are wrapped in a TextLoader classes. This class dispatches a TextLoaderEvent through stage.loaderInfo.sharedEvents. A TextManager class in the main.swf receives these events and substitutes the textFields with one that contains the right copy and formatting.

The testFormat links to another xml which contains attributes for the font, size, color etc.
<format textFormat="myFormat" font="myFont" size="20"...  />

Currently I am looking to replace this with a robotlegs solution...
The robotlegs context maps all TextFields to a mediator:         mediatorMap.mapView(TextField, TextFieldMediator);
The mediator replaces the TextField with one with the correct copy. NB the new textField will instantiate a new  TextFieldMediator so if the xml copy cannot be located (as it has already been replaced) then the textField should not be replaced and the Mediator should deactivated / removed itself.

Exclude settings:

Our main.swf is also published as a swc into a library. This swc is linked in the libraries of loaded swfs with the linkage option of exclude. (In flash click on the linked library and change settings from merged to exclude). All common classes across the project are referenced in a MainShared class linked to the Main class of the main.swf.

public class Main extends MovieClip
{
public function Main(){
MainShared
}
}
  

public class MainShared 
{
public function  MainShared (){
TextLoader
TextManager
TLFTextField
SharedClassA
SharedClassB
}
}
  
NB we do not instantiate these classes just reference them so they get compiled into the main.swf and swc. Loaded swfs will compile with the exclude setting so the classes are not duplicated in loaded swfs. When publishing a loaded swf it may seem as if it has failed to publish correctly as classes it is expecting are not there, but if loaded through the main.swf then the excluded classes will be available to it.

Preloader:
Not looked at that yet. If main.swf has the reference then all loaded swfs can use the preloaded classes. Then you will only need a preloade in main. I thnk?!


Ben

Sam

unread,
May 28, 2012, 12:38:18 PM5/28/12
to bristol-flas...@googlegroups.com
Hi Ben,

Thanks so much for this info, it's a huge help and I really appreciate it.

I am trying to follow your technique of setting the link type( to the shared tlf-containing swc in the libraries' of the modular swfs) to external/exclude. The problem I am having is that I am getting errors like this - ReferenceError: Error #1065: Variable standardButton is not defined. - where the standardButton object of the swc isn't getting picked up in the modular swfs. The standardButton is a library instance whose class is generated at compile time by the IDE (BUT whose base class is actually part of the main class library). Do you think I need to go about generating objects like this in the swc I want to be available in a different way? Can you see what else might be going wrong?

Much thanks,

Sam

Sam

unread,
May 30, 2012, 5:20:13 AM5/30/12
to bristol-flas...@googlegroups.com
Hello again,

Actually I figured out my error problems. As you said, I needed to at least var the library classes (found in my swc) in the base swf for them to be available in the loaded swfs. This fixed the problems. I also provided an Application Domain context into Bulkloader (which is being used for all the loading) for all the modular swfs.

A couple of other questions that have come up:-

- When I add a TLFTextField into the base swf (or 'merge into code' the textlayout.swc)  it increases by about 180k BUT it I embed a TLFTextField onto the stage of the swc, it increases by about 4-500k. Any ideas why this is happening?

- Do you know what the difference is between publishing for 10.2 or 10.1 with regards to TLFTextField functionality and also the Proloader classes?


Cheers,

Sam
Reply all
Reply to author
Forward
0 new messages