I promised you the MouseEvent, here is a drawing movie illustrating the different event playing together.
http://www.contrechoc.com/flash/SimpleDraw.zip
The mouse is a very complex thing! All kinds of events are possible.
Here are several eventlisteners for the mouse:
- addEventListener(MouseEvent.CLICK, clickHandler);
- addEventListener(MouseEvent.DOUBLE_CLICK, doubleClickHandler);
- addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
- addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
- addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
- addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
- addEventListener(MouseEvent.MOUSE_WHEEL, mouseWheelHandler);
So a mouse is more complex than a key!
for instance the position, which can be found using the event like this:
function startDraw ( event:MouseEvent): void
{
var posX : Number = event.stageX;
var posY : Number = event.stageY;
}
used:
- for loop
- timer
- mouse event (in simpledraw)
Aucun commentaire:
Enregistrer un commentaire