Skip to main content
March 31, 2009
Question

TLF keyboard input

  • March 31, 2009
  • 4 replies
  • 2055 views
Hello,

in the forum I read "TLF has full support for keyboard input"...
Someone can get an example?

Thanks.
This topic has been closed for replies.

4 replies

Adobe Employee
April 1, 2009
There are several different ways to get keyboard input. If you attach an EditManager as the interactionManager for a TextFlow, most keyboard input is handled automatically. There are examples of this posted on the Labs TLF site: http://labs.adobe.com/downloads/textlayout.html, look particularly at the ActionScript examples, see EditText.as.

If you want to override the processing TLF does by default, there are several ways. You can, as tdminh81 suggests, override FlowOperations. Or you can derive from EditManager and override the keyDownHandler function. Or you can even derive from DisplayObjectContainerController and catch the event earlier in the sequence.
April 1, 2009
be patient with Adobe. TLF is changing :) many bad stuffs but i hope they will be cleared out. For now clean OOP is not possible.
April 1, 2009
if(e.operation is InsertTextOperation){

var op:InsertTextOperation = e.operation as InsertTextOperation;
distance = Math.abs(absoluteStart-op.absoluteStart);

// TAB processing
if(op.text == '\t' ){
bm = listManager.getBulletMapByPara(p);
if(bm != null){
if(bm.hasPara(p)){
if(distance <= 2){
e.preventDefault();
if(bm.isParaFirst(p)){
bm.setMargin(bm.margin+20);
}else{//not first line
var newbm:BulletMap = new BulletMap();
newbm.parentMap = bm;
bm.childMap = newbm;
newbm.margin = bm.margin+20;

bm.removePara(p);
newbm.addPara(p);
listManager.bulletMaps.addItem(newbm);
}
}
}
}else{.........

this is handler of FlowOperationBegin.
Hope this helps
April 1, 2009
Thanks tdminh81....

I work from 6 years as webdeveloper (.net/java) and this "textLayout" for me it's the worst object class that I used....
For me this project will be the last on Adobe technology.
Participating Frequently
April 2, 2009
> I work from 6 years as webdeveloper (.net/java) and this "textLayout" for me it's the worst object class that I used

Fabio, can you give some specific examples of what you don't like about TLF?
April 1, 2009
no one suggestion?