zoukankan      html  css  js  c++  java
  • 在flash中使用arguments数组

    在方法中使arguments数组,一般情况下,方法需要的参数都是在参数定义时写出的,但是有些特定的情况下,参数的个数是未知的,在这种情况下,就可以使用flash内建的arguments数组,所以向方法传递的参数都被自动的放入arguments数组中
    例:// There is no need to specify the parameters to accept when using the 
    // arguments array.
    private function average(  ):Number {
      
    var sum:Number = 0;

      
    // Loop through each of the elements of the arguments array, and 
      // add that value to sum.
      for (var i:int = 0; i < arguments.length; i++) {
        sum 
    += arguments[i];
      }
      
    // Then divide by the total number of arguments
      return sum/arguments.length;
    }

    // You can invoke average(  ) with any number of parameters. 
    var average:Number = average (12510820);
  • 相关阅读:
    windows7 下 oracle 10g服务端如何安装?
    DOM模块支持测试
    获取css属性
    在webstorm启动nginx服务器
    获取link链接
    innerText
    外部动态加载javascript
    外部动态加载css
    冒泡排序
    Nodelist
  • 原文地址:https://www.cnblogs.com/sunbingzibo/p/1455960.html
Copyright © 2011-2022 走看看