List Component's Rows and Icons
Okay. So with this tutorial, you can make your List Component's every second row to be grey, and other ones white.
Drag new List Component from Library panel, and give it an instance name, 'myList'.
Then just copy and paste this into Actionscript panel.
So it wasn't so hard...?
Okay, and next thing is adding new colors, for your grey listIcon.
So create new Movieclip and draw rectangle, size: 14x, 14y.
Select your listIcon from your Library, right click on your mouse and select Linkage. There you have to select 'Export in First Frame' and 'Export for Actionscript'. And give it new identifier, 'listIcon'.
And keep it in Library. then go inside of it, and create new Layer, and write this into Actionscript panel.
So it's simple code too ;)
Then we just attach them into our List Component's rows. and labels of course. So get back to Scene1 and select your Actions layer and write this into Actionscript panel.
So now we just created labels, and listIcons colors on there. But next we attach our listIcons into List component with following code.
I hope you understood everything, and if you didn't ask us in here. Or PM me ;) Hope you enjoy so you don't have to create so many listIcons if you want them to be different colors.
Drag new List Component from Library panel, and give it an instance name, 'myList'.
Then just copy and paste this into Actionscript panel.
- Code: Select all
myList.setStyle("alternatingRowColors", [0xFFFFFF, 0xEAEAEA]);
So it wasn't so hard...?
Okay, and next thing is adding new colors, for your grey listIcon.
So create new Movieclip and draw rectangle, size: 14x, 14y.
Select your listIcon from your Library, right click on your mouse and select Linkage. There you have to select 'Export in First Frame' and 'Export for Actionscript'. And give it new identifier, 'listIcon'.
And keep it in Library. then go inside of it, and create new Layer, and write this into Actionscript panel.
- Code: Select all
var categoryColour = this._parent.item.colour;
colour = new Color(this);
colour.setRGB(categoryColour);
So it's simple code too ;)
Then we just attach them into our List Component's rows. and labels of course. So get back to Scene1 and select your Actions layer and write this into Actionscript panel.
- Code: Select all
myList.addItem({label:"Mable", data:1, colour:0x009966});
myList.addItem({label:"Terry", data:2, colour:0xFF3300});
myList.addItem({label:"Saren", data:3, colour:0xEDF176});
myList.addItem({label:"Stead", data:4, colour:0x90C2E9});
myList.addItem({label:"Trent", data:5, colour:0xFF9900});
myList.addItem({label:"Fondue", data:6, colour:0xBCF247});
myList.addItem({label:"Glint", data:7, colour:0xDDF247});
myList.addItem({label:"Rabbit", data:8, colour:0xBC0047});
myList.addItem({label:"Mavis", data:9, colour:0xCCE347});
So now we just created labels, and listIcons colors on there. But next we attach our listIcons into List component with following code.
- Code: Select all
myList.defaultIcon = "listIcon";
I hope you understood everything, and if you didn't ask us in here. Or PM me ;) Hope you enjoy so you don't have to create so many listIcons if you want them to be different colors.