Attaching movie clip, duplicating it, and placing them in random coordinates, then unloading them...

Ya so I am trying to create a background effect.  I want to dynamically load a movieClip into a flash doc multiple times and in different locations (x y coordinates).  I also want the clips to unload themselves after one loop of itself.  Then start all over again.  There would probably be around 10 clips at any given moment loaded on screen.

I have tried a couple different approches, but really when it comes down to it, I have no clue where to start since I have only a basic working knowledge of ActionSript.

Mix-fx software actually has an effect that produces a similar result but only around text (since it is a flash text effect program).  However, it would give you a good visual about what I want.  Look at the background and ignore the text.
http://www.mix-fx.com/blowsmoke.htm

Thanks in advanced.  Oh, this is rather time sensitive.



kearnguyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dushan De SilvaTechnology ArchitectCommented:
You can try like this. Seperate your backgrounds to different swf movies. Then when you needs you can load , what ever the movies you needs for the moment. You can use "loadmovie" command to load the movies to the main movie. And this is an efficient method. And when you dont want the background you can simply unload that swf using "unloadMovie" mathod for a perticular level.

And if u want more effects with images in flash you can try with some thirdparty tools like "siwsh", "swishmax", "flex", "swift3d".

Best Regards
Dushan
0
Aneesh ChopraCommented:
Hi,

Here I have done a same effect for you
download the source FLA here.
http://s48.yousendit.com/d.aspx?id=197I9FPQAGHKC1XUR3CGL5J858

Rgds
Aneesh
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kearnguyAuthor Commented:
aneeshchopra, this is great.  However, I will need to taylor it for several different projects so please break it down for me.

For exmple, could you comment out explanations of what the lines of code are doing so that I can change settings of them.
Here's what I understand so far so please explain better for me (I want to learn this stuff so I can one day give back to this awesome community):

FRAME 1
//setting value for variable
i = "0";
//is this the number of movieClips?
amount = "10";
//setting the movieClip initial value to invisible
circle._visible=false;

FRAME 2
//not too sure what the numbers are doing here and what they effect
valuetest = random("160") + 40;
//duplicating the circle moviClip, naming the instance, then something I don't get with the numbers again
duplicateMovieClip("circle", "test" add i, 16384 + (1000 - i));
//doing something with the coordinates
this["test" add i]._x= random("100") - 50;
this["test" add i]._y=random("30") - 15;
//doing something with the size of the movieClip
this["test" add i]._yscale=valuetest;
this["test" add i]._xscale= valuetest;
//somehow changing the alpha property
this["test" add i]._alpha= random("40") + 10;
i = i + 1;

FRAME 11
//looping the whole effect
if (i<amount+1)
{
      gotoAndPlay(2);
} else
{
      i = "1";
      amount = "10";
      gotoAndPlay(2);
}
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

kearnguyAuthor Commented:
...also, what is making the circles a red tint?  I can't find anything that is causing this.  I changed the background color to black and the circles are still a red/orange color.
0
Aneesh ChopraCommented:
Here I have updated the comments for frame 2 code, I hope rest all is clear to you.
-------------
//generating a random number inbetween 160 to 200 to assign the scale (size) of movieclip
valuetest = random("160") + 40;
//duplicating the circle moviClip, naming the instance, last parameter is to assign the depth with a unique number.
duplicateMovieClip("circle", "test" add i, 16384 + (1000 - i));
//setting x-coordinate with random number inbetween -50 to 50;
this["test" add i]._x= random("100") - 50;
//setting y-coordinate with random number inbetween -15 to 15;
this["test" add i]._y=random("30") - 15;
//setting scale (size)..
this["test" add i]._yscale=valuetest;
this["test" add i]._xscale= valuetest;
//changing the alpha property with a random value inbetween 10 to 50
this["test" add i]._alpha= random("40") + 10;
i = i + 1;
--------------

red tint is coming because....

root instance of "circle_mc" has it defined using tint...
to remove it do the following:
1.
select "circle_mc" at root

2.
click color dropdown and select a tine once,and then remove it again..

Rgds
Aneesh
0
kearnguyAuthor Commented:
Yes, that clears it up great.  I have one more question concerning this code.

When the circles are generated, they show up in a random _x _y coordinate.  However, they keep loading into that same coordinate while the movie is playing.  They only change coordinates if the movie is refreshed.  I need the circle_mc clip to unload and reload so that it is in a constant state of random placement.

Once that is figured out, then I will have my solution.

0
Aneesh ChopraCommented:
Now it will do as you required...
here is the updated codem for frame 1 and 11:

frame 1
--------
//setting value for variable
i = 0;
//is this the number of movieClips?
amount = 10;
//setting the movieClip initial value to invisible
circle._visible = false;
---------

frame 11
--------
//looping the whole effect
if (i<amount+1)
{
      gotoAndPlay(2);
} else
{
      i = 0;
      amount = 10;
      gotoAndPlay(2);
}
--------

actually variable "i" and "amount" had been defined as "String".. now they are as number...

Rgds
Aneesh
0
kearnguyAuthor Commented:
Thanks.  This is great.  You have been a great help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.