# Function and Variable Problem

**URL:** <https://forum.kirupa.com/t/function-and-variable-problem/269986>\
**Category:** flash\
**Created:** [September 3, 2008, 10:02pm UTC](https://forum.kirupa.com/t/function-and-variable-problem/269986 "2008-09-03T22:02:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aurumlupus](https://avatars.discourse-cdn.com/v4/letter/a/8e8cbc/32.png) [@Aurumlupus](https://forum.kirupa.com/u/Aurumlupus)\
**Post date:** [September 3, 2008, 10:02pm UTC](https://forum.kirupa.com/t/function-and-variable-problem/269986/1 "2008-09-03T22:02:25Z")

</div>

Hi Everyone,

Its been a while since I`ve played with flash but I`m trying to make a menu that when someone clicks on a university, the university appears and when they click on it again, it disappears.

movieVar = 0

mcUni.onEnterFrame = function()  
{  
uniMenu(mcCov, movieVar, mcContent.mcUni);  
}

uniMenu = function (cover, movieVar, uni)  
{  
cover.onRelease = function ()  
{  
if (movieVar == 1)  
{  
uni.\_visible = false;  
movieVar–;  
}  
else if(movieVar == 0)  
{  
uni.\_visible = true;  
movieVar++;  
}  
}  
}

The problem is the movieVar never outputs and doesnt appear to update and wont switch on and off when I click the button. it will switch on, but not off.

Any help?
