Flex special character escape

Source: Internet
Author: User

Many flex applications add the "" symbol at the bottom, and some special characters are required in many cases. However, it does not seem to work normally if "& copy;" is used simply. The following example lists the numerical encoding of most special characters, which can be conveniently used in flex. In the demo, double-click a row in the DataGrid to display the character and number encoding below and copy the data directly.

Let's take a look at the demo (You can right-click View Source or click here to viewSource code):

 

Below is the completeCode(Or click here to view details ):

Download: Main. mxml
  1. <?XML Version="1.0" Encoding="UTF-8"?>
  2. <MX: Application Xmlns: MX="Http://www.adobe.com/2006/mxml"
  3. Layout="Vertical"
  4. Verticalalign="Middle"
  5. Backgroundcolor="White"
  6. Creationcomplete="Init ()">
  7.  
  8. <MX: script>
  9. <! [CDATA [
  10. Import MX. Collections. arraycollection;
  11.  
  12. [Bindable]
  13. Private var charcodes: arraycollection;
  14.  
  15. Private function Init (): void {
  16. Charcodes = new arraycollection ();
  17. VaR I: int;
  18. For (I = slider. Values [0]; I <= slider. Values [1]; I ++ ){
  19. Charcodes. additem ({charcodenum: I, charcodevalue: "& #" + formatstring (I) + ";", charcodestr: String. fromcharcode (I )});
  20. }
  21. }
  22.  
  23. Private function formatstring (STR: object, minlength: Int = 4): String {
  24. Return ("000000000" + Str. tostring (). substr (-minlength );
  25. }
  26. ]>
  27. </MX: script>
  28.  
  29. <MX: vbox>
  30. mx: DataGrid id = " DataGrid " dataprovider = " { charcodes} " width = " 300 " >
  31. <MX: Columns>
  32. <MX: datagridcolumn Datafield="Charcodestr" />
  33. <MX: datagridcolumn Datafield="Charcodevalue" />
  34. </MX: Columns>
  35. </MX: DataGrid>
  36.  
  37. <MX: hbox Width="100%">
  38. < MX: hslider   ID = " Slider " Minimum = " 32 " Maximum = " 512 " Thumbcount = " 2 " Values = " [0,512] " Livedragging = " True " Snapinterval = " 1 " Tickinterval = " 32 " Datatipprecision = " 0 " Change = " Init () " />
  39. <MX: Label Text="'{DataGrid. selecteditem. charcodestr}' = {DataGrid. selecteditem. charcodevalue}" Selectable="True" />
  40. </MX: hbox>
  41. </MX: vbox>
  42.  
  43. <MX: Label Text="& #169; {new date (). fullyear} flex examples" />
  44.  
  45. </MX: Application>

Address: http://blog.minidx.com/2008/07/06/1048.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.