Flasher Archive
[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]
Subject: | Re: FLASH: Random Questions Without Repeating |
From: | Ilia Pasymansky |
Date: | Wed, 26 Jul 2000 08:20:57 +0100 |
this script may help..??
Create an array for all the correct answers on the first frame of the main
timeline too:
set varaible:"answer1"= "yes"
set varaible:"answer2"= "no"
set varaible:"answer3"= "yes"
set varaible:"answer4"= "yes"
set varaible:"answer5"= "no"
And also put set varaible: "z" = "1"
and then call (random)
Then on the main timeline create a movieclip,inside the movieclip on the
first frame put:
set variable: "/:currentframe" = Getproperty("/",_currentframe)
Then on the second frame put:
Go To And Play(1)Now put this movieclip on a newlayer that spreads across
all frames.
Then on the first frame of the main movie put:
Call (Random)
The second frame on the main timeline should be given a label "Random"
On this frame we are going to create 5 unique random numbers:
Set Variable: "i" = 1
Loop While (i <> 6)
Set Variable: "rnd" = Random (5)+1
Set Variable: "x" = 1
Loop While (x <> (Length(Temp)+1))
If ((Substring (Temp, x, 1)) eq rnd)
Set Variable: "rnd" = ""
End If
Set Variable: "x" = x+1
End Loop
If (rnd ne "")
Set Variable: "Temp" = Temp & rnd
Set Variable: "i" = i + 1
End If
End Loop
Then we have a varaible called temp which now contains 5 unique random
numbers.
We now want to go to and play that unique random number so underneath we
put:
Go to And Play (Substring(temp,z,1))+ 2
set varaible "z" = z + 1
Now all you have to do is create 5 frames after for your five questions and
in each put a button, three questions and a textfield called "answer" On
each button put:
On(press)
if (Eval("answer" & currentframe)= answer
Call(random)
set varaible:"correct" = correct + 1
End If
End on
And also put a stop action on each frame.
Now create your questions and answers and put then out your answers in the
array!!
ANd then put a textfield on the maintimleine called "correct" this will
display the number of correct answers.
> 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 helpchinwag [dot] com
[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]