# AS gradually modify color

**URL:** <https://forum.kirupa.com/t/as-gradually-modify-color/28753>\
**Category:** flash\
**Created:** [August 18, 2003, 4:35am UTC](https://forum.kirupa.com/t/as-gradually-modify-color/28753 "2003-08-18T04:35:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hoppedup](https://avatars.discourse-cdn.com/v4/letter/h/dfb087/32.png) [@hoppedup](https://forum.kirupa.com/u/hoppedup)\
**Post date:** [August 18, 2003, 4:35am UTC](https://forum.kirupa.com/t/as-gradually-modify-color/28753/1 "2003-08-18T04:35:39Z")

</div>

ok so I have MovieA, which loads MovieB.

MovieB wants to change the color of the first movie, slowly darkening it.

so I tried a for loop:

darkenBGColor = new Color(\_level0.instance1.bg);  
darkenCAColor = new Color(\_level0.instance1.ca);  
for(i = 100; i \>= 50; i-1){  
dark.ra = i;  
dark.ga = i;  
dark.ba = i;  
darkenBGColor.setTransform(dark);  
darkenCAColor.setTransform(dark);  
}

but the change happens so fast that you can’t even tell. Is there a way that I can slow this effect down so it looks like I have tweened the change in color over maybe 10 frames?

or if you think it can be more easily done in another manner, please let me know Ⓜ

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 18, 2003, 5:08am UTC](https://forum.kirupa.com/t/as-gradually-modify-color/28753/2 "2003-08-18T05:08:06Z")

</div>

You could use the onEnterFrame event  
Something like this:[AS]darkenBGColor = new Color(myClip);  
dark = new Object();  
i = 0;  
myClip.onEnterFrame = function() {  
if (i\>50) {  
this.onEnterFrame = null;  
} else {  
i++;  
dark.ra = i_i/70;  
dark.ga = i_i/15;  
dark.ba = i\*i/12;  
darkenBGColor.setTransform(dark);  
}  
};[/AS]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 18, 2003, 5:18am UTC](https://forum.kirupa.com/t/as-gradually-modify-color/28753/3 "2003-08-18T05:18:29Z")

</div>

You may or may not find this thread useful…

[http://www.kirupaforum.com/forums/showthread.php?s=&threadid=22838](http://www.kirupaforum.com/forums/showthread.php?s=&threadid=22838)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 18, 2003, 5:22am UTC](https://forum.kirupa.com/t/as-gradually-modify-color/28753/4 "2003-08-18T05:22:49Z")

</div>

Ahh thats much better lost… im ashamed of my poor example 😊
