I would like to position relatively a scroller in my application like below. When I scale the image, I resize the scroller...
<s:Scroller width="50%" height="50%" >
<s:Group>
<mx:Image
id="img"
source="sample.jpg"
/>
</s:Group>
</s:Scroller>
If I set absolute dimension to the scroller like below, it does not resize (behaviour I want)
<s:Scroller width="400" height="400" >
<s:Group&g开发者_JAVA技巧t;
<mx:Image
id="img"
source="sample.jpg"
/>
</s:Group>
</s:Scroller>
.. but my intention is to position the scroller relatively to other components. Any explanations/solutions?
This is because the Group
doesn't have a size, so it gets a measured size and becomes whatever it's collective children's sizes are. Then the Scroller
has a ScrollerLayout
which sizes the Scroller: If it has an explicit width/height, it uses that, otherwise it uses it's content sizes. Flex ignores percent sizing it seems.
Check out the ScrollerLayout source, at the updateDisplayList
method. It doesn't take into account the Scroller's percent sizes :/.
Hope that helps, Lance
Thanks, it works (but only by setting the percents in the Scroller). For example:
<s:HGroup width="50%" height="50%">
<s:Scroller width="100%" height="100%" >
<s:Group>
<mx:Image
id="img"
source="sample.jpg"
/>
</s:Group>
</s:Scroller>
<s:Button label="Zoom+" click="{zoomPlus()}">
</s:Button>
</s:HGroup>
精彩评论