My code is below.
I am having some difficulty getting the duplicateMovieClip to work here. I can easily attach the movie within the “for” statement and get the result I want but I have multiple MC’s that I want to use this function on and alot of the code would be redundent. Is there better way?
for (i = 0; i < 1; i++) {
var myMC = this.attachMovie ("dragger", "dragger" + i, i);
this._x = 400;
this._y = 300;
this.onEnterFrame = explode;
}
function explode () {
for (i = 0; i < 50; i++) {
//var explode = this.attachMovie ("dragger", "dragger" + i, i);
//explode._x = 400;
//explode._y = 300;
var rn = Math.floor (Math.random () * (300 - 25)) + 250;
this._xscale = rn;
this._yscale = rn;
this.dx = Math.round (Math.random () * 600);
this.dy = Math.round (Math.random () * 600);
this.speed = Math.floor (Math.random () * (50 - 10)) + 10;
this.duplicateMovieClip (this, this.getNextHighestDepth ());
this.onEnterFrame = explosion;
}
}
function explosion () {
this._x += (this.dx - this._x) / this.speed;
this._y += (this.dy - this._y) / this.speed;
}
That code looks like it would crash a computer awefull quick. A loop making objects and onEnterFrame of those objects, you are running another loop, which attaches objects and duplicates them. Also animating them all at the same time.
wow.
That code looks like it would crash a computer awefull quick. A loop making objects and onEnterFrame of those objects, you are running another loop, which attaches objects and duplicates them. Also animating them all at the same time.
wow.
I am not having ANY problems but…
the demographic that will be going to my site wont be on great computers.
Thank you…You just saved me alot of headaches.
What do you recommend?
Please don’t say Custom MC Class I am avoiding learning how to do that.
What do you recommend? I only want to bring in ONE object and duplicate it and animate all the instances.
i dont really understand from the code what you are trying to accomplish, give me a bit of an explaination:)
this.duplicateMovieClip (this, this.getNextHighestDepth ());
should be something similar too.
this.duplicateMovieClip (this, NEWNAME, this.getNextHighestDepth ());
Amongst quite a few other things… I will initially give you this one… you are not utilizing the duplicateMovieClip method correctly.
TakeCare
_Michael
The following code works fine. But instead of using the attachMovie within the For loop. I want use duplicateMovieClip. Then I can attach the object and call the function for the object.
for (i = 0; i < 25; i++) {
var explode = this.attachMovie ("dragger", "dragger" + i, i);
explode._x = 400;
explode._y = 300;
var rn = Math.floor (Math.random () * (300 - 25)) + 250;
explode._xscale = rn;
explode._yscale = rn;
explode.dx = Math.round (Math.random () * 600);
explode.dy = Math.round (Math.random () * 600);
explode.speed = Math.floor (Math.random () * (50 - 10)) + 10;
explode.onEnterFrame = explosion;
}
function explosion () {
this._x += (this.dx - this._x) / this.speed;
this._y += (this.dy - this._y) / this.speed;
}
yeah, i noticed he was trying to dupe with attach syntax.
Whenever you have time I would love to hear it. Any help is welcome.