var tf:TextFlow;

var len:int = tf.numChildren;
for (var i:int = 0; i < len; i += 1)
{
  tf.removeChildAt(0);
}

tf.flowComposer.composeToPosition();
tf.flowComposer.updateAllControllers();

TypeError: Error #1009: 无法访问空对象引用的属性或方法。
 at flashx.textLayout.edit::ParaEdit$/insertText()       flashx\textLayout\edit\ParaEdit.as:54]
 at flashx.textLayout.operations::InsertTextOperation/doInternal()   flashx\textLayout\operations\InsertTextOperation.as:196]
 at flashx.textLayout.operations::InsertTextOperation/doOperation()   flashx\textLayout\operations\InsertTextOperation.as:223]
 at flashx.textLayout.edit::EditManager/doInternal()       flashx\textLayout\edit\EditManager.as:723]
 at flashx.textLayout.edit::EditManager/doOperation()      flashx\textLayout\edit\EditManager.as:603]
 at flashx.textLayout.edit::EditManager/flushPendingOperations()    flashx\textLayout\edit\EditManager.as:873]
 at flashx.textLayout.compose::StandardFlowComposer/updateToController()  flashx\textLayout\compose\StandardFlowComposer.as:554]
 at flashx.textLayout.compose::StandardFlowComposer/updateAllControllers() flashx\textLayout\compose\StandardFlowComposer.as:517]

tf.interactionManager.selectRange(tf.textLength, tf.textLength);

TypeError: Error #1009: 无法访问空对象引用的属性或方法。
 at flashx.textLayout.edit::ParaEdit$/insertText()       flashx\textLayout\edit\ParaEdit.as:54]
 at flashx.textLayout.operations::InsertTextOperation/doInternal()   flashx\textLayout\operations\InsertTextOperation.as:196]
 at flashx.textLayout.operations::InsertTextOperation/doOperation()   flashx\textLayout\operations\InsertTextOperation.as:223]
 at flashx.textLayout.edit::EditManager/doInternal()       flashx\textLayout\edit\EditManager.as:723]
 at flashx.textLayout.edit::EditManager/doOperation()      flashx\textLayout\edit\EditManager.as:603]
 at flashx.textLayout.edit::EditManager/flushPendingOperations()    flashx\textLayout\edit\EditManager.as:873]
 at flashx.textLayout.compose::StandardFlowComposer/internalCompose()  flashx\textLayout\compose\StandardFlowComposer.as:711]
 at flashx.textLayout.compose::StandardFlowComposer/composeToPosition()  flashx\textLayout\compose\StandardFlowComposer.as:837]

报错在ParaEdit.as,sibling为null
   var sibling:FlowElement = textFlow.findLeaf(absoluteStart);
   var siblingIndex:int;
   var paragraph:ParagraphElement = sibling.getParagraph();

问题貌似是因为EditManager.as里insertText方法中的Event.ENTER_FRAME,这个下一帧处理好像会导致快速输入删除时候的不同步
    if (captureLevel == 0 && origOperationState == null && controller && controller.container && allowDelayedOperations)
    {
     enterFrameListener = controller.container;
     enterFrameListener.addEventListener(Event.ENTER_FRAME, enterFrameHandler, false, 1.0, true);
    }
    else
     flushPendingOperations();

我的解决方法是同步处理 不让他下一帧处理 设置 EditManager(tf.interactionManager).allowDelayedOperations = false;

问题解决 具体为什么 还不是很清楚,先这么用着吧,如果有大神知道,希望可以交流

textLayout在快速输入清除时报错解决方法的更多相关文章

  1. mysql truncate带有被引用外键的表时报错解决方法

    清空具有外键约束的表时报ERROR 1701(42000)的解决   mysql> truncate table t_users;ERROR 1701 (42000): Cannot trunc ...

  2. rebuild online时意外中断 再次重建时报错解决方法

    rebuild online时意外中断 再次重建时报错 SQL> alter index PARTY.IDX_CM_INDIV_CUSTOMER_4 rebuild online; alter ...

  3. 安装redis 执行make命令时报错解决方法

    一.未安装GCC 解决方法:执行yum install gcc-c++命令安装GCC,完成后再次执行make命令 yum install gcc-c++ Linux无法连接网络 http://www. ...

  4. XML节点名称中有小数点处理(deal with dot)导致使用xpath时报错解决方法

    <?xml version="1.0"?> <ModifyFiles> <_Layout.cshtml>123456</_Layout.c ...

  5. python运用中文注释时报错解决方法

    写了一段简单的代码,不知 为什么总是报错,后来上网查了一下才知道原因,当用中文进行注释时需要添加如下代码:# coding=utf-8          (注意:该段代码必须放在最前面才能有用,并且 ...

  6. react创建项目后运行npm run eject命令将配置文件暴露出来时报错解决方法

    最近在用create-react-app创建项目,因要配置各种组件,比如babel,antd等, 需要运行npm run eject命令把项目的配置文件暴露出来,但是还是一如既然碰到报错,因为是在本地 ...

  7. 解决loadrunner在脚本回放时长时间等待及在vugen中create controller scenario时报错的方法!超管用!!

    解决loadrunner在脚本回放时长时间等待及在vugen中create controller scenario时报错的方法 经过咨询,有两种方法.经过实践,下面的方法1有效,方法2无效(我下载安装 ...

  8. asp.net MVC webservice 报次错解决方法

    asp.net  MVC  webservice  报次错解决方法: 解决方法: 在 RouteConfig.cs public static void RegisterRoutes(RouteCol ...

  9. redhat linux enterprise 5 输入ifconfig无效的解决方法

    redhat linux enterprise 5 输入ifconfig无效的解决方法   在安装完成linux后,进入终端,输入命令行ifconfig,会提示bash: ifconfig: comm ...

随机推荐

  1. ORA-01078, LRM-00123错误处理

    创建spfile时, 或者在nomount时, 出现下面的问题: SQL> create spfile from pfile; create spfile from pfile * ERROR ...

  2. 3.x的触摸响应机制

    第一种是采用函数回调,主要是用于MenuItem [cpp] view plaincopy // a selector callback void menuCloseCallback(Object*  ...

  3. 【STL学习】map&set

    技术不只是我的工作,也是我的生活,以后的博客中会穿插一些个人的喜悦.愤怒或者感悟,希望大家能够接受. 我所有的一切,比我技术更好的怕是我的脸皮了,昨天收到京东面试没有通过的消息,喊了几句“我好悲伤啊” ...

  4. android studio 真机调试

    1.使用usb连接电脑,打开开发者选项,打开usb调试. 2.不能使用仅充电,修改为媒体设备(MTP) 3.如果无法连接可以使用豌豆荚或者金山手机助手连接. 4.运行android程序即可. 5.如果 ...

  5. 成员方法与const之间的关系

    const可以放在成员方法的三个地方,前.中.后. 首先考虑在中间: 1.const修饰形参,表示形参是否为const 2.如果const修饰引用(指针指向的对象),可以进行过载,如果不是修饰引用(指 ...

  6. HDU 5478 Can you find it 随机化 数学

    Can you find it Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pi ...

  7. MmSystem播放Wav格式声音

    //MmSystem播放Wav格式声音 //MmSystem 支持 *.wav声音格式 snd ->SoundRecorderuses MmSystem; //引用MmSystem//播放系统声 ...

  8. Custom-Progress-Dialog-Android

    https://github.com/ManolescuSebastian/Custom-Progress-Dialog-Android

  9. 教你如何选择Android游戏引擎

    我们进行Android游戏开发时选择游戏引擎是必须的,但是该如何选择呢?哪个Android游戏引擎更加适合自己呢?本文就提供了三个游戏引擎的对比说明,阐述了它们各自的特点,为大家选择引擎提供了参照. ...

  10. Timus 1446. Sorting Hat 分类问题

    At the start of each school year, a very important event happens at Hogwarts. Each of the first-year ...