View Full Version : random letter creator
postatomic
February 6th, 2003, 02:18 PM
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:
lostinbeta
February 6th, 2003, 02:27 PM
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
senocular
February 6th, 2003, 02:37 PM
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 :)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.