# Text box problem

**URL:** https://forum.kirupa.com/t/text-box-problem/311493
**Category:** Uncategorized
**Created:** [July 8, 2010, 9:05am UTC](https://forum.kirupa.com/t/text-box-problem/311493 "2010-07-08T09:05:32Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![adrian\_luck](https://avatars.discourse-cdn.com/v4/letter/a/87869e/32.png) [@adrian\_luck](https://forum.kirupa.com/u/adrian_luck)
#### Post date: [July 8, 2010, 9:05am UTC](https://forum.kirupa.com/t/text-box-problem/311493/1 "2010-07-08T09:05:32Z")

</div>

Hello  
I have a script which creates a column of text input boxes three in number. The purpose is to capture a users date of birth, the top box would hold the users birthday e.g. 15 the next box the month e.g. 09 and the bottom box would hold the year e.g. 2010.

I decided I would like the cursor to jump to the next text box after the user has entered their birthday and again after they have entered their birth month, so I have part of the script that does this using the [COLOR=#993300]stage[/COLOR].[COLOR=#000000]focus[/COLOR] command.

The Problem:  
As the cursor moves to the next text box the text just inputted repositions the text. e.g input 15 changes to 51 and 09 changes to 90.

I dont know enough about action script to see why its doing this and therefor dont know how to solve it.

Help is most appretiated.

[COLOR=#993300]var[/COLOR] current\_year:[COLOR=#993300]Number[/COLOR];  
[COLOR=#993300]var[/COLOR] current\_month:[COLOR=#993300]Number[/COLOR];  
[COLOR=#993300]var[/COLOR] current\_day:[COLOR=#993300]Number[/COLOR];

[COLOR=#993300]var[/COLOR] client\_year:[COLOR=#993300]Number[/COLOR];  
[COLOR=#993300]var[/COLOR] client\_month:[COLOR=#993300]Number[/COLOR];  
[COLOR=#993300]var[/COLOR] client\_day:[COLOR=#993300]Number[/COLOR];

[COLOR=#993300]var[/COLOR] input\_year:[COLOR=#993300]Number[/COLOR];  
[COLOR=#993300]var[/COLOR] input\_month:[COLOR=#993300]Number[/COLOR];  
[COLOR=#993300]var[/COLOR] input\_day:[COLOR=#993300]Number[/COLOR];

[COLOR=#993300]var[/COLOR] temp\_year:[COLOR=#993300]Number[/COLOR];  
[COLOR=#993300]var[/COLOR] temp\_month:[COLOR=#993300]Number[/COLOR];  
[COLOR=#993300]var[/COLOR] temp\_day:[COLOR=#993300]Number[/COLOR];

[COLOR=#993300]var[/COLOR] result\_year:[COLOR=#993300]Number[/COLOR];  
[COLOR=#993300]var[/COLOR] result\_month:[COLOR=#993300]Number[/COLOR];  
[COLOR=#993300]var[/COLOR] result\_day:[COLOR=#993300]Number[/COLOR];

[COLOR=#993300]var[/COLOR] [COLOR=#993300]date[/COLOR]:[COLOR=#993300]Number[/COLOR];  
[COLOR=#993300]var[/COLOR] minutes:[COLOR=#993300]Number[/COLOR];  
[COLOR=#993300]var[/COLOR] days:[COLOR=#993300]Number[/COLOR];  
[COLOR=#993300]var[/COLOR] hours:[COLOR=#993300]Number[/COLOR];  
[COLOR=#993300]var[/COLOR] months:[COLOR=#993300]Number[/COLOR];  
[COLOR=#993300]var[/COLOR] years:[COLOR=#993300]Number[/COLOR];

[COLOR=#993300]var[/COLOR] my\_date:[COLOR=#993300]Date[/COLOR] = [COLOR=#993300]new[/COLOR] [COLOR=#993300]Date[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#993300]var[/COLOR] my\_dateText = my\_date;

minutes = [COLOR=#993300]Number[/COLOR]COLOR=#000000[/COLOR];  
hours = [COLOR=#993300]Number[/COLOR]COLOR=#000000[/COLOR];  
days = [COLOR=#993300]Number[/COLOR]COLOR=#000000[/COLOR];  
months = [COLOR=#993300]Number[/COLOR]COLOR=#000000[/COLOR];  
years = [COLOR=#993300]Number[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#993300]date[/COLOR] = [COLOR=#993300]Number[/COLOR]COLOR=#000000[/COLOR];

[COLOR=#993300]var[/COLOR] adjusted\_days:[COLOR=#993300]Number[/COLOR] = days + [COLOR=#000000]1[/COLOR];  
[COLOR=#993300]var[/COLOR] adjusted\_months:[COLOR=#993300]Number[/COLOR] = months + [COLOR=#000000]1[/COLOR];

[COLOR=#993300]var[/COLOR] current\_date\_output:[COLOR=#993300]TextField[/COLOR]= [COLOR=#993300]new[/COLOR] [COLOR=#993300]TextField[/COLOR]COLOR=#000000[/COLOR];  
current\_date\_output.[COLOR=#993300]width[/COLOR] = [COLOR=#000000]400[/COLOR];

[COLOR=#993300]var[/COLOR] myFormat:[COLOR=#993300]TextFormat[/COLOR] = [COLOR=#993300]new[/COLOR] [COLOR=#993300]TextFormat[/COLOR]COLOR=#000000[/COLOR];  
myFormat.[COLOR=#993300]size[/COLOR] = [COLOR=#000000]15[/COLOR];  
myFormat.[COLOR=#993300]align[/COLOR] = TextFormatAlign.[COLOR=#993300]LEFT[/COLOR];

[COLOR=#993300]var[/COLOR] InputDayTextField:[COLOR=#993300]TextField[/COLOR] = [COLOR=#993300]new[/COLOR] [COLOR=#993300]TextField[/COLOR]COLOR=#000000[/COLOR];  
InputDayTextField.[COLOR=#000000]defaultTextFormat[/COLOR] = myFormat;  
InputDayTextField.[COLOR=#993300]type[/COLOR] = TextFieldType.[COLOR=#000000]INPUT[/COLOR];  
InputDayTextField.[COLOR=#993300]border[/COLOR] = [COLOR=#993300]true[/COLOR];  
InputDayTextField.[COLOR=#000000]x[/COLOR] = [COLOR=#000000]10[/COLOR];  
InputDayTextField.[COLOR=#000000]y[/COLOR] = [COLOR=#000000]100[/COLOR];  
InputDayTextField.[COLOR=#993300]height[/COLOR] = [COLOR=#000000]20[/COLOR];

[COLOR=#f000f0]_[//InputDayTextField.autoSize](https://InputDayTextField.autoSize) = TextFieldAutoSize.LEFT;_[/COLOR]  
InputDayTextField.[COLOR=#993300]multiline[/COLOR] = [COLOR=#993300]true[/COLOR];  
InputDayTextField.[COLOR=#993300]wordWrap[/COLOR] = [COLOR=#993300]true[/COLOR];  
addChildCOLOR=#000000[/COLOR];

[COLOR=#993300]var[/COLOR] InputMonthTextField:[COLOR=#993300]TextField[/COLOR] = [COLOR=#993300]new[/COLOR] [COLOR=#993300]TextField[/COLOR]COLOR=#000000[/COLOR];  
InputMonthTextField.[COLOR=#000000]defaultTextFormat[/COLOR] = myFormat;

InputMonthTextField.[COLOR=#993300]type[/COLOR] = TextFieldType.[COLOR=#000000]INPUT[/COLOR];  
InputMonthTextField.[COLOR=#993300]border[/COLOR] = [COLOR=#993300]true[/COLOR];  
InputMonthTextField.[COLOR=#000000]x[/COLOR] = [COLOR=#000000]10[/COLOR];  
InputMonthTextField.[COLOR=#000000]y[/COLOR] = [COLOR=#000000]120[/COLOR];  
InputMonthTextField.[COLOR=#993300]height[/COLOR] = [COLOR=#000000]20[/COLOR];

[COLOR=#f000f0]_[//InputMonthTextField.autoSize](https://InputMonthTextField.autoSize) = TextFieldAutoSize.LEFT;_[/COLOR]  
[COLOR=#f000f0]_[//InputMonthTextField.multiline](https://InputMonthTextField.multiline) = false;_[/COLOR]  
[COLOR=#f000f0]_[//InputMonthTextField.wordWrap](https://InputMonthTextField.wordWrap) = false;_[/COLOR]  
addChildCOLOR=#000000[/COLOR];

[COLOR=#993300]var[/COLOR] InputYearTextField:[COLOR=#993300]TextField[/COLOR] = [COLOR=#993300]new[/COLOR] [COLOR=#993300]TextField[/COLOR]COLOR=#000000[/COLOR];  
InputYearTextField.[COLOR=#000000]defaultTextFormat[/COLOR] = myFormat;  
InputYearTextField.[COLOR=#993300]type[/COLOR] = TextFieldType.[COLOR=#000000]INPUT[/COLOR];  
InputYearTextField.[COLOR=#993300]border[/COLOR] = [COLOR=#993300]true[/COLOR];  
InputYearTextField.[COLOR=#000000]x[/COLOR] = [COLOR=#000000]10[/COLOR];  
InputYearTextField.[COLOR=#000000]y[/COLOR] = [COLOR=#000000]140[/COLOR];  
InputYearTextField.[COLOR=#993300]height[/COLOR] = [COLOR=#000000]20[/COLOR];  
[COLOR=#f000f0]_[//InputYearTextField.autoSize](https://InputYearTextField.autoSize) = TextFieldAutoSize.RIGHT;_[/COLOR]  
[COLOR=#f000f0]_[//InputYearTextField.multiline](https://InputYearTextField.multiline) = false;_[/COLOR]  
[COLOR=#f000f0]_[//InputYearTextField.wordWrap](https://InputYearTextField.wordWrap) = false;_[/COLOR]  
addChildCOLOR=#000000[/COLOR];

[COLOR=#993300]stage[/COLOR].[COLOR=#000000]focus[/COLOR] = InputDayTextField;

[COLOR=#993300]var[/COLOR] DayTextCount:[COLOR=#993300]Number[/COLOR];  
DayTextCount = [COLOR=#000000]0[/COLOR];  
[COLOR=#993300]var[/COLOR] MonthTextCount:[COLOR=#993300]Number[/COLOR];  
MonthTextCount = [COLOR=#000000]0[/COLOR];

InputDayTextField.[COLOR=#000000]addEventListener[/COLOR]COLOR=#000000[/COLOR];  
InputMonthTextField.[COLOR=#000000]addEventListener[/COLOR]COLOR=#000000[/COLOR];  
InputYearTextField.[COLOR=#000000]addEventListener[/COLOR]COLOR=#000000[/COLOR];

[COLOR=#993300]function[/COLOR] DayTextInCOLOR=#000000[/COLOR][COLOR=#000000]{[/COLOR]  
DayTextCount ++ ;  
[COLOR=#993300]trace[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#993300]trace[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#993300]if[/COLOR] [COLOR=#000000]([/COLOR]DayTextCount \>= [COLOR=#000000]2[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]

client\_day = [COLOR=#993300]Number[/COLOR]COLOR=#000000[/COLOR];  
input\_day = [COLOR=#993300]Number[/COLOR] COLOR=#000000[/COLOR];

[COLOR=#993300]trace[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#993300]stage[/COLOR].[COLOR=#000000]focus[/COLOR] = InputMonthTextField;  
[COLOR=#000000]}[/COLOR]  
[COLOR=#000000]}[/COLOR]

[COLOR=#993300]function[/COLOR] MonthTextInCOLOR=#000000[/COLOR][COLOR=#000000]{[/COLOR]  
MonthTextCount ++ ;  
[COLOR=#993300]trace[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#993300]trace[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#993300]if[/COLOR] [COLOR=#000000]([/COLOR]MonthTextCount \>= [COLOR=#000000]2[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]  
[COLOR=#993300]stage[/COLOR].[COLOR=#000000]focus[/COLOR] = InputYearTextField;  
[COLOR=#993300]trace[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#000000]}[/COLOR]  
[COLOR=#000000]}[/COLOR]

[COLOR=#993300]function[/COLOR] YearTextInCOLOR=#000000[/COLOR][COLOR=#000000]{[/COLOR]

[COLOR=#993300]trace[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#000000]}[/COLOR]
