A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Randomiser for pictures.

  1. #1
    Junior Member
    Join Date
    Sep 2003
    Posts
    14

    Randomiser for pictures.

    I have a flash website and i want to randomise the pictures in the site (as in backgroud pictures. How would i go about doing this? if its possible?

  2. #2
    FK's Giant Steve_w_V's Avatar
    Join Date
    Mar 2003
    Location
    San Jose, California
    Posts
    2,113
    Have the background images you want to have named "img1.jpg...img10.jpg" sequentially. Have the images in the same folder as the swf. On the main timeline, have:
    code:
    _root.onLoad = function() {
    ran = Math.round(Math.random()*9+1);
    name = "img"+ran+".jpg";
    loadMovieNum(name, -100);
    name._x = Stage.width/2;
    name._y = Stage.height/2;
    trace(name);
    };


    This will load an array of random images from "img1.jpg" to "img10.jpg".
    The other day, I bought a box of animal crackers. On the side, it said "Do Not Eat if Seal is Broken". I opened the box and sure enough...

  3. #3
    Junior Member
    Join Date
    Sep 2003
    Posts
    14

    this is all done but...

    I have the script on the background layer. A box appears telling me of a random img*.jpg it chooses but it doesnt appear in the website? What am I doing wrong?

    All the pics are in the same folder as the swf file.

    loadMovieNum(name, -100);

    Where does this load the movie too? And does this resize the picture? as they are the correct size?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center