zoukankan
html css js c++ java
FLEX光标定位和插入文本
因为目前的FLEX的RichTextEditor不支持图文混编,所以,只能自己动手了,实现最核心的部分,光标定位插入文本。
Code
1
<?
xml version="1.0" encoding="utf-8"?gt;
2
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"gt;
3
<mx:Script>
4
<![CDATA[
5
6
[Bindable]
7
private var textAreaString:String = "textAreaString";
8
[Bindable]
9
private var insertString:String = "|insert|";
10
11
private function insertHandler():void {
12
if (textArea.selectionBeginIndex == textArea.selectionEndIndex) {
13
var startPart:String = textAreaString.substring(0,textArea.selectionBeginIndex);
14
var endPart:String = textAreaString.substring(textArea.selectionEndIndex,textAreaString.length);
15
startPart+=insertString;
16
startPart+=endPart;
17
textAreaString = startPart;
18
}
19
}
20
21
private function changeInsertHandler():void {
22
insertString = insertInput.text;
23
}
24
]]>
25
</mx:Script>
26
<mx:TextArea id="textArea" x="10" y="21" width="298" height="158" text="{textAreaString}"/gt;
27
<mx:Button x="316" y="20" label="Insert" click="insertHandler();"/gt;
28
<mx:TextInput id="insertInput" x="316" y="50" text="{insertString}" change="changeInsertHandler();"/gt;
29
</mx:Application>
30
查看全文
相关阅读:
.net core系列之《.net平台历程介绍以及.net framework和.net core对比》
C++ 拷贝构造函数
C++ const引用
C++ 引用和指针
C++ 将派生类赋值给基类(向上转型)
C++ 虚继承
C++ 基类和派生类的构造函数以及析构函数
C++ 类继承时的作用域嵌套和对象内存模型
C++ private + protected + public
C++ const成员变量、成员函数和对象
原文地址:https://www.cnblogs.com/zack/p/1434500.html
最新文章
Map接口
Vue.js 表单控件绑定 v-model
适配器模式
Template模板模式
策略模式
使用Java API 操作ElasticSearch
ElasticSearch分片详解
ElasticSearch节点类型描述
ElasticSearch集群搭建
ElasticSearch基本命令
热门文章
解决win7下的host文件不起作用
.net core系列之《.net core中使用MySql以及Dapper》
Ubuntu-18.04下安装mysql
.net core系列之《.net core中使用集成IDistributedCache接口的Redis和MongoDB实现分布式缓存》
.net core系列之《在.net core中使用MemoryCache实现本地缓存》
.net core系列之《对AOP思想的理解及使用AspectCore实现自定义日志拦截》
.net core系列之《.net core内置IOC容器ServiceCollection》
.net core系列之《从源码对Configuration的底层运行机制进行分析》
.net core系列之《新一代的配置系统Configuration在支持多数据源,热更新,层级化方面代码快速实践》
.net core系列之《sdk和runtime区别及使用CLI在Ubuntu上快速搭建Console,WebApi,MVC三大应用模型》
Copyright © 2011-2022 走看看