Computer Science Canada

Flash if Bar

Author:  Balmung [ Mon Oct 01, 2007 8:18 am ]
Post subject:  Flash if Bar

Ok, I have a bar that changes size when it Moves with this:

code:
// Moves Bar up to Start//
on (keyPress "<Up>") {
        bar._y = 396.9;
        bar._x = 320.6;
        bar._width = 111.3;
}

// Moves Bar down to Continue //
on (keyPress "<Down>") {
        bar._y = 432.9;
        bar._x = 298.9;
        bar._width = 155.5;
}


which works fine but when i go to do an if statement on another button for it, it doesn't work it only does the first if statement and doesn't test the rest.

code:
on (keyPress "<Enter>") {
        if (bar_.width=111.3) {
                gotoAndStop(2);
        } else {
                gotoAndStop(1);
        }
}

Author:  Steven Toews [ Sun May 04, 2008 10:44 am ]
Post subject:  Re: Flash if Bar

Well this is one hell of a late reply but just incase people out there have the same question sometime... you should put it in a function that is constantly being repeated, if you want your if statements to be cycled through...
Balmung wrote:

Ok, I have a bar that changes size when it Moves with this:

code:
// Moves Bar up to Start//
on (keyPress "<Up>") {
        bar._y = 396.9;
        bar._x = 320.6;
        bar._width = 111.3;
}

// Moves Bar down to Continue //
on (keyPress "<Down>") {
        bar._y = 432.9;
        bar._x = 298.9;
        bar._width = 155.5;
}


which works fine but when i go to do an if statement on another button for it, it doesn't work it only does the first if statement and doesn't test the rest.

code:
on (keyPress "<Enter>") {
        if (bar_.width=111.3) {
                gotoAndStop(2);
        } else {
                gotoAndStop(1);
        }
}



You should try...
code:


bar.onEnterFrame = function() {

// Moves Bar up to Start//
on (keyPress "<Up>") {
        bar._y = 396.9;
        bar._x = 320.6;
        bar._width = 111.3;
}

// Moves Bar down to Continue //
on (keyPress "<Down>") {
        bar._y = 432.9;
        bar._x = 298.9;
        bar._width = 155.5;
}

on (keyPress "<Enter>") {
        if (bar._width=111.3) {
                gotoAndStop(2);
        } else {
                gotoAndStop(1);
        }
}
}





: