# Rectangle based on text in radio button group

**URL:** https://forum.kirupa.com/t/rectangle-based-on-text-in-radio-button-group/331439
**Category:** flash
**Created:** [August 1, 2013, 11:57am UTC](https://forum.kirupa.com/t/rectangle-based-on-text-in-radio-button-group/331439 "2013-08-01T11:57:54Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![haponing](https://avatars.discourse-cdn.com/v4/letter/h/7bcc69/32.png) [@haponing](https://forum.kirupa.com/u/haponing)
#### Post date: [August 1, 2013, 11:57am UTC](https://forum.kirupa.com/t/rectangle-based-on-text-in-radio-button-group/331439/1 "2013-08-01T11:57:54Z")

</div>

[COLOR=#000000][FONT=Arial]HI I wanted to resize my drawRect function based on text characters in my radio button group. I have this code:

[/FONT][/COLOR]

```auto
[COLOR=#000000][FONT=Consolas]function chkAnswer(mevt:MouseEvent):void {[/FONT][/COLOR]

    cdlDone[index] = 1;    
   var rectSize:uint = 300; // i don't know how to set up the width based on text
  var correctRect:Shape = new Shape();    
  correctRect.graphics.beginFill(0x00FF00, 0.5); /* The user selected the "Show me the answer" button */   

if (cdlCorrect[index] == 0) { // Correct answer is the 1st radio button correctRect.graphics.drawRect(45, 45, rectSize, 25); / [COLOR=#000000][FONT=Consolas] trace("This is 1st Radio button"); [/FONT][/COLOR]

```
