As3 defines classes in the package

Source: Internet
Author: User

In as3, you can define other classes outside the package of a class and reference the package class in this class:

Package com. Custom. utils
{
Public class tfunction
{
Public var minus: function;
Public static const M: Int = 10;
Public const N: Int = 20;

Public Function tfunction ()
{
VaR test1: test1 = new test1 ();
VaR Test2: Test2 = new Test2 ();
}

Public var alert: function = function (M: int, N: INT): void
{
Trace ("tfunction is create:" + (m + n ));
}

Public Function show (... ARGs ):*
{
If (ARGs. Length = 2)
{
Trace ("tfunction minus show:" + (ARGs [0]-ARGs [1]);
}
Else if (ARGs. Length = 3)
{
Trace ("tfunction chongzai:" + (ARGs [0] + ARGs [1] + ARGs [2]);
}
}
}
}

Class test1 {
Public Function test1 (){
Trace ("now is Bao nei Lei test1 ");
}
}

Class Test2 {
Public Function Test2 (){
Trace ("now is Bao nei Lei Test2 ");
}
}

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.