专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > Flex

百思不得骑姐,该怎么解决

发布时间:2011-06-27 19:23:35 文章来源:www.iduyao.cn 采编人员:星星草
百思不得骑姐
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal" fontSize="12">
<mx:Script>
<![CDATA[
//导入类库
import mx.events.FlexEvent;
import mx.controls.TextArea;
import mx.controls.RichTextEditor;
import mx.controls.TextInput;
//定义最大输入字数
private const MAX_CHARS:uint = 100;
private function richTextEditor_creationComplete(evt:FlexEvent):void
{
RichTextEditor(evt.currentTarget).textArea.maxChars= MAX_CHARS;
}
//显示当前输入字数和最大字数
private function richTextEditor_change(evt:FlexEvent):void
{
var rte:RichTextEditor = evt.currentTarget as RichTextEditor;
var rteTA:TextArea = rte.textArea as TextArea;
rte.status = rteTA.length + "/" + rteTA.maxChars;
}
//设置工具栏内超级链接输入框的显示与隐藏
private function toggle_linkTextInput():void
{
var textInput:TextInput = richTextEditor.linkTextInput;
var isSelected:Boolean  = cbLinkButton.selected;
textInput.visible = isSelected;
textInput.includeInLayout = isSelected;
}
]]>
</mx:Script>
<mx:Array id="fontFamilyArr">
<mx:String>Arial</mx:String>
<mx:String>Verdana</mx:String>
<mx:String>黑体</mx:String>
<mx:String>楷体</mx:String>
<mx:String>宋体</mx:String>
<mx:String>微软雅黑</mx:String>
</mx:Array>
<mx:Panel width="650" height="400" layout="absolute" title="文本编辑器">
<mx:VBox width="100%" height="100%">
<mx:ApplicationControlBar width="100%" dock="true">
<mx:CheckBox label="显示工具栏" id="cbBar" selected="true"/>
<mx:CheckBox label="显示超级连接按钮" id="cbLinkButton" selected="true" click="toggle_linkTextInput();"/>
</mx:ApplicationControlBar>
<mx:RichTextEditor title="请输入任意文字,并修改格式。" width="100%" height="100%" id="richTextEditor" showToolTips="true"
fontFamilyToolTip="字体" colorPickerToolTip="颜色"
showControlBar="{cbBar.selected}"
change="richTextEditor_change(event);"
creationComplete="richTextEditor_creationComplete(event);"
fontFamilyArray="{fontFamilyArr}">
</mx:RichTextEditor>
</mx:VBox>
</mx:Panel>
</mx:Application>
=======红色行报:1118: 属于 static 类型 flash.events:Event 的值的隐式强制指令的目标可能是非相关类型 mx.events:FlexEvent。错误,神马意思?
------解决方案--------------------
private function richTextEditor_change(evt:Event):void
{
var rte:RichTextEditor = evt.currentTarget as RichTextEditor;
var rteTA:TextArea = rte.textArea as TextArea;
rte.status = rteTA.length + "/" + rteTA.maxChars;
}
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: