Skip to main content
November 5, 2009
Question

you can't make a silk purse out of a sow's ear

  • November 5, 2009
  • 1 reply
  • 1821 views

Playing with and comparing text.engine to TextField.  I mean TextField is already very slow. Did you have to go ahead and make text.engine much, much slower ?

You can't be serious right ?

You mean to tell me that each time a page is resized I have to remove all the textLine children I just added in AS3 and then add new ones so my textBlock can adjust to the new size ? Am I wrong ?

You need to move alot of this kind of thing down to C++. AS3 is not C++ lol

So its looks like its going to be a long time before text.engine is even usable.

And so TextLayoutFramework will never be any good until text.engine is vastly improved. The simple act of resizing brings it to its knees unless I am missing something.

TextField could use some addtional performance improvements so please do. obvious to do: textField.appendHTMLText... Some slight improvements to TextField could go a long way.

While I am at it, device fonts have integer heights and widths, while embedded fonts have fractional heights and widths....  I hope you realize thie can cause problems such as varible spacing between lines among other things.

I can provide examples if you are interested.

Don

This topic has been closed for replies.

1 reply

Participating Frequently
November 5, 2009

Have you used the Times Reader AIR application? It uses FTE and reflows text in multiple columns quite nicely as you resize the window.

There are indeed situations where FTE is slower than TextField, but it is much more flexible. And you can use it to build powerful applications that perform well. Please give us more information about what resizing problems you're having.

Gordon Smith

Adobe Flex SDK Team

November 5, 2009

Hi Gordon, I have been working many hours lately so abit on edge.... but...

I did try the Times Reader and it is nice. The Reader I just downloaded does not resize so I can't gleen anything from that. I do see it has the annoying mouse bug with context menu.  Start dragging and selecting text. WIth left button still down, right click. Release left button. escape out of the context menu. Flash still thinks the left button is down.

Another Air app I looked at as the Adobe Extension Manager... It just has a small amount of text and something is not right with it. Like the cursor keeps changing from Arrow to IBeam... and scrolling is very slow  so I am thinking just another side effect of FTE or the framework.

Now I want FTE to work and I want it to work well. I plan to do all my page layout with Flash from now on. I have TextField working very well for this but still the flow offered by FTE is what you need.

Heres a simple test page. It has 50,000 characters in it of just straight text, no graphics or fancy formatting. Using FTE of course. By the way, this little test is 121 k.... because of FTE. Now I test everything on my celeron 2.66 mhz machine because it tells me immediatley about performance issues.

o - On the slow test machine it really bottles up. Long pauses when resizing left and right. Here I can tell that TextField performs much better.

o - On my pentium duo it worked ok

http://sms.pangolin.com/sizetest/

Alot of people still have relatively low end machines by todays standards. But really all this should work very well even on machines such as my Celeron.

I have another post to make with some code tidbits...

Don

November 5, 2009

As a rough comparison I had to do a Java RichText editor but not as complete as yours. This ran as an applet. I tested it with 200,000 characters for wrapping and editing and no problem with sizing or editing whatsoever.

Ok so here is how I am coding the test page.

public class Test extends Sprite {

private var textBlock:TextBlock;

private var _stage:Stage;

public function Test (_stage:Stage)

{

    textBlock = new TextBlock();

    this._stage = _stage;

    var format:ElementFormat = new ElementFormat ();

    var fontDescription:FontDescription = new FontDescription ("Arial");
    format.fontSize = 16;
    format.alignmentBaseline = TextBaseline.DESCENT;
    format.fontDescription = fontDescription;
    var textElement:TextElement = new TextElement ("",format);

    // put some text in

    for (var i:int = 0; i < 5000; ++i)
        textElement.replaceText (textElement.text.length,textElement1text.length,"aaaa bbbb ");

    _stage.addEventListener (Event.RESIZE,onEventResize);

}

private function onEventResize (e:Event) : void
{
    while (this.numChildren > 0)
        removeChildAt (0);
    createTextLines (textBlock);
}

private function createTextLines(textBlock:TextBlock) : void

{
    var yPos:Number = 0;
    var textLine:TextLine = textBlock.createTextLine (null,_stage.stageWidth);

    while (textLine != null)
    {
        addChild(textLine);
        textLine.x = 0;
        yPos += textLine.textHeight + 8;
        textLine.y = yPos;
        textLine = textBlock.createTextLine (textLine, _stage.stageWidth);
    }
}

} // end of class

Gordon, is this about it in this simple case ? or is there some better way ?