Problems with Text Layout Framework

November 22, 2009 at 4:11 pm Leave a comment

I had hoped to release a beta version of e2publish after this weekend.  But I got caught up in some problems with the Text Layout Framework – so it will be a little while longer.  I’m still refining the workarounds, and I’ll be putting in some bug reports soon.

The first problem is that ContainerController.textLength is unreliable.  Investigating further, I discovered that the problem occurs when the ContainerController contains a line of text that is not terminated by a newline.  Like might happen at the end of the textflow.

I managed to get around the problem as follows (within a class that inherits ContainerController) …..

 

var textLength:int=this.textLength;
if (textLength==0 && getSubString(textFlow,absoluteStart,absoluteStart+1)!='') textLength=textFlow.textLength-absoluteStart-1;

If textLength is zero, yet we still detect a character in the first position of the ContainerController, then clearly, textLength shouldn’t be zero – so we calculate what it should be assuming that we’re at the end of the textflow and knowing what the total length of the textflow should be.

I’ve utilised a substring method that I found on adobe forums.  I was using this anyway in my program – so it was convenient to call it here.  No doubt there’s a better workaround that doesn’t rely this method.

But don’t try to override textLength.  I tried, and it caused problems.  I’m not entirely sure why, but this seemed to cause several other ContainerController methods to fail – as if they rely on the incorrect value.

 

The second problem I’ve encountered is that ContainerController.getScrollDelta(n) fails with a run time error depending on the contents of the ContainerController.  If the ContainerController is empty, or has only newline characters – this causes a failure.

 

Advertisements

Entry filed under: Adobe AIR, e2publish, Text Layout Framework.

Forthcoming AIR application updates First beta prototype of e2publish here now!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


  RSS feed          View Daniel Freeman's LinkedIn profileView my profile

Add to Technorati Favorites

November 2009
M T W T F S S
« Oct   Dec »
 1
2345678
9101112131415
16171819202122
23242526272829
30  

%d bloggers like this: