AS3 class and class name judgment, acquisition, conversion, etc.

Source: Internet
Author: User

1.is--determines whether an object/class belongs to a category, returns a Boolean value
Example: 123 is number
Return: True
Example: int is Object
Return: True

2.as--determines whether the object/class is in a certain class, returns the object itself successfully, and fails to return null
Example: 123 as UINT
Returns: 123
Example: 123 As String
return: null
Note: In many cases, the compiler automatically makes the as operation when the type does not match
With AS, we can call out code hints without strong conversions.

3.Class (object)--strong conversion, possible loss of data, wide applicability, failure throw error
Example: Int (123.45)
Returns 123

4.typeof--returns the type of the object as a string, not recommended
Example: typeof "Test"
return: "String"

5.instanceof--and is the same, but cannot judge the interface, is not recommended to use

6.getdefinitionbyname--get class by class name

7.getqualifiedclassname--get the Full class name

8.getqualifiedsuperclassname--get the full parent class name

9.constructor gets the class based on the object, needs to be converted to object objects, otherwise the compilation does not pass
Example: Obj1.constructor
return: [Class Object]

Transferred from: http://bbs.9ria.com/thread-195841-1-1.html

AS3 class and class name judgment, acquisition, conversion, etc.

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.