Give some suggestions for all the ActionScript

Source: Internet
Author: User
Give some suggestions for all the ActionScript

Disclaimer: This article will be updated occasionally in the form of serialization. If you are interested, you can pay attention to it at any time.

This article may be reproduced at will, but please note: Author: jinni and its source

(04.26.2004)

After a long time in the forum, I often encounter a friend who asks this question: I am a cainiao. How can I learn? I can't think of myself as a master, but I have three years of as programming experience and can be considered as half a veteran (in the blue sentence: There is no cainiao or a master, it's only for beginners and veterans). The reason for this is to first show their positions and mix the time on the Internet. I know most of the top as experts in China, I know that I am not qualified to compete with them. The reason why I am not ashamed to write this article is that I can't bear to look at many beginners who are struggling to find the way to learn or simply give up. This article is my personal ignorance, if any defect exists, you are welcome to discuss it. In addition, I am very grateful to AOL for providing some important information in the article.

1. What is acionscript?

Open a technical book at will. In Chapter 1, most of the titles are "What's XXXX". To learn the same technology, you must first find out what it is. It is defined in the simplest sentence: As is a scripting language. There are two keywords in this sentence: 1. Language: All computer languages are connected (including assembly languages, intermediate languages, and advanced languages ), this means that if you have studied other computer languages systematically, getting started with as will become very easy. 2. Script: This indicates that as is an interpreted language (or scripting language ). It has the advantages of interpreted language: rapid development, dynamic nature, low learning threshold, and so on. At the same time, it also inherits the corresponding disadvantages: two main disadvantages are inefficiency and source code exposure. This is also a headache for Flash developers today. Low Efficiency means that flash cannot effectively complete some complex algorithms (for recursion, only 256-layer depth recursion is allowed in Flash ). When the source code is exposed, the copyright of the flash author cannot be effectively protected. many well-known decompilation software at home and abroad can render the program code in Flash nowhere. After all, flash as is a simple and powerful script language, superb as programming skills + Good artists + excellent creativity can create many amazing works: Brilliant special effects and interesting games, powerful network applications .... however, it all starts from the most basic to variables and functions (of course, if you have a programming Foundation, it should be another question ), the building is built with bricks and tiles, right?

Ii. interpretation? Compile type? Cross-platform?

Some may have noticed that when talking about the problem of Flash source code exposure, there was such a saying: "Many famous decompilation software .... ", that is," explanation ", why is" decompilation "? It's not what I did. The flash as is indeed implemented through interpretation. The tool used to interpret and execute is the flash player with a 98% browser share. However, before you give the source program to Flash Player for execution, you must go through a "Compilation" process, which converts the source code into a tag that can be recognized by FP ). These labels are compressed and stored in files in .swf format. Of course, a .swf file contains as, graphics, sound, and other resources. Before "interpretation", "Compilation" is not an extra step. There are three main advantages of Compilation: 1. the compiled source code is labeled (called the "target code ") it is easier to be recognized by Flash Player and thus can improve the speed of interpretation. 2. The compilation process can detect syntax errors in the program in advance and provide appropriate error information for debugging. 3. The compilation process is also the process of code compression, and the compiled code is simpler.

In this case, it is inappropriate to call as a pure explanatory language. We can classify it as a "hybrid" language. The feature of a hybrid language is that the source code is first compiled to generate an "intermediate code", and the intermediate code is interpreted and executed on the corresponding platform (Flash Player. Among the most popular mixed languages, the current popular Java language: the source code of the Java language (. java) after compilation, get the bytecode (. class), and the execution bytecode is interpreted by the platform (JVM. Unfortunately, this "Compilation" Process in hybrid languages is usually reversible. Both Java and flash can decompile the source code based on the intermediate code. In addition, the difficulty of decompilation SWF is much lower than that of class, and encryption is much more complicated during the compilation process. That is why flash decompilation software is rampant today.

Another advantage of Flash Player is that it provides cross-platform performance. No matter what platform, you can enjoy flash by having a browser embedded with Flash Player or an independent Flash Player, the SWF file itself does not need to be changed. The difference is that flash player is implemented on various platforms. This is also one of the reasons why it can be widely used in the Internet. Another example of flash, that is, projector, is a. EXE file. However, it should be noted that the flash released in projector mode does not have cross-platform capabilities. As long as you understand the principles of projector, you can easily understand this point. In fact, projector simply integrates an independent Flash Player and SWF file. As mentioned above, different platforms have different Flash Player implementations. Therefore, the SWF integrated into the projector cannot be played using different flash players, and thus its cross-platform nature is naturally lost. The real benefit of projector is that it allows machines without Flash Player to browse flash without installing FP. The effect is roughly equivalent to buying a DVD, but you do not have a DVD server. Therefore, vendors who sell CDs send you a DVD server for free. Of course, such a good thing cannot happen in reality.

3. Do I have to have a programming foundation when learning? Which language should I learn if necessary?

This is a frequently heard problem. As I mentioned earlier, if you have programming basics in other languages, learning as is very easy. But what if no? Is it difficult? The answer is no. In general, as is a relatively simple language, and you can even use it as your first step into the programming world. If you have C/Java/JS programming experience, you will find that as is only a subset of the knowledge you have learned and mastered. You only face different APIs, that's all. However, if your goal is to learn as, then you do not have to learn any other language for it, just as you want to understand that 1 + 1 = 2, the same is true for the study of 2 + 2 = 4. What you need to do now is to start from the basics. What is the basis? Variables, data types, operators, and so on are all the foundation. After learning programming for a while, I ++ and I are still unclear about the differences among a few. Don't underestimate them. The lack of strong understanding of basic concepts may cause a major headache for your future programming experience. At this time, you may need a book to help you. I strongly recommend the following book:


Seeing his cover, you will know that this book was published by the famous o'reilly company. Today, o'reilly's publications have become the standards of computer technology books. Seeing the logo of o'reilly is equivalent to seeing quality assurance. (I am only talking about the original English version. For qualified readers, read the original English version as much as possible. Good English does not matter, look at the http://www.blueidea.com/bbs/archive...asp? Id = 799443)

This book can be said to be an excellent entry-level book for flash ActionScript, which systematically describes all the basic content of As, including: variables, data and data types, original data types, operators, statements, conditional statements, cyclic control statements, functions, event and event processing, arrays, objects and classes.

Do not be intimidated by this pile of content. If you are smart, you should easily understand them. The purpose of learning is to use them. Therefore, the most important thing for you is to repeat the examples in the book to deepen your understanding. It is best to modify those examples and analyze the errors. In this way, you will find that your progress is faster or even faster than your imagination. Although you cannot make anything as you feel, this will lay a solid foundation for your future achievements. Some friends always do not pay attention to such basic training and think that creativity and thoughts are the most important. Indeed, I do not deny the importance of creativity in our work. But good ideas also need to be implemented based on the foundation, otherwise, you can only be a homesick.

4. Free is the best

As soon as the article was published in the afternoon, I received comments from friends in the Flash coders group. I thought that the recommended book, the official guide to ActionScript, is a little difficult for beginners. Indeed, maybe this book is not entirely suitable for beginners without any programming Foundation. The main reason why I recommend this book is that it is systematic enough to explain it step by step, it is also impressive to make full use of the code to thoroughly analyze many confusing concepts. Like thinking in Java, I never think this book is suitable for beginners of Java (even though I think it is not a beginner of Java, but I still cannot fully digest a lot of the content in the book), but whenever someone asks me which excellent Java books I have, I always think of it first. Therefore, we may be able to refer to the official guide to ActionScript as a review manual. When you have an overall impression of As, you can start to read this book, you may find many vulnerabilities you have learned in the past, or your doubts that have been around your mind are suddenly solved. However, who gives you this "overall impression "? More simple books? Introductory training courses? Here I want to say "free is the best". Although this sentence is not applicable to every corner, the help system provided with the Flash software is definitely qualified as the entry master. A lot of people look at the help systems of software and think that they only teach you how to install and uninstall software. This is a big misunderstanding, especially when you are using an IDE in a certain language, this misunderstanding is even more exaggerated. The Help System of flash can already be called a Bible. Beginners can solve almost all problems. Help is used in English, and help is used in English. Therefore, if you post "help" in a forum, it is better to seize the treasure-saving straw around you. What's more, there may be no reply to the forum post in three days, while the help system is on call.
The next question is, how can we better use help? According to my opinion, a complete help system has two main functions: 1. Entry guide. Ii. Tool books. Flash helps the system well complete these tasks. Taking the Help System of Flash MX 2004 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 are basically irrelevant to ActionScript. In the last three parts, the third and fifth parts are the best entry guide, and the fourth part is a complete as dictionary, which can be viewed at any time. For beginners of flash, you can ignore the components. Let's take a look at the ActionScript Reference Guide: Chapter 1 talks about some nonsense, and Chapter 2 is not designed for beginners, it outlines the changes in Flash MX to 2004 in the as aspect. If you are interested, you can take a look at my "2004 new feature instance tutorial ". Address: http://www.blueidea.com/bbs/newsdet...8&posts=current and the next chapter: Flash base, is the top priority. It involves data types, variables, and functions in the most basic syntax. When learning this basic knowledge, you must understand it and do not remember it. If you encounter some problems and need to find a solution to the problem by recalling them, it means that you cannot really understand the problem. How to deepen understanding? Only by adding more exercises, do not think that they are too simple. Behind the simple, there may be complicated ideas, even if it is an equal sign, it is also worth writing dozens of lines of programs to verify their role in different situations. In short, since it is the foundation, it is the same for anyone, it is not the kind of superstructure that needs to exert human imagination and creativity. Therefore, practice + summarization is the only way to learn basic knowledge. When you have a complete grasp of the AS basics, you can move on to a more advanced field.

(04.27.2004)

5. What time do you know?

The basics of learning are also tricky. For most concepts, they are relatively in line with people's thinking logic, so you can easily understand them, and it is not easy to confuse them; but for those who are new to the programming world, there are still some rules that are unfamiliar or even hard to understand. At this time, all you have to do is to learn and accept them. If you ride freely in this world regardless of these rules, I think the compiler will definitely look good to you.

The following are the points that you should pay attention to when learning the basic programming knowledge, which are representative at least. Check if you have mastered them:

1. identifier rules:

The rules here refer not only to those rules that are governed by the compiler's boss. They cannot start with a number, but can contain numbers, letters, underscores, dollar signs... and so on. It also contains some "folk" Conventions, such as variable and function names starting with lowercase letters, class names starting with uppercase letters, and constant names all use uppercase letters ..... if you do not comply with these conventions, the compiler will not light you on the red light, but it will cause your program to become less readable. This reminds me of the translation of thinking in Java, translated by Mr. Hou Jie, because he has neglected the reading habits of Chinese readers and created some new vocabulary, as a result, many readers throw eggs on the pretext (of course, I understand the main reason is that most readers think this book is too expensive ).

2. = and =

If you are in the first grade of elementary school, you can tell me the difference between "=" and "=" is the difference between an equal sign and two equal signs, but as a programmer, you should understand that they are not a category of things at all. "=" is a value assignment operator, and "=" is a comparison operator. So don't ask me again why such code is incorrect if (a = B) A = 1. However, I admit that when I first came into contact with the Program (C language), I also made many such errors and could not find the problem for a long time. When I found the error, I always blame myself for why I am so stupid. I would like to remind you that, if you still make such a mistake, it only means that you are more stupid than me.
3. Operator priority

A problem that is often overlooked! Indeed, it can completely avoid the troubles caused by priority in another way, that is, the frequent use of "()", through "() to determine the operation sequence of each step. As long as you are not afraid of trouble, you can do this and increase the readability of the program. But not all people like this. An old-qualified programmer is willing to use several operators with different priorities in a long string of expressions without any parentheses, this is a test of your understanding of the operator priority. However, using "()" to identify your operation sequence is not a bad thing or even worth recommending.

4. I ++ and ++ I

I have mentioned this issue in my previous article. Although it seems very simple now, it did bring us some troubles and this issue is also very common. To fully understand it, you can write several expressions that contain I ++ and ++ I, and then observe the operation result of the expression and the value of I. Soon, this will not be a problem for you.

5. Data Type Conversion

You may not often use data type conversion, but you should at least know their principles. Those conversions are implicit, and those conversions must be explicitly performed, in addition, data may be damaged. By understanding this, you can avoid some strange errors. Because the program problems caused by data type conversion are hard to be noticed.

6. Array

Strictly speaking, arrays are not a data type, but a data structure. This is a concept that deserves your attention. In practice, the array usage is much higher than other collection types or even some original types. You need to understand the various effective formats for constructing and initializing arrays, and you should also understand the two arrays. The combination of arrays and loop control may already work half of a complete program.

(04.28.2004)

6. Should beginners learn as1.0 or as2.0?

This problem is also very popular and frequently appears in the corner of the Forum. Then there will be "a group" (forgive me for using this word) divers who have never posted a post all the year round come ashore to show their fingers, and then rush to the bottom of the water. I don't know if only such a controversial topic can ask them to "raise their hands ", express their respective great ideas. However, before talking about this topic, it is really difficult for me to express my position clearly, I have to mention many terms that may not be heard by beginners, such as prototype, inheritance, and interfaces. My goal is to explain the differences between as1.0 and as2.0 so that I can draw my own conclusions on this issue. Finally, I decided to ignore the existence of those terms and draw a conclusion directly. If you are unconvinced, please verify it in practice. My conclusion is that as2.0 and as1.0 are essentially the same, but as2.0 is more strict and reasonable than as1.0, and more like a real object-oriented language. However, if you want to learn about as2.0 directly, you have to understand the object-oriented programming concepts you may have never touched before while facing a bunch of unfamiliar APIs. This may be disastrous for some beginners because they may be intimidated by too many unknown factors. Therefore, my suggestion is to study as1.0 according to the syntax specification of as2.0, which means that you should first ignore everything related to custom classes and interfaces in as2.0, only pay attention to the APIS provided by flash, but you also need to comply with the new syntax specifications introduced by as2.0, including strong type, Case sensitivity, and so on. There are two advantages for doing so: 1. Beginners will not be troubled by API and design concepts at the same time. 2. They are used to the syntax specifications of as2.0, laying a solid foundation for the transformation from as1.0 to as2.0 in the future. (Many people ask why the Program executed in Flash MX has become faulty in Flash MX 2004? That's why you didn't notice a change in the syntax specification of as2.0 ).

Some may ask, since as1.0 and as2.0 are essentially the same, why don't we need to learn object-oriented ideas before learning as1.0? This is because the design concept of as1.0 contains two branches: Object-oriented and process-oriented. These two branches are "Cross. In most as1.0 programming, we pay close attention to the process-oriented branch, while the object-oriented branch is implemented by flash (with movieclip as the core) cleverly and implicitly implemented. I know many people will be dizzy here. Don't worry, I will give you a satisfactory explanation in my serialization.

(05.02.2004)

VII. Wisdom of inquiry

I have discussed so many technical questions before. If you are tired of reading them, I am also bored. learning is not only about learning a certain skill, but also about mastering a skill, this time, let's talk about the questioning skills. As a matter of fact, I am writing such a topic without having to draw a snake, because I have already discussed this issue in an excellent article, the title of this section is still intact. I suggest you read this article carefully for all those who like to seek help on the Forum: http://www.blueidea.com/bbs/newsdet...9&posts=current maybe you see me this article has felt a long drag, don't want to suffer again, it doesn't matter, I can help you summarize the key points in the article, in addition, considering China's national conditions and the characteristics of the flash Forum, check whether you can:

1. When should I ask a question:First, try to solve the problem by yourself: Google, documentation, Forum excellent posts, top posts, and most importantly: your own brain. When none of the above tools can help you solve the problem, you can ask questions again, so that other people will not think you are a lazy, just like to raise some stupid questions that cannot be passed by the brain.

2. accurately describe your problem:"Why does my code not work ?" "Why is this effect amazing ?" Such a question is often difficult to get a satisfactory answer, because others do not know what you are asking.

3. Make full use of titles: As a moderator, it is impossible for me to carefully browse every post every time I come to the Forum. Therefore, for such a title: "Help !" "Let's take a look ".... I may ignore "priority". I don't have to be so curious to find out, but why can I use [] to reference objects?" The title of this type of relative statement is as clear as possible.

4. Respect for others: Remember: all the help you get on the forum is free of charge. No one owes you anything, and you are not qualified to ask others to do anything for you. Therefore, please do not have any urge, for example, the title I just saw yesterday: "This time is really very urgent! I haven't even eaten dinner yet !", My first response was: "Have you ever eaten dinner ?", Modify your topic with something irrelevant to the question itself. It is nothing more than urging experts to answer your questions as soon as possible. You think you should write three more "Urgent !" Will your questions be answered faster? On the contrary, you may be reducing your chances of getting answers. What I just talked about is a sentiment issue, which makes it even harder to say: "Can someone help me make a XXX and send it to my mailbox, I will delete it directly. If you are the boss, please let your owner do it. After all, you have to pay for it.

5. Thank you: Today, whenever I get help in any form on domestic and foreign forums or even QQ groups, I will not forget to say "thank you ". This is the most basic courtesy, although "thank you" in China is not as common as "thanks" in English countries (in many English countries, thanks is a common language in the family, for example, a mother handed a book to her son, the son would say "thanks, Mom", but it seems that it is rarely heard in Chinese families, and it seems that all of this is taken for granted), but in any case, the words "thank you" should also be worth your help in the Forum. After resolving the problem, you can promptly Thank you for setting up a good image and helping you get better help next time.

6. Self-esteem: I talked about how to respect others. Maybe you think you have done it, but have you noticed another problem: have you achieved self-esteem? Everyone wants to be respected, but if you cannot respect yourself, it is impossible for others to respect you. In recent years, there have been a series of helpless ways on domestic forums, such as "Kneeling", "Kneeling", and "naked. For the Chinese, kneeling is a type of act that has a very bad identity, and is a kind of submission and weak performance. Maybe you say that I am making a huge fuss, but looking at titles such as "Kneeling", "ice, snow, and neighborhood" on a full screen, I can't help but wonder: Ask a question, is it so cheap? I have never seen "kneeling for help!" on Foreign Forums !" Such a title, or even "Help !!" This title is already objectionable (see the article I recommended earlier). Why are chinese people so "open "? My personal principle is: no matter what problems he raises, I will ignore such a person. Want to learn technology? Learn how to behave first.

I know that the content of today's section may be controversial, and I have not made any reservation in this article, which directly reflects my personal views on some things, I only hope that everyone who reads this article will understand my purpose, but hope that everyone can better get help from the Forum, that's all.

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.