View Full Version : Function Bank?
grandsp5
August 7th, 2003, 02:36 PM
Out of curiosity, has anyone ever heard of something like a function bank for flash?
thoriphes
August 7th, 2003, 02:38 PM
are you talking about like a site with custom prototypes (added functions to existing objects)?
grandsp5
August 7th, 2003, 02:38 PM
yeah
ahmed
August 7th, 2003, 02:39 PM
http://proto.layer51.com/
senocular has many proto's posted on there =)
senocular
August 7th, 2003, 02:39 PM
http://proto.layer51.com
:!: beaten by a mere reference!
ahmed
August 7th, 2003, 02:40 PM
haha :beam:
Coppertop
August 7th, 2003, 02:40 PM
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?
senocular
August 7th, 2003, 02:43 PM
garsh I just might have to revise the FAQ there then :-\
Coppertop
August 7th, 2003, 02:45 PM
eh?
senocular
August 7th, 2003, 02:46 PM
I wrote the FAQ (most of it) at http://proto.layer51.com which describes what a prototype is, well briefly at least
thoriphes
August 7th, 2003, 02:47 PM
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] = 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.
senocular
August 7th, 2003, 02:48 PM
But thoriphes!! reverseX2 is completely unecessary!! :sure:
Coppertop
August 7th, 2003, 02:48 PM
I get it. thats one d4mn useful peice of code!
ahmed
August 7th, 2003, 02:48 PM
and if you really wanna get deeper into how prototypes work, read sen's stuff on inheritance, it'll help a lot too =)
thoriphes
August 7th, 2003, 02:50 PM
Originally posted by senocular
But thoriphes!! reverseX2 is completely unecessary!! :sure: :m:
Coppertop
August 7th, 2003, 02:50 PM
aright. thanks.
senocular
August 7th, 2003, 02:52 PM
thoriphes.prototype.:m: = function(){
return new senocular( :love: );
}
thoriphes
August 7th, 2003, 02:52 PM
Don't listen to senocular and his rabble-babble. he goes to clubs at night and opens conversations with "I'm Batman".
:bad:
thoriphes
August 7th, 2003, 02:53 PM
Originally posted by senocular
thoriphes.prototype.:m: = function(){
return new senocular( :love: );
} :m:();
:love:
senocular
August 7th, 2003, 02:54 PM
No, sorry, you've been missinformed. Batman does that, not me. Our amazing similarity in looks is purely coincidence.
Johnny64
August 7th, 2003, 02:54 PM
i learned a LOAD of all sen's post's here and there :}
and http://proto.layer51.com is one of my favorieten(dam that's dutch :sigh: )
;) :sigh:
grandsp5
August 7th, 2003, 02:55 PM
I am batman...you should submit that to FreddyThunder as a pickup line.
Johnny64
August 7th, 2003, 03:01 PM
but he has changed his footer!!
kirupa
August 7th, 2003, 03:04 PM
Just wondering thor, isn't it unnecessary to reverse something twice? Curious minds want to know ;)
....on a more relevant note, I have never used prototypes before, but they seem really useful! I may have to give that a shot sometime. I only barely started using Event Handlers a few weeks ago :)
thoriphes
August 7th, 2003, 03:05 PM
Originally posted by thoriphes 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] = 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. :whistle:
senocular
August 7th, 2003, 03:07 PM
LOL! and a bomb from kirupa! ;)
kirupa
August 7th, 2003, 03:10 PM
haha, don't worry thor - I was just twisting your leg....all the way around and into a pretzel :)
Freddythunder
August 10th, 2003, 12:50 AM
[just a side note - I was searching my name]
Master64 - you can still put in pickup lines at:
http://www.freddythunder.com/home.php?goto=footer
hahaha!!!
I got like 200 pickup lines in the four days it was up. I'll update it soon!!
Jubba
August 10th, 2003, 11:40 AM
slammed by kirupa... the master of motion tweens ;)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.