I am currently loading images randomly for a slideshow and I would like to push it to the next level.
-
First, something that is probably more common (but I can’t find info) is to make sure the same image is not loaded twice consecutively.
-
Second, there are 3 categories in the slideshow, and I would like to see a picture from a different category every time. Currently, the category is defined in the XML as shown below.
<?xml version="1.0"?>
<menu>
<item category="category 1" pic="1.jpg"/>
<item category="category 1" pic="2.jpg"/>
<item category="category 2" pic="3.jpg"/>
<item category="category 2" pic="4.jpg"/>
<item category="category 3" pic="5.jpg"/>
<item category="category 3" pic="6.jpg"/>
</menu>
The flash random function is set as follow:
imageToLoad = Math.floor(Math.random()*(totalImageNum.length));
I would like to convert the Math part to a new Var that would generate a number that matches my 2 conditions.
Any idea?