Tải bản đầy đủ (.pdf) (2 trang)

What Event Handlers Do

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (8.71 KB, 2 trang )


< Day Day Up >

What Event Handlers Do
Many computer programs allow users to accomplish tasks by dragging and dropping
items on the screen, resizing windows, making adjustments with sliders, and creating
artistic masterpieces using "virtual" art tools—all modes of interaction determined by the
way in which the software has been programmed to deal with various events (mouse
presses, mouse movements, keyboard input, and so on).
Event handlers orchestrate your movies' interactivity by controlling when scripts are
triggered. They provide a "when" to a script so that it executes only when something
specific occurs. Every script in your movie is triggered by an event—a user rolling over a
button or pressing a key, your movie's timeline reaching a certain frame, and so on.
In ActionScript, event handlers (with the exception of frame events) usually represent the
first lines in a script. For example:

When this happens (event) {

do this;

do this;

}


Frame events occur when the timeline reaches a frame that contains a script. When you
place a script on a frame, you don't need to identify a frame event to trigger that script
because the timeline reaching the frame is enough to cause it to execute. If the script were
placed in a frame, it would look like this:

do this;



do this;


The better you understand event handlers, the more control you'll have over the user's
experience. By using event handlers properly, you can create immersive environments
the user will enjoy.

< Day Day Up >

Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×