hi. I’m using the following code… and having problems with the random feature. I need to randomly place objects in an area could u give me a hand?
right now this code uses the stage to set the area. I don’t want to do that. I have started to put in a xmin and xmax but the random(); only likes one number … can some one please help me please…
z
my email address is [email protected] thanks for your time.
stop();
xMin = 65;
xMax = 390;
yMin = 65;
yMax = 390;
//Number of balloons to be created
totalBalloons = 5;
//Set the dimensions of the screen so that we can randomly place the balloons
screenWidth = 100;
screenHeight = 100;
//Create and place the balloon instances on the stage
for (var i = 0; i<totalBalloons; ++i) {
var name = “balloon”+i;
_root.attachMovie(“balloon”, name, i);
//var x = random (xMin, xMax); was just playing here.
var x = random(screenWidth);
var y = random(screenHeight);
_root[name]._x = x;
_root[name]._y = y;
}