Hi
I’m trying to get the effect of letters cycling randomly until it gets to the correct letter and then stops…so you can have a word cycle randomly until it creates the word you want.
how can I achieve that in MX
postatomic :evil:
Hi
I’m trying to get the effect of letters cycling randomly until it gets to the correct letter and then stops…so you can have a word cycle randomly until it creates the word you want.
how can I achieve that in MX
postatomic :evil:
There are 2 random letter cycling tutorials on this site…
http://www.kirupa.com/developer/flash5/randomlettercycling.asp
http://www.kirupa.com/developer/flash5/randomlettercycling2.asp
you might want to see http://www.kirupaforum.com/showthread.php?s=&threadid=11686
there is a function
Math.randomRange = function(min, max){
return Math.floor(Math.random()*(max-min+1)) + min;
}
which can be used with the range of letters in char codes 97-122 (a-z) and be checked for correctness
simple example
Math.randomRange = function(min, max){
return Math.floor(Math.random()*(max-min+1)) + min;
}
checkFor = "a";
this.onEnterFrame = function(){
charValue = Math.randomRange(97,122);
if (checkFor == String.fromCharCode(charValue)){
trace("Found match: "+ checkFor +" and "+ String.fromCharCode(charValue) +" ("+ charValue +")")
}
}
this doesnt stop, just traces a message, but you get the point
[edit]
or see the previous links