Changing the colour of an MC

Hello again,

I am trying to automatically change the colour of an MC when it comes into play and am having a few problem. I used the code I found in the Flash AS Help, but it’s not working.

Here’s what I used:

myColor = new Color(rollover);
myColor = setRGB(0x993366);

Rollover is the instance of the MC I want to target.

What am I doing wrong?

Try this…

myColor = new Color(rollover);
myColor.setRGB(0x993366);

Thanks again lost … it didn’t work though … should i put in on the mc action or main timeline … i’m not sure if its not working because its inside an MC that acts as a button …

time for a break …

I didn’t test that, I gotta go eat dinner now, I should be on later so if no one else solves the problem… I will be back…lol.

Untested again, but I just realized I forgot something…

myColor = new Color(_root.rollover);
myColor.setRGB(0x993366);

I forgot to add the _root, it should work now, if not, I will experiment later.

nope … didn’t work …

here’s the deal … the target is within a mc acting as a button … the target is on the _over state …

you’ve seen the nav … its the rollouts … each color should be diffent … rather than creating 3 graphics or tinting … i thought i’d be able to just change the color through AS

This is what I did and it works great…

I created a square… converted that to a movie clip.

Inside the square movie clip I created a circle (next to the square) and made that a movie clip with the instance name “circle” (no quotes).

I then went back to the _root timeline and added these actions to my square movie clip…

onClipEvent (load) {
	circleColor = new Color(this.circle);
}
on (rollOver) {
	circleColor.setRGB(0xE6E6E6);
}
on (rollOut) {
	circleColor.setRGB(0x999999);
}

Works great :slight_smile: (except that since the circle is also part of the movie clip when you mouseover the circle it does the same thing, but I don’t know your exact situation so I am not going to bother with fixing it).

I attached the .fla if you want to check.

No fair … doesn’t work for me … I think it’s because I have it set up a little differently that you …

Here’s my setup …

MC1 - on main timeline acting as button

Within MC1 on _over state, MC2 (animated) …

MC2 is what I’m trying to target … but the gods won’t let me …

Why, oh why, do they have to rain on my parade? L

Thanks for the help though. I could do with you with Flash as one of those helpers … you know … the kind that pop up in Microsoft Office and ask ‘can i help?’ … L

LOL, I am not a paper clip…LOL.

Anywho, can you post a .fla???

Even if it is just a basic example one and not the real one.

LOL … nah … you’re the wacko scientist … or maybe the cute dog … L … and hey … paper clips are handy you know …

Okay, give me a sec … I’ll strip the .fla down a little and send it along … although last time I tried to attach a .swf it wouldn’t let me … so god knows what it will do with my crazy .fla …

give me 10 mins … i need to switch burn it and transfer to this computer …

Yes, I want to be a crazy scientist!!!

You can’t attach .swf files to the board, it doesnt work when you try to view.

As for .fla files, it should work fine as long as the size isn’t too big.

actually, i got a copy on this comp … here ya go …

I don’t see your setRGB code, are you trying to change the RGB code on the object in your layer labeled “background”???

*Originally posted by lostinbeta *
**I don’t see your setRGB code, are you trying to change the RGB code on the object in your layer labeled “background”??? **

oops … that one won’t have it … that’s an older version … the new one is on my laptop … yes … it’s the background layer … its an animated mc

ok

Sorry, got caught up in something. do you want me to post the other one?

No, that is ok.

I have a sneaking suspicion that it is because you use graphics in your movie clip, I am not sure though :-\

*Originally posted by lostinbeta *
**I have a sneaking suspicion that it is because you use graphics in your movie clip, I am not sure though :-\ **

Well that sucks eh?

Looks like I’m going back to just tinting… cheers me dears!

Well you could recreate your tweens without using graphic symbols.

I am going to test this now and let you know if it works.

really? i never know that … don’t go out of you way on my behalf … I’m just creating individual graphics for the rollovers … its only 3 …