Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: Re: FLASH: Random Questions Without Repeating
From: Helen Triolo
Date: Wed, 26 Jul 2000 03:26:15 +0100

It's not as easy in Flash as in Director! Something like the following
should work. I haven't tested it, so there may be typos or something
not syntactically correct, but the theory of it should be OK:

If you have 30 variables, question1 - question30, and you want to
display a random one in textfield <thisquestion>, then do this first
(actually I think Flash defaults a variable to 0 if you don't specify
otherwise, but for the sake of logic I left it in):

Set Variable: "nTimes" = 0 //how many questions have been
displayed

and then this every time you want to show a new question:

Set Variable: "duplicate" = true // just to initialize for
next line
Loop While (duplicate=true) // loop til new random
number found
Set Variable: "ranNum" = random(30)+1 // random number, 1-30
Set Variable: "duplicate" = false // another loop initializer
Set Variable: "checkthis" = 1 // also a loop initializer
(i want flash5 now!)
Loop While (checkthis < nTimes+1 and duplicate=false)
If (ranNum = eval("alreadyasked"&checkthis))
Set Variable: "duplicate" = true
End If
Set Variable: "checkthis" = checkthis+1
End Loop
End Loop
Set Variable: "nTimes" = nTimes + 1
Set Variable: "alreadyasked" &nTimes = ranNum // array of previously
selected numbers (like you suggested)
Set Variable: thisquestion = question&ranNum

---------------------------------------------------
Helen Triolo � http://i-Technica.com � 301-424-6037
Flash Q&A archive � http://i-technica.com/flashlist


Paul Steven wrote:
>
> Hi all
>
> I am making a quiz where there are 30 questions. I want to randomly choose a
> question and ask it then remove it from the question pool. I normally have
> no problem doing this sort of stuff in Director - I simply create a list of
> the question numbers and remove the question number from the list after
> asking the question - but I can't figure out how do do it in Flash - am I
> being really dumb?! The only way I can think of is have 30 variables i.e
> Question1_Asked=False, Question2_Asked=False etc and set the boolean to True
> if asked.
>
> Anyone suggest a better way please.
>

flasher is generously supported by...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flashforward2000 and the Flash(tm) Film Festival
July 24-26, 2000, NEW YORK CITY, Hammerstein Ballroom
www.flashforward2000.com
Produced by United Digital Artists and lynda.com
Sponsored by Macromedia, Adobe Systems, Fusion, Inc, AtomFilms,
shockwave.com and Electric Rain.
1.877.4.FLASH.4 or (1.805.640.6679 outside the US and Canada)
Register before June 30 and save $200!!-- www.flashforward2000.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe or change your list settings go to
http://www.chinwag.com/flasher or email helpatchinwag [dot] com


Replies
  RE: FLASH: Random Questions Without Repe, Branden Hall

Replies
  FLASH: Random Questions Without Repeatin, Paul Steven

[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]