Fully master as midpoint (.) The application of grammar

Source: Internet
Author: User
Tags expression
Syntax in the As scripting language we often see dots (.) An official description of the point syntax (operator) is as follows:

operator, which is used to locate a movie clip's hierarchy to access nested (child) movie clips, variables, or properties. The dot operator is also used to test or set the object's properties, execute the object's methods, or create a data structure.

The language above is more concise and not easy to understand.
In the Actionscrip scripting language, dot (.) A point is used to identify the associated properties and methods of a movie clip (MC) or object. It's simpler to say something like a slash syntax (the slash syntax is mainly used in older versions of Flash, such as: Flash3 Flash4 of course flash5++ also supports this slash syntax, the role of the slash syntax is to point to the variable, movie clips, the target path)
A point syntax is a target path that is used to point to a variable or movie clip, and its expression starts with the name of a movie clip or object, next to a small point, and then to the method, attribute, or variable to be specified, for a simple example:
_alpha is to get the transparency expression of a movie clip Lewimc._alpha is to get the transparent properties of a movie clip Lewimc, where _x is to get the horizontal axis of the movie clip's x, and the expression lewimc._x is to get the horizontal axis of LEWIMC this movie clip, The above 2 examples are relatively simple and easy to understand.

Let's take a look at this slightly more complex expression.
Lewi.from.china=true
This expression is to be understood with no as grammar, and English translation is very simple, but he has different meanings in as. The understanding of the above expression is:
The Chinese movie clip is a variable in from, and this from is nested in the movie clip Lewi.
The way to express a movie clip and object is the same, such as moving a LEWIMC movie clip's playhead can be written as a lewimc.play ();

In the point grammar there are 2 special "nicknames", respectively, _parent and _root. By literal means it is not difficult to see one is the parent time axis, one is the main time to go, we first introduced the first _parent

We agreed that LEWIMC be nested in the movie clip Lewi ' SFATHERMC If you want to tell Lewi ' sfathermc's movie clips on LEWIMC movie clips to stop playing, we should say _parent.stop ();
Note: This script is written on LEWIMC this movie clip.

The above basically is the detailed usage of the point grammar, perhaps everybody can think point grammar and slash the grammatical meaning of the department almost?
Why not use the slash syntax? Many script examples use the Telltarget action, I can see the slash syntax!

We have said that the slash syntax is mainly used in the old version of the Flashplayer, although the high version Flashplayer also support the slash syntax, but we do not recommend the use! In the slash syntax, the slash is substituted for the point. Such as:
worldMC.asiaMC.ChinaMC.lewiMC.my variable (point syntax) and
Worldmc/asiamc/chinamc/lewimc/my variable (slash syntax)
said the effect of expression is the same.

About point syntax is the basic knowledge that must be understood as script writing! I hope we all can master it.



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.