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