fscommand('allowscale', false);
fscommand('fullscreen', false);
fscommand('showmenu', false);
Stage.showMenu = false;
stop();
import TextField.StyleSheet;
//urlPath = '';
/*////////////////////////////////////////////////////////////
LOAD STYLESHEET
////////////////////////////////////////////////////////////*/
var my_styleSheet = new TextField.StyleSheet();
my_styleSheet.onLoad = function(success:Boolean) {
if (success) {
count.load(urlPath + 'counter.xml');
trace('stylesheet loaded')
} else {
trace('error loading stylesheet')
}
}
my_styleSheet.load(urlPath + "counter.css");
/*////////////////////////////////////////////////////////////
LARGE COUNTER AND TEXT FORMATTING
////////////////////////////////////////////////////////////*/
lg_txt.embedFonts = true;
lg_txt.html = true;
lg_txt.autoSize = true;
lg_txt.multiline = true;
lg_txt.styleSheet = my_styleSheet;
counter.embedFonts = true;
counter.html = true;
counter.autoSize = true;
counter.styleSheet = my_styleSheet;
var labelfmt = new TextFormat();
labelfmt.color = 0xd5c5b0;
var hoverfmt = new TextFormat();
hoverfmt.color = 0xFFFFFF;
/*////////////////////////////////////////////////////////////
LOAD XML
////////////////////////////////////////////////////////////*/
count = new XML();
count.ignoreWhite = true;
count.onLoad = function(success) {
if (success) {
trace("XML loaded...");
lg_txt.htmlText = '
' + count.firstChild.childNodes[0].attributes.label + '
';
cStartTime = Number(count.firstChild.childNodes[0].attributes.start);
cSpeed = count.firstChild.childNodes[0].attributes.speed;
nonfiction.label_txt.htmlText = '' + count.firstChild.childNodes[1].attributes.label + '
';
nonfiction.cStartTime = Number(count.firstChild.childNodes[1].attributes.start);
nonfiction.cSpeed = count.firstChild.childNodes[1].attributes.speed;
nonfiction.startCounter();
fiction.label_txt.htmlText = '' + count.firstChild.childNodes[2].attributes.label + '
';
fiction.cStartTime = Number(count.firstChild.childNodes[2].attributes.start);
fiction.cSpeed = count.firstChild.childNodes[2].attributes.speed;
fiction.startCounter();
magazines.label_txt.htmlText = '' + count.firstChild.childNodes[3].attributes.label + '
';
magazines.cStartTime = Number(count.firstChild.childNodes[3].attributes.start);
magazines.cSpeed = count.firstChild.childNodes[3].attributes.speed;
magazines.startCounter();
music.label_txt.htmlText = '' + count.firstChild.childNodes[4].attributes.label + '
';
music.cStartTime = Number(count.firstChild.childNodes[4].attributes.start);
music.cSpeed = count.firstChild.childNodes[4].attributes.speed;
music.startCounter();
movies.label_txt.htmlText = '' + count.firstChild.childNodes[5].attributes.label + '
';
movies.cStartTime = Number(count.firstChild.childNodes[5].attributes.start);
movies.cSpeed = count.firstChild.childNodes[5].attributes.speed;
movies.startCounter();
games.label_txt.htmlText = '' + count.firstChild.childNodes[6].attributes.label + '
';
games.cStartTime = Number(count.firstChild.childNodes[6].attributes.start);
games.cSpeed = count.firstChild.childNodes[6].attributes.speed;
games.startCounter();
tech.label_txt.htmlText = '' + count.firstChild.childNodes[7].attributes.label + '
';
tech.cStartTime = Number(count.firstChild.childNodes[7].attributes.start);
tech.cSpeed = count.firstChild.childNodes[7].attributes.speed;
tech.startCounter();
other.label_txt.htmlText = '' + count.firstChild.childNodes[8].attributes.label + '
';
other.cStartTime = Number(count.firstChild.childNodes[8].attributes.start);
other.cSpeed = count.firstChild.childNodes[8].attributes.speed;
other.startCounter();
startCounter();
}
}
/*////////////////////////////////////////////////////////////
FUNCTIONS AND VARIABLES FOR THE COUNTER
////////////////////////////////////////////////////////////*/
function startCounter() {
counter.htmlText = '' + strSeperator(cStartTime,",") + '
';
counter._x = Math.round((Stage.width/2) - (counter._width/2));
}
function executeCallback():Void {
cStartTime = Math.round(cStartTime + 1);
counter.htmlText = '' + strSeperator(cStartTime,",") + '
';
}
function strSeperator (num,delimiter){
sign = num<0 ? '-' : '';
num=Math.abs(num).toString();
pos = (num.indexOf('.')==-1) ? num.length : num.indexOf('.');
while(pos>3){
pos-=3;
n2=num.slice(pos,num.length);
n1=num.slice(0,pos);
num=n1+delimiter+n2;
}
return sign+num;
}