Getting started as a beginner's guide

Source: Internet
Author: User
Tags arrays execution key words mixed new features variables reference advantage
Beginner One, what is Acionscript?

Open a technology book, the first chapter of most of the first section to "What ' xxxx" to do the title, to learn the same technology, of course, the first to find out what it is. Define the simplest sentence: As is a scripting language. There are two key words in this sentence:

1. Language: All computer languages are interlinked (including assembly language, intermediate language, advanced language), which means that if you have been systematically learning some other computer language, as getting started will be very easy.

2. Script: This means that the as is an interpreted language (or scripting language). It has the advantages of interpretive language: rapid development, dynamic, low learning threshold, etc., and it also inherits the corresponding disadvantages: The main two disadvantages are inefficiency and source code exposure. This is also the current flash developers extremely headache two problems, inefficient, meaning that the flash can not effectively complete some complex algorithms (the return of the word, flash, only allow 256-level depth of recursion). But the source code exposes, then lets the flash author's copyright not to obtain the effective protection, at home and abroad many famous decompile software can let the flash in the program code nowhere to hide. Nevertheless, after all afterward, Flash as is still an easy-to-use, powerful scripting language, superb as programming skills + good Art + excellent creativity can create a lot of stunning works: Gorgeous special effects, interesting games, powerful network applications .... However, all this is to start from the most basic to such as variables, functions (of course, if you have the basis of programming that is another matter), in the magnificent building is also brick building up, isn't it?


Second, explanatory type? Compile type? Cross platform?

Perhaps a friend noticed that just when the flash source code exposed, there is such a word "many famous decompile software ...", that is, "interpretation", and why "decompile"? I did not say that, flash as is indeed explained by the implementation of, and used to explain the implementation of the tool, is well-known, with 98% browser share of Flash Player. However, before you trust the source program to Flash Player for execution, you must go through a "compile" process that converts the source code into a tag (tag) that can be identified by the FP. These tags are compressed in a zip way in a file stored in the. swf format. Of course, a. swf file contains as, as well as graphics, sounds, and other resources. "Compiling" before "explain" is not superfluous, and the benefits of compilation are three:

1. The compiled source code, in the form of tags (called "Object Code"), is easier to be identified by Flash Player, thus improving the interpretation speed.

2. The compilation process can detect the grammatical errors in the program beforehand, and give the appropriate error information to facilitate debugging.

3. The compilation process is also the process of code compression, and the compiled code is more streamlined.

In that sense, it would be improper to call the as a pure interpretive language, and we could classify it as a "mixed" language. The characteristic of hybrid languages is that the source code is compiled first, generating an "intermediate code" that is interpreted by the corresponding platform (Flash Player) to perform the intermediate code. The best of mixed language is now the same fiery Java language: source code (. java) of the Java language is compiled, resulting in bytecode (. Class), which is interpreted by the platform (JVM) to interpret the execution byte code. Unfortunately, this kind of "compile" process for mixed languages is usually reversible, both Java and Flash, which can be recompiled to source code based on their intermediate code. Also, the difficulty of decompile SWF is far less than class, and in the process of compiling encryption is much more complex, which is why the flash decompile software rampant reasons.
Another advantage of Flash Player is the cross-platform, no matter what platform, as long as the built-in Flash player browser or stand-alone Flash Player player, you can enjoy flash, and the SWF file itself does not need any changes, The difference is only the way Flash Player is implemented on each platform. This is one of the reasons it can be widely used in the Internet. Maybe some friends think of another way to play Flash, that is, the projector way, usually we see an. exe file. It should be noted, however, that Flash, published in projector mode, does not have cross-platform capabilities. As long as you understand the principle of projector, you can easily understand this, in fact, projector is simply a standalone Flash Player player and SWF file integration, mentioned above, different platform Flash Player implementation is different, therefore, The SWF that is integrated into projector cannot play with different flash players and naturally loses its cross-platform nature. The real advantage of projector is that the machine that doesn't have Flash player can browse flash without having to install FP. The effect is roughly the equivalent of buying DVDs, but you don't have a DVD player, so the CD vendor delivers you a DVD player for free. Of course, there is no such good thing in reality.

Learning as needs do not need to have a programming base? If you need to, you should learn that language?

This is a question that is often heard. As I mentioned earlier, if you have a programming base in other languages, learning as will become a very easy task. But what if it doesn't? Is it going to be difficult? The answer is in the negative. In general, as is a relatively simple language, even you can use it as a first step into the world of programming. If you have C/JAVA/JS programming experience, you will find as just a subset of the knowledge you have learned and mastered, and you face only a different API, that's all. However, if your purpose is only to learn as, then you have no need to learn any other language for it first, it is like you in order to understand 1+1=2, and Dickens to study 2+2=4, put the cart before the horse. All you have to do now is start from the basics. What is the basis? variables, data types, operators and so on are basic, learned a period of time programming but still do not know the difference between i++ and ++i a few people. Do not underestimate them, the basic concept of the weak grasp, may be the future of your programming experience caused great trouble, is called Sink, Shan. At this time, you may need a book to help you, I strongly recommend the following book:

When you see his cover, you know this book is published by the famous O ' Reilly company. Now, O ' Reilly's publication has become the standard of computer technology books, see O ' Reilly's logo, is equal to see the quality assurance.
This book is the perfect primer for Flash ActionScript, which systematically describes all the basics of as, including variables, data and data types, raw data types, operators, statements, conditional statements, loop control statements, functions, event and event handling, arrays, Objects and classes, and so on.
Do not be intimidated by this mass of content, smart you should be easy to understand them, the purpose of learning is to use. Therefore, the most important thing for you is to follow the example in the book again to deepen understanding, preferably to modify those examples, and to analyze the errors that occur. In this way, you will find that your progress is faster or more than you can imagine, even though you are not able to make something like it now, it will lay a solid foundation for your future achievements. Some friends always do not attach importance to such basic training, think the creativity, thought the most important, admittedly, I do not deny the importance of creativity in our work, but good ideas, but also need to achieve the basis, otherwise, you can only be a visionary.

Four, Free is the best?

The afternoon article just published, I received the comments of the Friends in Flash coders Group, think I recommended the book "ActionScript Authoritative Guide" for beginners, the difficulty is a bit big. Indeed, perhaps this book is not entirely suitable for beginners without any programming foundation, so the main reason why I recommend this book is that it is systematic, methodical, and makes full use of the code to analyze a lot of confusing concepts more thoroughly and impressively. Like "Thinking in Java", I never thought this book was suitable for Java beginners (today, although I think I'm not a Java beginner, I still haven't been able to digest much of the book), but whenever someone asks me what good Java books are, I was always the first to think about it. So, maybe we can take the ActionScript Authority Guide as a review manual, and when you have an overall impression of as a, and then pick up the book, you may find many of the past gaps in learning, or have been coiled in your heart of the doubts have suddenly been solved. However, who will give you this "overall impression"? A more superficial book? Introductory training course? Here I would like to say is "Free is the best", although this sentence does not apply to every corner, but here, flash with the software attached to the Help system can definitely be qualified to master this role. Many people underestimate the software's help system, think they just teach you how to install, how to uninstall, this is a big misunderstanding, especially when you are using a language of the IDE, this misunderstanding is even more exaggerated. Only in the Flash's help system, it can be called a Bible. Beginners can solve almost all problems from it. "Help" in English is helped, "help" English is also helps, so, if you have in the forum to shout "Help" time, it is better to seize the side of this amount of straws. What's more, forum posts may not be answered for three days, and the Help system is on call.
The next question is, how do you better use help? According to the author's opinion, a perfect help system has two main functions:
1. Introductory guidance.
2. Reference books.

Flash's Help system completes these tasks well. Take the Flash MX 2004 Help system as an example, the entire system is divided into five parts: Getting Started with flash,using flash,actionscript Reference guide,actionscript Dictionary,using components, the first two parts have nothing to do with ActionScript, not with consideration. In the latter three sections, the third and part five are the best introductory guides, and part fourth is a complete as dictionary that can be consulted at any time. For Flash beginners, you can ignore the part of the component (components), let's look at ActionScript Reference Guide: Chapter One tells some nonsense, chapter two is not designed for beginners, it outlines the flash MX to 2004 in the as aspect of the change, interested friends can look at my "2004 New features instance Tutorial". Address: http://www.flashempire.com/school/tutor.php?author=jinni and then chapter Three: Flash Basics, is the most important. It starts from the most basic grammar, has involved in data types, variables, functions and so on, in the learning of these basic knowledge needs attention, to understand, do not remember. If you encounter certain problems and need to rely on memory to find a solution to the problem, then you can not really understand the problem. How to deepen understanding? Only practice more, do not think they are too simple, simple behind may contain complex idea, even an equal sign, it is worth writing dozens of lines of procedures to verify its role in different situations. In short, since it is the foundation, it is the same for anyone, it is not the superstructure that needs to develop the human imagination and creativity. Therefore, Practice + summary is the only way to learn basic knowledge. When you have a more complete grasp of the as foundation, you can go to the higher realms.


(04.27.2004)
Five, you should know the time
Learning Foundation is also a knack, for most concepts, are relatively consistent with human thinking logic, so you can easily understand them, and not easily confused, but for the first into the programming world of friends, there are still some rules are unfamiliar, even difficult to understand. At this time, all you have to do is to learn and accept them, if you disregard these rules and free to gallop in the world, I think the compiler will certainly give you good.
Here are some of the main points that I've summed up when learning the basics of programming, which is exhaustive, but at least fairly representative. See if you have mastered them skillfully:

1. Rules of Identifiers:
The rules here are not just those governed by the compiler: You can't start with numbers, you can include numbers, letters, underscores, dollar signs ... Wait a minute. Also includes some "folk" conventions, such as variables, function naming begins with lowercase letters, class names begin with uppercase letters, and constant names use uppercase letters and so on. If you do not follow these conventions, the compiler will not light a red light on you, but will cause your program to be less readable. This reminds me of Mr. Houtie, the author of Thinking in Java, by ignoring the reading habits of mainland readers, and creating some jerky vocabulary, many readers use this as an excuse to throw eggs (but I understand that the main reason is that most readers dislike the book too much).

2.= and = =
If you are in grade one, you can tell me that the difference between "=" and "= =" is the difference between an equal sign and two equals, but as a programmer, you should understand that they are fundamentally not a class of things, "=" is an assignment operator, and "= =" is the comparison operator. So don't ask me if (a=b) a=1; Such code is wrong. But I admit that at the beginning of the process (c), I have made a number of such mistakes, and for a long time can not find the problem, until the discovery of mistakes, and always blame themselves why so stupid. I am particularly reminding you of this, and if you still make such a mistake, it will only show that you are more stupid than I am.

3. Operator Precedence
A problem that is often overlooked! Indeed, it can be done in a different way to completely avoid the problem of prioritization, which is to use "()" frequently, to determine the order of operations for each step by "()". As long as you are not afraid of trouble, you can do so, but also increase the readability of the program. But not all people like this, a veteran programmer is usually willing to use a number of different precedence operators in a long string of expressions and does not contain any parentheses, which is a test of your mastery of operator precedence. But anyway, using "()" to clarify your order of operations is not a bad thing, even worth recommending.

4.i++ and ++i
I have already mentioned this in the previous article, although it seems so simple now, but it did bring some trouble to us, the problem is very common. The way to fully understand it is to write several expressions that contain i++ and ++i, and then observe the results of the expression and the value of I. Soon, this will not be a problem for you.

5. Data type Conversion
You may not use data type conversions very often, but you should at least know how they work, those conversions are implicit, and those transformations must be done explicitly, and can cause data corruption. Knowing this can help you avoid some of the strangest mistakes. Because the program problems that are usually caused by data type conversions are difficult to detect.

6. Array
Strictly speaking, an array is not a data type, but a structure. This is a concept worthy of your careful study. Because of the actual application, the usage of the array is much more than that of other collection types and even some original types. You need to understand the various valid formats for constructing and initializing arrays, and you should also have an understanding of two-bit arrays. Array and loop control may already work together in half of a complete program.


(04.28.2004)
Should beginners learn AS1.0 or AS2.0?
This question is equally popular, appearing frequently in the corner of the forum, and then there will be "a bunch" (excuse me to use the word) the divers who have not seen a post all year have floated ashore to point a finger, and then hurried to the bottom, and I wonder if it is only this controversial topic to ask them to "self-cut", Express their great ideas, but before we talk about it, it really makes me feel awkward, because to make it clear, I have to mention a lot of terms that may have been unknown to beginners, such as prototypes, inheritance, interfaces, and so on. My purpose is simply to elaborate on the differences between AS1.0 and AS2.0 in order to launch my own conclusions on this issue. Finally, I decided to ignore the existence of those terms, to give a direct conclusion, if you can not be convinced, please in practice to verify the good. My conclusion is: AS2.0 and AS1.0 are identical in nature, but AS2.0 is more rigorous than AS1.0, more reasonable and more like a real object-oriented language. However, if you are going to learn AS2.0 directly, you have to understand object-oriented programming ideas that you may never have encountered while facing a host of unfamiliar APIs. This may be disastrous for some beginners because they may be intimidated by too many unknown factors. Therefore, my advice: to learn AS1.0 by AS2.0 Grammar, it means: you should ignore everything in AS2.0 that is related to custom classes, interfaces, and focus on the API provided by Flash, but at the same time you need to comply with the new syntax code introduced by AS2.0, including the strong type, Case sensitive and so on.

There are two advantages to doing this:

First, beginners will not face the problem of API and design concept at the same time.
Second, accustomed to the AS2.0 of the grammatical norms for the future from the AS1.0 to AS2.0 transformation lay a good foundation.

(Many people ask why a good program executed in Flash MX has gone wrong in Flash MX 2004?) This is when you don't notice that AS2.0 's grammatical specifications have changed.
Perhaps some friends will ask, since AS1.0 and AS2.0 are the same in nature, then why do we not have to learn AS1.0 before learning object-oriented thinking? This is because: AS1.0 's design thought includes object-oriented and process-oriented two branches, these two branches are "cross". In most AS1.0 program design, we attach importance to its process-oriented branch, while the object-oriented branch of the flash itself by the mechanism (to MovieClip as the core) ingenious, implicit implementation. I know a lot of people see here will faint, don't worry, I will continue in my series to give you a satisfactory explanation.



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.