|
-
Guitar Tutor?
Hi there,
I'd like to build my own version of something like this, and customise the design:
Code:
http://www.chordbook.com/guitarchords.php
Has anyone seen any posts, or tutorials where I could get started from? I've got a good idea of the process, but little things like the way you can Drag and Drop the circles into position is something I've never done before...
Thanks to anyone who can point me in the right direction!!
-
Piece of cake. Drag and drop with snap, rough outline below. Good luck.
PHP Code:
var gridSize:Number = 10;
// Sets the size of the squares of the grid which the dots snap to.
stage.addEventListener(MouseEvent.MOUSE_DOWN, mousePressed);
function mousePressed(down:MouseEvent):void {
stage.addEventListener(MouseEvent.MOUSE_UP, mouseReleased);
down.target.startDrag();
}
function mouseReleased(up:MouseEvent):void {
stage.removeEventListener(MouseEvent.MOUSE_UP, mouseReleased);
up.target.stopDrag()
// These next lines handle the 'snapping'
up.target.x = Math.round(mouseX / gridSize) * gridSize;
up.target.y = Math.round(mouseY / gridSize) * gridSize;
}
----------------------------------------------------------------------1
5-------------3-------------2-------------1-------------0-------------0
-------0-------------0-------------0-------------0-------------0------0
----------------------------------------------------------------------0
3-------------2-------------0-------------0---------------------------2
--------------------------------------------------------3-------------3
-
Hi there... thank you! ...been stuck on something else so still not had chance to try this.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|