hi
does anyone know what is difference beetween flash 6 and 8?
i need to put these actionscript from 6 to 8
Code:
// ==============================================================
// FUNCTIONS
// ==============================================================
// FUNCTION: Calulate difference (elapsed time value).
fncCalcElapsed = function (nbrTime0, nbrTime1) {
return nbrTime1-nbrTime0;
};
// ------------------------------------
// FUNCTION: Pad numbers with zeros so always two digits.
fncNbrPad = function (nbrValue) {
// Concatenate zeros (prepend).
var stgValue = "00"+nbrValue;
// Return last two digits.
return stgValue.substr(stgValue.length-2);
};
// ------------------------------------
// FUNCTION: Display formatting function.
fncDisplayFormat = function (nbrHr, nbrMin, nbrSec, nbrHnd) {
// Assign to display textfield text property text returns from number padding function for each value.
tfdDisplay.text = fncNbrPad(nbrHr)+":"+fncNbrPad(nbrMin)+":"+fncNbrPad(nbrSec)+":"+fncNbrPad(nbrHnd);
};
// ------------------------------------
// FUNCTION: Update the display values.
fncDisplayUpdate = function () {
// Calcuate elapsed value from current timing plus previous value.
nbrTimeElapsed = fncCalcElapsed(nbrTrackStart, getTimer())+nbrTrackPrev;
// Call fncParse function to parse the elapsed time into units and display accordingly.
fncParse(nbrTimeElapsed);
};
// ------------------------------------
// FUNCTION: Function to track time whether in stopped state or running state
fncTrackStatus = function () {
// If current status is "running" (started)...
if (blnStatus) {
// Clear interval (stops updating).
clearInterval(itvTime);
// Store the new time elapsed value (which includes previous values).
nbrTrackPrev = nbrTimeElapsed;
// Else current status is "not running" (stopped)...
} else {
// Store current timer value.
nbrTrackStart = getTimer();
// Launch interval to call fncDisplayUpdate.
itvTime = setInterval(fncDisplayUpdate, 10);
}
};
// ------------------------------------
// FUNCTION: extract unit values (hours, minutes, seconds, and hundredths of seconds)
// from number of milliseconds elapsed.
fncParse = function (nbrMilliseconds) {
// Calculate hundredths of a second.
var nbrHnd = Math.floor(nbrMilliseconds/10)%100;
// Calculate seconds.
var nbrSec = Math.floor(nbrMilliseconds/1000)%60;
// Calculate minutes.
var nbrMin = Math.floor(nbrMilliseconds/60000)%60;
// Calculate hours.
var nbrHr = Math.floor(nbrMilliseconds/3600000)%24;
// Call display formatting function.
fncDisplayFormat(nbrHr, nbrMin, nbrSec, nbrHnd);
};
// ==============================================================
// INITIALIZE
// ==============================================================
// Establish boolean variable and initialize, to contain
// value representing status: 0 = stopped; 1 = running
blnStatus = 0;
// Establish array of strings to use for button label (to indicate next action).
mvcBtnStartStop.rraLabel = ["START", "STOP"];
// Initialize textfield label for button.
mvcBtnStartStop.tfdBtnLabel.text = mvcBtnStartStop.rraLabel[blnStatus];
// Define button event.
mvcBtnStartStop.onPress = function() {
this._parent.fncTrackStatus();
this._parent.blnStatus = Number(!this._parent.blnStatus);
this.tfdBtnLabel.text = this.rraLabel[this._parent.blnStatus];
};
// Conditional that starts tracking only if blnStatus is initialized to 1, above.
if (blnStatus) {
// Store current timer value.
nbrTrackStart = getTimer();
// Launch interval to call fncDisplayUpdate.
itvTime = setInterval(fncDisplayUpdate, 10);
}
// ==============================================================