Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Putting movie in place 1

Status
Not open for further replies.

adiMasher

Programmer
Aug 31, 2001
144
US
Code:
bn = "_root.tri" add n;
duplicateMovieClip ("_root.tri", bn, n);
setProperty (bn, _x, Number(getproperty(_root.John.Henry, _x))+250);
setProperty (bn, _y, Number(getproperty(_root.John.Henry, _y))+250);
n = Number(n)+1;
set (bn add ":n", n);

This is pretty much straight from the duplicatemovieclip example in flash 5. Only the variables have changed.

What I have is a movie instance traveling on a motion guide (John.Henry) that I extract _x & _y from to put the other movie clip on. And all it does right now is follow the motion guide as if it were designed inside the original instance.

What I need it to do is get the x,y and paste the movie in those coordinates, and let it play til it dies and continue on.

What am I doing wrong here. Or what else can I be doing?

thanks,
Martin I don't suffer from insanity.
I enjoy every minute of it.
 

...And all it does right now is follow the motion guide as if it were designed inside the original instance.


Wasn't that the original intention?
And isn't your duplicated movie clip following the other one with a 250 pixels offset?

Regards,
new.gif
 
Yes it follows on the path.

I want it to find the offset and start a movie in that place.

as if I were to say start a movie at 1,6 now start a movie at 4,8.

only with this, the movie clip is hanging on to the "cursor" of John Henry and the clip follows it. I just want a good ole cut & paste action.

Martin I don't suffer from insanity.
I enjoy every minute of it.
 
Pardon me, Copy & paste not cut & paste

I want multiple instances to appear at once

and in a line.

Martin I don't suffer from insanity.
I enjoy every minute of it.
 
Ok! Getting a better picture here! Don't forget, we're not sitting beside you and we are trying to visualize all of this on your sole descriptions and info!
How many duplicate intances do you figure on having? Is this endless? Or is it limited to a few instances?

Regards,
new.gif
 
bout 240 or so.

not a few and not infinite.. I don't suffer from insanity.
I enjoy every minute of it.
 
Well don't think this is going to work either! At least not as I understand what you're trying to do.
I figure you want 240 or so duplicated movie clips following or trailing a original clip tied to a motion path.
This would work (and does!) if each duplicated is eaxctly positioned according to the current position of the original clip. If you offset them (position wise), they'll follow the original clip but on a parallel course, never on the exact motion guide. What you want, once again if I understand you correctly, is an offset in terms of frames in the movie. In other words, 10 frames into the movie, you want the first duplicated clip to appear where the original clip was 10 frames before... And so forth, so that the duplicated clips allways follow the original motion guide.
Go figure that one out! For now, the only way I can imagine doing that, would be to have 240 layers with each the same motion guide as the original clip, but offsetting their appearance in terms of frames on the main timeline!

Or am I missing something here!

Wang or Dave where are you when we need you?

Regards,
new.gif
 
I'll show you what I have so far, It looks decent and will do the trick..... how can I upload to this site?

Or email me and I'll send it to you.
masher@adi-cs.com I don't suffer from insanity.
I enjoy every minute of it.
 
You can't upload to this site!
You can post a link to the movie and/or the .fla on one of your sites.
My address is available in the info when you hit my handle!

Regards,
new.gif
 
Here's how I would do it...

Set up an array for the _x values of where you want your clips to go and also one for the _y values. Then using a loop set your clips up on that path by setting their _x and _y properties equal to the array values.

If you increment the counter every frame you can move through the array creating a trail.

Okay, so that's not a good explanation (very hungover), here's some code...


onClipEvent (load) {
// set up values for trail of clips
xPos = new Array();
yPos = new Array();
// fill trail with values
for (j=0; j<360; j++) {
xPos[j] = j;
yPos[j] = (Math.sin(j*Math.PI/180)*100)+180;
}
// duplicate clips for the trail
for (i=1; i<=20; i++) {
duplicateMovieClip (_root.target, &quot;trail&quot;+i, i);
}
// initialise counter
count = 0;
}
onClipEvent (enterFrame) {
// place clips on the trail
for (i=1; i<=20; i++) {
_root[&quot;trail&quot;+i]._x = xPos[count+i];
_root[&quot;trail&quot;+i]._y = yPos[count+i];
}
// go to the next step on the trail, loop if finished
count++;
if (count>=xPos.length) {
count = 0;
}
}


Put this in a control clip and have the clip you want to form the trail offstage and called &quot;target&quot;. I've just used a mathematical equation to generate the trail because I couldn't be bothered to fill the arrays manually but the principle is sound enough.

Here it is so you can see it in action and the .fla is up there too, just change the file extension.

 
Alright, in the case that anyone was following and wanted to know how to do that, let me tell you how I finally came to a conclusion.

First create two distinct symbols, In my case, a motion guided dot, and a movie clip of sparks.

So here's the set up.

Create the clip of the sparks, which all I did was 3 gradient dots on motion paths to make it look like falling sparks.

Create a new symbol, draw a gradient dot to resemble the spark. Modify the instance of this dot to have an instance name. Make your motion guide for it however you want. I chose the cutout of a logo.

Now go to the scene and bring in an instance of the path and name the instance. Next bring over an instance of the sparks and name them. under the actions of the sparks from the scene, use the code from onclipevent(load) to declare that _x and _y will correspond to the path instance.dot instance's _x and _y. Under the actions of the path's instance use the code from onclipevent(enterframe) to duplicate the movie clip of the sparks instance.

Then all that's left is to turn the instance of the sparks off and I did that with another effect of a gradual alpha decrease inside the original sparks action.

Hope this is useful to someone.

Martin I don't suffer from insanity.
I enjoy every minute of it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top