Hi, I made a dynamic textbox on an error page, and i’m gonna load 1 text file, but the text file contains 4 or 5 phrases. Can anyone tell me how to randomly select 1 phrase and show it?
Thanx a lot.
Hi, I made a dynamic textbox on an error page, and i’m gonna load 1 text file, but the text file contains 4 or 5 phrases. Can anyone tell me how to randomly select 1 phrase and show it?
Thanx a lot.
separate each phrase with a &.
ie. &kirupatext0=hello&kirupatext1=bye&kirupatext2=go
then for your script to load the txt file, modify the variable such that it picks a random number which then attaches to another string, thus picking a random string
eg
loadText = new loadVars();
loadText.load("kirupa.txt");
loadText.onLoad = function() {
scroller.text = this."kirupatext"+random(2);
};
well, i’m not too sure if the scripting part is correct, but that’s the rough idea.
[size=1]sorry if the coding part’s not right, do play around till you get it. don’t have time to try it out now and i’m not an AS expert :P[/size]
:: Copyright KIRUPA 2024 //--