Setting up a scrollbar is a fair amount of work. What is the centering
problem? If scrollbars are always on, will setting
verticalScrollPolicy="on" fix your centering issue?
the problem is as follows
Canvas_A is fixed and has scrollbars set to on, Canvas_B is inside Canvas_A and has a horizontal and vertical centre of 0 so it is always centered within Canvas_A.
I then have a zoom componenet that consists of a slider, when the slider control is used Canvas_B is increased in size, at this point the scrollbars always start from the top left corner and even though I'm still looking at the center of Canvas_B I can't use the scrollbars to navigate to the top left of Canvas_B
you can see an example of what I mean hear
Are you required to use Flex 3.x? I just showed someone how to do something
similar in Flex 4.
<?xml version="1.0" encoding="utf-8"?>
<s:Application width="100%" height="100%"
private function scaleAndZoom():void
img.scaleX = img.scaleY = zoomFactor.value;
private function checkScrolling():void
var imgWidth:Number = img.width * img.scaleX;
var imgHeight:Number = img.height * img.scaleY;
if (group.contentWidth < imgWidth ||
group.contentHeight < imgHeight)
var excessW:Number = imgWidth - group.contentWidth;
var excessH:Number = imgHeight - group.contentHeight;
scroller.verticalScrollBar.minimum = -excessH;
scroller.verticalScrollBar.maximum = excessH;
group.verticalScrollPosition = 0;
scroller.horizontalScrollBar.minimum = -excessW;
scroller.horizontalScrollBar.maximum = excessW;
group.horizontalScrollPosition = 0;
<s:HSlider id="zoomFactor" minimum="1" maximum="100" stepSize="0.1"
change="scaleAndZoom()" width="100%" />
<s:Scroller id="scroller" width="100%" height="100%" >
<s:Image verticalCenter="0" horizontalCenter="0"
source="umbrellas.jpg" id="img" updateComplete="checkScrolling()" />
The whole program thus far is written in 3 and I don't fancy having to convert it to 4 just yet!
Any solution in 3?
Or even if there is just a way to set the scrollbar handle size would be good!
I'm not sure what you mean by handle, but there is an API on Scrollbar for
setting various properties to describe what is being scrolled. Is the
content just an image? You might have the option of offsetting the content
in a UIComponent.
in a vertical scrollbarr I'd say theres 4 parts, an up arrow, a down arrow, the track and the handle that slides up and down the track, I want to be able to increas or decrease this size of this.
No the contents are quite complex
That's what we call the 'thumb'. There should be a setScrollProperties
method and minimum and maximum properties that control the appearance of the
Could you possibly post a really basic example, i can't seem to affect the
thumb size at all