PDA

View Full Version : Matrix Style - Word Spin


HenryG
05-15-2008, 04:05 PM
Hi guys, i made the following script and this _should_ be working but apparently i can't see the error.

The script is supposed to make the word "hello" after going through the alphabet finding the right individual letter. At the moment all it seems to be able to do is get the first letter to spin!

any ideas would be great :)

stop()
vSecretWord = "hello";
vWordBox = "*****";
vGuess = "";
vCharIndex = 0;
onEnterFrame = function () {
if (vCharIndex<vSecretWord.length){
vRandomNo = random(26)+97;
vRandomChar = String.fromCharCode(vRandomNo);
vWordBox = vGuess+vRandomChar+"***";

if (vRandomChar == VsecretWord.charAt(vCharIndex)) {
vGuess = vGuess+vRandomChar;
vCharIndex++;

for (i=0; i<vSecretWord.length-vCharIndex-1; i++) {
vWordBox = vWordBox+"*";
}

}
}
};

ASWC
05-15-2008, 05:52 PM
var vSecretWord:String = "hello";
var vWordBox:String = "";
var vGuess:String = "";
var vCharIndex:Number = 0;
var hidingText:String = "****";
this.onEnterFrame = function () {
if (vCharIndex<vSecretWord.length){
vRandomNo = Math.floor(Math.random()*26);
vRandomChar = String.fromCharCode(vRandomNo+97);
vWordBox = vGuess+vRandomChar;
the_txt.text = vWordBox+hidingText;

if (vRandomChar == vSecretWord.charAt(vCharIndex)) {
vGuess += vRandomChar;
vCharIndex++;
hidingText = hidingText.substr(1,hidingText.length-1)
}
}
};