Get the App
SLTechnology News&Howtos  ›  Development  › 

Example Analysis of Flex component Development

Shulou Source: shulou.com Published: 2022-06-02 07:59:21 09月26日 Update

This article mainly introduces the example analysis of Flex component development, which is very detailed and has certain reference value. Friends who are interested must finish it!

Summary of Flex component development

The problems encountered in the usual Flex development process and the solutions are summarized as follows:

1. How do I monitor keyboard events?

PrivatefunctionsendKeyHandler (evt:KeyboardEvent): void {/ / enter if (evt.keyCode==13) {this.sendTxt (); return;}}

Code description: there are two types of keyboard events: KeyboardEvent.KEY_DOWN and KeyboardEvent.KEY_UP

The above is listening to the carriage return incident.

If you want to listen for key combinations, such as Ctrl+ enter, the code is as follows:

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

How to control the control bar of RichTextEditor in 2.Flex development?

Use the showControlBar property to control the control bar of the RichTextEditor, so that the entire control bar is closed

If you want to control each hosted control in the control bar separately, you can refer to the following code:

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

Of course, you can also refer to this article.

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

Why didn't you respond to the control double-click event (DoubleClickEvent) in 3.Flex development?

PrivatefunctiondoubleClickHandler (evt:MouseEvent): void {Alert.show ("doubleClick");}

Code description:

The doubleClickEnabled property: specifies whether the object receives the doubleClick event. The default value is false, which means that doubleClick events are not received by default. If the doubleClickEnabled property is set to true, the instance receives the doubleClick event within its scope

How to insert characters in the cursor position of TextArea in 4.Flex development?

PrivatefunctioninsertString (insertStr:String): void {if (this.textEditor.selectionBeginIndex==this.textEditor.selectionEndIndex) {varstartPart:String=this.textEditor.text.substring (0Magnethis.textEditor.selectionBeginIndex); varendPart: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;}}

How to keep the scroll bar of the TextArea control at the bottom in 5.Flex development?

This.txt_content.addEventListener (FlexEvent.VALUE_COMMIT,VALUE_COMMITHandler); privatefunctionVALUE_COMMITHandler (evt:FlexEvent): void {txt_contenttxt_content.verticalScrollPosition=txt_content.maxVerticalScrollPosition;}

Code description: this code is to achieve the TextArea control scroll bar is always kept at the bottom, in order to facilitate users to view chat information

If the VBox control needs to achieve a similar effect, you can look at the following code:

PrivatefunctionupdateCompleteHandler (evt:FlexEvent): void {thisthis.vd.verticalScrollPosition=this.vd.maxVerticalScrollPosition;} above is all the content of the article "sample Analysis of Flex component Development". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Development events code controls controls components properties if reference monitoring examples analysis content articles keyboards values locations information cursors interests Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Redmi MariaDB macOS Apple