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
查看全文
相关阅读:
win7颜色反转
全框眼镜拆卸镜片方法分享
自定义锁屏图片 win7
保存chrome主题背景的图片
广域网设计
网络方案设计
电脑不能上网win7 解决办法
局域网设计
以太网安全技术ACL原理+配置
协议无关组播--稀疏模式 PIM-SM
原文地址:https://www.cnblogs.com/zack/p/1434500.html
最新文章
django之中间件
分页
agc032
agc031
LOJ#2722 情报中心
洛谷P4769 冒泡排序
12省联考2019口胡
用lemon测交互题
LOJ#6041 事情的相似度
大厨砍树
热门文章
洛谷P2824 排序
CF集萃1
有意思的代码片段
构造函数挨个过 —— String()
JavaScript的this指针到底指向哪?
JavaScript 数据类型小结
回到HTML〇
学Git,用Git ③
学Git,用Git ②
学Git,用Git ①
Copyright © 2011-2022 走看看