# Password protected menu~listener function?

**URL:** https://forum.kirupa.com/t/password-protected-menu-listener-function/53363
**Category:** Uncategorized
**Created:** [June 3, 2004, 1:12am UTC](https://forum.kirupa.com/t/password-protected-menu-listener-function/53363 "2004-06-03T01:12:54Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![mindfriction](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/mindfriction/32/172_2.png) [@mindfriction](https://forum.kirupa.com/u/mindfriction)
#### Post date: [June 3, 2004, 1:12am UTC](https://forum.kirupa.com/t/password-protected-menu-listener-function/53363/1 "2004-06-03T01:12:54Z")

</div>

Hi guys and girls,

I want to have a menu which has items disabled until a user logs in. At the momment I have a simple conditional that runs onEnterFrame to keep checking the variable loggedIn. I was looking in the Actionscript dictionary for some sort of listener function which I could set. Was hoping to create some sort of function that only checks loggedIn variable when its value changes so I dont have onEnterFrame continually looping…Any ideas?

```auto

if(mySubButton.type=="protected"){
								mySubButton.onEnterFrame = function(){
									if((user_so.data.loggedIn==undefined) || (user_so.data.loggedIn==false)){
										new Color(this).setTransform({aa: '25'});
										this.enabled=false;
									}else{
										new Color(this).setTransform({aa: '100'});
										this.enabled=true;
									}
								}
								trace("LOGIN REQUIRED");
							}else{
								trace("NORMAL");
							}

```
