Hi,
As I saw this issue is very searched for and there wasn't a tutorial for it...
If you need a random image file loaded do the following:
| CODE | onLoad () { imagesel = math.random(n); tellTarget (_root.loader) { loadMovie("image"+ imagesel +".jpg"); } }
|
Explanation
We declared a variable called imagesel that picks a number randomly from the n range... for example if n=3 then we have a result of a random number between 0,1,2,3.
loader is the sprite located in _root in which we want to load the image.
The images that will load have to be named like: image0.jpg, image1.jpg, image 2.jpg... and so on, depending on the number of images you have.
To load a text randomly, you have the following code:
| CODE | onLoad () { txtsel = math.random(n); tellTarget (_root.loader) { loadMovie("text"+ txtsel +".txt"); } }
|
Explanation
We declared a variable called txtesel that picks a number randomly from the n range... for example if n=3 then we have a result of a random number between 0,1,2,3.
loader is the dynamic text located in _root in which we want to load the text.
The texts that will load have to be named like: text0.txt , text1.txt , text2.txt ... and so on, depending on the number of texts you have.
Hope this helps you out and achieve what you want. If you have any questions don't hesitate to ask. This "tut" will also be available in update nr.2 in SM Unleashed e-book.
Regards, Eddie
|