Skip to main content
Participant
March 18, 2007
Question

Random Shuffe Array

  • March 18, 2007
  • 4 replies
  • 274 views

Hello Action Script Writers,

I am new to action script although understand the basic programming principals
and have worked from template scripts in the past.

I would like to place a piece of script within 1 cell which will then
request 1 of 5 files on a random basis (named 1.swf - 5.swf)

if you can help an explanation of your code would also be appreciated.

thank you





This topic has been closed for replies.

4 replies

kglad
Community Expert
Community Expert
March 19, 2007
check this forum for the array.shuffle() method if you need it.
Participant
March 19, 2007
thats great thanks, i'll experiment with it

HOWEVER

i need to be more particular about the array qualities as
i intend to use the final code 6 times with variations
across 6 TV channels / Cells.

In other words, in

cell 1 = movie channel

play random but dont repeat 1.swf - 99.swf

cell 2 = sports channel

play random but dont repeat 100.swf - 199.swf


i already have a radomiser to land on any one of the 6 channels.

The objective is that with these 6 new shuffle arrays

(each shuffle array defining the .swf parameters for that channel...
ie 1.swf - 99.swf)

are combined with the existing channel randomiser viewers will be
able to land randomly across 600 shows.

you can see a working example of the channel randomiser at www.bulletprooftv.com






kglad
Community Expert
Community Expert
March 18, 2007
the shuffle() method for arrays is to be used when you don't want repeats. otherwise, the simple code given by eric is sufficient.
March 18, 2007
This should work. Check the Flash help for description of the loader, Math.random() etc.