(Flash MX)
I’ve basically finished this project, but there are some feature I’d like to add which are giving me trouble. Heres the jist of the fla
It takes data from a txt file and uses split() to put that data into an array (a list of phrases). Then it randomly chooses one of these phrases and displayes it in a text field, then it repeats this every 5 seconds.
What I am trying to add are these two things:
do not repeat array value until all have been used once
alpha fade in and out of each phrase, the AS of which is basic, but I am not sure where to put the code and set it up in this case.
Im just confused on where to place and exactly how the write the code for these additional elements. Help would be appreciated!
I can`t open your fla but for the first part, rather than taking elements out of the array, it may be easier just to shuffle the array and then loop through.
something like this should work
shuffle = function () {
return Math.round(Math.random());
};
lv = new LoadVars();
myArray = ;
lv.onLoad = function() {
for (i=0; i<5; i++) {
myArray* = lv[“var”+i].split(“:”);
}
myArray.sort(shuffle);
for (var n = 0; n != myArray.length; n++) {
trace("myArray["+n+"] - "+myArray[n]);
}
};
lv.load(“var.txt”);
for the second part, there are tons of fadein/fadeout tutorials around but when using dynamic text, you have to remember to embed font outlines.
I’ve attached the fla, you should be able to see it now.
I like the idea of shuffling the array and then going through it once, I;ll look into that.
The alpha fade effect is easy thats not the problem, where to place it to work properly is more like it. How do I set it up so that when the time is up for one value it fades it out then fades in the other :\
You’d need an if statement there, dal platinum, or else you would spam some undefined’s once you delete everything. I’d say if the length==1, re-load (repopulate, refill) the array and restart putting random quotes…
Creating engaging and entertaining content for designers and developers since 1998.