Prev | Current Page 780 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

getContent(???colors.txt???);
var q = new Array();
for(line in c.split(???\n???))
{
var p = line.split(???|???);
q.push({ name : StringTools.trim(p[0]), hex : StringTools.trim(p[1]) });
}
return q;
}
}
The file with the color definitions contains one description per line with the name of the color and its hex
value separated by a pipe character ( | ). To find a list of valid colors, just make a search on your preferred
search engine using the keywords css color names .
420
Part II: Server Side, JavaScript, and Flash: Oh My!
The client main script just instantiates an object of type RemoteColorSelector . The class takes as an
argument the id value of the placeholder element on the page.
class Main
{
public static function main()
{
new RemoteColorSelector(???colorinput???);
}
}
The class constructor creates the container for the list of filtered colors, known in the code as tags , and the
color sample area. The input control is enhanced with a key - up event. Each time the control has the focus
and the keyboard is used, the update() method checks if a new list must be loaded, refreshes the list of
visible tags and eventually the selected color.


Pages:
768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792