i am an intermediate flasher but i am confused on the subject of making trails in actionscript, i have trails made out of movie clips by offseting tweens a little bit, but there has to be an easier way, like if i attached a movie clip as the cursor, how would i make the movie clip have a trail to folow it? i guess thats what im asking thanks
duplicateMovieclip \r\rI’m in a hurry and i can’t provide much more info than that. Edit the movie clip and in the timeline use dupMC
what is dup MC?
Embedded Scripts and Applets not allowed \r\ryou mean you want something like this? this is just a basic mouse trail. what you do is make a MC (movie clip) and give it an instance name. right click on the MC and select edit. Now in the timeline, select frame 10 and press F5 (this inserts a frame). Now insert a layer and in this new layer select frame 4 and press F6 (this inserts a keyframe). Now double click on frame 4 and the actions panel will come up. In the actions panel put this code\r\rduplicateMovieClip (“Target” , “newname”, “depth”)\r\rtarget=the orginal MC so your code will be “_root.INSTANCENAME” w/o the quotes.\r\rnewname= the name of the image that will be created. anything will do.\r\rdepth=the depth of the new image that is created.\r\rrepeat this with frames 5, 6,7 etc, and you will get a trail.
or what you could do is duplicate a number of movieclips, then make each follow the one ahead of it, and make the primary instance follow the mouse or something.\r\ractually here’s the code to make it work:\rgiven an MovieClip instance named “mc0” (meaning a movieclip symbol with the name “mc0”, not what you named it when you created it with F8 or whatever, but when you place it from the library to the main stage, select it, then find the “Instance” tab, then give it the name “mc0” there.):\r\r<font color=“blue”><tt>\ronClipEvent (load) {\r if (_name == “mc0”) {\r for (x=1; x<=20; ++x) {\r this.duplicateMovieClip(“mc”+x, x);\r _root[“mc”+x].follow = x-1;\r }\r } else {\r mc = _root[“mc”+follow];\r }\r delay = 7;\r}\ronClipEvent (enterFrame) {\r if (_name == “mc0”) {\r x = _root._xmouse;\r y = _root._ymouse;\r } else {\r x = mc._x;\r y = mc._y;\r }\r vx = x-_x;\r vy = y-_y;\r _x += vx/delay;\r _y += vy/delay;\r}</font></tt>\r\rthere, that should do it for ya. enjoy!
The master of mouse trailers has spoken… Thor, your movies in the Animation section are just the best, did I tell you that aldeady ?\r\rpom 0]
lol, thanks pom.
right now im just fooling around with actionscript, trying to get a better grasp on it. Ive got the whole flash without actionscript thing down, but actionscript just threw me off… im making a section on my website that is going to contain all of my flash expiraments, as soon as i get the place tidied up and some good movies on there ill send the link. Thanks again
ok now insted of making the trail follow a movie clip thats attached to a mouse, im trying to attach a trail to a randomly moving movie clip, only when i do, i just get a bunch of syntax errors. Im at school and the *.fla is at my house otherwise i would post the source… maybe you can help me?
pub40.ezboard.com/fkirupa…=459.topic\r\r\rthere is random mouse trail. thanks to sinfinity
to make it follow this object, just change _root._xmouse and _root._ymouse to the x and y of the randomly moving object.
you guys are gods… i hope some day to be able to inform the masters (you guys) on how to do something, then i will be able to die a happy man.
yeah, ive been trying hard to make the trails on a randomly moving movie clip work, but when i do all i get is a blue dot (the movie clip) in the center of the screen and after about 2 sceonds it just flys off into the NW corner of the screen… maybe someone can give me an example of a script that would put a fading trail on a randomly moving movie clip… cuz my brain hurts from trying so hard…
in the frame i have:\rfunction getdistance (x, y, x1, y1) {\r        var run, rise;\r        run = x1-x;\r        rise = y1-y;\r        return (hyp(run, rise));\r}\rfunction hyp (a, b) {\r        return (Math.sqrt(aa+bb));\r}\rMovieClip.prototype.reset = function () { \rvar dist, norm, movie_height, movie_width;\r\rmovie_height = 400;\rmovie_width = 550;\r\rspeed = Math.random()4+2;\rtargx = Math.random()(movie_width-_width);\rtargy = Math.random()*(movie_height-_height);\rdist = _root.getdistance(_x, _y, targx, targy);\r\rnorm = speed/dist;\rdiffx = (targx-_x)*norm;\rdiffy = (targy-_y)*norm;\r};\r\r\rMovieClip.prototype.move = function () { \rvar cycle;\r\r\rcycle = 200;\r\rif (_root.getdistance(_x, _y, targx, targy)>speed) {x += diffx;y += diffy;\r} else {x = targx;\ry = targy;\rif (!this.t) {\rt = getTimer();\r}if (getTimer()-t>cycle) {reset();\rt = 0;\r}\r}\r_x = x;\r_y = y;\r}\r\rand on the movie clip i have:\r\ronClipEvent (load) {\r        if (_name == “mc0”) {\r                for (x=1; x<=20; ++x) {\r                        this.duplicateMovieClip(“mc”+x, x);\r                        _root[“mc”+x].follow = x-1;\r                }\r        } else {\r                mc = _root[“mc”+follow];\r        }\r        delay = 2;\r}\ronClipEvent (enterFrame) {\r        if (_name == “mc0”) {\r                x = _xmouse;\r                y = _ymouse;\r        } else {\r                x = _x.mc;\r                y = _y.mc;\r        }\r        vx = x-_x;\r        vy = y-_y;\r        _x += vx/delay;\r        _y += vy/delay;\r}\r\r\rmaybe this will help you understand what im trying to do, i just dont know what to change _root._ymouse and _root._xmouse to. or maybe i have bigger problems
HHHHHHHHHHHEEEEEEEEEEEEEEEEEELLLLLLLLLLLLLLLPPPPPPPPPPPPPPP MMMMMMMMMMMMEEEEEEEEEEEEEE!!!
come on, someone please read this
Gimme a minute.\rpom 0]
More complex than I thought…\rpom 0]
someone please help me!!!
OK, OK… Put 3 layers in your movie : Code, empty and clip.\r\rIn Code, just paste Supra’s random motion code.\rIn empty, put an empty clip, that you’ll instance name “empty”, and with this code :
onClipEvent (enterFrame) {\r\r move();\r\r}
and in Clip a movie clip with the code :
onClipEvent (load) {\r\r if (_name == "mc0") {\r\r for (x=1; x<=20; ++x) {\r\r this.duplicateMovieClip("mc"+x, x);\r\r _root["mc"+x].follow = x-1;\r\r }\r\r } else {\r\r mc = _root["mc"+follow];\r\r }\r\r delay = 7;\r\r}\r\ronClipEvent (enterFrame) {\r\r if (_name == "mc0") {\r\r x = _root.empty._x;\r\r y = _root.empty._y;\r\r } else {\r\r x = mc._x;\r\r y = mc._y;\r\r }\r\r vx = x-_x;\r\r vy = y-_y;\r\r _x += vx/delay;\r\r _y += vy/delay;\r\r \r\r}\r\r
Happy now ??\rpom 0]