Try 
addressRB.setActualSize(addressRB.measuredWidth,addressRB.measuredHeight)
airportRB.setActualSize(addressRB.measuredWidth, addressRB.measuredHeight);

in the updateDisplayList() function

--- In flexcoders@yahoogroups.com, "Wally Kolcz" <wko...@...> wrote:
>
> 
> 
>                               Using an example from the web I am trying to 
> create a custom Panel component that had radio buttons in the panel header 
> for a specific piece of a web site. The panel works and I am getting 2 radio 
> buttons but no labels for either button and the radioGroup's 
>                               changeStartType() is not being called
>                               . What am I doing wrong? Here is the AS:
> 
> package com.wallykolcz.views.components
> {
> 
>     import edu.umich.body.Maps;
>     import flash.events.Event;
>     import mx.containers.Panel;
>     import mx.controls.Button;
>     import mx.controls.RadioButton;
>     import mx.controls.RadioButtonGroup;
> 
>     public class RadioButtonPanel extends Panel
>     {
> 
>         //Create Radio Button Group and Buttons
>         private var startLocation:RadioButtonGroup = new RadioButtonGroup();
>         private var addressRB:RadioButton = new RadioButton();
>         private var airportRB:RadioButton = new RadioButton();
>         private var maps:Maps;
> 
>         //constructor
>         public function RadioButtonPanel()
>         {
>             super();
>         }
> 
>         public function changeStartType():void {
>             if (startLocation.selectedValue == "address"){
>                 maps.start_txt.text = "Enter Starting Address";
>                 maps.frmAirport.includeInLayout = false;
>                 maps.frmAirport.visible = false;
>                 maps.frmAddress.includeInLayout = true;
>                 maps.frmAddress.visible = true;
>                 maps.submit_btn.visible = true;
>             }else{
>                 maps.start_txt.text = "Choose Your Airport";
>                 maps.frmAddress.includeInLayout = false;
>                 maps.frmAddress.visible = false;
>                 maps.frmAirport.includeInLayout = true;
>                 maps.frmAirport.visible = true;
>                 maps.submit_btn.visible = true;
>             }
>         }
> 
>         protected override function createChildren():void{
>             super.createChildren();
>             //instantiate new radiobuttons and assign properties
>             addressRB.value="address";
>             addressRB.label="My Address";
>             addressRB.groupName = "startLocation"; 
> 
>             airportRB.value="airport";
>             airportRB.label="Airport";
>             airportRB.groupName="startLocation"
> 
>             //add event listener for change event and call method
>             startLocation.addEventListener(Event.CHANGE, changeStartType);
> 
>             //add the buttons to rawChildren
>             rawChildren.addChild(addressRB);
>             rawChildren.addChild(airportRB);
>         }
> 
>         protected override function updateDisplayList(unscaledWidth:Number, 
> unscaledHeight:Number):void{
>             super.updateDisplayList(unscaledWidth, unscaledHeight);
>             //gap between label and edges of button
>             var margin:int = 4;
> 
>             //position the buttons in the panel
>             addressRB.move(145, 15);
>             airportRB.move(255,15)
>         }
>


Reply via email to