Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Colouring an MC increases its depth?

Status
Not open for further replies.

Leozack

MIS
Oct 25, 2002
867
GB
Here's 1 I didn't see coming - I havea n mc box as a bg, to which I attach another mc that loads a picture. all ok. the picture covers the bg.

But if I say this
Code:
myColor = new Color(image_mc);
myColor.setRGB("0x"+Colour);
then suddenly the bg is in front of the image! That's it. That's all I do, and suddenly it's up front. Can anyone tell me why this is happening and how to colour a background mc without it covering things that were otherwise above it?

_________________________________
Leozack
Code:
MakeUniverse($infinity,1,42);
 
After further investigation it seems the problem isn't what I thought it was, but it is still a problem.

If I use the mc background box I have to create the mc I load my image into rather than the _root
ie var thisImage_mc = image_mc.createEmptyMovieClip("thisImage_mc",0);
not var thisImage_mc = _root.createEmptyMovieClip("thisImage_mc",0);
then if I have previous coloured over the bg box mc with a colour ie myColor = new Color(image_mc); and myColor.setRGB("0x0088EE");
the result is I get 2 mc's of colour instead of the bg box mc coloured and the image mc having the image in.

So I can use _root instead of the coloured box to createemptymovie with, but then I have to fiddle the positioning (not hard). But surely when I say mc.createemptymovie - even if the new movie gets coloured the same way the last one did - it shouldn't mean an image I load in doens't show? :(

Oh - and on my stage I have a textbox and if I use _root to make an mc for my loaded image rather than image_mc (already on stage and under the textbox) then the textbox is covered and I can't find a way to stop that being covered without using image_mc to work from instead of _root, which then gives me that colouring problem x_x So I'm having problems eitherway and I can't workaround them yet ><


_________________________________
Leozack
Code:
MakeUniverse($infinity,1,42);
 
Yeah sorry it's late at night and the fla is too bloated to show. I'll knock up an exmaple if I can. But essentially here is a more refined summary :

Stage contains a clip with a background filling gradient.

Above that clip is a textbox with a title in.

Actionscript code loads a picture into a new clip at runtime - either attaching the .createEmptyMovieClip call to the _root or to the previously mentioned background clip on the stage (as referenced in bold above post).

If I attach the .createEmptyMovieClip call to my background clip, all works fine, I see the title. But if I setColor on my background clip (before the new clip is even made), the new clip containing the image is also this colour, and the image doesn't show up.

If I instead attach the .createEmptyMovieClip call to _root, then colouring the background clip doesn't effect it, but instead the titlebox is underneath it and I can't make it appear in front no matter what :(

_________________________________
Leozack
Code:
MakeUniverse($infinity,1,42);
 
If you set the colour of a MovieClip using your method everything in the MovieClip will be coloured - that's why you don't see the loaded image. If you want to set the background colour, the background needs to be a MovieClip.

Kenneth Kawamoto
 
I'm setting the colour of a mvieclip which I then .createEmptyMovieClip onto with a new clip that loads the image. But the new clip is also coloured and the image doens't show. How would I colour a movie clip I .createEmptyMovieClip onto without the new one being coloured too?

_________________________________
Leozack
Code:
MakeUniverse($infinity,1,42);
 
If you colour a MovieClip, anything you create/load into the Clip will be in that colour. That's why you don't see your loaded image. Create a MovieClip, then create a background MovieClip inside the MovieClip. Set the colour of this background MC, not the container MC.

Kenneth Kawamoto
 
Ah so my placeholder clip (already has a gradient background but maybe the user wants to set a colour as a background instead) creates an empty clip, colours that, then creates another empty clip, and the 2nd one loads the images? Ok cool. I cando it that way then and not have to create the image loading one on the root, which covers the preplaced textbox up which I couldn't get to show when I did that. Thanks. I think that sorts me for now. :) But now I have HL2:ep1 and portal to tempt me from coding. Alas. But off to job#2 now so no time anyway xD Thanks again Ken

_________________________________
Leozack
Code:
MakeUniverse($infinity,1,42);
 
No - your container clip will have a background clip with gradient, and a place holder clip which you load your image into. You colour containerMC.backgroundMC. ContainerMC.placeholderMC will not be affected by the colouring of the background MC.

Kenneth Kawamoto
 
Well the thing is I already have backgrounds for my "areas" with a feint gradient. And it adds a clip from that to load the image into. But incase they didn't want the gradient and wanted a colour like white or black for a bg, I add another clip and colour that right? That way the image clip doesn't get coloured as they're both children of the original gradient clip they're made from. Basically like you just said - a contrainer with 2 subclips, 1 to colour and 1 to fill with an image. Just that my container one alerady has a gradient fill is all.

_________________________________
Leozack
Code:
MakeUniverse($infinity,1,42);
 
One problem with your approach is that your "1 to colour" is empty (so that you can see the gradient behind). This means its size is 0 x 0. I don't think you can see any colour if it's invisible.

Kenneth Kawamoto
 
>________________> yeah thanks
But the copied clips I'm making are the same as the original gradient background. I guess. And I colour one. And dump the image in the other. Assuming they want a colour. Else none of this occurs and just the image one is loaded.
If you were patient you wouldn't be VIPing tektips you'd be stressed out and coding on the side like me <_< And I appreciate as much as the next guy that understanding is more useful than code snippets but takes longer to get across. Now if you'll excuse me it's 2am and I've got work in a few hours -_-

_________________________________
Leozack
Code:
MakeUniverse($infinity,1,42);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top