Is this too processor demanding?
Hi,
Does this make any sense? I'm trying to delete "ind" before each next function call but I can't. Could it be because this is happening too quick?
Code:
var aFonts:Array = ["Times", "Calibri", "Aparajita", "Times", "Trebuchet MS", "Verdana", "Andalus", "Arial"];
var aFontSize:Array = ["18", "22", "26", "28", "30", "34", "38", "42"];
var aFontColor:Array = ["0xFF0000", "0x003300", "0xFFFFFF", "0x000033", "0x99CC00", "0x6666CC", "0xFF66CC", "0xCC66CC"];
var aBoldness:Array = ["true", "false", "true", "true", "false", "false", "true", "false"];
var aItalic:Array = ["true", "false", "true", "false", "true", "false", "true", "false"];
var theX = Math.floor(Math.random() * Stage.width);
var theY = Math.floor(Math.random() * Stage.height);
function textFormatter(a, b)
{
var select:Number = Math.floor(Math.random() * aFonts.length - 1);
var tFormatter:TextFormat = new TextFormat();
tFormatter.font = aFonts[select];
tFormatter.size = aFontSize[select];
tFormatter.color = aFontColor[select];
tFormatter.bold = aBoldness[select];
tFormatter.italic = aItalic[select];
ind.setTextFormat(a, b, tFormatter);
}
var ind:TextField = this.createTextField("ind", this.getNextHighestDepth(), theX, theY, 800, 500);
ind.text = "In... inde... independčncia!";
ind.antiAliasType = "advanced";
ind.embedFonts = true;
ind.selectable = false;
ind._rotation = Math.floor(Math.random() * 90) - 45;
ind._alpha = Math.round(Math.random() * 100) + 10;
var aAudio:Sound = new Sound();
aAudio.attachSound("critsInde");
aAudio.setVolume(10);
aAudio.start();
var audioPosition:Number;
var audioDuration:Number;
this.onEnterFrame = function() {
audioDuration = aAudio.duration/1000;
audioPosition = aAudio.position/1000;
trace(aAudio.position);
if(audioPosition == 1.022){
trace("Primera síl·laba");
textFormatter(0,6);
}
if(audioPosition == 1.022){
trace("Segon crit");
ind.removeTextField();
textFormatter(6,14);
}
if(audioPosition == 2.136){
trace("Crit final");
ind.removeTextField();
textFormatter(14,ind.text.length);
}
};
aAudio.onSoundComplete = function() {
aAudio.stop("critsInde");
delete onEnterFrame;
};