Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

on load movie clip place random change

Explorer ,
Feb 22, 2013 Feb 22, 2013

1.jpg

i want to change movieclip postion completly random what code i use

TOPICS
ActionScript
881
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 22, 2013 Feb 22, 2013

It depends on what code you are using to place things to begin with.  SHow that code.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 22, 2013 Feb 22, 2013

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);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 22, 2013 Feb 22, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 26, 2013 Feb 26, 2013
LATEST

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;

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines