Flasher Archive

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


Subject: Re: FLASH: Arrays to control random MCs
From: Laura Mollett
Date: Wed, 1 Mar 2000 02:08:42 GMT

> I would like write an action script that cycles through the MCs. I want the
> movie to randomly play one of each of the seven MCs until they've all played
> and then to start over again. From what I'm reading about arrays, it sounds
> like they will do an efficient job. However, I don't really understand how
> arrays work.
>
> I know I could write a Set Variable, but it seems like an ugly solution.
>
> (The MCs are six animated heads and seven animated haircuts. As the site
> stands now, the viewer can get the same head or haircut over and over
> again.)

I think this is how you would do it:
Number all the movie clips: 1-7 (name them with an instance name, like clip1
- clip7). Then have a variable ClipCounter that you set to 0,
Set Variable: "ClipCounter" = 0
Loop While (ClipCounter < 7)
Set Variable: "ClipCounter" = ClipCounter +1
Set Variable: "Clip" & ClipCounter = False
End Loop
(You'd put that on your main timeline)

When you click the button have it do this:
Loop While (Done = False)
Set Variable: "CurrentClip" = Random(7) + 1
If (Eval("Clip" & CurrentClip) = False)
Load <movieclipname> [or tell target play or whatever you want]
Set Variable: "Done" = True
Else
Set Variable: "Done" = False
End If
End Loop

This will, I think, play a random movie clip when you click the button, but
never the same one twice. You might hafta play with it some to get it to
work. I don't know how you'd do it without using set variable... why's it an
ugly solution?

Laura

flasher is generously supported by...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flashforward2000 and The Flash Film Festival
"The World�s Premier Flash Solutions Conference and Expo"
March 27-29, Nob Hill Masonic Center, San Francisco, California

-Register before Feb 25 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: Arrays to control random MCs, Branden Hall

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