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
- <?XML Version="1.0" Encoding="UTF-8"?>
-
- <MX: Application Xmlns: MX="Http://www.adobe.com/2006/mxml"
- Layout="Vertical"
-
- Verticalalign="Middle"
-
- Backgroundcolor="White"
- Creationcomplete="Init ()">
-
-
-
- <MX: script>
-
- <! [CDATA [
-
- Import MX. Collections. arraycollection;
-
-
- [Bindable]
-
- Private var charcodes: arraycollection;
-
-
-
- Private function Init (): void {
-
- Charcodes = new arraycollection ();
-
- VaR I: int;
-
- For (I = slider. Values [0]; I <= slider. Values [1]; I ++ ){
- Charcodes. additem ({charcodenum: I, charcodevalue: "& #" + formatstring (I) + ";", charcodestr: String. fromcharcode (I )});
-
- }
-
- }
-
-
-
- Private function formatstring (STR: object, minlength: Int = 4): String {
-
- Return ("000000000" + Str. tostring (). substr (-minlength );
-
- }
- ]>
-
- </MX: script>
-
-
-
- <MX: vbox>
- mx: DataGrid id = " DataGrid " dataprovider = " { charcodes} " width = " 300 " >
- <MX: Columns>
-
- <MX: datagridcolumn Datafield="Charcodestr" />
- <MX: datagridcolumn Datafield="Charcodevalue" />
-
- </MX: Columns>
-
- </MX: DataGrid>
-
-
- <MX: hbox Width="100%">
- < MX: hslider ID = " Slider " Minimum = " 32 " Maximum = " 512 " Thumbcount = " 2 " Values = " [0,512] " Livedragging = " True " Snapinterval = " 1 " Tickinterval = " 32 " Datatipprecision = " 0 " Change = " Init () " />
-
- <MX: Label Text="'{DataGrid. selecteditem. charcodestr}' = {DataGrid. selecteditem. charcodevalue}" Selectable="True" />
- </MX: hbox>
-
- </MX: vbox>
-
-
-
- <MX: Label Text="& #169; {new date (). fullyear} flex examples" />
-
-
- </MX: Application>
Address: http://blog.minidx.com/2008/07/06/1048.html