Practical tips for naming variables

Source: Internet
Author: User
Variables | tips

Usually in writing actoinscript, always look forward to some corner of this hint or something. Lest you think of some common words.
Actually there are a lot of tricks.
As an example:
If you want to enter a MovieClip instance name, you can then get code hints for common properties
such as:. _currentframe. _alpha. _x Unloadmovie (), etc.
As a general method, you can declare this instance to be named the movie clip, as follows:

var movie:movieclip//Disclaimer movie for movie clips

Then after you enter: Movie.  Instance name + "." A code hint will pop up
But now you don't have to declare it.
It's a good idea to name a variable (or instance name) as a [*_ variable type abbreviation ] format.
As long as you change the movie clip's instance name to: MOVIE_MC can use the same effect as above
In the Actions panel, enter the MOVIE_MC. //Instance name + "." A code hint will pop up
Similarly, MovieClip uses _MC, and other types are shown below
Movie clips: MovieClip => _MC
Buttons: Button => _btn
Character: String => _str
Text: Text => _txt
Arrays: Array => _array
More can be found in the help document from the standard wording
Note: One of the benefits of writing this way is to improve the readability of your code, and you can see the type of the variable at a glance.
Author: Wood (13tds@163.com)
http://bbs.flash8.net/blogs/mutoo/
Reprint please indicate the source



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.