# Buttons lose focus passing data

**URL:** https://forum.kirupa.com/t/buttons-lose-focus-passing-data/189978
**Category:** flash
**Created:** [June 7, 2006, 5:43pm UTC](https://forum.kirupa.com/t/buttons-lose-focus-passing-data/189978 "2006-06-07T17:43:54Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![flashpipe](https://avatars.discourse-cdn.com/v4/letter/f/839c29/32.png) [@flashpipe](https://forum.kirupa.com/u/flashpipe)
#### Post date: [June 7, 2006, 5:43pm UTC](https://forum.kirupa.com/t/buttons-lose-focus-passing-data/189978/1 "2006-06-07T17:43:54Z")

</div>

Very strange. I’m using the following function to pass characters to 2 text input components, but sometimes (and much more often with the “Password” field), after I click a button, the button loses focus and I have to move the mouse to regain the rollover state and be able to click the button again. When I’ve lost focus, if I click the mouse, it just changes the button to the rollover state but doesn’t pass the value…

Here’s the code:

```auto

var Focus:String = "";
function KeyPadButtonClick(_id:Number) {
    // default the focus to the UserID
    if (this.Focus == "") {
        this.Focus = "UserID";
    }
    if (this.Focus == "UserID") {
        this.UserID.text = this.UserID.text+_id.toString();
    }
    if (this.Focus == "Password") {
        this.Password.text = this.Password.text+_id.toString();
    }
}

```

The zip file is attached.

Any ideas???

TIA!!!
