Solved

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

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
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…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
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…

828 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