Tutorial: Instrument de desen in flash

1. Creati un nou document in flash, si selectati ca backgorund, culoarea negru.

2. Faceţi dublu-clic pe numele Layer 1, pentru ao modifica. Apasati Enter odată ce aţi tastat în noul nume!

3. Selectati primul layer si apoi apasati “F9″ si apoi scrieti codul de mai jos:

var drawingnerd Tutorial: Instrument de desen in flashoolean = false;
this.graphics.lineStyle(1, 0xFFFFFF);
this.graphics.moveTo(mouseX, mouseY);
this.addEventListener(Event.ENTER_FRAME, onLoop, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_DOWN, onDown, false, 0,
true);
stage.addEventListener(MouseEvent.MOUSE_UP, onUp, false, 0, true);
function onDown(evt:MouseEvent):void {
drawing = true;
}
function onUp(evt:MouseEvent):void {
drawing = false;
}
function onLoop(evt:Event):void {
if (drawing) {
this.graphics.lineTo(mouseX, mouseY);
} else {
this.graphics.moveTo(mouseX, mouseY);
}
}

Pentru a vedea ce a iesit, apasati “CTRL+ENTER”.

Cei ce nu au reusit, pot descarca sursa de aici
Rezultatul:

Filed Under: Tutoriale Flash

Tags: , , , , , , , , , , , , , , , , , , , , , , , , ,

About the Author

Un cretin!

Leave a Reply




If you want a picture to show with your comment, go get a Gravatar.

CommentLuv badge