Question

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;
Was it helpful?

Solution

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.

OTHER TIPS

You do have another option. If you primary concern is the size of your final swf, you may want to switch your 'Framework Linkage' in the 'Flex Build Path' properties area, to 'Runtime shared library (RSL)'. This will allow your swf to not have any runtime libraries included in it. The textLayout_2.0.0.232.swz file is 188kb all by itself. This runtime library won't download to a client if they already have it, in which case downloading your swf would be the only piece downloaded, and be much smaller.

You should try that and see what the size of your swf is. Make sure you have the RSL files deployed with your swf, so they can be downloaded if needed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top