PDA

View Full Version : 'Wheel of Fortune' type of animation



Maive
September 26th, 2006, 11:01 AM
Based on the Loading Random Background (http://www.kirupa.com/developer/mx/loadingrandombackground2.htm) tutorial, which is very helpful, I would like to set some conditions on the generator making it a more advanced ActionScript. Does anyone know how to set the condition so that the same MC won't be randomly generated twice? (For the record, I would have 10 random elements)

And secondly, which I can foresee is probably the harder bit, is there a way to regulate the randomizing to occur only every 24 hrs? That is, if I were to have this uploaded onto the web, it would randomly generate a SWF, keep that SWF/data generated for 24 hrs, then after 24 hrs the generator would reset the data and generate a new one to which it would keep displaying for another 24 hrs (and so on).

evildrummer
September 26th, 2006, 11:15 AM
well I cant think of an easy way so I will post my way I would do it,

IF your server has PHP and MySQL then I would have it SO flash would get a variable from the MySQL db for teh date with the number for the image, but if it detects no recird with the date then it would get yesterdays and create a random number nit that one.

Maive
September 26th, 2006, 11:21 AM
Wow that definately doesn't sound easy! lol
Thanks for the reply though.
Was hoping for a few extra lines in the script to set those conditions.. .hmmm

evildrummer
September 26th, 2006, 12:32 PM
Well the problem I see in flash is that it cant change itselfs code so you need to change either a .txt or MySQL with PHP, thats one bad thing about it, reconsidering I think a .txt would be easier but still hard.

Counterproductive
September 26th, 2006, 01:01 PM
You could do it with just Flash but it wouldn't just be by just adding on a couple lines to the tutorial. Maybe an array and a variable that adds the background names to it as a string and then if statements to look through the string to see if the background was already used. But im not writing all that out, im at work :trout: .

Counterproductive
September 26th, 2006, 01:13 PM
Or you could associate a boolean variable to each background when it picked and throw if statements in each case and that could work
(i think). I don't have flash here so i cant test it and ive never used cases before. If that works its not hard to do.