Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the solutions to common problems in Flex component development?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Flex component development solutions to common problems, many novices are not very clear, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

Summary of Flex component development

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 when developing 2.Flex components?

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) when developing 3.Flex components?

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 do I insert characters in the cursor position of TextArea when developing 4.Flex components?

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;}}

5. The scroll bar that implements the TextArea control is always kept at the bottom?

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): is it helpful for void {thisthis.vd.verticalScrollPosition=this.vd.maxVerticalScrollPosition;} to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report