back to the web-based training module


//hide the real mouse cursor
Mouse.hide()

//function to call new mouse cursor
_root.cursor_mc.onEnterFrame = function(){
cursor_mc._x = _root._xmouse;
cursor_mc._y = _root._ymouse;
}

//function to check for new mouse cursor
var currentCursor = cursor_mc;
function initCursor(mc){
delete currentCursor.onEnterFrame ;
currentCursor = mc;
currentCursor.onEnterFrame = function(){
mc._x = _root._xmouse;
mc._y = _root._ymouse;
}
}

// function to call helper message
var errorCheck;

helpMessage = "Change the helpMessage variable on this frame's actionscript...";

function helper_start(foo){
this.error_mc.errorMessage_mc.errort = helpMessage;
if (errorCheck == true){
_root.error_mc.gotoAndPlay("start");
errorCheck = false;
}else{
_root.error_mc.gotoAndStop("end");
}
}

// function for delayed helper message
var helpTimer;

function delay() {
helper_start(helpMessage);
}

//function to check if target is clicked
background_mc.onPress = function() {
if (target_mc.hitTest(_root._xmouse, _root._ymouse)) {
play();
}
else {
_root.circle_mc.gotoAndPlay("start");
helper_start(helpMessage);
}
};

// super function to reset things as frame moves forward
function resetAll(){
//checks for new cursor
initCursor(cursor_mc);
//resets red circle
_root.circle_mc.gotoAndStop(1);
//resets error message
_root.error_mc.gotoAndStop(1)
//go to appropriate text instructions
_root.instructions_mc.gotoAndPlay(textPanel);
//resets help timer
errorCheck = true;
clearTimeout(helper);
helper = setTimeout(delay, helpTimer);
}