mercredi 17 février 2010

FLASH scripting starter 3

Order and Chaos this time!

Loading a sequence of images in a for loop.
We learn how to put the timer to good use:

http://www.contrechoc.com/flash/orderANDchaos.zip

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 complex thing!

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);



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