Learning a skill, a more systematic approach is still books. Sometimes, however, provide examples of tutorial books and did not recommend a good programming practice to make the reader take a lot of detours. 7yue this blog is ActionScript3 programming books on some common scenarios to describe the problem.
Contact ActionScript3 programming now more and more fans, they can choose from different angles to learn ActionScript3 Programming: books, tutorials, blog, open source projects and so on. I recently found an interesting phenomenon, that is the part of the tutorial AS3 there exists a small problem is that when providing Mouxie examples for beginners and tutorials, these elements are not from the good start programming experience or habit, but send expect to learn in the future, then understand better, more worthy of the methods used, I wonder why a lot of tutorial or article can not start to provide the best practices relevant content for aficionados? This not only improves the learning efficiency, but also to reduce the learning detours.
For example, the following snippet of code from one of the O'Reilly books
The code book to let developers know AS3 SWF in the treatment of priority is greater than the visual effect, then, on the first section of the code used to illustrate this:
for (var i: int = 0; i <50; i + +) (myClip.x + = 2;)
To illustrate this code in the loop, MC's position would not in accordance with the for loop, as presented x coordinate of the sliding scale, but a direct jump to the end of the last cycle of the location of x coordinates go, this is actually no problem, but The following code, it is said that developers can use Event.ENTER_FRAME event to trigger a listener function, the listener function to deal with the movement of a MC.
myClip.addEventListener (Event.ENTER_FRAME, slideClip); function slideClip (evt: Event): void (if (myClip.x <100) (myClip.x + = 2;) else (myClip.removeEventListener (Event.ENTER_FRAME, slideClip) ;))
Developers time to learn the code, especially beginners, will have a profound impression on the Event.ENTER_FRAME reason that, as his learning curve, since for AS3 in the dynamic treatment for the MC, they will naturally will continue to use ENTER_FRAME, even keep the place in which various processing mechanisms. The result is obvious, a large number of application performance and flexibility with problems, perhaps after some long period of time, to hear Youjiangzuoshui, ENTER_FRAME is a style of programming is not recommended, but recommend us to spend a statement like Timer and so on .
Similar tutorials nothing wrong with the content itself, in order to demonstrate a feature or features, using the most easy way to illustrate the problem, if it is a pre-sales engineer, then this method is perfect, if it is for readers and to learn who this method sufficient to constitute, and does not consider learning costs and efficiency, as it led directly to the developers of common programming Fang Shi, Zhi Dao developers have accumulated some experience, or is paid a certain amount of Daijiazhihou , will find a better way, more of the performance to achieve the same results. So, if writing a book or tutorial, I think the better thing is to take account of the costs and curves of learners, not to achieve their objectives, and allow learners to obtain a practical and desirable approach.
I remember before I discovered this problem in MSDN, the existence of a large number of code and examples, the results used later, it was found is very good and the price of content, I thought, Why not I have to tell me when to learn a better method?