pisuvar
pisuvar

Reputation: 267

Relative sizing and positioning in Flex 4.5

I have a web application, in this application I have one main bordercontainer and under this there different component charts,buttons and images. My problem is that the web browser opening this application can change in resolution size. How can I give relative x and y positions as well as width and height values. I tried to do something like this in my mxml file:

   <s:SkinnableContainer  id="mainContainer" x="0" y="0" width="100%" height="100%">
        <s:SkinnableContainer id="lastPersonInContainer" x="{130}" y="{102}" width="{mainContainer.scaleX*191}" 
                           height="{mainContainer.scaleY*254}" backgroundAlpha="0.0">
            <s:BitmapImage id="personImageBackGround" visible="true" width="100%" height="100%"  fillMode="scale" scaleMode="stretch" source="picBackGround.png"
                     verticalAlign="middle"/>
            <s:BitmapImage id="personImage" width="100%" height="100%" visible="true"  fillMode="scale" scaleMode="stretch"
                     source="assets/TT.jpg" verticalAlign="bottom"/>
        </s:SkinnableContainer>
</s:SkinnableContainer>

This approach does not seem to work and I need this relative positioning and sizing not dynamically for now but at the initial state when the application opens. What does the scaleX and scaleY values hold are they the ratio (difference in width)/width or something else. I want to resize every component by its parent resize rate

Thank you for your help.

Upvotes: 0

Views: 124

Answers (1)

pisuvar
pisuvar

Reputation: 267

I solved my case by first deciding the size of the background image such:1920*1200. Then by the initial values of the components I multiplied for width (mainContainer.widt/1920)*initialWidth component. Hope it helps for others who are having the similar problem.

Upvotes: 0

Related Questions