ActionScript 3 检测文本何时在TextFlow对象中运行到ContainerController的末尾

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3 检测文本何时在TextFlow对象中运行到ContainerController的末尾相关的知识,希望对你有一定的参考价值。

/*
A good idea to set a config object to pass into the TextFlow object when you create it
*/
config = Configuration(TextFlow.defaultConfiguration).clone();

/*
And add this overflowPolicy to it as well as your formatting defaults
*/
config.overflowPolicy = OverflowPolicy.FIT_DESCENDERS;

textFlow = new TextFlow(config);

/*
  Create your containers from sprites and make sure the scrollPolicy is OFF
*/
var controller:ContainerController = new ContainerController(containerSprite,width,height);
controller.verticalScrollPolicy = controller.horizontalScrollPolicy = ScrollPolicy.OFF;
					
textFlow.flowComposer.addController(controller);

/*
Now imagine we are in a loop which adds a paragraph of lorem ipsum to the textflow and updates the controllers and checks if the flow is now out of the bounds of the container
*/

while(LOOP)
{
  textFlow.addChild(myParagraphElement); // you've created the paragraph
  textFlow.flowComposer.updateAllControllers(); // you've created the controllers
  
  var containerIndex:int = textFlow.flowComposer.findControllerIndexAtPosition(textFlow.textLength-1);
  if(containerIndex==-1) textFlowCompleteHandler();
}

以上是关于ActionScript 3 检测文本何时在TextFlow对象中运行到ContainerController的末尾的主要内容,如果未能解决你的问题,请参考以下文章

检测用户何时在 UITableViewCell 中输入 UITextField

检测用户何时停止/暂停在 TextField 中写入 - SwiftUI

actionscript 2 碰撞检测

在 Actionscript 3 中拖动时检测鼠标离开阶段

ActionScript 3 AS3检测鼠标是否在舞台上方

检测文本何时进入TextFlow对象中ContainerController的结尾