惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - aierong

CommunityToolkit.Mvvm系列文章导航 CommunityToolkit.Mvvm8.1 IOC依赖注入控制反转(5) CommunityToolkit.Mvvm8.1 消息通知(4) CommunityToolkit.Mvvm8.1 viewmodel源生成器写法(3) - aierong wpf RelativeSource绑定 CommunityToolkit.Mvvm8.1 viewmodel使用-旧式写法(2) CommunityToolkit.Mvvm8.1 MVVM工具包安装引用指南(1) Jquery利用ajax调用asp.net webservice的各种数据类型(总结篇) 创建Windows服务(Windows Services)N种方式总结 .NET中对串口(COM)读写操作方式汇总 Sql Server2008 Transact-SQL 新兵器学习总结之-用户定义表类型和日期,时间数据类型 Air版免费视频成人聊天室,免费网络远程视频会议系统((Flex,Fms3联合打造))&lt;视频聊天,会议开发实例7&gt; Flex(flash)检测摄像头的3种状态(是否被占用,没安装摄像头,正常) - aierong - 博客园 Flex Air开发SQLite小结,SQLite开发工具及SQLite与Sql Server的语法差异汇总 开源Flex Air版免费激情美女视频聊天室,免费网络远程视频会议系统((Flex,Fms3联合打造))<视频聊天,会议开发实例6> - aierong 免费网络远程视频会议系统,免费美女多人视频聊天(附源码下载)(Flex和Fms3开发)&lt;视频聊天,会议开发实例5&gt; Flex组件的项目渲染器(ItemRenderer)使用总结 推荐几个Adobe Flex Builder 3的插件(代码格式化和fms服务器通讯文件(main.asc)编写) 免费美女视频聊天,多人视频会议功能加强版本(Fms3和Flex开发(附源码))&lt;视频聊天,会议开发实例4&gt;
Flex组件开发总结-20090209
aierong · 2009-02-09 · via 博客园 - aierong

在平时的Flex开发过程中遇到的问题以及解决办法总结如下:

1.如何监听键盘事件?

<mx:TextArea id="textEditor" keyDown="sendKeyHandler(event)"  x="11" y="366" width="399"/>

private function sendKeyHandler(evt:KeyboardEvent):void
{

//Enter 键

        if (evt.keyCode == 13)
        {
            this.sendTxt();

            return ;
        }

}

代码说明:有两种类型的键盘事件:KeyboardEvent.KEY_DOWNKeyboardEvent.KEY_UP

以上是监听的是回车事件

要是想监听组合键,例如:Ctrl+Enter 键,代码如下:

if (evt.keyCode == 13 && evt.ctrlKey)
{
}

2.怎么控制RichTextEditor的控制栏?

利用showControlBar属性,控制RichTextEditor的控制栏,这样把整个控制栏都关闭了

要是想分别控制控制栏中各寄宿控件,可以参考如下代码:

this.textEditor.alignButtons.height=0;
this.textEditor.alignButtons.visible=false;

this.textEditor.bulletButton.height=0;
this.textEditor.bulletButton.visible=false;

this.textEditor.linkTextInput.height=0;
this.textEditor.linkTextInput.visible=false;

this.textEditor._RichTextEditor_VRule1.height=0;
this.textEditor._RichTextEditor_VRule1.visible=false;

this.textEditor._RichTextEditor_VRule2.height=0;
this.textEditor._RichTextEditor_VRule2.visible=false;

当然,还可以参考这文章

http://blog.minidx.com/2008/12/29/1841.html

3.控件双击事件(DoubleClick Event)怎么没反应?

<mx:Button doubleClickEnabled="true" doubleClick="doubleClickHandler(event)" x="48" y="32" label="Button"/>

private function doubleClickHandler(evt:MouseEvent):void
{
    Alert.show("doubleClick");
}

代码说明:

doubleClickEnabled属性:指定对象是否接收 doubleClick 事件。默认值为 false,这意味着在默认情况下,不接收 doubleClick 事件。如果将 doubleClickEnabled 属性设置为 true,实例在其范围内接收 doubleClick 事件

4.怎么在TextArea的光标位置插入字符?

<mx:TextArea id="textEditor"  x="11" y="366" width="399"/>

private function insertString(insertStr:String):void
{
    if (this.textEditor.selectionBeginIndex == this.textEditor.selectionEndIndex)
    {
        var startPart:String=this.textEditor.text.substring(0, this.textEditor.selectionBeginIndex);
        var endPart:String=this.textEditor.text.substring(this.textEditor.selectionEndIndex, this.textEditor.text.length);
        startPart+=insertStr;
        startPart+=endPart;
        this.textEditor.text=startPart;
    }
    else
    {
        this.textEditor.text=insertStr;
    }
}

5.实现TextArea控件的滚动条始终保持在最下面?

this.txt_content.addEventListener(FlexEvent.VALUE_COMMIT,VALUE_COMMITHandler);
private function VALUE_COMMITHandler(evt:FlexEvent):void{
        txt_content.verticalScrollPosition = txt_content.maxVerticalScrollPosition;
}

代码说明:这段代码是为了实现TextArea控件的滚动条始终保持在最下面,以方便用户查看聊天信息

要是VBox控件需要实现类似效果,可以看如下代码:

<mx:VBox id="vd" updateComplete="updateCompleteHandler(event)" x="10" y="10" width="399" height="348">

private function updateCompleteHandler(evt:FlexEvent):void
{
    this.vd.verticalScrollPosition=this.vd.maxVerticalScrollPosition;
}

收藏与分享

收藏到QQ书签 添加到百度搜藏 添加到百度搜藏 添加到雅虎收藏 分享到饭否 收藏到就喜欢网络收藏夹

feedsky    http://wap.feedsky.com/aierongrss    E-mail
订阅到雅蛙       使用RSS邮天下订阅    订阅到有道阅读
订阅到抓虾    鲜果阅读器订阅图标    Add to Google
訂閱 Bloglines    哪吒提醒    Subscribe in NewsGator Online

东莞.net俱乐部

东莞.net俱乐部 欢迎您的加入