[FMX2004] Countdown timer in Exercise - problems in integrating 2 files

I want to put a countdown timer into a exercise, thus when the timer goes to 0, then it will stop the exercise and goes to the results page.

the exercise file is the QUiz example from Flash MX 2004. inside contains drag n down elements and multiple choice…

but i tried to integrate both files(countdown timer & exercise) by tryong to change those action scripts… below is the original AS for both files… i would appreciate if those experts could guide me on this… as i m not good in action script… thx in advance 1st…

http://www.kirupa.com/developer/mx/countdown.htm [ I modified from the URL]
[AS - Countdown Timer]
currentDate = new Date();
thisYear = currentDate.getFullYear();
thisMonth = currentDate.getMonth();
thisDate = currentDate.getDate();
thisHours = currentDate.getHours();
thisMin = currentDate.getMinutes();
thisSec = currentDate.getSeconds();
thisMiliSec = currentDate.getMilliseconds();

eventDate = new Date(thisYear, thisMonth, thisDate, thisHours + 2, thisMin, thisSec, thisMiliSec);
eventMillisecs = eventDate.getTime();
counter.onEnterFrame = function(){
currentDate = new Date();
currentMillisecs = currentDate.getTime();
this.msecs = eventMillisecs - currentMillisecs;

if (this.msecs <= 0){
play();
return;
}

this.secs = Math.floor(this.msecs/1000); // 1000 milliseconds make a second
this.mins = Math.floor(this.secs/60); // 60 seconds make a minute
this.hours = Math.floor(this.mins/60); // 60 minutes make a hour

this.msecs = string(this.msecs % 1000);
this.secs = string(this.secs % 60);
this.mins = string(this.mins % 60);
this.hours = string(this.hours % 24);

while (this.msecs.length < 3) this.msecs = “0” + this.msecs;
if (this.secs.length < 2) this.secs = “0” + this.secs;
if (this.mins.length < 2) this.mins = “0” + this.mins;
if (this.hours.length < 2) this.hours = “0” + this.hours;

for(movie in this){
if (this[movie]._parent == this) this[movie].evaluateFrameFrom(this);
}
};
MovieClip.prototype.evaluateFrameFrom = function(variableClip){
var nameArray = this.name.split("");
var numberSet = variableClip[nameArray[0]];
var character = number(nameArray[1]);
var frame = 1 + number(numberSet.charAt(character));
if (this._currentframe != frame) this.gotoAndStop(frame);
};

[AS - EXERCISE/QUIZ(can be obtain in Flash MX 2004 samples)]
this._visible = false;
if(getTimer() > 1000){
if(!startFlag){

_parent.QuizTrack = new Quiz();

_parent.QuizTrack.randomize = Randomize;
_parent.QuizTrack.quest_to_ask = QuestionsToAsk;
_parent.QuizTrack.login_file = LoginURL;
_parent.QuizTrack.activity_ID = Activity_ID;
_parent.QuizTrack.activity_name = Activity_Name;
_parent.QuizTrack.results_page = Results;
_parent.QuizTrack.start_time = Math.round(getTimer()/1000);;
_parent.QuizTrack.level = _parent;
_parent.QuizTrack.setQuestArray();

_parent.QuizTrack.initStartQuiz();

startFlag = true;
stop();
}
} else{
play();
}

=========================================================
#initclip 0
_global.LToolBox = function()
{
this.interaction_id = undefined;
this.interaction_type = undefined;
this.correct_response = undefined;
this.student_response = undefined;
this.result = undefined;
this.feedback = undefined;
this.numOfTries = 1;
this.feedback_list = undefined;
this.tracking = undefined;
this.weighting = undefined;
this.objective_id = undefined;
this.latency = undefined;
this.navigation = undefined;
this.buttonLabels = new Array();
}

_global.LToolBox.prototype = new Object();

LToolBox.prototype.setTextField = function (fieldName, val) {
this.assets_path[fieldName].text = val;
}

LToolBox.prototype.setComponentLabel = function (UIComponent, val) {
this.assets_path[UIComponent].label = val;
}

LToolBox.prototype.setComponentListener = function (UIComponent, val) {
this.assets_path[UIComponent].clickHandler = val;
}

LToolBox.prototype.setComponentState = function (UIComponent, val) {
this.assets_path[UIComponent].enabled = val;
}

LToolBox.prototype.getComponentLabel = function (UIComponent) {
return this.assets_path[UIComponent].label;
}

LToolBox.prototype.setRadioGroupName = function (UIComponent, val) {
this.assets_path[UIComponent].groupName = val;
}

LToolBox.prototype.initControlButton = function (eventHandler) {

if (this.feedback == true){
this.label_state = this.buttonLabels[1];
if (this.navigation == 2) this.navigation = 1;
}
else if (this.tracking == true){
this.label_state = this.buttonLabels[2];
}
else if (this.navigation != 0){
this.label_state = this.buttonLabels[3];
if (this.navigation == 2) this.navigation = 1;
}
else {
this.label_state = this.buttonLabels[0];
}
this.setComponentLabel(this.Assets.ControlButton, this.label_state);
this.setComponentState(this.Assets.ControlButton, false);
this.setComponentListener(this.Assets.ControlButton, eventHandler);
}

LToolBox.prototype.setFeedback = function (val){
if (this.feedback == true){
var feedbackField = this.Assets.FeedbackField;
var control = this.Assets.ControlButton;
if (val == 0){
this.setTextField(feedbackField, this.feedback_list[0]);
}
else if (val == 1){
var buttonState = this.getComponentLabel(control);
this.setTextField(feedbackField, this.feedback_list[3]);
}
else if (val == 2){
this.setTextField(feedbackField, this.feedback_list[1]);
}
else if (val == 3){
if(this.numOfTries > 1){
this.setTextField(feedbackField, this.feedback_list[4]);
} else {
this.setTextField(feedbackField, this.feedback_list[2]);
}
}
else if (val == 4){
this.setTextField(feedbackField, this.feedback_list[4]);
}
}
}

LToolBox.prototype.setNavigation = function (){
if (this.navigation == 0){
this.setComponentState(this.Assets.ControlButton, false);
}
else if (this.navigation == 1) {
if (!this.buttonFlag || this.buttonFlag == false){
this.setComponentLabel(this.Assets.ControlButton, this.buttonLabels[3]);
this.buttonFlag = true;
}
else{
if(this.navAction == false){
if(!this.navLabel){
this.assets_path.nextFrame();
}
else {
this.assets_path.gotoAndStop(this.navLabel);
}
}
else if(this.navAction == true){
if(!this.navLabel){
this.assets_path.gotoAndPlay(this._currentframe+1);
}
else {
this.assets_path.gotoAndPlay(this.navLabel);
}
}
}
}
else if (this.navigation == 2) {
this.assets_path.nextFrame();
}
}

LToolBox.prototype.sessionStart = function () {
this.dateStamp = this.getDateStamp();
this.timeStamp = this.getTimeStamp();
this.sessionTimer(true);
}

LToolBox.prototype.sessionStop = function () {
this.latency = this.getLatency(this.sessionTimer(false));
}

LToolBox.prototype.submitScore = function () {
if (this.weighting <= 0 || this.weighting == undefined) {
this.weighting = 1;
}
var weight;
if (this.result == “C”) {
weight = this.weighting;
} else if (this.result == “W”) {
weight = -1 * this.weighting;
}
if (this.tracking == true){
var intData = this.dateStamp+";"+this.timeStamp+";"+this.interaction_id+";"+
this.objective_id+";"+this.interaction_type+";"+this.correct_response+";"+
this.student_response+";"+this.result+";"+this.weighting+";"+this.latency;
fscommand (“MM_cmiSendInteractionInfo”, intData);
}

Component
QuizTrack.countScore(weight);
}

LToolBox.prototype.getDateStamp = function ()
{
var dateObj = new Date();
var year = dateObj.getFullYear();
var month = this.formatNum(dateObj.getMonth()+1);
var day = this.formatNum(dateObj.getDate());
var dateString = year+"/"+month+"/"+day;
return dateString;
}

LToolBox.prototype.getTimeStamp = function ()
{
var timeObj = new Date();
var hours = this.formatNum(timeObj.getHours());
var minutes = this.formatNum(timeObj.getMinutes());
var seconds = this.formatNum(timeObj.getSeconds());
var timeString = hours+":"+minutes+":"+seconds;
return timeString;
}

LToolBox.prototype.sessionTimer = function (action)
{
if (action == true){
this.startTime = Math.round(getTimer()/1000);
} else if (action == false){
this.stopTime = Math.round(getTimer()/1000);
var elapsedSec = this.stopTime - this.startTime;
return elapsedSec;
}
}

LToolBox.prototype.getLatency = function (timeInSec)
{
var l_seconds, l_minutes, l_hours, timeInHours;
if (timeInSec <= 9) {
l_seconds = “0”+timeInSec;
l_minutes = “00”;
l_hours = “00”;
} else {
l_seconds = timeInSec;
l_minutes = “00”;
l_hours = “00”;
}
if (l_seconds > 59) {
l_minutes = int(l_seconds / 60);
l_minutes = this.formatNum(l_minutes);
l_seconds = l_seconds - (l_minutes * 60);
l_seconds = this.formatNum(l_seconds);
l_hours = “00”;
}
if (l_minutes > 59) {
l_hours = int(l_minutes/ 60);
l_hours = this.formatNum(l_hours);
l_minutes = l_minutes - (l_hours * 60);
l_minutes = this.formatNum(l_minutes);
}
timeInHours = l_hours+":"+l_minutes+":"+l_seconds;
return timeInHours;
}

LToolBox.prototype.formatNum = function (num) {
if (num <= 9) {
num = “0”+num;
}
return num;
}
#endinitclip