PDA

View Full Version : Changing the colour of an MC



yorkshirepuddin
November 21st, 2002, 07:18 PM
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?

lostinbeta
November 21st, 2002, 08:21 PM
Try this...


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

yorkshirepuddin
November 21st, 2002, 08:41 PM
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 ...

lostinbeta
November 21st, 2002, 08:42 PM
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.

lostinbeta
November 21st, 2002, 09:11 PM
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.

yorkshirepuddin
November 21st, 2002, 10:02 PM
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

lostinbeta
November 21st, 2002, 11:22 PM
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 :) (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.

yorkshirepuddin
November 22nd, 2002, 12:09 AM
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*

lostinbeta
November 22nd, 2002, 12:11 AM
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.

yorkshirepuddin
November 22nd, 2002, 12:19 AM
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 ...

lostinbeta
November 22nd, 2002, 12:20 AM
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.

yorkshirepuddin
November 22nd, 2002, 12:24 AM
actually, i got a copy on this comp ... here ya go ...

lostinbeta
November 22nd, 2002, 12:28 AM
I don't see your setRGB code, are you trying to change the RGB code on the object in your layer labeled "background"???

yorkshirepuddin
November 22nd, 2002, 12:30 AM
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

lostinbeta
November 22nd, 2002, 12:37 AM
ok

yorkshirepuddin
November 22nd, 2002, 12:52 AM
Sorry, got caught up in something. do you want me to post the other one?

lostinbeta
November 22nd, 2002, 12:57 AM
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 :-\

yorkshirepuddin
November 22nd, 2002, 12:59 AM
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!

lostinbeta
November 22nd, 2002, 01:01 AM
Well you could recreate your tweens without using graphic symbols.

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

yorkshirepuddin
November 22nd, 2002, 01:06 AM
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 ...

lostinbeta
November 22nd, 2002, 01:14 AM
Yeah dude, I am confused.

I create a tween and stuff in my own file, and it works fine, but when I create a tween in your and try and change the alpha, it comes up as a mixed symbol so I can't change the alpha or anything.

It makes no sense, I didn't even use any graphics.

I also tried every way I could to change this RGB through AS, still a no go.

It really makes no sense.

yorkshirepuddin
November 22nd, 2002, 01:17 AM
Originally posted by lostinbeta
but when I create a tween in your and try and change the alpha, it comes up as a mixed symbol so I can't change the alpha or anything.

figures its something i did ... *LOL* ... screw it ... individual graphics it is ... had too many challenges lately

lostinbeta
November 22nd, 2002, 01:31 AM
No, it wasn't something you did, this was when I tried recreating the tween from scratch in your movie clip.

That is why I am confused... because its not something you did, whenever I create a tween Flash it making it a mixed symbol and I don't know why.

yorkshirepuddin
November 22nd, 2002, 01:33 AM
mmm ... did you create a new mc/graphic? i know sometimes if say i have a graphic tweening ... and at the end of the tween on that keyframe i convert it to a mc .. the beginning frame will still be graphic... does that make sense ... it's late ... *L*

lostinbeta
November 22nd, 2002, 01:37 AM
Yep, I drew a whole new rectangle from scratch and everything.

yorkshirepuddin
November 22nd, 2002, 01:43 AM
did you make it an mc before you starting playing with the tweens?

lostinbeta
November 22nd, 2002, 01:45 AM
Nope. I did my usual, it works fine for me when I start a new document, but it doesn't work that way when I do it in your document.

yorkshirepuddin
November 22nd, 2002, 01:54 AM
mmm .... i hate that ... it probably right in front of us ...

lostinbeta
November 22nd, 2002, 01:55 AM
lol, probably, but I can't figure it out :-\

yorkshirepuddin
November 22nd, 2002, 01:58 AM
Originally posted by lostinbeta
lol, probably, but I can't figure it out :-\

me neither ... :*( but i did what i said and pulled off the same effect ... i don't know why i just didn't do that in the first place ... serves me right for trying to be all fancy ... :)

lostinbeta
November 22nd, 2002, 01:59 AM
LOL ::rolls eyes::


:P