class Tools { public static function tilt (nr,overflow) { // returns a 'sin'-version of the numner: start slow first, then speeden up, then damp speed // for smooth animation // input: number between 0-1 // output: nummer between 0-1 // overflow : doorslaan-effect /*if (overflow!=null) { overflowcorrection = 1/ getPercentage (1+overflow);//(1+0.5*Math.cos(overflow+2*Math.PI)); trace ("corr="+overflowcorrection); } else { overflow=0; overflowcorrection=1; }*/ //trace (overflowcorrection); var input = nr*2; var output = .5*(1+Math.cos(Math.PI*(1+input)))*(overflow+1); if (input>1) {output = 1 + output*overflow} return output; } public static function toHex (value) { var hex = "000000"+value.toString(16); hex= hex.substr (hex.length-6,6); return hex; } public static function getValue (node) { return node.firstChild.nodeValue; } public static function playSound(soundId,volume) { if (!_root.sounds) _root.sounds = new Array; if (!_root.sounds[soundId]) { var sound = new Sound; sound.attachSound (soundId); if (volume) sound.setVolume (volume); _root.sounds[soundId] = sound; } _root.sounds[soundId].start (0); } public static function replace (holder, searchfor, replacement) { var temparray = holder.split(searchfor); holder = temparray.join(replacement); return (holder); } /*public static function raise (errorString) { trace ("Error: "+errorString); }*/ public static function firstCapital (str) { var newStr; if (str.toLowerCase().indexOf("ij")==0) newStr = str.substring(0,2).toUpperCase()+str.substring(2); else newStr = str.substring(0,1).toUpperCase()+str.substring(1); return newStr; } public static function removeAccents (str) { var accents=new Array; accents=[ { searchFor : "èéêë", replacement : "e" }, { searchFor : "àáäâ", replacement : "a" }, { searchFor : "íîïì", replacement : "a" }, { searchFor : "òóõö", replacement : "o" }, { searchFor : "ùúü", replacement : "u" } ] for (var i in accents) { for (var j=0; j