Na you can do that. Make the color(s) you want to chagne into movie clips, and give them instance names. then to chage color, do somethign like this: myColor = new Color(_root.clip1.subClip); myColor.setRGB(0x333333); You can put that in a function or whatever. Just put a path to the subclip in the parenthesis above. Then put the hex value in setRGB preceded by 0x. Also double check, i cant remember if the hex has to be in quotes and dont have flash open. Look into the color class for more info - HTH. -J
[quoted text, click to view] "David Stiller" <stiller-NO-SPAM-@quip.net> wrote in message news:e0hhs9$6gt$1@forums.macromedia.com... > Changing a movie clip's colors is an all-or-nothing thing. If a clip has nested artwork -- whether graphic symbols or movie > clip symbols -- your whole clip, all of it, will become the color you set it to. It will look like a colored silhouette. If you > want to swap two colors inside a movie clip, you'll have to make the inside items movie clips, too. Don't change the movie clip > that contains them; rather, change each of the clips inside.
Did you forget about colorTransform? http://members.cox.net/4my5cats/colorTransform.html tralfaz
[quoted text, click to view] "David Stiller" <stiller-NO-SPAM-@quip.net> wrote in message news:e0hkfd$9n5$1@forums.macromedia.com... > tralfaz wrote: >>> Did you forget about colorTransform? >>> http://members.cox.net/4my5cats/colorTransform.html > > Actually, I didn't ... but I wasn't nearly as clear as I could have been. :) I like your example a lot -- in fact, I'm pretty > sure I've seen that page of yours before -- but even this doesn't give the OP what he or she is looking for (I think). The color > change is always uniform ... it isn't possible to change only the red parts of an image or to swap the red parts for the blue > parts, etc. Not unless those parts are nested MCs and you hit those each, instead. > > Really, though, you may have nailed it. Maybe I don't understand the OP's question. It's a tricky thing I think because if each object has only one color of red, green, or blue (not a mix), then it's easy to reduce or increase just that color, but if each object is a mix of colors then changing one of the rgb settings will affect the color in both objects. Well, maybe colorTransform will help, depending on the effect that was needed. Anyway, I thought you might have been thinking of setRGB which would flat color the object, not just adjust it from where it's at now. tralfaz
[quoted text, click to view] "rogz" <webforumsuser@macromedia.com> wrote in message news:e0hk2m$9b4$1@forums.macromedia.com... >i have a movie clip with some white and blue in it. what i want to do is change > the blue to the following color FF9900...i can get the settransform to sort of > work but the orange color seems a little faded and is not as rich as it should > be...any ideas? i'm currently using the following code: > > myColor = new Color(myMovie); > myColorTransform = new Object(); > myColorTransform = { ra: '100', rb: '255', ga: '100', gb: '153', ba: '100', > bb: '0', aa: '0', ab: '100'}; > myColor.setTransform(myColorTransform);
I would have to see the original and try the numbers. You can download that example and replace the kitty picture with your movieclip, then play around with the sliders. Because white is a mix of all 3 colors ..rgb, lowering any of them will reduce the white to a gray. You can do like David Stiller suggested and only color parts of the movieclip by making some sub-clips inside of it. so, let's say that myMovie has a white color, and inside that movieclip you have a blue box that you changed to a movieclip bluebox. Then you could set up the color object.. myColor = new Color(myMovie.bluebox); Now your color transform would leave the white part alone and only change the color on the bluebox part. tralfaz
rogz, [quoted text, click to view] > Is it possible to replace colors in a movieclip through > actionscript.
Yes. [quoted text, click to view] > I have a movie clip that contains some blue and white > and i want to swap the blue with red...can i do this or > do i need to go the route of reloading the movie clip > with images?
Changing a movie clip's colors is an all-or-nothing thing. If a clip has nested artwork -- whether graphic symbols or movie clip symbols -- your whole clip, all of it, will become the color you set it to. It will look like a colored silhouette. If you want to swap two colors inside a movie clip, you'll have to make the inside items movie clips, too. Don't change the movie clip that contains them; rather, change each of the clips inside. David stiller (at) quip (dot) net Dev essays: http://www.quip.net/blog/ "Luck is the residue of good design."
[quoted text, click to view] tralfaz wrote: >> Did you forget about colorTransform? >> http://members.cox.net/4my5cats/colorTransform.html Actually, I didn't ... but I wasn't nearly as clear as I could have been. :) I like your example a lot -- in fact, I'm pretty sure I've seen that page of yours before -- but even this doesn't give the OP what he or she is looking for (I think). The color change is always uniform ... it isn't possible to change only the red parts of an image or to swap the red parts for the blue parts, etc. Not unless those parts are nested MCs and you hit those each, instead. Really, though, you may have nailed it. Maybe I don't understand the OP's question. [quoted text, click to view] rogz wrote: > i have a movie clip with some white and blue in it. what i want to > do is change the blue to the following color FF9900...i can get the > settransform to sort of work but the orange color seems a little > faded and is not as rich as it should > be...any ideas?
colorTransform is a more granular way of changing color (and opacity) of a movie clip, but it's still an all-or-nothing deal. Applying a change to your movie will adjust everything it contains, not just certain colors inside it. David stiller (at) quip (dot) net Dev essays: http://www.quip.net/blog/ "Luck is the residue of good design."
[quoted text, click to view] I wrote: > The color change is always uniform ... it isn't possible to > change only the red parts of an image or to swap the red > parts for the blue parts, etc.
And actually, that statement is probably incorrect now, given the new BitmapData class. I really need to study that one. Still, using that to change certain colors in a movie clip ... much more complicated. And actually, you're not really touching a movie clip at that point, but an actual image. David stiller (at) quip (dot) net Dev essays: http://www.quip.net/blog/ "Luck is the residue of good design."
Thats what i thought too, sorry if i misguided you. If you can break the movie clip into distinct subclips and give each an instance name, you can set colors for each of them. Im not sure what kind of picture you have tho. Can you post something? Not to state the obvious, but another, less efficient way to do this would be to mod your image in photoshop, then just tween or transition between the two in flash. You can use something like select/color range and tweak it there, then import it as another movie clip. If you are only doing this once the hit may be acceptable, but if you want a reusable bit of code that will apply color transforms to different clips, that may get a bit heavy. HTH. -J
Is it possible to replace colors in a movieclip through actionscript. I have a movie clip that contains some blue and white and i want to swap the blue with red...can i do this or do i need to go the route of reloading the movie clip with images?
i have a movie clip with some white and blue in it. what i want to do is change the blue to the following color FF9900...i can get the settransform to sort of work but the orange color seems a little faded and is not as rich as it should be...any ideas? i'm currently using the following code: myColor = new Color(myMovie); myColorTransform = new Object(); myColorTransform = { ra: '100', rb: '255', ga: '100', gb: '153', ba: '100', bb: '0', aa: '0', ab: '100'}; myColor.setTransform(myColorTransform);
if your movieclip has instance name mc1, you can use the following code to replace 0x0000ff in mc1 with FF9900: import flash.display.BitmapData; bmp = new BitmapData(mc1._width, mc1._height, true, 0xcccccccc); _root.createEmptyMovieClip("holderMC", 1); bmp.draw(mc1); holderMC.attachBitmap(bmp, 1); for (var x = 0; x<=mc1._width; x++) { for (var y = 0; y<=mc1._height; y++) { c = bmp.getPixel(x, y); if (c.toString(16)==0000ff) { bmp.setPixel(x, y, 0xffFF9900); } } }
Don't see what you're looking for? Try a search.
|