TAILIEUCHUNG - Using Local Variables and Creating Functions that Return Results

Sử dụng các biến địa phương và tạo Chức năng đó trở lại Kết quả Các biến bạn đã tạo và được sử dụng cho đến nay có thể được truy cập bất cứ lúc nào bởi bất kỳ kịch bản trong phim Flash. Ngược lại, các biến địa phương là các biến đặc biệt bạn có thể tạo và sử dụng chỉ trong phạm vi một định nghĩa chức năng. | Using Local Variables and Creating Functions that Return Results The variables you ve created and used so far can be accessed at any time by any script in the Flash movie. In contrast local variables are special variables you can create and use only within the scope of a function definition. In other words a local variable is created within the function definition used by the function when it s called then deleted automatically when that function has finished executing. Local variables exist only within the function where they are created. Although local variables are not absolutely required in ActionScript it s good programming practice to use them. Applications that require many and frequent calculations create a lot of variables and will slow applications over time. By using local variables however you minimize memory usage and help prevent naming collisions which occur when your project gets so big you unknowingly create and use variable names that are already in use. However local variables in one function definition can have the same names as local variables within another function definition even if both definitions exist on the same timeline. This is because Flash understands that a local variable has meaning only within the function definition where the variable was created. There is only one way to create a local variable manually and you have been using this syntax for four lessons. Here s the syntax var myName String Jobe This variable becomes a local variable by simply being declared within a function definition using the keyword var. To better grasp this concept consider this example. In the previous exercise we declared created the variable currentChannel on Frame 1 of the main timeline using the following syntax var currentChannel Number Because the line of script that created the variable was on Frame 1 of the main timeline and it didn t exist within a function definition currentChannel became a variable of the main timeline. If we place this exact

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.