A little suggestion for all ActionScript Beginners Classic _flash as

Source: Internet
Author: User
Tags mixed advantage
Statement: This article I will be serialized in the form of irregular updates, interested friends can always pay attention to.
This article allows to reprint, but please specify: Author: jinni, Source: Classic Forum


(04.26.2004)
In the forum when the owner time is long, often encounter a friend to ask such a question: I am a rookie, ask the Master, as in the end how to learn? I think I am not a master, but three years as programming experience, how many can be counted as half veteran (should be blue that sentence: No rookie and Master of the points, only novice and veteran of the other), the reason so to say, is to first show the position, in the online mix These times, the domestic as the top master I mostly still know, Self-Knowledge is not yet qualified with them, the reason why this article is shameless, it is not bear to see many beginners because of the lack of learning the road and hard groping or simply give up, the article is described in the author's personal humble opinion, there are defects welcome to explore. In addition, thanks to AOL, he provided some important information that was used in the article.


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 keywords in this sentence: one, 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, then as the introduction will become very easy. Ii. script: This shows that 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. "Compile" before "explain" is not superfluous, the benefits of compilation are mainly three: first, after the compiled source code, to label (called "Object Code") in the form of the existence, more easily by Flash Player recognition, so can improve the interpretation speed. Second, the compilation process can be detected in the program syntax errors, and give appropriate error information, convenient debugging. Third, the compilation process is also the process of code compression, compiled code 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:
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7 this.alt= ' Click here to open new Window\nctrl+mouse Wheel to zoom in/out ';} ' Border=0>
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. (All I'm saying is that for the original English version, for a qualified reader, you should read the English version as much as possible.) It doesn't matter if English is bad, look at http://bbs.blueidea.com/viewthread.php?tid=799443
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
In 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 somewhat 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: first, introductory guidance. Second, 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://bbs.blueidea.com/viewthread.php?tid=1177438 and then the third chapter: Flash basis, it 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 think the book is too expensive:).
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, two, 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.

(05.02.2004)
Seven, the wisdom of questioning
Discussed in front of so many technical problems, you look tired, I also write boring, learning itself is not only to learn a skill, but also to master a skill, this time we will talk about the skills of questioning. In fact, I would like to write such a topic is superfluous suspicion, because there is a very good article in-depth discussion of this issue, and I this section of the title is copied, suggest all people like to ask for help in the forum to read this article carefully: http:// bbs.blueidea.com/viewthread.php?tid=449319 maybe you saw me. This article has already felt some procrastination long, does not want to be painful once, does not matter, I can help you to summarize the article in the key, In combination with China's national conditions and the characteristics of the Flash forum, now check if you can do these requirements:
1. When to ask questions:First try everything to solve their own problems: Google, documents, forum highlights, sticky stickers, the most important: their brains. When none of the above tools can help you solve the problem, ask questions so that others don't think you're a slacker and just want to ask some stupid questions about your brain.
2. Describe your problem accurately:"Why doesn't my code work?" "Why does this effect not come out?" "It's usually hard to get a satisfying answer because people don't know what you're asking.
3. Use of the title: As a moderator, I can not come every time the forum has time to carefully browse every post, so, for such a title: "Help!" "The master comes in to see" .... I may have "priority" to ignore, I do not have so much curiosity to go to a check, but for "why can I use [] to refer to the object?" "The relatively clear title of this kind of relative expression, I usually give as much clarity as possible."
4. Respect for others: Remember: All the help you get in the forum is free, no one owes you anything, and you are not qualified to ask someone else to do anything for you. So, please do not have any urge mood, for example I just saw yesterday a title: "This is really very urgent!" I haven't even eaten dinner yet! "My first reaction was:" What does it matter to me that you haven't eaten dinner? "To modify your topic with something unrelated to the problem itself, is to urge the Masters to help you answer as soon as possible." You think three more "Hurry!" "Will let your questions get a quicker answer?" On the contrary, you may be reducing your chances of getting the answer. What I said just now is the emotional problem, and then the problem of the latter attitude cannot be unreasonable: "Someone can help me to make a xxx, do send to my mailbox, usually for such a problem, I will directly delete, if you are the boss, please let your subordinates to do, after all, you are to open wages to him.
5. About thanking: Today, whenever I am at home and abroad on the forum or even QQ group to get any form of help, I will not forget to say "thank you". This is the most basic courtesy, although China's "Thank you" is not as common as the English-speaking countries (in many English-speaking countries, it is a family term, for example, the mother handed a book to her son, the son will say "thanks,mom", but it seems in China's family rarely heard, It all seems to be a matter of course, but in any case, the help you get in the forum should be worth saying "thank you". Thanking you in time for a problem can help you build a good image and help you get better next time.
6. Self-Esteem: Before you talk about respecting others, maybe you think you've done it, but have you noticed another question that corresponds: Have you achieved self-esteem? Everyone wants to be respected, but if you can't be respectful to yourself, there's no one else to respect you. In recent years, there has been a series of domestic forums to make me loathe the extreme way of help, that is, "kneeling for" "Kneeling Xie" "Naked Beg" and so on. Kneeling is an extremely degrading act for the Chinese, is a kind of yielding, cowardly performance, perhaps you say I fuss, but look at the full screen of the "kneeling" "Snow naked to ask for" the title, I really can't help but think: Ask a question, with so cheap? I have never seen "kneeling for help!" in a foreign forum. Such a headline, even "help!!" This headline has been annoying (see the article I recommended earlier), why do people so "open"? My personal principle is: I have no problem with such a person, no matter what kind of questions he raises. Want to learn technology? Learn to behave first.
I know that the content of today's section may be controversial, I do not have any reservations in the text, very direct reflection of my personal views on some things, I only hope that every person reading this article understand, my purpose, just hope that you can better get help from the forum, that's all.
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.