PDA

View Full Version : Functions&Objects


sandman9
10-11-2003, 02:11 PM
Hello

I'm trying to memorize a list of built-in functions and a list of built-in objects. Although I want to understand why eval, escape, etc are built in functions and why colour, button, etc are built in objects. Like is there something that can help me to distinguish in my mind what is a functin and what is a object (built in of coarse). Also things like boolean and string will appear as both a built in function and object. My only reference has been looking at something like this:



function scoreTally (userName, score) {
score.display = userName;
score.display = score;
}




Looking at this I figure what ever goes in the first line above is considered a function and the "score.display" would be the object. I don't know if this is correct. Can anyone help my confused mind?

Sandman9

sandman9
10-11-2003, 06:45 PM
Basically I guess my question is:

How can my mind look at date, array, eval, and escape and say "oh, Date and Array are built-in Objects and Eval and Escape are built-in Functions" ......... How can I know this?

Sandman9

snapple
10-12-2003, 06:26 AM
sandman,

Well this is going to sound like an annoying answer, built in objects are ones you don't have to instantiate, you access the object directly. Built in objects are made by Flash.

Obviously, built in functions are exactly the same, in that we dont have create them, for example, you know what the


gotoAndPlay();


function does - you know that you can always use that, because you know it is a built in function and will always be available.

Its built it - its very easy to tell built in objects apart from user defined ones - cos you have to make the ones that aren't built it, simple !

You could also change your settings in Flash so that whenever you use a built object or function it appears bright pink - then you'd know.

Regards, snapple :)

sandman9
10-12-2003, 04:02 PM
Hey Snapple

Thanks for your reply but I think you missed the question. I am asking about how to diffferntiat between Objects and Functions. Please read above to find out what exactly :).

Thanks again for the reply
Sandman9

senocular
10-12-2003, 04:48 PM
you know by remembering :rolleyes:

snapple
10-12-2003, 05:32 PM
Yeah, i think senocular's technnique might work well.

I mean, i probably missed the question cos its a bit of an odd one. Get a book and a cup of coffee & tolberone (my combo).

Functions are functions - they do things, objects contain data. Methods are functions applied to objects.

Theres no magical way - an object is an object - i mean you know that the date object is not a method or a function - because its an object.

Functions accept parameters too when they are instiated.

snapple :)

jubei
10-12-2003, 06:53 PM
I like your suggestion that functions -do- things wheras objects -are- things.. things that contain data. It makes it sound like a verb versus a noun :)

sandman9
10-12-2003, 06:59 PM
ya this is what I was going to do. I did not know if there was a better way than just that ...... i guess i know now :D

thanks guys
Sandman9