The clickreleased variable is a boolean set to false, just like it is in nreleased.
function chooseround(e:Event)
{
trace("called chooseround function");
if (clickreleased)
{
trace("called if clickreleased");
called chooseround function traces, but called if clickreleased doesnt.
I did your change for Mouse_Down and that gave me some progress. Ill post the whole function so you can get a better idea of whats happening.
function chooseround(e:Event)
{
trace("called chooseround function");
if (clickreleased)
{
trace("called if clickreleased");
clickreleased = false;
if (mainMenu.roundpicker.currentFrame == 6)
{
trace("round-1");
ship.roundnumberchosen = 1;
mainMenu.roundpicker.gotoAndStop(7);
}
if (mainMenu.roundpicker.currentFrame == 7)
{
trace("round-3");
ship.roundnumberchosen = 3;
mainMenu.roundpicker.gotoAndStop(6);
}
}
else
{
clickreleased = true;
}
}
and it triggers both round-1 and round-3 which is what the clickreleased is suppose to prevent.
as a comparison to where I have a similar function working as intended.
if (Key.isDown(77))
{
if (mreleased)
{
togglemusic();
mute1 = ! mute1;
this.nextFrame();
}
mreleased = false;
}
else
{
mreleased = true;
}
Its suppose to make it so that whatever I call only happens once. on a single button press, instead of possibly calling it 4 or 5 times on 1 button press. I was thinking I could translate that into mouse presses, but for some reason (and its probably some basic reason) its not happening.
|