AS3 Write Class ClassLoader class 1th/2 page _flash AS3

Source: Internet
Author: User
Tags function definition

Main uses :

1, in the use of flash projects, put some components, by setting the link class, and then use this class, through the GetClass method can take down the material


Figure 1 (see Example 1)

2, many of the classes are divided into different SWF, and then by invoking the SWF, to invoke the function of the class library, and then through the getclass to get the class (see Example 2)

Index.base.net.ClassLoader class Explanation:
Load the SWF file and get the class by calling GetClass, or you can get the definition of the namespace or function

Constructors
Public Function ClassLoader (obj:object = Null,lc:loadercontext = null)
Parameter 1 can be a string, can be a bytearray, if the former is a load method, the latter using the Loadbytes method
Parameter 2 is to create a ClassLoader instance with the specified Loadercontext object, Loadercontext can set whether to load Cross-domain files, application domains, etc., as described in the official Loadercontext Class!

Load method
Public function load (_url:string,lc:loadercontext = null): void
Loading files
Parameter 1 is the load address, and parameter 2 sees the constructor

Loadbytes method
Public Function loadbytes (bytes:bytearray,lc:loadercontext = null): void
Load byte file
Parameter 1 is byte data, and parameter 2 sees the constructor

GetClass method
Public Function GetClass (classname:string): Object
Gets a public definition, either a class or a namespace or a function definition
Parameter 1 is to get the complete package plus class name for class, such as our class full definition name is Index.base.net.ClassLoader
See examples for details

Hasclass method
Public Function Hasclass (classname:string): Boolean
Returns whether the public definition is included
Parameter 1 See GetClass method

Clear method
Public Function Clear (): void
Empty

URL Property
public Var url:string
Get URL Property

Loader property
public Var Loader:loader
Get Loader Property

Current 1/2 page 12 Next read the full text

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.