Fully understand the application of the as dot (.) syntax

Source: Internet
Author: User

In the AS scripting language, we often see the official descriptions of vertices (.) On point syntax (operators) AS follows:

Operator; used to locate the hierarchy of video clips to access nested (child-level) video clips, variables, or attributes. The vertex operator is also used to test or set object attributes, execute object methods, or create data structures.

The above language is more refined and not easy to understand.
In the ActionScrip scripting language, a dot (.) is used to specify attributes and methods related to a movie clip (MC) or Object. To put it simply, it is similar to the slash syntax (the slash syntax is mainly used in earlier versions of Flash, for example, Flash3 Flash4. Of course, Flash5 ++ also supports this slash syntax, the slash syntax is used to point out variables, movie clips, and target paths)
The dot syntax is used to point to the target path of a variable or a movie clip. Its Expression is based on the name of a movie clip or object, followed by a small dot, and then the method to be specified, attribute or variable. For example:
_ Alpha is the expression used to obtain the transparency of a video clip (lewiMC. _ alpha is used to obtain the transparency attribute of the movie clip lewiMC. For example, _ x is used to obtain the x abscissa of the movie clip. The expression is lewiMC. _ x is used to obtain the abscissa of the lewiMC film clip. The two examples above are simple and easy to understand.

Let's take a look at this slightly complex expression.
Lewi. from. China = true
This expression must be understood without the AS syntax. English translation is very simple, but its meaning in the AS. syntax is different. The above expression is understood:
China Movie editing is a variable in from, and this from is embedded in the movie editing lewi.
The method for expressing a movie clip and an object is the same. To move the playback header of A lewiMC movie clip, you can write it as lewiMC. play ();

In the dot syntax, there are two special "sub-names": _ parent and _ root. It is not hard to see that one is the parent timeline, and the other is the master time, first, we will introduce the first _ parent

We agree that lewiMC is nested in the movie clip lewi 'sfathermc. If we want to tell lewi 'sfathermc that the movie clip is stopped on lewiMC, we should express _ parent. stop () like this ();
Note: This script is written on the lewiMC movie clip.

The above is basically the detailed usage of the dot syntax. May you want to point the syntax and the meaning of the slash syntax?
Why not use the slash syntax? I can see the slash syntax when tellTarget is used in many script examples!

As we have mentioned earlier, the slash syntax is mainly used in the Flash Player of earlier versions. Although the Flash Player of later versions also supports the slash syntax, we do not recommend it! In the slash syntax, the slash is replaced by a dot. For example:
WorldMC. asiaMC. ChinaMC. lewiMC. my variable (point syntax) and
WorldMC/asiaMC/ChinaMC/lewiMC/my variable (slash syntax)
The expression works the same.

The dot syntax is the basic knowledge that must be understood for AS scripting! I hope everyone 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.