Solved

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

Posted on 2014-01-19
3
469 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
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 how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

751 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