Saturday, September 20, 2008

Playing with ASCII values in Actionscript 3 - Part 1
Agenda: Populate combo box with drive letters from A to Z.

 var i:int=0;
for(i=65; i<65+26; i++)
{   
atoz.addItem(String.fromCharCode(i)+":");
}
driveListCombo.dataProvider = atoz;


Done, my combo box is populated with drive letters from A to Z.
Now, to convert a character to its ASCII value use charCodeAt() function of String. You can use it like below:
var selectedDrive:String = "C";
//Now, to get ASCII value for "C"
selectedDrive.charCodeAt(0);


Will update once I get more clarity on performing ASCII operations.

Please provide your valuable comments.