Copy link to clipboard
Copied
i want to change movieclip postion completly random what code i use
Copy link to clipboard
Copied
It depends on what code you are using to place things to begin with. SHow that code.
Copy link to clipboard
Copied
placing all this clips into 1 movieclip and in 1 frame this script is use
and in that clip 5 different position clips arranged,
but every time swf loaded those clips are randomly place taht i want
stop();
function randomFrameAndStop(target_mc:MovieClip) {
var rFrame:Number = Math.floor(Math.random()*5)+1;
trace(rFrame);
target_mc.gotoAndStop(rFrame);
}
randomFrameAndStop(this);
Copy link to clipboard
Copied
I do not see how that code has anything to do with placing the various images anywhere. It only appears to be randomly picking a frame to go to.
If you do not have any code to place the images at this time, I suggest you devcelop code for that first, then see about asking for help making it place them randomly if you still cannot see how to do it.
Copy link to clipboard
Copied
i find this code and i apply in my file but it's not working
var myArray =
[
{x:-288.75, y:-185.55},
{x:-288.75, y:-67.55},
{x:-288.75, y:49.5},
{x:-288.75, y:162.5},
{x:-174.75, y:-185.55},
{x:-174.75, y:-67.55},
{x:-174.75, y:49.5},
{x:-174.75, y:162.5},
{x:-60.15, y:-185.55},
{x:-60.15, y:-67.55},
{x:-60.15, y:49.5},
{x:-60.15, y:162.5},
{x:53.85, y:-185.55},
{x:53.85, y:-67.55},
{x:53.85, y:49.5},
{x:53.85, y:162.5},
{x:166.65, y:-185.55},
{x:166.65, y:-67.55},
{x:166.65, y:49.5},
{x:166.65, y:162.5},
{x:280.65, y:-185.55},
{x:280.65, y:-67.55},
{x:280.65, y:49.5},
{x:280.65, y:162.5}
];
myArray.sort(function () {
return Math.round(Math.random());
});
var arrayLength:Number = myArray.length;
for (i = 0; i < arrayLength; i++) {
var mc:MovieClip = this["mcFindObject" + (i + 1)];
box._x = myArray.x;
box._y = myArray.y;
}
function setNewLocations() {
myXArray.sort(shuffle);
for (var j=1; j<=myXArray.length; j++){
this["box"+((i-1)*6+j)].newXLoc=myXArray[i-1];
this["box"+((i-1)*4+j)].newYLoc=myYArray[j-1];
}
}
function shuffle(a,b):Number {
return Math.floor(Math.random() * 30) + 1;
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now