0

我是弹性开发的新手。我正在尝试在我的背景所在的 php 中完成它似乎非常基本。我想要做的是获取我正在从 textarea 读取的行的值。我阅读这些行没有问题,但是当我运行循环时我无法获得它的值。代码如下。如果有人可以提供帮助,我将不胜感激

var composer:StandardFlowComposer = txtSource.textFlow.flowComposer as StandardFlowComposer;
            for each (var line:TextFlowLine in composer.lines){ 
                trace(line); 
                     }  
4

2 回答 2

1

据我从文档中得知,“行”不是 StandardFlowComposer 的属性。您需要使用 getLineAt(int) 来读取一行。所以,像这样:

var composer:StandardFlowComposer = txtSource.textFlow.flowComposer as StandardFlowComposer;
for (var i:int = 0; i < composer.numLines; i++){ 
    trace(composer.getLineAt(i)); 
}
于 2013-01-09T05:31:34.127 回答
1
var composer:StandardFlowComposer = txtSource.textFlow.flowComposer as StandardFlowComposer;



 var dlim:int=0;
for each (var line:TextFlowLine in composer.lines)
{ 
        var text:String = txtSource.text.slice(dlim,dlim+line.textLength);
        dlim=dlim+line.textLength;
        trace(text);
}  
于 2013-01-09T06:59:17.653 回答