# \[MX04\] function(arg) problem

**URL:** https://forum.kirupa.com/t/mx04-function-arg-problem/103144
**Category:** Uncategorized
**Created:** [March 2, 2004, 2:35pm UTC](https://forum.kirupa.com/t/mx04-function-arg-problem/103144 "2004-03-02T14:35:57Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![matej](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@matej](https://forum.kirupa.com/u/matej)
#### Post date: [March 2, 2004, 2:35pm UTC](https://forum.kirupa.com/t/mx04-function-arg-problem/103144/1 "2004-03-02T14:35:57Z")

</div>

Hi,

having a bit of a problem with a simple function, I don’t know, I guess I’m just too tired to get it right:

I would like to make a function which randomly calculates values which I later use in the setTransform thingie.

If I hardcode the random script (see the commented lines) it works ok.

But the function won’t work ☹ the values don’t transfer.

Below is the whole script of the enterFrame:

onClipEvent (enterFrame) {  
if (something) {  
function alco(arg) {  
arg = -225+(Math.floor(Math.random()\*450));  
return(arg);  
trace(arg);  
}  
alco(alphar);  
alco(alphag);  
alco(alphab);  
alco(alphaa);  
alco(colorr);  
alco(colorg);  
alco(colorb);  
alco(colora);  
//alphar = -225+(Math.floor(Math.random()\*450));  
//alphag = -225+(Math.floor(Math.random()\*450));  
//alphab = -225+(Math.floor(Math.random()\*450));  
//alphaa = -225+(Math.floor(Math.random()\*450));  
//colorr = -225+(Math.floor(Math.random()\*450));  
//colorg = -225+(Math.floor(Math.random()\*450));  
//colorb = -225+(Math.floor(Math.random()\*450));  
//colora = -225+(Math.floor(Math.random()\*450));  
}  
colorObj = new Color(MCname);  
colorObj.setTransform({ra:alphar, rb:colorr, ga:alphag, gb:colorb, ba:alphab, bb:colorb, aa:alphaa, ab:colora});

}

If you have any ideas how to write this function, I would be very thankful. I hope the aim is clear.

Regards, Matej
