TAILIEUCHUNG - Học Actionscript 3.0 - p 10

Removing Event Listeners Garbage Collection: A Recommended Optional Parameter for Event Listeners Garbage collection is the method by which Flash Player purges from memory objects that you no longer need. Garbage collection and memory management typically are not topics you need to concern yourself with when just getting started with ActionScript . However, garbage collection frees up memory so it’s available for your SWF to use throughout its runtime life, so it’s a good thing to be aware of. There are some coding practices that you can adopt immediately, and relatively painlessly—even at the outset of your learning—that may prove to be. | Removing Event Listeners Garbage Collection A Recommended Optional Parameter for Event Listeners Garbage collection is the method by which Flash Player purges from memory objects that you no longer need. Garbage collection and memory management typically are not topics you need to concern yourself with when just getting started with ActionScript . However garbage collection frees up memory so it s available for your SWF to use throughout its runtime life so it s a good thing to be aware of. There are some coding practices that you can adopt immediately and relatively painlessly even at the outset of your learning that may prove to be useful habits in the long run. Using weak references is such a practice. We want to just scratch the surface of this subject laying the groundwork for conventions that we ll use throughout the remainder of this book and then refer you to additional resources for more information. There are three optional parameters that you can add to the end of the addEventListener method. Here is the syntax of the method which will look partly familiar. The optional parameters we ll discuss are in bold. NAME eventResponse useCapture Boolean priority int weakReference Boolean The first two optional parameters control when the listener function executes. You may never need to adjust these values often but here s a quick snapshot of what they do. The first optional parameter useCapture allows you to handle the listener event before it reaches its target if set to true or once the event has reached its target if set to false and is bubbling back up through the display list. The default false behavior is to react to all events captured at or after the event reaches the target and this is the configuration you will use most of the time. Using true is akin to clicking on a button but capturing the event before it reaches the button. It will appear as if nothing happened. The only practical use of this feature

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.