Flash mx-motion trail

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.

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.

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:

yeah, where is that lost in beta?

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

that all depends :wink:

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
:slight_smile:

anywhere, anytime would be nice. :slight_smile:

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:

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

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?

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…

here is the scripted bounce with the trailer…

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:

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.

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

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

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…

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