[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2006-03-28
8
Medium Priority
?
177 Views
Last Modified: 2008-02-01
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.



0
Comment
Question by:kearnguy
  • 4
  • 3
8 Comments
 
LVL 17

Expert Comment

by:Dushan De Silva
ID: 16317163
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
 
LVL 34

Accepted Solution

by:
Aneesh Chopra earned 1400 total points
ID: 16317321
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
 

Author Comment

by:kearnguy
ID: 16324849
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:kearnguy
ID: 16327364
...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
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 16328461
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
 

Author Comment

by:kearnguy
ID: 16328707
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
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 16328795
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
 

Author Comment

by:kearnguy
ID: 16344230
Thanks.  This is great.  You have been a great help.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
Suggested Courses

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question