IconFunction and Labelfunction have been supplemented by the "LabelFunction and Iconction functions" on the jiagao's blog. I remembered the following experiment:
MyList.dataProvider = [{Label: "Lifelight", Data: {FileName: "MyPhoto1", FileExtension: "JPG"}}, {Label: "Learning Notes", Data: {FILENAME: "MyDocument2", FileExtension: " Doc "}}, {Label:" Product Photo ", Data: {FileName:" MyPhoto2 ", FileExtension:" GIF "}}, {Label:" Temporary text ", Data: {FileName:" MyDocument1 ", FileExtension:" TXT"}}];
MyList.Labelfunction = function (item) {
Return (item.label "(" item.data.filenaMe "." ")") ")")
}
mylist.iconfunction = function (item) {
Var type = item.data.fileextension;
IF (Type == "JPG" || Type == "GIF") {
Return "Pictureicon";
} else if (Type == "DOC" || Type == "txt") {
Return "Docicon";
}
}
iConFunction is a method of scrollselectlist, so Tree and DataGrid of subclass of ScrollSelectList's subclasses of ScrollSelectList should also be the same as the same method (Menu method is not in the Flash Help, the clouds let me see MM The class of V2 is really useful.)
Labelfunction has many components that can be used, such as List, Menu, Tree, DataGrid, DataGridColumn, MenuBar, ComboBox, and their subclasses. (There is no Menu's mention in the Flash Help, LabelFunction Method)
Everyone can follow the code below
Var mymdp = new xml ();
Var newItem = mymdp.addMenuItem ({Label: "new"});
NewItem.com ({Label: "File ..."});
NewItem.addMenuItem ({Label: "Project ..."});
NewItem.com ({Label: "resource ..."});
Mymdp.addMenuItem ({Label: "Open", InstanceName: "miopen"});
Mymdp.addMenuItem ({Label: "Save", InstanceName: "Misave"});
Mymdp.addMenuItem ({Type: "separator"});
Mymdp.addMenuItem ({Label: "quit", InstanceName: "miquit"}); var mymenu = mx.controls.Menu.createMenu (MyParentClip, mymdp);
//
mymenu.iconfunction = function (item) {
Switch (item.attributes.label) {
Case "new":
Case "File ...":
Case "Save":
Return "Docicon";
Break;
DEFAULT:
Return "Pictureicon";
Break;
}
}
Mymenu.show (250, 10);