Script-Question

Hey Fellas!
Whenever I read through the tutorials including complicated AS as well as the tips that the freaks here (Upu, IamnotJubba, Eyezberg, etc.), I see:

function name () {
}
thingy and I really don’t know what it is, what it does and all that.

THe same thing with the “for” code.

for ( init; condition; next ) {
}

What in the world does all that crap mean?

THX

Don Albino

you know whats funny? i was going to post the same question. Well, not about function, but about the for statements. lol

I gotta admit, that that is kinda of funny, but it really doesn’t help me.
Well it may…
since it is easier when you know, that there are other people out there, that have the same problem, especially when it is someone as good with FLash, as you are (no joke, I am serious)

When you got it figured out, tell me.

Don Albino

Syntax

for(init; condition; next); {
statement;
}

Arguments init An expression to evaluate before beginning the looping sequence, typically an assignment expression. A var statement is also permitted for this argument.

condition An expression that evaluates to true or false. The condition is evaluated before each loop iteration; the loop exits when the condition evaluates to false.

next An expression to evaluate after each loop iteration; usually an assignment expression using the ++ (increment) or – (decrement) operators.

statement A statement within the body of the loop to execute.

Description Action; a loop construct that evaluates the init (initialize) expression once, and then begins a looping sequence by which, as long as the condition evaluates to true, statement is executed and the next expression is evaluated.

Some properties can not be enumerated by the for or for…in actions. For example, the built-in methods of the Array object (Array.sort and Array.reverse) are not included in the enumeration of an Array object, and movie clip properties, such as _x and _y, are not enumerated.

functions are really quite fun. I’m having a blast trying to put them together.

a function is basicaly just a reusable piece of code that you give a name so that you can call to it.

syntax looks like this

function name(optional arguements){
code in here
}

so if you had a function like this

function figureTax(cost){
newPrice=cost*.065+cost;
return newPrice;
}

the name, “figureTax” can be called from anywhere like so

figureTax(33.99);

this will use 33.99 in the function and perform anything that the function calls for upon that number, in this case, it multiplies it time .065 and then adds it to the price then it returns the variable newPrice back to the place that called for the function.

Sometimes functions can be very complex, even calling other functions into effect during their execution…

It is not neccessary to have any arguements passed to or from the function at all.

hmmm…

Thx

But how woulf Flash know that it is supposed to substitute the 33.99 for the cost?
I think I will play around with it for a while.

THX again. I’ll be back with even mire questions.

Don Albino

Here I go again.
What do the “++” “–” and “+=” or “-=” for?

nevermind
I figured out how Flash knows why iy should substitute 33.99 for cost.
It was quite obvious.
I just didn"t pay attention the first time
Sorry

Albino