Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to convert AS2 and AS3 variables in Flex3

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Xiaobian to share with you how to convert AS2 and AS3 variables in Flex3, I believe most people still do not know how to, so share this article for your reference, I hope you have a lot of harvest after reading this article, let's go to understand it together!

Flex3 Tutorial AS2 and AS3 Variable Conversion

Conversion of variables

Similar to the changes in classes and methods, the protected,internal modifier has also been added to variables, which has the same effect as the same name modification of classes and methods, so it will not be repeated here. The final keyword cannot be used to modify variables, unlike Java, but instead a const keyword instead of var is used to identify constants, such as constN:int=100; similar to C/C++.

Another change is that AS3 introduces a new type *, * stands for arbitrary type (i.e. no type checking), although in AS3, variables and method return types can also be set undeclared, but FlexBuilder will warn, because AS3 is more static than AS2, so it is not recommended to omit type declaration, if you really need to do no type checking, then use *, such as vardynamicProperty:*;dynamicProperty will be assigned any type of value, functionmethod():* will be able to return any type of value.

◆ Another important point is that the initial values of variables in Flex3 tutorial are different from AS2, which should be careful when converting. For AS2, variables are equal to undefined before assignment, while in AS3, the initial values of different types are as follows:

Datatype

Defaultvalue

Boolean

false

int

0

Number

NaN

Object

null

String

null

uint

0

◆Flex3 tutorial does not declare the type (equivalent to * type)

undefined

Other types include user-defined classes.

null

Therefore, be careful here, int,Number,uint,Boolean and other variables will not have null or undefined values.

The above is "How to convert AS2 and AS3 variables in Flex3" all the content of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report