# \[MX\] Changing Colour

**URL:** <https://forum.kirupa.com/t/mx-changing-colour/22653>\
**Category:** flash\
**Created:** [June 6, 2003, 5:09pm UTC](https://forum.kirupa.com/t/mx-changing-colour/22653 "2003-06-06T17:09:09Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paz](https://avatars.discourse-cdn.com/v4/letter/p/22d042/32.png) [@Paz](https://forum.kirupa.com/u/Paz)\
**Post date:** [June 6, 2003, 5:09pm UTC](https://forum.kirupa.com/t/mx-changing-colour/22653/1 "2003-06-06T17:09:09Z")

</div>

Hi

I need help, I got this code from Kax. This allows me to change colour of my background. This use to work on my movie but now is just not working anymore!

Since i created a button loading a .swf file this has stopped working, Any suggestions anyone?

Code is below

on (release) {  
MovieClip.prototype.fadeColor = function(cto, e) {  
var myColor = new Color(this), cColor = myColor.getTransform();  
this.onEnterFrame = function() {  
for (var c in cColor) {  
cColor[c] += (cto[c]-cColor[c])/e;  
}  
myColor.setTransform(cColor);  
};  
};  
myMovieClip.fadeColor({rb:204, gb:0, bb:0, ab:255}, 4);  
}

I understand that I have to replace “myMovieClip” with the name of my clip!

Hope someone can help!!!  
:beam:

---

<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:** [June 6, 2003, 5:49pm UTC](https://forum.kirupa.com/t/mx-changing-colour/22653/2 "2003-06-06T17:49:44Z")

</div>

I think it has something to do with the [COLOR=BLUE]this[/COLOR]. Try replacing it with \_parent. I can’t test this 'cause I ain’t got flash on this pc but anyway. It’s worth a try.

---

<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:** [June 6, 2003, 6:03pm UTC](https://forum.kirupa.com/t/mx-changing-colour/22653/3 "2003-06-06T18:03:17Z")

</div>

No luck there, i’m sure its something simple, just like that though.

Thanks anyway!

---

<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:** [June 6, 2003, 6:17pm UTC](https://forum.kirupa.com/t/mx-changing-colour/22653/4 "2003-06-06T18:17:20Z")

</div>

[AS]MovieClip.prototype.fadeColor = function(cto, e) {  
var myColor = new Color(this), cColor = myColor.getTransform();  
this.onEnterFrame = function() {  
for (var c in cColor) {  
cColor[c] += (cto[c]-cColor[c])/e;  
}  
myColor.setTransform(cColor);  
};  
};[/AS]

That goes on a frame not on the button.

[AS]myMovieClip.fadeColor({rb:204, gb:0, bb:0, ab:255}, 4);[/AS]

That can go in the onRelease, but you have to make sure \<B\>myMovieClip\</B\> targets the movie clip you are trying to change.

---

<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:** [June 6, 2003, 6:41pm UTC](https://forum.kirupa.com/t/mx-changing-colour/22653/5 "2003-06-06T18:41:27Z")

</div>

Ah yep, missed that. Lost is the guru around here :beam:

---

<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:** [June 6, 2003, 6:45pm UTC](https://forum.kirupa.com/t/mx-changing-colour/22653/6 "2003-06-06T18:45:51Z")

</div>

Nope, thats Sen, Ilyas, Sbeener, and Eyez. Im catching up though (i think) :beam: :evil: :bad:

---

<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:** [June 6, 2003, 6:51pm UTC](https://forum.kirupa.com/t/mx-changing-colour/22653/7 "2003-06-06T18:51:31Z")

</div>

Sorry i’m not having any luck with that either.

When i had this working before the whole code was on the button.

---

<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:** [June 6, 2003, 6:55pm UTC](https://forum.kirupa.com/t/mx-changing-colour/22653/8 "2003-06-06T18:55:23Z")

</div>

Works fine for me :-\ I just tested it.

---

<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:** [June 6, 2003, 7:05pm UTC](https://forum.kirupa.com/t/mx-changing-colour/22653/9 "2003-06-06T19:05:23Z")

</div>

The code works in a movie of its own, but now placed into this movie when the button is pressed there is no responce.

Do you have an email address that i can send the file across to?

---

<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:** [June 6, 2003, 7:08pm UTC](https://forum.kirupa.com/t/mx-changing-colour/22653/10 "2003-06-06T19:08:36Z")

</div>

It sounds like a targeting issue to me.

You can attach your file to forum via the attachment feature (hit “Post Reply” button and there is a field in there for it).

---

<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:** [June 6, 2003, 7:23pm UTC](https://forum.kirupa.com/t/mx-changing-colour/22653/11 "2003-06-06T19:23:26Z")

</div>

My file size is too big! Sorry!

---

<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:** [June 6, 2003, 7:41pm UTC](https://forum.kirupa.com/t/mx-changing-colour/22653/12 "2003-06-06T19:41:41Z")

</div>

Can you upload to a server and put up a link? I don’t accept attachments in my e-mail so if that’s the only method you can do this, then perhaps one of the other folks here could help you out.

---

<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:** [June 6, 2003, 10:30pm UTC](https://forum.kirupa.com/t/mx-changing-colour/22653/13 "2003-06-06T22:30:12Z")

</div>

Hi i have placed the files at the address below to download.

[www.pagemakers.co.uk/flash](http://www.pagemakers.co.uk/flash)

I have also include the kari.fla which makes the .swf that opens into the .fla that does not work.

Hope this all makes sence!  
Thanks

---

<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:** [June 6, 2003, 10:37pm UTC](https://forum.kirupa.com/t/mx-changing-colour/22653/14 "2003-06-06T22:37:33Z")

</div>

Why are you publishing as Flash 5?

Thats why it doesn’t work, it uses Flash MX coding, but you are exporting as Flash 5.

Go to File/Publish Settings and click on the Flash tab. In the “Version” drop down box choose “Flash 6” and it works fine.

---

<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:** [June 6, 2003, 10:40pm UTC](https://forum.kirupa.com/t/mx-changing-colour/22653/15 "2003-06-06T22:40:39Z")

</div>

How stupid do i feel 😊 :crazy:

Thank you so much, wonder if i would of ever worked it out!:thumb:
