# Functions

**URL:** https://forum.kirupa.com/t/functions/122983
**Category:** Uncategorized
**Created:** [September 19, 2004, 3:01am UTC](https://forum.kirupa.com/t/functions/122983 "2004-09-19T03:01:52Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Zelwyn](https://avatars.discourse-cdn.com/v4/letter/z/3e96dc/32.png) [@Zelwyn](https://forum.kirupa.com/u/Zelwyn)
#### Post date: [September 19, 2004, 3:01am UTC](https://forum.kirupa.com/t/functions/122983/1 "2004-09-19T03:01:52Z")

</div>

[size=+2][color=#680aac][font=Comic Sans MS][size=2]How do you make a function where you type, for example, bladibladiblah(whatever, whatever2, whatever3);, and the whatevers be a variable in the function? Here’s my code:

function colorFade(endRa, endRb, endGa, endGb, endBa, endBb, endAa, endAb, speed) {  
speed = speed;  
myTransform = new Object();  
rA += (endRa-rA)/speed;  
rB += (endRb-rB)/speed;  
gA += (endGa-gA)/speed;  
gB += (endGb-gB)/speed;  
bA += (endBa-bA)/speed;  
bB += (endBb-bB)/speed;  
aA += (endAa-aA)/speed;  
aB += (endAb-aB)/speed;  
myTransform.ra = rA;  
myTransform.rb = rB;  
myTransform.ga = gA;  
myTransform.gb = gB;  
myTransform.ba = bA;  
myTransform.bb = bB;  
myTransform.aa = aA;  
myTransform.ab = aB;  
colorFunction = new Color(this);  
colorFunction.setTransform(myTransform);  
}

Then, on my MC, there’s this:  
onClipEvent (enterFrame) {  
colorFade(-100, 256, -100, 256, -100, 256, 100, 0, 5);  
}

Shouldn’t that pass on the variables I used to call the function to the actual function as endRa, endRb, endGa, etc., etc.?[/size][/font][/color][/size]
