Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Flex: Positioning RadioButtons x position according to the selected button in ButtonBar

Posted on 2014-01-19
3
Medium Priority
?
501 Views
Last Modified: 2014-01-20
Hello, here is my problem explained with an image:
problem with positionYou can see when selecting my second button it makes a scroll-text-resize area, that should not be there.
Here is my code:
<mx:ToggleButtonBar id="mapTypeToggleButtonBar" right="5" top="5" horizontalGap="0" selectedIndex="1" fontSize="10" toggleOnClick="false" dataProvider="{mapTypeViewStack}" />
	<mx:ViewStack id="mapTypeViewStack" y="{mapTypeToggleButtonBar.y + mapTypeToggleButtonBar.height}" width="{mapTypeToggleButtonBar.width}" x="{mapTypeToggleButtonBar.x}">
		<mx:Canvas id="mapView" label="Map" width="100%" height="100%" x="{mapTypeToggleButtonBar.x}">
			<s:RadioButton id="mapTerrain" label="Terrain" fontSize="10" x="{getmapTypeToggleButtonBarSelectedButtonX(mapTypeToggleButtonBar.selectedIndex)}"/>
		</mx:Canvas>
		<mx:Canvas id="satelliteView" label="Satellite" width="100%" height="100%">
			<s:RadioButton id="satelliteLabels" fontSize="10" label="Labels" x="{getmapTypeToggleButtonBarSelectedButtonX(mapTypeToggleButtonBar.selectedIndex)}"/>
		</mx:Canvas>
	</mx:ViewStack>

Open in new window


			public function getmapTypeToggleButtonBarSelectedButtonX(value:int) : int
			{
				var i:int;
				var st:int = mapTypeToggleButtonBar.selectedIndex;
				var hold:int;
				for (i = 0; i < st; i++)
					{
						hold += mapTypeToggleButtonBar.getChildAt(mapTypeToggleButtonBar.selectedIndex).width;
					}
				return hold
			}

Open in new window


How can I fix this, or is there a simpler way?

Thank you in advance.
0
Comment
Question by:JoachimPetersen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
3 Comments
 

Author Comment

by:JoachimPetersen
ID: 39792269
Added scale for the radiobutton below:
<mx:ToggleButtonBar id="mapTypeToggleButtonBar" right="5" top="5" horizontalGap="0" selectedIndex="1" fontSize="10" toggleOnClick="false" dataProvider="{mapTypeViewStack}" />
	<mx:ViewStack id="mapTypeViewStack" y="{mapTypeToggleButtonBar.y + mapTypeToggleButtonBar.height}" width="{mapTypeToggleButtonBar.width}" x="{mapTypeToggleButtonBar.x}">
		<mx:Canvas id="mapView" label="Map" width="100%" height="100%" x="{mapTypeToggleButtonBar.x}">
			<s:RadioButton id="mapTerrain"
						   x="{getmapTypeToggleButtonBarSelectedButtonX(mapTypeToggleButtonBar.selectedIndex)}"
						   y="2.5" label="Terrain" width="{mapTypeToggleButtonBar.getChildAt(mapTypeToggleButtonBar.selectedIndex).width/3 + mapTypeToggleButtonBar.getChildAt(mapTypeToggleButtonBar.selectedIndex).width}" scaleY="{mapTypeToggleButtonBar.getChildAt(mapTypeToggleButtonBar.selectedIndex).width/satelliteLabels.width}" scaleX="{mapTypeToggleButtonBar.getChildAt(mapTypeToggleButtonBar.selectedIndex).width/satelliteLabels.width}"/>
		</mx:Canvas>
		<mx:Canvas id="satelliteView" label="Satellite" width="100%" height="100%">
			<s:RadioButton id="satelliteLabels"
						   x="{getmapTypeToggleButtonBarSelectedButtonX(mapTypeToggleButtonBar.selectedIndex)}"
						   y="2.5" label="Labels" width="{mapTypeToggleButtonBar.getChildAt(mapTypeToggleButtonBar.selectedIndex).width/3 + mapTypeToggleButtonBar.getChildAt(mapTypeToggleButtonBar.selectedIndex).width}" scaleY="{mapTypeToggleButtonBar.getChildAt(mapTypeToggleButtonBar.selectedIndex).width/satelliteLabels.width}" scaleX="{mapTypeToggleButtonBar.getChildAt(mapTypeToggleButtonBar.selectedIndex).width/satelliteLabels.width}"/>
		</mx:Canvas>
	</mx:ViewStack>

Open in new window

This still does not work, as when you start the application it will not scale the first visible radiobutton to correct size before you press the buttonbar so it refreshes the first button.
How can I fix this?

Is there an easier way?
0
 

Accepted Solution

by:
JoachimPetersen earned 0 total points
ID: 39795703
scale down radiobutton is the solution I found
0
 

Author Closing Comment

by:JoachimPetersen
ID: 39795704
worked
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question