Código para n me esquecer na MASK
public function BlurMatch() {
init();
}
private function init():void {
wordsMcArray = [youtube_mc,mastercard_mc,ibm_mc,canon_mc,shell_mc,bmw_mc];
strArray = ["youtube","master","ibm","canon","shell","bmw"];
mcCheckArray = [];
counter = 0;
totalWords = strArray.length;
//Displays the number of correct words answered and set the focus to the input text field.
found_txt.text = String(counter) + "/" + String(totalWords) + "correct";
stage.focus = input_txt;
for (var j:int = 0; j < wordsMcArray.length; j++) {
//Adds a blur and outline to each of the image
wordsMcArray[j].filters = [new BlurFilter(15,15,3)];
var outLine:Shape = new Shape ;
outLine.graphics.lineStyle(2,0x000000);
outLine.graphics.drawRect(wordsMcArray[0].x + xOffset * j % cols,wordsMcArray[0].y + yOffset * int(j / cols),wordsMcArray[0].width + 2,wordsMcArray[0].height + 2);
outLine.graphics.endFill();
addChild(outLine);
}
//Adds the change event to the input text field.
input_txt.addEventListener(Event.CHANGE,detectKeys);
}
private function detectKeys(e:Event):void {
for (var i:int = 0; i < strArray.length; i++) {
if (strArray[i] == input_txt.text.toLowerCase()) {
trace('correct');
//If the correct word is typed then the counter gets incremented and the
//found displayed is updated to show a word has been found.
counter++;
found_txt.text = String(counter) + "/" + String(totalWords) + "correct";
//This adds the correct word into the mcCheckArray.
mcCheckArray.push(wordsMcArray[i]);
//This removes the correct word from wordsMcArray and the strArray.;
wordsMcArray.splice(wordsMcArray.indexOf(wordsMcArray[i]),1);
strArray.splice(strArray.indexOf(strArray[i]),1);
//Removes the movie clip blur filter.
mcCheckArray[mcCheckArray.length - 1].filters = [];
//This clear the text field after a half second delay
setTimeout(function(){ input_txt.text = ""; },500);
}
}
}
}
}