PDA

View Full Version : using proprproprototypes



kupreg
June 10th, 2003, 01:45 PM
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?

lostinbeta
June 10th, 2003, 04:11 PM
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.

Raydred
June 10th, 2003, 07:38 PM
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 =)

senocular
June 10th, 2003, 08:08 PM
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.

lostinbeta
June 10th, 2003, 08:12 PM
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 :)