自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

Flex組件開發(fā)總結(jié)

開發(fā) 后端
本文向大家簡單介紹一下在平時(shí)的Flex開發(fā)過程中遇到的問題以及解決辦法總結(jié),希望本文的介紹能讓你有所收獲,歡迎大家一起來學(xué)習(xí)。

Flex組件開發(fā)有很多值得學(xué)習(xí)的地方,本文向大家介紹一下在平時(shí)的Flex開發(fā)過程中遇到的問題以及解決辦法總結(jié),相信通過本文的介紹你對Flex開發(fā)過程中遇到問題有一定的認(rèn)識(shí)。

Flex組件開發(fā)總結(jié)

在平時(shí)的Flex開發(fā)過程中遇到的問題以及解決辦法總結(jié)如下:

1.如何監(jiān)聽鍵盤事件?

  1. <mx:TextAreaidmx:TextAreaid="textEditor"keyDown="sendKeyHandler(event)"x="11"y="366"width="399"/> 
  2.  
  3. privatefunctionsendKeyHandler(evt:KeyboardEvent):void  
  4. {  
  5.  
  6. //Enter鍵  
  7.  
  8. if(evt.keyCode==13)  
  9. {  
  10. this.sendTxt();  
  11.  
  12. return;  
  13. }  
  14.  
  15. }  

代碼說明:有兩種類型的鍵盤事件:KeyboardEvent.KEY_DOWN和KeyboardEvent.KEY_UP

以上是監(jiān)聽的是回車事件

要是想監(jiān)聽組合鍵,例如:Ctrl+Enter鍵,代碼如下:

  1. if(evt.keyCode==13&&evt.ctrlKey)  
  2. {  

2.Flex開發(fā)中怎么控制RichTextEditor的控制欄?

利用showControlBar屬性,控制RichTextEditor的控制欄,這樣把整個(gè)控制欄都關(guān)閉了

要是想分別控制控制欄中各寄宿控件,可以參考如下代碼:

  1. this.textEditor.alignButtons.height=0;  
  2. this.textEditor.alignButtons.visible=false;  
  3.  
  4. this.textEditor.bulletButton.height=0;  
  5. this.textEditor.bulletButton.visible=false;  
  6.  
  7. this.textEditor.linkTextInput.height=0;  
  8. this.textEditor.linkTextInput.visible=false;  
  9.  
  10. this.textEditor._RichTextEditor_VRule1.height=0;  
  11. this.textEditor._RichTextEditor_VRule1.visible=false;  
  12.  
  13. this.textEditor._RichTextEditor_VRule2.height=0;  
  14. this.textEditor._RichTextEditor_VRule2.visible=false;  
  15.  

 當(dāng)然,還可以參考這文章

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

3.Flex開發(fā)中控件雙擊事件(DoubleClickEvent)怎么沒反應(yīng)?

  1. <mx:ButtondoubleClickEnabledmx:ButtondoubleClickEnabled="true"doubleClick="doubleClickHandler(event)"x="48"y="32"label="Button"/> 
  2.  
  3. privatefunctiondoubleClickHandler(evt:MouseEvent):void  
  4. {  
  5. Alert.show("doubleClick");  
  6. }  
  7.  

 代碼說明:

doubleClickEnabled屬性:指定對象是否接收doubleClick事件。默認(rèn)值為false,這意味著在默認(rèn)情況下,不接收doubleClick事件。如果將doubleClickEnabled屬性設(shè)置為true,實(shí)例在其范圍內(nèi)接收doubleClick事件

4.Flex開發(fā)中怎么在TextArea的光標(biāo)位置插入字符? 

  1. <mx:TextAreaidmx:TextAreaid="textEditor"x="11"y="366"width="399"/> 
  2.  
  3. privatefunctioninsertString(insertStr:String):void  
  4. {  
  5. if(this.textEditor.selectionBeginIndex==this.textEditor.selectionEndIndex)  
  6. {  
  7. varstartPart:String=this.textEditor.text.substring(0,this.textEditor.selectionBeginIndex);  
  8. varendPart:String=this.textEditor.text.substring(this.textEditor.selectionEndIndex,this.textEditor.text.length);  
  9. startPart+=insertStr;  
  10. startPart+=endPart;  
  11. this.textEditor.text=startPart;  
  12. }  
  13. else  
  14. {  
  15. this.textEditor.text=insertStr;  
  16. }  
  17. }  

 5.Flex開發(fā)中如何實(shí)現(xiàn)TextArea控件的滾動(dòng)條始終保持在最下面?

  1. this.txt_content.addEventListener(FlexEvent.VALUE_COMMIT,VALUE_COMMITHandler);  
  2. privatefunctionVALUE_COMMITHandler(evt:FlexEvent):void{  
  3. txt_contenttxt_content.verticalScrollPosition=txt_content.maxVerticalScrollPosition;  

代碼說明:這段代碼是為了實(shí)現(xiàn)TextArea控件的滾動(dòng)條始終保持在最下面,以方便用戶查看聊天信息

要是VBox控件需要實(shí)現(xiàn)類似效果,可以看如下代碼:

  1. <mx:VBoxidmx:VBoxid="vd"updateComplete="updateCompleteHandler(event)"x="10"y="10"width="399"height="348"> 
  2.  
  3. privatefunctionupdateCompleteHandler(evt:FlexEvent):void  
  4. {  
  5. thisthis.vd.verticalScrollPosition=this.vd.maxVerticalScrollPosition;  
  6. }  

【編輯推薦】

  1. Flex開發(fā)者需要知道的10件事
  2. Flex安全沙箱問題解決方法
  3. 技術(shù)前沿 看Flex客戶端緩存技術(shù)如何使用
  4. 解析Flex全屏模式設(shè)置方法
  5. Flex內(nèi)存泄露解決方法和內(nèi)存釋放優(yōu)化原則

 

責(zé)任編輯:佚名 來源: csdn.net
相關(guān)推薦

2010-08-12 13:39:46

Flex組件

2010-07-30 13:52:17

Flex組件

2010-08-05 10:58:55

Flex組件

2010-08-04 14:44:33

Flex圖表

2010-08-12 13:34:13

Flex驗(yàn)證組件

2010-08-13 09:21:12

FlexButton組件

2009-07-03 08:58:22

Flex教程Flex程序

2010-07-28 12:58:24

Flex DateCh

2009-08-20 10:12:59

Flex Alert組

2010-08-13 13:14:09

Flex圖表

2010-08-09 15:30:00

Flex字體

2010-08-13 09:11:11

LabelFlex

2010-08-04 10:20:30

Flex組件開發(fā)

2010-07-28 12:52:39

Flex組件

2010-07-27 10:39:25

Flex組件

2010-08-04 15:37:31

Flex圖表

2010-07-28 12:41:18

Flex組件

2010-08-05 10:08:06

Flex效果

2010-08-05 10:16:14

Flex效果

2010-07-27 13:53:15

Flex ComboB
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號