广告合作
|
关于我们
|
网站地图
|
我要投稿
首页 > ActionScript代码库 > Bool Object
  • 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); //
    

     

  • 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));

友情链接

Copyright 2000-2011 ActionScript. All Rights Reserved. 联系我们