Happy New Year everyone,
I'm trying bits of code to come to terms with AS3 within KM7. Eventually this will be used for students to move the arms of a clock to the correct time. Later in another project I want to move one arm to a specific angle for maths.
The problem is the mc rotates from the middle not the end and it needs to also go backwards.
Any help appreciated.
var mouseposx:int;
var mouseposy:int;
var dragablemin = false; // start with it still
var dragablehour = false;
function mouseClickHandler(evt:MouseEvent):void{ //test to see if it can be moved
if(dragablemin == false){
dragablemin = true;
} else if(dragablemin == true){
dragablemin = false;
}
trace(dragablemin);
}
function mouseMoveHandler(evt:MouseEvent):void{ // this shows rotation forward but from centre of mc not the end
if(dragablemin == true){
minutehand.rotation += 3; // mouse moves minute hand forward (+= 3) but "swaps' when passing over hour hand. How can this be stopped and
} // (-= 3 moves it backwards so how can we have both - when student makes mistake)
function hourMoveHandler(evt:MouseEvent):void{ // rotates from the centre not the end
if(dragablehour == true){
hourhand.rotation += 3; // same as before you want the student to be able to go backwards if they made a mistake (-= 3)
}