Variable RollOut


Anyways, click on that link. As you can see I’ve set it up so that clicking on one will change the color of the other. As well, they have a rollover to another color.

But, I want to add a rollout thing to each link so that when I rollout the link will go back to the color it was before I rolled over.

Right now it stays with the rollover color and when I add a rollout thing it is constrained to one color. I need it to be adaptive to each situation as I will be adding more links and more colors down the road.

I just need a rollout action that will not change it to a certain color, just the color it was before I rolled over.

If you understood that at all answer. If not, tell me or ask a question to clear it up. I might even whip up a larger version of it with more colors to make it clearer, but only if you need.


(I’m working with Flash MX.)

// code for changing color back
} ?? i don’t get the problem… maybe you should make an example with more colors or buttons…

I’ll make a better example.

Here’s a better example. It has more stuff.

Click on and of the last 4 links, you’ll notice what happens. All the other links turn a color and the one you clicked goes whitish. When you RollOver any link that is colored, it goes whitish as well. But when you RollOut, it goes to a single color. I want it to be so that when you RollOut it will go to the color it was previously, but it has to be adaptive because each link could be one of 5 colors (grey included) when you RollOver it.

Anyone see what I mean?

why dont you just capture the last color into a variable?
when you click a button, how exactly are you changing the colors of the text? If its sending the timeline to a different frame, you can just rollout back to that frame. I have to know how you are changing the colors so I can tell you how exactly your code can be fixed.

It’s with this:

This is what the “Portfolio” button looks like.

on (release) {
var colorful = new Color("_root.home");
var colorful = new Color("_root.portfolio");
var colorful = new Color("_root.tutorials");
var colorful = new Color("_root.downloads");
var colorful = new Color("_root.infocontact");
on (rollOver) {
var colorful = new Color("_root.portfolio");
on (rollOut) {
var colorful = new Color("_root.portfolio");

I need to change that rollOut tag so its not just one color. So it works in all situations. If that isn’t possible this way, can you help me out with another way of doing this?

The problem with this is that it becomes too tedious to code it all out. One way I think you can do this is to make a prototype for all the buttons. However, I think there should be a way to keep track of teh last color with your current code. The problem is that you are using var and you cant easily access it outside of the event. Also all your variables are called colorful which makes it hard to keep track which is which.

If you create new variables like:
redColor = (0xd50000);
blueColor = (hecidecimal for blue) //put hecidecimal values in there.
pinkColor = (blah blah) and so on.
on each button put this release and roll out code:
homeColor = new Color("_root.home");
//set the rest of the buttons to redColor accordingly.

thisColor = new Color(this);

I hope this isnt too confusing. The code might not be correct but if you get the logic you can just figure something out on your own.

I think I understand it, but will that rollOut code work in all instances? Say if the button was Green or Blue when you rolledOver?

**** masked your right, I didnt think of fixing that yet. Ill think of something soon

Thanx! This means a lot!