Natives as introductory tutorials Grammar Chapter

Source: Internet
Author: User
Tutorials | Getting Started | grammar

As Grammar chapter

-----------------------------------

After reading my first tutorial--based on the basics--now do you have a certain idea of the existence of as? If not, then go and review it.

Aborigines series as Getting Started tutorial--Basic articles

The next thing I want to talk about is the syntax of AS.

The first thing to make people understand is that the case of as grammar is sensitive.

such as: gotoAndPlay () correct gotoandplay () error.

The spelling of the keyword must be consistent with the grammar, and it is easy to do so, because in the Flash's as panel, the keyword will have a different color display.

Many flash birds may want to start complaining, can't remember? I have a way here, is back. Do not shed the grievances of tears, we are all so come through. Use two more times and you'll remember.

Here, we want to start with a good habit of programming, such as after each statement with a semicolon, if possible, to add comments to complex statements. Example of an annotation:

This is a comment, but only one line

* This is also a note, can write a lot of lines * *

Next, introduce several types of syntax.

1. Several common methods of controlling the scene, such as:

play(); //让时间轴的指针播放

stop(); //停止时间轴的指针在程序触发时候的那个帧

gotoAndPlay(); //让指针跳转到某个帧,然后继续播放

gotoAndStop(); //让指针跳转到某个帧,停止在那个帧

nextFrame(); //往下走一帧

prevFrame(); //往前走一帧

The above are all methods.

Method? Solution: For example, we call eating food a way to solve the problem of starvation. We call Stop () a method to solve the problem that the time axis pointer stops. We call the above several things called methods, to solve the problem of the motion of the time axis pointer.

2, control the syntax of the property. There are many, I list a few

_x

_y

_alpha

_width

_name

..... And so on properties

The above are all attributes.

Property? The solution: to make an analogy. We call your height the attribute, which is used to identify your height. We call your weight the attribute, to identify your quality. We call the _x attribute, which identifies the x-axis coordinates of the target. We call the _alpha attribute, which is used to identify the transparency of the target .... I'm so wordy, alas.

3, control The syntax of the statement process, such as

if (条件){

//条件满足执行这里的代码

}else{

//条件不满足执行这里的代码

}

for(i=0;i <N;I++){ P <>

//执行这里的代码N次

}

while(条件){

//当条件满足时一直执行这里的代码

}

Wait a minute. These are the basic grammar and the basis of AS.

4, other methods and their own definition of the method.

Here I can not put all the grammar listed to introduce, because it is too much, specific reference to the flash with the Help manual. We can only be familiar with the application in the future. Here, you have a basic concept. At the back I would add a note to every sentence.

In retrospect, this is a minor thing to remember:

the case of the as grammar is sensitive.

The concept of the method.

the concept of a property.

adjourned



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.