Add up Flash (2)

Source: Internet
Author: User

Add up Flash (2)-ActionScript 3.0 base packages, classes, package classes, namespaces, properties, methods, interfaces, and inheritance

Example

Functiontest.as

package actionScript
{
   import flash.display.Sprite;

   public class FunctionTest extends Sprite
   {
     public function FunctionTest()
     {

     }

     // 减法
     public function Subtract(a:int, b:int):int
     {
       // 参数总数
       trace(arguments.length);
       // output: 2

       // 第一个参数
       trace(arguments[0]);
       // output: “参数 a 的值”

       // 第二个参数
       trace(arguments[1]);
       // output: “参数 b 的值”

       // 返回a - b
       return a - b;
     }

     // 加法(args - 任意多参数)
     public function Add(s:String, args):String
     {
       var i:int = 0;

       // 枚举出 args 中的所有参数
       for each(var v in args)
       {
         i += v;
       }

       return s + ": " + i;
     }
   }
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.