# Function question

**URL:** https://forum.kirupa.com/t/function-question/156019
**Category:** Uncategorized
**Created:** [July 21, 2005, 10:00pm UTC](https://forum.kirupa.com/t/function-question/156019 "2005-07-21T22:00:44Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Thinker2501](https://avatars.discourse-cdn.com/v4/letter/t/e0b2c6/32.png) [@Thinker2501](https://forum.kirupa.com/u/Thinker2501)
#### Post date: [July 21, 2005, 10:00pm UTC](https://forum.kirupa.com/t/function-question/156019/1 "2005-07-21T22:00:44Z")

</div>

The following code is a function difined in my \_root. If I create a variable \_root.alpha and reference that in the function everything works fine. But when I use the function with an internally difined variable it doesn’t work. I need to be able to call this function from a number of movies in different timelines. Any help would be appriciated.

[INDENT]fade = function (alpha) {  
if (alpha\<=0) {  
alpha = 0;  
myColorTransform = {ra:‘100’, rb:alpha, ga:‘100’, gb:alpha, ba:‘100’, bb:alpha, aa:‘100’, ab:‘100’};  
my\_color.setTransform(myColorTransform);  
break;  
} else {  
myColorTransform = {ra:‘100’, rb:alpha, ga:‘100’, gb:alpha, ba:‘100’, bb:alpha, aa:‘100’, ab:‘100’};  
my\_color.setTransform(myColorTransform);  
alpha -= 25;  
}  
};  
[/INDENT]
