Changing colours using Actionscript.
I am starting to learn AS2.0. Can someone show me how to change a colour in a movie clip via Actionscript? For instance, say the clip starts off red and I want it to change to blue then green and finally red again? How would I do that?
I really want to learn this so any help is much appreciated.
Use the built in SetRGB(); Function
Haven't checked out others help, but you should definitely use the setRGB function. Paste this is in first frame of your flash movie.
// *************************** //
// MovieClip.setRGB() method //
//this is a built in function which allows us to set the color of the lots from the text file.
MovieClip.prototype.setRGB = function(newColor) {
(new Color(this)).setRGB(newColor);
} // end MovieClip.setRGB()
// *************************** //
Then you would type something like this:
_root.map.lot1bg.setRGB(_root.lotInfo.lot1color);
where _root.map.lot1bg is the path of the movie clip who's bg you are changing, and lot1color is just a variable I set in an external document and imported.
I think you can then use the new built in mx transition tweens to swap between colors, and you can use the parameter that allows you to run a function when the tween is done (I forget what it is called - just look up mx.transitions and it will explain) - that way you could set up a repeating function. I wouldn't advise using setInterval here - that will get messy, and slow things down for no reason...let me know if you need more help and I could give you better details -