Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problems with global variable in do while loop 1

Status
Not open for further replies.

goaganesha

Programmer
Dec 4, 2001
178
BE
Hello,

Here's the problem. I've made a pop up menu in flash but it closes right away when the mouse leaves the menu. I want to make some sort of a counter so the menu stays open for a second after the mouse leaves the menu.
In the first frame of the main scene I've created a global variable.

menu1closing = false;

I want this variable to become true when the mouse leaves the menu and then go back to false after 1 second.

so the menu will only close when
onClipEvent(enterFrame)
{
if (! _root.menu1closing)
{
code to close the menu
}
}

to make the variable true I've put this "do while" loop before the previous "if statement"


counter = 0;
do
{
trace (counter);
counter = counter + 1;
}
while (counter < 12 )

this works fine , it counts till 11 and stops


from the moment I change the code to


counter = 0;
do
{
trace (counter);
_root.menu1closing = true;
counter = counter + 1;
}
while (counter < 12 )



an endless loop is being created and the global variable never goes back to false which means the menu stays open.
Does anyone understand what's going wrong?


regards, goaganesha


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top