So now I wonder if there's any way I can get the color value for the color I get when I drag red_mc over my 2. mc, - I mean if mc1 is green and mc2 is red, - the result would be a dark red, - but how do I get that value at runtime?
function CreatColor () {
c = new Color("dm");
r = (Math.random()*256);
g = (Math.random()*256);
b = (Math.random()*256);
c.setRGB(r << 16 | g << 8 | b);
_root.hexValue="#"+(c.getRGB()).toString(16);
trace(_root.hexValue)
}
onMouseDown=function(){
CreatColor()
}
dipkya
---------------------------------------------------------------
SO MUCH HAVE TO DO, SO LITTLE HAS DONE!
As far as I can see from that code it just makes a mc have a random color each time you press the button, - and that's not my problem, - I want to receive the color code from the color that is beeing generated when a mc with one color (red) and an alpha (fx. 50%) is dragged over another mc with another color (green), - it's, in this case, a dark red color, - how can I get this code via actionscript?
Check the code again
====================================
_root.hexValue="#"+(c.getRGB()).toString(16);
trace(_root.hexValue)
=====================================
Above lines give you hex values of movieClip color
If want to know color with alpha property then you should myColor.getTransform() instead getRGB
regards
Last edited by dipkya; 08-25-2004 at 02:15 AM.
dipkya
---------------------------------------------------------------
SO MUCH HAVE TO DO, SO LITTLE HAS DONE!
Hi, - the problem is not to get the color of an mc with an alpha, - the problem is getting the color that is created when a mc with an alpha is over another mc, - mc1 is fx. red with an alpha 50% and mc2 is fx. green.
When I take mc1 and drag it over mc2 I get a 'new' color, - the blending of the transparent red and the solid green, - in this case a dark red, - that is the color code I want, - but the problem is that this color is neither the red or the green mc's color but a blend of both and how do I address this mc1mc2 movieClip ;-)
Looks great, but I'm not sure I understand, - I send a very simple sample of what it is I'm after, - just drag the red square into the green circle and give me the blended color, - I will be the happiest man on earth ;-)
sorry man, - was in the wrong mode, - now it works, - yes I think we are getting closer here... I'll check it out and return later, - thanks a lot for your help.
Still I have a problem, - what if my dragging square is moved over an image... I know that I can't get any colors out of an image in flash, - but If my drag mc has an alpha, - can I then get the value.
Lets say its a black and white image, - so I only want to let my drag mc aware if it's over something white og something black in the image.
We can make it as simple as a image of a black line on white background.
So if I take my drag mc with an alpha an move over the image, - I should have a darker red when moving over the black line.
So you see, - is it possible to get the color of this blend? I mean the color of the part of my drag mc that is over the black line.
Kind regards
You can only use the Color object to access information from Color objects.
eg: getRGB will only get the RGB for a MC that has had RGB or transform set by a Color object. Similarly, getTransform will only get the transform set by a Color object.
You should be able to modify my example to use get/setTransform rather than get/setRGB. This would allow you to use alpha values. So the next problem is how to do the stripes.
Color objects apply to an entire MC. Therefore, for each separate alpha setting you want, you need a separate MC.
If you break the stripe down into five(?) MC (three white and two black) you can do what you want.
thankx for your question, - sorry to say that manipulating the jpeg is out of the question, - so no 5 mc's ;-)
But I just got this idear, - if my draggable mc is 1x1 pixcel and I drag it over my jpeg, my whole drag mc (with the alpha) has a new color, - I mean it's not the jpeg that has a new color it's the drag mc and it's not just part of the mc but the whole thing..
Flash doesn't allow you to query the colour of individual pixels. The colour blending isn't necessarily the colour you see on screen, but is the result of a mathematical operation on two colour transforms.
For example, if you have an MC set using Color to be red with _alpha of 20; it may appear to be something quite different while dragging over a brightly coloured JPEG. However, for the purposes of the mathematic comparison, it will still think of itself as red and 20% _alpha.