# Flash mx-motion trail

**URL:** <https://forum.kirupa.com/t/flash-mx-motion-trail/10996>\
**Category:** Uncategorized\
**Created:** [January 10, 2003, 12:04pm UTC](https://forum.kirupa.com/t/flash-mx-motion-trail/10996 "2003-01-10T12:04:09Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimw00d](https://avatars.discourse-cdn.com/v4/letter/j/46a35a/32.png) [@jimw00d](https://forum.kirupa.com/u/jimw00d)\
**Post date:** [January 10, 2003, 12:04pm UTC](https://forum.kirupa.com/t/flash-mx-motion-trail/10996/1 "2003-01-10T12:04:09Z")

</div>

If there is an mc on the stage, that moves around say simply from left to right, is there a way, using actionscript, that the motion trail can be seen, a little like the onion effect, to show where a mc has been.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 10, 2003, 3:24pm UTC](https://forum.kirupa.com/t/flash-mx-motion-trail/10996/2 "2003-01-10T15:24:22Z")

</div>

you could duplicate the MC at distances behind the origonal relative to its direction of movement, then make them have lower and lower alpha values… I guess that would be entirely AS… but you could easily animate [insert desired number here] instances of a MC and then offset their timing so you get that onion skin effect, but that wouldnt be all AS so i dunno:sigh:

Maybe if you gave an example of what you are trying to achieve.

Peace

BTW if you look at Dans footer, he used all tweens for that, so you can achieve it without AS too.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 29, 2003, 12:03am UTC](https://forum.kirupa.com/t/flash-mx-motion-trail/10996/3 "2003-03-29T00:03:19Z")

</div>

i too am looking for code that will offset the timing and alpha for any given movie clip. we know it can be done with multiple instances, but we want Actionscripting Code!!! Where are you Lost in Beta??

Many people say they know how, and that its easy, and then say, ‘do it the old way…’ …but then again, if i was an AS-guru, i would get sick of people that always want code snippets, but take no initiative in learning it themselves. Perhaps if codes were accompanyed with comments, we could understand how they are working. I dont know, just a thought… Bleep! :rd:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 29, 2003, 12:07am UTC](https://forum.kirupa.com/t/flash-mx-motion-trail/10996/4 "2003-03-29T00:07:50Z")

</div>

yeah, where is that lost in beta?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 29, 2003, 12:09am UTC](https://forum.kirupa.com/t/flash-mx-motion-trail/10996/5 "2003-03-29T00:09:06Z")

</div>

im sure the almighty senocular knows this… or am i wrong??

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 29, 2003, 12:12am UTC](https://forum.kirupa.com/t/flash-mx-motion-trail/10996/6 "2003-03-29T00:12:59Z")

</div>

that all depends 😉

So how do you want it to operate? How portable does it need to be? Do you need this on one clip or do you want something that can be thrown anywhere anytime?

Theres different ways of handling it depending on the end result  
🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 29, 2003, 12:34am UTC](https://forum.kirupa.com/t/flash-mx-motion-trail/10996/7 "2003-03-29T00:34:56Z")

</div>

anywhere, anytime would be nice. 🙂

i would actually like something simple, that offsets an duplicate instance of an MC by one frame, lowers the alpha by 20%, before playing it, and then repeats until nothing is shown. Or anything that would act simliar to that. Does that make sense? :crazy:

How about i just ask, “Is there a way i could get an onion screening effect in an animation by using AS?”

:skull:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 29, 2003, 2:52am UTC](https://forum.kirupa.com/t/flash-mx-motion-trail/10996/8 "2003-03-29T02:52:36Z")

</div>

Is this what you’re looking for? it only uses one MC named ball and the rest is AS… Each ball is a duplicate of the first ball and then there is some AS to change the alpha and for each ball to follow the one that’s ahead of it… enjoy

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 30, 2003, 2:40am UTC](https://forum.kirupa.com/t/flash-mx-motion-trail/10996/9 "2003-03-30T02:40:25Z")

</div>

thats pretty much the effect that i wanted, but is there a way to apply that to a motion tweened movie clip? one that rely’s on the position of the clip, as opposed the the mouse cursor…

[AS]

ball.\_visible = false  
for (i=0; i\<5; i++) {  
nm = “ball”+i  
ball.duplicateMovieClip(nm, 5-i)  
}  
ball0.onEnterFrame = function() {  
this.\_x = this.\_x-(this.\_x-\_shape)/1.2;  
this.\_y = this.\_y-(this.\_y-\_shape)/1.2;  
};  
ball1.onEnterFrame = function() {  
this.\_alpha = 80  
this.\_x = this.\_x-(this.\_x-ball0.\_x)/1.2;  
this.\_y = this.\_y-(this.\_y-ball0.\_y)/1.2;  
};  
ball2.onEnterFrame = function() {  
this.\_alpha = 60  
this.\_x = this.\_x-(this.\_x-ball1.\_x)/1.2;  
this.\_y = this.\_y-(this.\_y-ball1.\_y)/1.2;  
};  
ball3.onEnterFrame = function() {  
this.\_alpha = 40  
this.\_x = this.\_x-(this.\_x-ball2.\_x)/1.2;  
this.\_y = this.\_y-(this.\_y-ball2.\_y)/1.2;  
};  
ball4.onEnterFrame = function() {  
this.\_alpha = 20  
this.\_x = this.\_x-(this.\_x-ball3.\_x)/1.2;  
this.\_y = this.\_y-(this.\_y-ball3.\_y)/1.2;  
};

[/AS]

can something like this be used and applied to a movie clip in a motion tween?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 12:46am UTC](https://forum.kirupa.com/t/flash-mx-motion-trail/10996/10 "2003-04-08T00:46:52Z")

</div>

Sure you can tween. You can also script the motion. For a motion tween, just change the firs few lines of code to follow the main tweened ball / object…

[AS]ball0.onEnterFrame = function() {  
this.\_x = this.\_x-(this.\_x-ball.\_x)/1.2;  
this.\_y = this.\_y-(this.\_y-ball.\_y)/1.2;  
};[/AS]

for scripted motion such as a bounce change it to:

[AS]decay = 0.98  
gravity = 1  
dx = 25  
ball.\_visible = false  
for (i=0; i\<5; i++) {  
nm = “ball”+i  
ball.duplicateMovieClip(nm, 5-i)  
}  
ball0.onEnterFrame = function() {  
//bounce  
dy \*= decay  
dy += gravity  
this.\_y += dy  
if (this.\_y\>350){  
this.\_y = 350  
dy \*= -1  
}  
//x movement  
this.\_x += dx  
dx \*= decay  
if (this.\_x\>540){  
this.\_x = 540  
dx \*= -1  
}  
if (this.\_x\<10){  
this.\_x = 10  
dx \*= -1  
}  
}[/AS]

just do the normal scripting to the main or original MC and leave the rest the same. here are the flas if you wanna check them out…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 12:48am UTC](https://forum.kirupa.com/t/flash-mx-motion-trail/10996/11 "2003-04-08T00:48:33Z")

</div>

here is the scripted bounce with the trailer…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 12:51am UTC](https://forum.kirupa.com/t/flash-mx-motion-trail/10996/12 "2003-04-08T00:51:41Z")

</div>

here is the motion tween w/ the trailer…

p.s. the code may not be optimized since I’m not yet a flash ‘guru’ so bear with me. also, if you have any comments or suggestions on how to improve the script, i would like to hear from you…:block:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 3:32pm UTC](https://forum.kirupa.com/t/flash-mx-motion-trail/10996/13 "2003-04-08T15:32:55Z")

</div>

thanks a lot zylum! ball trailer3 is exactly what i was looking for!

And to think, LIB said it couldn’t be done…

i could not get ball trailer2 to output anything. i get this error:

> 

Scene=Scene 1, Layer=Layer 1, Frame=1: Line 33: ‘;’ expected  
this.\_x = this.\_x-(this.\_x-ball0.\_x)1.2/\*the intertia follow (this.\_x = this.\_x-

Of course you can never just add a ‘;’ where it says and be done with it, cuz that would be too easy. Anyway, thanks a lot.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 8:21pm UTC](https://forum.kirupa.com/t/flash-mx-motion-trail/10996/14 "2003-04-08T20:21:02Z")

</div>

alas, i took out a division sign when i wrote the comment… here’s the code if you wanna fix it yourself

was:  
[AS]ball1.onEnterFrame = function() {  
this.\_alpha = 80  
this.\_x = this.\_x-(this.\_x-ball0.\_x)1.2; /\*the intertia…  
[/AS]  
is:  
[AS]ball1.onEnterFrame = function() {  
this.\_alpha = 80  
this.\_x = this.\_x-(this.\_x-ball0.\_x)\*\*/\*\*1.2; /\*the intertia…  
[/AS]

notice the missing slash before the ‘1.2’… here’s the fla if you’re too lazy to put in the slash;)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 8:23pm UTC](https://forum.kirupa.com/t/flash-mx-motion-trail/10996/15 "2003-04-08T20:23:13Z")

</div>

sweet! thanks a lot zylum. you rock! :rd:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 8:25pm UTC](https://forum.kirupa.com/t/flash-mx-motion-trail/10996/16 "2003-04-08T20:25:30Z")

</div>

no problem, you may want to ask one of the betters ASers to fix it up tho cuz i don’t think it’s really optimized…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 11:17pm UTC](https://forum.kirupa.com/t/flash-mx-motion-trail/10996/17 "2003-04-08T23:17:46Z")

</div>

Yeah,  
Thanks, I have also been trying to create something like that!
