# Variables don't work correctly with onLoad

**URL:** <https://forum.kirupa.com/t/variables-dont-work-correctly-with-onload/299531>\
**Category:** flash\
**Created:** [November 6, 2009, 8:03am UTC](https://forum.kirupa.com/t/variables-dont-work-correctly-with-onload/299531 "2009-11-06T08:03:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![panoss](https://avatars.discourse-cdn.com/v4/letter/p/db5fbb/32.png) [@panoss](https://forum.kirupa.com/u/panoss)\
**Post date:** [November 6, 2009, 8:03am UTC](https://forum.kirupa.com/t/variables-dont-work-correctly-with-onload/299531/1 "2009-11-06T08:03:35Z")

</div>

I’m working with login.fla in samples of Flash ( c:/Program Files/Macromedia/Flash 8/Samples and Tutorials/Samples/ActionScript/Login ).  
I declared variable aa :  
var aa = 0;

At function checkForm at “result\_lv.onLoad = …” I added:  
"aa=“isValidLogin = " + result\_lv.isValidLogin;”

At the stage I added a textbox name aa\_txt .

At submit\_btn.clickHandler I added : “aa\_txt.text = aa;” (after checkForm).

I login (username: Herbert password: glasses ) press button but isValidLogin does not appear at aa\_txt textbox.  
If I press the button for a second time, the isValidLogin APPEARS!!! at the textbox.  
How can I make it appear with the first button press?  
Why is this happening?

I have attached the modified login.fla (zipped).
