View Full Version : [MX] Changing Colour
Paz
June 6th, 2003, 01:09 PM
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:
Voetsjoeba
June 6th, 2003, 01:49 PM
I think it has something to do with the this. 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.
Paz
June 6th, 2003, 02:03 PM
No luck there, i'm sure its something simple, just like that though.
Thanks anyway!
lostinbeta
June 6th, 2003, 02:17 PM
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);
};
};
That goes on a frame not on the button.
myMovieClip.fadeColor({rb:204, gb:0, bb:0, ab:255}, 4);
That can go in the onRelease, but you have to make sure <B>myMovieClip</B> targets the movie clip you are trying to change.
Voetsjoeba
June 6th, 2003, 02:41 PM
Ah yep, missed that. Lost is the guru around here :beam:
lostinbeta
June 6th, 2003, 02:45 PM
Nope, thats Sen, Ilyas, Sbeener, and Eyez. Im catching up though (i think) :beam: :evil: :bad:
Paz
June 6th, 2003, 02:51 PM
Sorry i'm not having any luck with that either.
When i had this working before the whole code was on the button.
lostinbeta
June 6th, 2003, 02:55 PM
Works fine for me :-\ I just tested it.
Paz
June 6th, 2003, 03:05 PM
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?
lostinbeta
June 6th, 2003, 03:08 PM
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).
Paz
June 6th, 2003, 03:23 PM
My file size is too big! Sorry!
lostinbeta
June 6th, 2003, 03:41 PM
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.
Paz
June 6th, 2003, 06:30 PM
Hi i have placed the files at the address below to download.
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
lostinbeta
June 6th, 2003, 06:37 PM
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.
Paz
June 6th, 2003, 06:40 PM
How stupid do i feel :blush: :crazy:
Thank you so much, wonder if i would of ever worked it out!:thumb:
jdulberg
April 19th, 2005, 09:26 AM
Just to resurrect this thread... I'm using Lostinbeta's code to fade text buttons onRollOver. The only catch is that it appears to be processor intensive once I move back and forth from button to button (there are 5). If I trace a value inside the prototype, it continues to trace even when the mouse is not calling the function. How do I stop the fade prototype once its complete?
Any suggestions would be great!
Thanks :)
Jason
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.