|
-
Ivor1
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.
-
here is a link that should help you. Download the BitmapData class tut (1st one)
-
Ivor1
Thanks. This colour picker tutorial certainly looks informative but it's going to take a while to learn. Ideally, I would like to have a movie clip whose background colour fades continuously through the spectrum and this has set me on the right course. Any more advice on achieving this is most welcome though.
-
will have you a sample later
Last edited by wattsup; 05-22-2007 at 05:22 AM.
-
silentweed posted this in another forum - it should do what you want.
have a look at colorshifter application at http://www.braingiants.com/ for an example of background color fades
-
Ivor1
Thanks, wattsup. That's a very cool site. I'm getting closer now to what I want. I just have to figure how to get the colours to change by themselves, without interaction.
That is, a white stage with a small movie clip on it with the m_c's colours fading through the spectrum, perhaps randomly.
-
-
Ivor1
I'll try set interval but it's gonna take a while. This is more involved than I first
thought. Thanks for helping.
-
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 -
-
Ivor1
I am going to try this "setRGB" function but as I'm a shade green to AS, it's going to take me a while. I can't start till later on but do I have to create and import another file as per your lot1colour? Many thanks for your help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|