Featured jobs
» More ActionScript, Flash and Flex jobs in the Employment Section
» Advertise a job for free
Featured template

View more templates
Home » Actionscripts library »  Bool Object

Check Euqality Of Bools
// AllBool function to detect equality between
// X given Bools and a preset constant (Bool)
// By Jesse Stratford, jesse@actionscript.org
function allBool (name, count, expected) {
        for (var k = 1; k<=count; k++) {
                if (this[name+k] != expected) {
                        return false;
                }
        }
        return true;
}
foo1 = true;
foo2 = true;
foo3 = true;
// All true vars, check for truth, returns true
trace (allBool("foo", 3, true));
bar1 = true;
bar2 = true;
bar3 = false;
// One false var, check for truth, returns false
trace (allBool("bar", 3, true));
// Attempt to check 4 vars when only 3 exist
// even though all three are true, return false
trace (allBool("foo", 4, true));

Posted by: Jesse Stratford | website http://www.ActionScript.org
enable and disable all buttons
MovieClip.prototype.disableAllButtons = function(act) {
        for (var counter in this) {
                if (this[counter].__proto__ == Button.prototype) {
                        this[counter].enabled = act;
                } else if
                (this[counter].__proto__ == MovieClip.prototype && this[counter]._parent == this)
                {
                        this[counter].disableAllButtons(act);
                }
        }
};
ASSetPropFlags(MovieClip.prototype, "disableAllButtons", 7);

  用法:

disableAllButtons(false); // 禁止使用主动画的所有按钮
disableAllButtons(true); // 允许使用主动画的所有按钮
myMC.disableAllButtons(false); // 禁止使用 myMC 内的所有按钮

Posted by: heskeyo | website http://www.ooxford.hk.st

Search Entire Site
Add to Google
Advertisements
Latest New Articles
  1. Set up a simple IIS Server for Flash
    by Peter McBride
  2. Day 1 at FITC Toronto 2008
    by Anthony Pace
  3. Simple reflection effect with AS2
    by Jean Andr Mas
  4. ActionScript.org Meets Josh Tynjala (aka dr_zeus)
    by ActionScript.org Staff
  5. Rapidly Create Online Flash Movies to Help Users Market, Sell and Support Software and Hardware
    by Sabrina F
mailing list
Enter your email address:
mailing list
Subscribe Unsubscribe
2000-2007 actionscript.org! All Rights Reserved.
Read our Privacy Statement and Terms of Use...
Our dedicated server is hosted and managed by WebScorpion Webhosting.