Using proprproprototypes

is there anything wrong with using a ton of prototypes. i’m making an interface that loads flash movies into itself. each flash movie has a bunch of movieclip.prototype functions. so after loading in a bunch of these swfs there will be a whole bunch of these functions floating around. will those slow the movie, has anyone ever tried this with bad results? should i maybe try and erase them when they are no longer any use?

After the movie is unloaded, so is the prototype. I think. So you shouldn’t have a bunch of them floating around. Besides, if they aren’t running they aren’t using much resources anyway.

prototypes are good to use when creating interfaces. (like what your trying to do) they are commonly used to make things easier when used correctly, and they dont take up any more resources than say a variable =)

Actually, contrary to what lostinbeta suspected, the prototypes will remain in the movie even after the movie is loaded - at least global object prototypes which I suspect you’re using (like MovieClip.prototype).

Will they bog down the movie? Hardly. The worse theyd do is take up a couple extra bytes of RAM, but nothing to really worry about. The only problem is making sure none of the movies set prototypes of the same name as current prototypes, ie, you start with a MovieClip.prototype.move and another movie gets loaded in and redefines MovieClip.prototype.move to be something else completely - then you might have a problem.

Under the right circumstances, in controlled environments, that can be avoided easily enough.

Actually, contrary to what lostinbeta suspected, the prototypes will remain in the movie even after the movie is loaded - at least global object prototypes which I suspect you’re using (like MovieClip.prototype).

Very good to know Sen, I wasn’t sure which is why I added “I think” after that. Definitely useful information :slight_smile: