tailieunhanh - Using ActionScript in Flash-P2

Tham khảo tài liệu 'using actionscript in flash-p2', công nghệ thông tin, đồ họa - thiết kế - flash phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Instance variables follow static variables. Write the public member variables first and follow them with private member variables. Following the public and private member variables add the constructor statement such as the one in the following example public function UserClass username String password String . Finally write your methods. Group methods by their functionality not by their accessibility or scope. Organizing methods this way helps improve the readability and clarity of your code. Then write the getter setter methods into the class file. In general only place one declaration per line and do not place either the same or different types of declarations on a single line. Format your declarations as the following example shows var prodSKU Number product SKU identifying number var prodQuantity Number quantity of product This example shows better form than putting both declarations on a single line. Place these declarations at the beginning of a block of code enclosed by braces . Initialize local variables when they are declared unless that initial value is determined by a calculation. Declare variables before you first use them except in for loops. Avoid using local declarations that hide higher level declarations. For example do not declare a variable twice as the following example shows var counter Number 0 function myMethod for var counter 0 counter 4 counter statements This code declares the same variable inside an inner block which is a practice you should avoid. The following example shows the organization of a simple class class private var m_username String private var m_password String public function UserClass username String password String username password public function get username String return public function set username username String Void username public function get password String return public function set password password

TỪ KHÓA LIÊN QUAN