Function Bank?

Out of curiosity, has anyone ever heard of something like a function bank for flash?

are you talking about like a site with custom prototypes (added functions to existing objects)?

yeah

http://proto.layer51.com/

senocular has many proto’s posted on there =)

http://proto.layer51.com

[edit] :!: beaten by a mere reference! [/edit]

haha :beam:

i’ve been wondering for a while now what the purpose of prototype was because everyone seems to be using it, but nothing seems to clear it up. not even that site. could one of you please explain it?

garsh I just might have to revise the FAQ there then :-\

eh?

I wrote the FAQ (most of it) at http://proto.layer51.com which describes what a prototype is, well briefly at least

using prototypes are a way to add a common function to an existing object type, like movieclip, or Array, or even math.

when you create a new object, a set of functions are available for that object. for example, array has split, pop, push, etc…you can add a function like reverseX2 like this:

Array.prototype.reverseX2 = function () {
this.reverse();
this.reverse();
};

which is completely unecessary (it reverses the order of an array twice :sigh:**), but for the sake of example, shut up!

now everytime you make a new Array object, you can use that function:

arr1 = new Array();
for (i = 0; i < 10; ++i) arr1* = i;
arr1.reverseX2(); // array is now the same as it's always been, but we did something !

See how it works? mind you though, that prototypes will only work with the same objects. reverseX2 will not work on a MovieClip or Sound object. the keyword “prototype” is telling flash to apply this functions to all objects of this type.

But thoriphes!! reverseX2 is completely unecessary!! :sure:

I get it. thats one d4mn useful peice of code!

and if you really wanna get deeper into how prototypes work, read sen’s stuff on inheritance, it’ll help a lot too =)

*Originally posted by senocular *
**But thoriphes!! reverseX2 is completely unecessary!! :sure: **
:m:

aright. thanks.

thoriphes.prototype.:m: = function(){
return new senocular( :love: );
}

Don’t listen to senocular and his rabble-babble. he goes to clubs at night and opens conversations with “I’m Batman”.

:bad:

*Originally posted by senocular *
thoriphes.prototype.:m: = function(){
return new senocular( :love: );
} **
:m:
();

:love:

No, sorry, you’ve been missinformed. Batman does that, not me. Our amazing similarity in looks is purely coincidence.