midimid
01-05-2009, 09:53 PM
Almost every AIR article covering loading HTML into the HTMLLoader class includes placing horizontal and vertical ScrollBar instances along the border.
What's bizarre is after loading the HTML (via .load() or .loadString()) and being sure to update the scrollbars afterwards, the thumb for the scrollbar is almost always very very small when compared to the amount of content in the window.
Anyone else run into this?
Here;s my update scroll bars function if it helps at all ("browser" is the HTMLLoader instance):
private function updateScrollBars():void {
if (browser.contentHeight > browser.height) {
vScrollbar.enabled = true;
vScrollbar.visible = true;
vScrollbar.minScrollPosition = 0;
vScrollbar.maxScrollPosition =browser.contentHeight - browser.height;
} else {
vScrollbar.enabled = false;
vScrollbar.visible = false;
}
if (browser.contentWidth > browser.width) {
hScrollbar.enabled = true;
hScrollbar.visible = true;
hScrollbar.minScrollPosition = 0;
hScrollbar.maxScrollPosition = browser.contentWidth - browser.width;
} else {
hScrollbar.enabled = false;
hScrollbar.visible = false;
}
}
What's bizarre is after loading the HTML (via .load() or .loadString()) and being sure to update the scrollbars afterwards, the thumb for the scrollbar is almost always very very small when compared to the amount of content in the window.
Anyone else run into this?
Here;s my update scroll bars function if it helps at all ("browser" is the HTMLLoader instance):
private function updateScrollBars():void {
if (browser.contentHeight > browser.height) {
vScrollbar.enabled = true;
vScrollbar.visible = true;
vScrollbar.minScrollPosition = 0;
vScrollbar.maxScrollPosition =browser.contentHeight - browser.height;
} else {
vScrollbar.enabled = false;
vScrollbar.visible = false;
}
if (browser.contentWidth > browser.width) {
hScrollbar.enabled = true;
hScrollbar.visible = true;
hScrollbar.minScrollPosition = 0;
hScrollbar.maxScrollPosition = browser.contentWidth - browser.width;
} else {
hScrollbar.enabled = false;
hScrollbar.visible = false;
}
}