# Onkillfocus bug cannot figure this out

**URL:** <https://forum.kirupa.com/t/onkillfocus-bug-cannot-figure-this-out/258993>\
**Category:** Uncategorized\
**Created:** [April 30, 2008, 4:34am UTC](https://forum.kirupa.com/t/onkillfocus-bug-cannot-figure-this-out/258993 "2008-04-30T04:34:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicolaszein](https://avatars.discourse-cdn.com/v4/letter/n/b77776/32.png) [@nicolaszein](https://forum.kirupa.com/u/nicolaszein)\
**Post date:** [April 30, 2008, 4:34am UTC](https://forum.kirupa.com/t/onkillfocus-bug-cannot-figure-this-out/258993/1 "2008-04-30T04:34:17Z")

</div>

Hello everyone,

for the life of me i cannot figure out what i am doing wrong. I honestly think it’s a bug but i am clueless, i have used this same exact code before and it works but the onkillfocus does not work unless i go to another text field. the cursor does not go away if i click anywhere else.

the fla and swf are in the directory listed below, any tips and advice would be greatly appreciated. Thanks. This is a flash cs3 project but as 2 code.

Thanks.

[http://www.nicolaszein.com/DELETE/onkillfocusbug/](http://www.nicolaszein.com/DELETE/onkillfocusbug/)

for those who do not want to open the file, here is the entire code below just in case:

```auto

stop();

//==================================================================================
//text effects
var text1:String = "name";
var text2:String = "email";
var text3:String = "message";

input_name.text=text1;
input_email.text=text2;
input_message.text=text3;
// tabIndex

input_name.tabIndex = 1;
input_email.tabIndex = 2;
input_message.tabIndex = 3;

//==============================================================================
input_name.onSetFocus=function() {
    if(this.text==text1) { 
        this.text="";
    } 
}
input_email.onSetFocus=function() {
    if(this.text==text2) { 
        this.text="";
    } 
}
input_message.onSetFocus=function() {
    if(this.text==text3) { 
        this.text="";
    } 
}

input_name.onKillFocus=function() {
    if(this.text=="") { 
        this.text=text1;
    } 
}
input_email.onKillFocus=function() {
    if(this.text=="") { 
        this.text=text2;
    } 
}
input_message.onKillFocus=function() {
    if(this.text=="") { 
        this.text=text3;
    } 
}

```
