I have one text field which needs to support RTL languages but this is not achievable with ordinary TextField so I used TLF. I created a test project just to make a test with this small text field which uses TLF, and guess what it became 346KB. I browsed the compiled swf in flash develop and I can see a lot of classes from TLF framework which I havent imported in the text project.
How to remove them from addin to the main swf file?
Here is my code
msg = "<TextFlow xmlns='http://ns.adobe.com/textLayout/2008'><p><span>Enter text here ...</span></p></TextFlow>";
textFlow = TextConverter.importToFlow(msg , TextConverter.TEXT_LAYOUT_FORMAT);
textFlow.fontSize = 12;
textFlow.flowComposer.addController(new ContainerController(this, 200, 50));
textFlow.flowComposer.updateAllControllers();
undoManager = new UndoManager();
editManager = new EditManager(undoManager);
textFlow.interactionManager = editManager;
So basically I am importing these classes
import flashx.textLayout.compose.StandardFlowComposer;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.conversion.TextLayoutExporter;
import flashx.textLayout.elements.SpanElement;
import flashx.textLayout.elements.ParagraphElement;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.formats.TextLayoutFormat;
import flashx.textLayout.factory.StringTextLineFactory;
import flash.text.engine.TextLine;
import flash.geom.Rectangle;
import flashx.textLayout.edit.EditManager;
import flashx.undo.UndoManager;
import flashx.textLayout.conversion.TextConverter;
The compiler embeds only the classes your project really needs to run. The classes you think you don't need are probably used by the TLF framework classes you did import.
RTL languages are really tough to implement, especially in conjunction with LTR text. But - there is always the possibility of extending TextField and creating your own RTL capable field, which would probably be considerably less heavy on file size. It all depends on how much time you are willing to spend.