Solved

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

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

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…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

776 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