Skip to content

Instantly share code, notes, and snippets.

@tonylukasavage
Created July 26, 2011 20:08
Show Gist options
  • Save tonylukasavage/1107869 to your computer and use it in GitHub Desktop.
Save tonylukasavage/1107869 to your computer and use it in GitHub Desktop.
Unsexy scroll position hackery
// fontList == s:List
// arrList == s:ArrayList for enumerated fonts
fontList.selectedIndex = -1;
for (var i:uint = 0; i < arrList.length; i++) {
if (arrList.getItemAt(i).fontName == FONT_NAME_TO_MATCH) {
fontList.selectedIndex = i;
fontList.layout.verticalScrollPosition = fontList.dataGroup.contentHeight * (i/(arrList.length-1)) - (fontList.height/2) + 8;
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment