Tuesday, October 4, 2011

Air: getting current user name

well , for this you can use following technique:
1)File path to user directory [in windows user director name = user name]
2) parse the path to get user name [last string has user name ie: c:\..\..\username]

Implementation:

 var userFolder:String = File.userDirectory.nativePath;
 var userName:String = userFolder.substr(userFolder.lastIndexOf(File.separator) + 1);

No comments:

Post a Comment