Macromedia Flash Professional 8 UNLEASHED [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Macromedia Flash Professional 8 UNLEASHED [Electronic resources] - نسخه متنی

David Vogeleer, Eddie Wilson, Lou Barber

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید






Events of the Mouse Object


The mouse is one of the most frequently used objects for interactive interfaces because the most common ways a user interacts with Flash are with either the mouse or the keyboard.

Table 14.3 shows the events for the Mouse object.

Table 14.3. Mouse Events

Event Handler Methods

Action Description

onMouseDown

This event occurs if the user presses the mouse button on the stage.

onMouseUp

This event occurs when the user releases the mouse button over the stage.

onMouseMove

This event occurs when the user moves the mouse over the stage.

onMouseWheel

This event occurs when the user uses the mouse wheel.

Now that you've seen all the events for the Mouse object, here is an example using the addListener() method and the onMouseWheel event.

Here is the code block used to detect the mouse wheel:


//create the listener object
var wheelListen:Object = new Object();
//create the event
wheelListen.onMouseWheel = function(amount){
trace(amount);
}
//add the listener to the Mouse object
Mouse.addListener(wheelListen);

In this code block, we create a listener object. Then we create the event-handling method for listening to the mouse wheel. Notice that you pass the event-handling method a parameter. The amount parameter is a numerical value representing which direction the mouse wheel is spinning, and at what speed. We send this numerical value to the Output panel with the trace function. After that, we add the listener to the Mouse object.

Now when you test the movie, if the event doesn't fire when you spin the wheel, click the stage once to make sure it has focus. When the mouse wheel spins, you will see negative and positive numbers in the Output panel.

The other object that is most often used for user interaction is the Key object.


/ 318