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'); count.load('counter.xml'); //trace('stylesheet loaded') } else { trace('error loading stylesheet') } } //my_styleSheet.load(urlPath + "counter.css"); my_styleSheet.load("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 + '

'; lg_txt.iniBooks = Number(count.firstChild.childNodes[0].attributes.start); lg_txt.cSpeed = count.firstChild.childNodes[0].attributes.speed; //nonfiction.curTS = count.firstChild.childNodes[i].attributes.server_time; //nonfiction.iniTS = count.firstChild.childNodes[i].attributes.timer_start; /* start Khaz Code */ //var myarr=['','nonfiction','fiction','magazines','music','movies','games','tech','other']; //trace('69='+arr[1]); //initialize objects /* for(i=1;i<8;i++) { var o=myarr[i]; _root[o].label_txt.htmlText='

' + count.firstChild.childNodes[i].attributes.label + '

'; _root[o].iniBooks = Number(count.firstChild.childNodes[i].attributes.start); _root[o].cSpeed = count.firstChild.childNodes[i].attributes.speed; _root[o].curTS = count.firstChild.childNodes[i].attributes.server_time; _root[o].iniTS = count.firstChild.childNodes[i].attributes.timer_start; _root[o].startCounter(); } */ /* end Khaz Code */ nonfiction.label_txt.htmlText = '

' + count.firstChild.childNodes[1].attributes.label + '

'; //nonfiction.label_txt.htmlText = '

ooo

'; var iniBooks1 = Number(count.firstChild.childNodes[1].attributes.start); nonfiction.cSpeed = Number(count.firstChild.childNodes[1].attributes.speed); var incr1=Number(count.firstChild.childNodes[1].attributes.speed); //nonfiction.ccurTS = Number(count.firstChild.childNodes[1].attributes.server_time); var curTS1=Number(count.firstChild.childNodes[1].attributes.server_time); //nonfiction.ciniTS = Number(count.firstChild.childNodes[1].attributes.timer_start); var iniTS1=Number(count.firstChild.childNodes[1].attributes.timer_start); nonfiction.iniBooks=setStartPoint(iniBooks1,curTS1,iniTS1,incr1); nonfiction.startCounter(); fiction.label_txt.htmlText = '

' + count.firstChild.childNodes[2].attributes.label + '

'; //fiction.iniBooks = Number(count.firstChild.childNodes[2].attributes.start); var iniBooks2 = Number(count.firstChild.childNodes[2].attributes.start); fiction.cSpeed = Number(count.firstChild.childNodes[2].attributes.speed); var incr2=Number(count.firstChild.childNodes[2].attributes.speed); var curTS2=Number(count.firstChild.childNodes[2].attributes.server_time);//fiction.ccurTS = Number(count.firstChild.childNodes[2].attributes.server_time); var iniTS2=Number(count.firstChild.childNodes[2].attributes.timer_start);//fiction.ciniTS = Number(count.firstChild.childNodes[2].attributes.timer_start); fiction.iniBooks=setStartPoint(iniBooks2,curTS2,iniTS2,incr2); fiction.startCounter(); magazines.label_txt.htmlText = '

' + count.firstChild.childNodes[3].attributes.label + '

'; var iniBooks3 = Number(count.firstChild.childNodes[3].attributes.start); //magazines.iniBooks = Number(count.firstChild.childNodes[3].attributes.start); magazines.cSpeed = Number(count.firstChild.childNodes[3].attributes.speed); var incr3=Number(count.firstChild.childNodes[3].attributes.speed); var curTS3=Number(count.firstChild.childNodes[3].attributes.server_time);//magazines.ccurTS = Number(count.firstChild.childNodes[3].attributes.server_time); var iniTS3=Number(count.firstChild.childNodes[3].attributes.timer_start);//magazines.ciniTS = Number(count.firstChild.childNodes[3].attributes.timer_start); magazines.iniBooks=setStartPoint(iniBooks3,curTS3,iniTS3,incr3); magazines.startCounter(); music.label_txt.htmlText = '

' + count.firstChild.childNodes[4].attributes.label + '

'; var iniBooks4 = Number(count.firstChild.childNodes[4].attributes.start); music.cSpeed = Number(count.firstChild.childNodes[4].attributes.speed); var incr4=Number(count.firstChild.childNodes[4].attributes.speed); var curTS4=Number(count.firstChild.childNodes[3].attributes.server_time);//music.ccurTS = Number(count.firstChild.childNodes[4].attributes.server_time); var iniTS4=Number(count.firstChild.childNodes[3].attributes.timer_start);//music.ciniTS = Number(count.firstChild.childNodes[4].attributes.timer_start); music.iniBooks=setStartPoint(iniBooks4,curTS4,iniTS4,incr4); music.startCounter(); movies.label_txt.htmlText = '

' + count.firstChild.childNodes[5].attributes.label + '

'; var iniBooks5 = Number(count.firstChild.childNodes[5].attributes.start); movies.cSpeed = Number(count.firstChild.childNodes[5].attributes.speed); var incr5=Number(count.firstChild.childNodes[5].attributes.speed); var curTS5=Number(count.firstChild.childNodes[5].attributes.server_time); var iniTS5=Number(count.firstChild.childNodes[5].attributes.timer_start); movies.iniBooks=setStartPoint(iniBooks5,curTS5,iniTS5,incr5); movies.startCounter(); games.label_txt.htmlText = '

' + count.firstChild.childNodes[6].attributes.label + '

'; var iniBooks6 = Number(count.firstChild.childNodes[6].attributes.start); games.cSpeed = Number(count.firstChild.childNodes[6].attributes.speed); var incr6=Number(count.firstChild.childNodes[6].attributes.speed); var curTS6=Number(count.firstChild.childNodes[6].attributes.server_time); var iniTS6=Number(count.firstChild.childNodes[6].attributes.timer_start); games.iniBooks=setStartPoint(iniBooks6,curTS6,iniTS6,incr6); games.startCounter(); tech.label_txt.htmlText = '

' + count.firstChild.childNodes[7].attributes.label + '

'; var iniBooks7 = Number(count.firstChild.childNodes[7].attributes.start); tech.cSpeed = Number(count.firstChild.childNodes[7].attributes.speed); var incr7=Number(count.firstChild.childNodes[7].attributes.speed); var curTS7=Number(count.firstChild.childNodes[7].attributes.server_time); var iniTS7=Number(count.firstChild.childNodes[7].attributes.timer_start); tech.iniBooks=setStartPoint(iniBooks7,curTS7,iniTS7,incr7); tech.startCounter(); other.label_txt.htmlText = '

' + count.firstChild.childNodes[8].attributes.label + '

'; var iniBooks8 = Number(count.firstChild.childNodes[8].attributes.start); other.cSpeed = Number(count.firstChild.childNodes[8].attributes.speed); var incr8=Number(count.firstChild.childNodes[8].attributes.speed); var curTS8=Number(count.firstChild.childNodes[8].attributes.server_time); var iniTS8=Number(count.firstChild.childNodes[8].attributes.timer_start); other.iniBooks=setStartPoint(iniBooks8,curTS8,iniTS8,incr8); other.startCounter(); //startCounter(); } else{ trace('Cannot load XML !'); } } /*//////////////////////////////////////////////////////////// FUNCTIONS AND VARIABLES FOR THE COUNTER ////////////////////////////////////////////////////////////*/ function startCounter() { counter.htmlText = '

' + strSeperator(iniBooks,",") + '

'; //counter.htmlText = '

aaa

'; counter._x = Math.round((Stage.width/2) - (counter._width/2)); } function executeCallback():Void { //iniBooks = Math.round(iniBooks + 1); counter.htmlText = '

' + strSeperator(iniBooks,",") + '

'; //counter.htmlText = '

nbv

'; } 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; } function setStartPoint(iniBooks,curTS,iniTS,incr){ //trace('iniBooks='+iniBooks + ';;; curTS='+curTS + ';;; iniTS='+iniTS + ';;; incr='+incr ); var diff=Math.round(((curTS-iniTS)/1000)*incr); // difference since inception var startBooks=iniBooks+diff; return startBooks; }