Eliminating Bugs Before They Hatch

Trước khi loại bỏ lỗi Họ Hatch Viết code không phải là điều bạn muốn làm trong khi nửa ngủ. Như các bạn đã có thể có kinh nghiệm, Flash là không hề khoan nhượng khi nó diễn giải các tập lệnh bạn thêm vào một dự án. | Eliminating Bugs Before They Hatch Writing code is not something you want to do while half asleep. As you ve probably experienced Flash is unforgiving when it interprets the script you add to a project. Seemingly tiny errors such as a faulty line of script or even a misspelled word can have a damaging domino effect on the rest of the code in your project. These minor problems are experienced by scripters of all skill levels. Most problems can usually be solved by a tap on the Backspace key. But if errors are hidden deep inside your code you ll find yourself staring at it for hours pulling out your hair and yelling at your dog maybe even pulling out your dog s hair if things get really out of control . Sometimes the simplest problem can be the largest contributor to a stressful development cycle. One of the best ways to avoid many problems is to be aware of what they are. The following list shows some of the more common mistakes that all scripters make Omitting quotation marks in strings. Strings of text should always be identified with quotes. Misnaming variables functions and objects. As your project grows you ll need to keep track of more named items. It s a good idea to adopt a common naming convention based on your preferences. Some scripters use all lowercase letters and underscores to name variables such as my_variable and my_other_variable and in-fix notation where the first letter of the first word is lowercase while the first letter in subsequent words is uppercase for function names such as myFunction and myOtherFunction . Other scripters avoid using plural names completely they don t have to remember whether an element s name has an s at the end. Whatever naming conventions you adopt consistency is the key. Remember that ActionScript is case-sensitive so userName and username are not the same. Omitting quotation marks when comparing string values. When writing a condi tional statement the concept of using quotes to identify strings sometimes gets lost in

Bấm vào đây để xem trước nội dung
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.