Get Color Of Pixel
Is there any way how to get a color of a pixel in photo or animation or whatever. My aim is to create some area composed of enlarged "pixels" (dynamically created field of small squares) and I want every "pixel" to calculate something like median of colors of source layer under this layer or simply adopt a color depicted from some point or pixel in a bitmap or footage or whatever.. Thanx for any idea.
FlashKit > Flash Help > Flash ActionScript
Posted on: 11-04-2004, 11:19 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Pixel Color Value .... Could I Know It?
Hi flash people!!!
I'd like to know if I could get the color of a pixel and how I could do it.
for instance... I'm moving the mouse and get the value of the pixel that is behing the mouse pointer...
Thank you very much!!!
Color At A Pixel
Hey guys I was informed about a new capability of flash, I was told that you can somehow find the color at any certain pixel in a flash movie, I checked in the flash help, at macromedia, and in the forums and i can't find it, I think I just suck at searching. Anyone wanna be an informant?
Pixel Color
Is there a way to get the color of a pixel that the mouse clicks on. I want to load text into a dynamic text box according to that color.
Pixel Color..
Hey.
You've all probably seen the classical take turns side scrolling cannons shooter.
Well i want to make one with a bit more advanced parts.
Lets say i have a ground made randomly each time game is loaded.
and a player dropped on opposite sides of the map..
now how do i make it so the player stops when they hit the ground?.
The only way i can think of doing this is if there a way to check what color a pixel is at a certain point? (you make it stop when pixel color under the player is same color as ground)
Also when players go on fighting i want holes to be blown out of the ground. And then again making sure the player is at the ground ( so make big white spots were bullets hit and again making player fall till they hit ground)
Any ideas welcome
//VoS
Color Pixel Generator
I am a complete newbie to Flash (I have only been using it for a week) and am trying to create an animation using only actionscript.
The premise is simple. The pixels from a photo randomly show up on the screen and eventually generate the image. I would like to be able to control the timing of when red values, green values and blue values appear.
I know it would be much easier to create the effect in a timeline, but I have animated for 10 years and would like to do this using a different method. If anyone could help, I would appreciate it!
Thanks.
Reading Pixel Color
hi people,
is there a way to read the color of a pixel right from the stage? by stage i mean the flattened image of all my layers...
say i want to figure out in which x,y coordinates theres black in my swf file, i run a for-loop that changes the y-coordinate and a nested for-loop for the x-coordinate, inside the nested for-loop im including an if-statement that compares the color of the pixel im checking to the value of the color i want (in this case, 0x000000)... if so, then the x and y coordinates are saved in a two-dimensional array...
while i think i got the logic right, i cant find a way to read the color of the pixels from the screen, can anyone help me out?
thx
Pixel Color Detection
hi there mates
i have this app where i'm using threshold to change the color of bitmaps, and i'm transformig the colors. the thing is, i'm trying to detect the black pixels that result in that transformation.
does anyone have a clue on how to do that? run through the image and find out the black pixels?
i looked through the help files, but all i found was the getPixel method, but this looks for specific locations through _x and _y...
hope anyone can help me out...
thanks in advance for reading this thread!
cheers
Reading The Color Of A Pixel Of An Image?
Is it possible to read the color of a pixel of an image using actionscript?
It would be fantastic if it was.... would open up so many doors for image dependant effects!
ty!
Runtime Loaded Image Pixel Color
I have used methods to find the color of a pixel in an image by Bitmap Data Class but this works only for images already imported in library but i want to make this work with images not loaded in the library at design time but loaded at run time.... Can any one help me with some code.....?
F8, Finding Color Range With A Single Pixel
Hi guys,
Wondering if anyone knows how to do this. Say i use getPixel on a bitmap and got the color info for it. Is it possible to define a range for that color i got. I need that as i find it almost impossible to define and work with just a single pixel color from a bitmap image as every single pixel has a different color and i cant go defining pixel by pixel or calculate pixel by pixel. There has to be a better way of doing this.
Many thanks in advance.
Color Profile And Pixel Aspect Ratio
So here I am working away again in my Flash CS/Flexbuilder (for AS project) world.
I'm "aware" of what these do, and even played around a little, but frequently saw little if any difference unless I was using photographs...
...what, in practical terms that a programmer can understand (how's that a programmer saying that to a designer) are these for, and is there any benefit to a coder:
- Color Profile
- Pixel Aspect Ratio
If you've never seen them, create a new profile in CS3, and click the "Advanced" tab.
What would be the benefit to a coder? I dunno, would tweens work better under certain conditions, is there any memory savings, are some allegedly processed more efficiently than others...how's it relate to printing...?
Flash Moving Small Images Pixel By Pixel, No Anti
Hi guys, sorry if this has been answered before I did my best to search for it but I didnt know what to search for.
I have a very small tree image (85x85 px) and I broke it up into parts. I plan to animate the tree with a breeze going through it. I had all my images aligned, got the motion tweens in, but when I play it it is VERY rough.. ie: over 30 frames for one movement it only visually moves twice, *very blocky movement*.
Im using 24bit pngs with transparency. If I could just get it to sway smoothly...
I tried playing with movie speed but with no difference, it still seems like blocky movement.
Any suggestions?
cuz damn if this dont work I'll have to scrap this idea
[CS3] Preloader Showing A Mask Pixel-by-pixel
Hi, everyone!
This is my first post here. I'm from Brazil and a basic ActionScript 2.0 programmer.
What I need to do is a preloader which is going to show a 543x513 pixel bitmap image by creating 1x1 pixel squares randomly inside a mask until it fills it up when it reaches 100% loaded.
So, trying to explain in differently, it's going to add pixel dots randomly in the mask to progressively show the image until the preloader is at 100%.
Can anybody give me a hand? Thank you in advance!
Bitmap Pixel Pixel Operation Performance
Hi, suppose we have two bitmaps, save size. I would like to add them together. For each pixel, I would like to add the red, green, blue channel respectively and clip to 0-255. What is the best way in terms of performance to do this?
thanks,
ff
Creating Objects Pixel By Pixel
Let me try to explain this without sounding waay too confusing...
I have a concept that I would like to try with building "menus" pixel by pixel. Having the pixels drop from the top of the screen to the location of the specific "box" and that box being built up from each pixel.
Am I making any sense? If I am, please read on. . .
I am wondering if this is possible to do with actionscript, and if so, can someone point me in the right direction to figure out how to do so.
I REALLY dont want have to do it by hand, create each pixel and then create the "box" and have a motion tween, I think that would take weeks. And I am just not patient enough.
If this makes little sense, please ask where I am not clear so that I may explain, I would really like to figure this one out.
Thanks !
Pixel - I Love Pixel
My first computer was a ZX Spectrum (Sinclair) and I was always fond of doing some basic programming with its pixel driven ways.
For that matter I would like to know how to approach such pixel driven ways in FlashMX. Yes, I know it is vectorial, rather...
How can I create a symbol with only one pixel (1x1 px) ? I tryed to import a .gif image with 1x1 pixel but it says the error message: "invalid format.." when I tryed to import it.
Then I thought of using the shortest and thinest line possible...
But I would like to hear from you on this. What do you have to say on this?
As Ric Ewing says in one of his tutorials: "Macromedia Flash MX draws lines in increments called twips, which are 1/20 of a pixel, so you can get precision of 0.05 on your lines. To make a line visible (without scaling it up), the minimum size is 0.15 pixels."
What I actually want to do is a layout where every pixel is changing colour (randomly). All nested side by side, but with the colour atribute changing (kinda like: the TV fuzzy/noise when it is not tuned to any particular station).
I found this tutorial that gave me lots of ideas on how to nest/tile the pixels:
http://www.kirupa.com/developer/mx20...background.htm
But before to put hands on work, would like to hear from someone with experience in these matters.
Thanks a lot,
Daniel Alexandre
How To Change MovieClip RollOver Color(NOT Single Color, But Gradient) Dynamically ?
hi
I have created this for single color.But how to change when it is a gradient color.
for single color rollover code.
Code:
rollcolor = "0xFF0000";
normalcolor = "0x339900";
my_color = new Color(my_mc);
my_mc.onRollOver = function() {
my_color.setRGB(rollcolor);
};
my_mc.onRollOut = function() {
my_color.setRGB(normalcolor);
};
Thanks in advance
How To Change MovieClip RollOver Color(NOT Single Color, But Gradient) Dynamically ?
hi
I have created this for single color.But how to change when it is a gradient color.
for single color rollover code.
ActionScript Code:
rollcolor = "0xFF0000";
normalcolor = "0x339900";
my_color = new Color(my_mc);
my_mc.onRollOver = function() {
my_color.setRGB(rollcolor);
};
my_mc.onRollOut = function() {
my_color.setRGB(normalcolor);
};
Thanks in advance
Changing Fill Color And Line Color Dynamicly And Seperately
Hi community,
In this case, I am going to load a swf with a looping animation colored in black and white only. I want to change the color of the animation dynamicly so that I could have different color at each time. Here is my code:
Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import flash.display.*;
import flash.net.URLRequest;
private function init():void{
myCan.addEventListener(Event.ENTER_FRAME,capMotion);
}
private function capMotion(event:Event):void{
var bmd1:BitmapData = new BitmapData(mySwf.width, mySwf.height, true, 0x00CCCCCC);
bmd1.draw(mySwf);
var bitmap1:Bitmap = new Bitmap(bmd1);
bitmap1.x = 0;
bitmap1.name="org";
if (map.getChildByName("org") != null){
map.removeChild(map.getChildByName("org"));
}
map.addChild(bitmap1);
var bmd2:BitmapData = new BitmapData(mySwf.width, mySwf.height, true, 0xFFFFFFFF);
var pt:Point = new Point(0, 0);
var rect:Rectangle = new Rectangle(0, 0, mySwf.width, mySwf.height);
var threshold:uint = 0xFF999999;
var color:uint = 0xFFFFFF00;
var maskColor:uint = 0x00FF0000;
bmd2.threshold(bmd1, rect, pt, ">=", threshold, color, maskColor, true);
var bmd3:BitmapData = new BitmapData(mySwf.width, mySwf.height, true, 0xFFFFFFFF);
threshold = 0xFF000000;
color = 0xFF00CCCC;
maskColor = 0xFFFFFF00;
bmd3.threshold(bmd2, rect, pt, "==", threshold, color, maskColor, true);
var bitmap2:Bitmap = new Bitmap(bmd3);
bitmap2.name="dup";
bitmap2.x = bitmap1.x + bitmap1.width + 10;
if (map.getChildByName("dup") != null){
map.removeChild(map.getChildByName("dup"));
}
map.addChild(bitmap2);
}
]]>
</mx:Script>
<mx:Canvas id="myCan" x="10" y="10" width="650" height="603">
<mx:SWFLoader id="mySwf" width="100" height="250" horizontalCenter="0" verticalCenter="-7.5" source="dance.swf" complete="init()" scaleContent="false" autoLoad="true"/>
<mx:Image x="61" y="320" width="550" height="152" id="map"/>
</mx:Canvas>
</mx:Application>
It works quite fine but I afraid that it's quite resource consuming using enterframe and bitmap drawing. Is there any better method?
Thanks for help.
How Would I Go Changing Lots Of Movieclips Color And Border Color Seperatly?
I am in the making of a isometric level editor, and I have about 15 movie clips with more to come.
I want to let people change the color of tiles to what they want from a list of colors, so how can I let them change the color of a tile dinamicly with actionscript so that it changes a tile's color while preserving changes of "shadows"?
I mean I have let's say a cube and to make it look 3D I need to change each face to make a feeling of 3D and not a flat one.
thanks.
Text Color And Background Color Setting Dynamically
How would I go about setting the background color of a flash movie as well as the text color of a text box based an external variable?
I want to pass in both of these colors in the <object> tag
myfile.swf?bgcolor=red&textcolor=white
Please advise.
Thanks
Robert
Changing Color On RollOut Then Back To Color After 2 Seconds
I am using the code below to make a shape turn color using on rollOver, then on rollOut is changes to a differant color(blue), then I want it to change back to the first color(white), either on another rollover or I perfer to make it change back to the fist color after a 2 seconds,
on (rollOver) {
var colorful = new Color("_root.shapes");
colorful.setRGB(0x006699);
}
on (rollOut) {
var colorful = new Color("_root.shapes");
colorful.setRGB(0x006688);
I want to be able to rollOver change color, onRollOut Change color again, then back to the first static color after 2 seconds.
Anyhelp would be great Thanks
Drag And Drop Color Swatches To Color Target
Hi there,
Need some help with this. I want to have color swatches that can be individually dragged onto a target MC and have that target MC take the color of the color swatch that has been dragged onto it. This procedure should be able to be done over and over again so a new color can replace the old one. I am working in Flash MX 6. Any help would really be appreciated.
Thanks so much.
Hex Color Code To Change Movie Clip Color
Hi all, Sorry real quick,
i've got a text box with the text with a hex code from a color picker which reads say "FF0000" how do i use that hex code(FF0000) to change a movie clips color.
simple (me stupid)....
thxs for any help
jon
[CS3] Changing Color (and Opacity Of That Color) Of Movie Clip
Hi. I have a pretty large movie clip filled with pngs. It's a sprite for a game and I want to change it's color. The setRGB method works, but I can't figure out how to set the opacity of the color. I don't want to change the alpha of the movie clip itself, just the color I'm applying to it so that it's just a shade over the normal images.
Is there any way to do this?
Assign Color To New Sprite In Order Of Color Wheel?
Is there a way to know the offset from one color to the next?
For example, I would like to create Sprite Balls, and have each be assigned a new color. But, I don't want it to be completely random color. I'd like it to be in order of the color chart slightly.
So if the first color is Red lets say, the next color would be a Yellow, then Green, then Aqua, then Blue, then Magenta, and back to Red. They don't need to be the absolute color, but in the general vicinity. Is this possible to do dynamically? What would the multiplier need to be to get to the next grouping of colors?
Drag And Drop Color Swatches To Color Target
Hi,
I am trying to have color swatches that can be individually dragged onto a colorless mc and have the mc adopt that color. This should be able to be replaced over and over again with new colors and reset to start again. I have only been able to find information on swopping mc's.
PLEASE HELP WITH THIS AS I AM STUMPED.http://www.jupiter.co.za/smart.jpg
THANKS SO MUCH
Fill Color And Stroke Color Option Not Working...
I am a faculty member at American River College who needs a word or two on how Flash CS3 works.
Specifically, how do I get back the option to add fill color to an oval drawing that I have made in Flash CS3? It appears that I have flipped a setting that makes that seemingly simple option unavailable.
I have several other documents where I have added fill color without a problem; however, as of this morning CS3 will not allow me do add such. When I open Flash, I draw on the Stage, the outline color is usually green, no matter what color I select for as Stroke Color and Flash will not allow me to change the Fill Color. I make a selection and nothing happens (just moments ago I opted for red as the Fill Color and the Fill remains white).
Is there a setting in Flash, that a rookie like yours truly could activated by accident?
Please help.
MacBrowne
Return MC To Original Color After Dynamic Color Change
How is it done? All I've seen on the web is how to change the color. Well how about going back. I'm talking about a MC with many colors. I can't just change back to a single hexadecimal color.
I can accomplish the change as it passes over a frame, but I can't get it to change back.
In the frame is this:
ActionScript Code:
cHurtColor = new Color(_root.compMC);cHurtColor.setRGB(0x00FF33);
Trying to keep this simple....
Return MC To Original Color After Dynamic Color Change
How is it done? All I've seen on the web is how to change the color. Well how about going back. I'm talking about a MC with many colors. I can't just change back to a single hexadecimal color.
I can accomplish the change as it passes over a frame, but I can't get it to change back.
In the frame is this:
ActionScript Code:
cHurtColor = new Color(_root.compMC);cHurtColor.setRGB(0x00FF33);
Trying to keep this simple....
What Makes A Pixel Font A Pixel Font?
I am trying to find out why, in Flash, pixel fonts remain alias at small sizes, but so far, all I have heard is "because they are very small fonts". Isn't there a complete, technical explanation as to what pixel fonts have that normal fonts don't?
If you know the technicalities about computer fonts (or if you are a font designer), I will very much appreciate your help. I am certain it will help many others, as there is little information easily available on this subject.
Color.setTransform(colorTransf) >>> Color Question
These are the codes I´m using on my mc (target)
onClipEvent (load) {
color = new Color(this);
colorTransf = new Object();
colorTransf.ra = 0;
colorTransf.ga = 0;
colorTransf.ba = 0;
}
onClipEvent (enterFrame) {
Rdif += red - colorTransf.rb;
Gdif += green - colorTransf.gb;
Bdif += blue - colorTransf.bb;
colorTransf.rb += Rdif / 4;
colorTransf.gb += Gdif / 4;
colorTransf.bb += Bdif / 4;
color.setTransform(colorTransf);
}
I´m trying to understand it...
1.0 I can´t get the "new Object()" What am I doing with this???
2.0 Why I set on (load) ra; ga; ba and then on (enterFrame) I use rb; gb; bb???
3.0 What exactly does the setTransform() do?
The rest I understand well...
Hope it´s not complex for explain.
Thanks!
Dynamic Color Slider Or Color Wheel ?
can someone help, or direct me to a tuttorial on
¥ user input to adjust/select color
- must be RGB sliders, or colorwheel/color bar to choos from
I need the user to be able to change the background color of a graphic, without them knowing anythign about color.
so it would be best if they could just adjust RGB sliders or pick from a color wheel would be even bettter. . .
thanks
Darin
P.S.
I could make a bunch of buttons with a few basic predefined colors, however this would be limmiting in selection.
Matching Bg Color To Surrounding Jpeg Color
I'm putting a flash movie into a space that's surrounded by a deep blue gif color. Nothing fancy - no gradient - just a plain, old, single color that matches out to a hex value of 333399.
When I set the Flash movie's background to 333399 and place it within HTML page, the colors don't match. I've fooled around with different hex combinations in flash and have finally found a combination that matches the blue gif background almost exactly (#294099) - but man, what a hassle!
There must be a better way to match a flash movie's background to a background that it will be placed within...isn't there? Please advise if there is...
Thanks to all in advance.
Hummm...one more thought, is there a way to export a movie with a transparent background???
Matching HTML Color To Flash Color
How come when I set #336699 to my HTML page background and also #336699 to my flash .swf background. I put the swf into the page and I could see the difference between the two colors!!!! How do I fix this?
To Show Color Default, Or Color Param.
I´m trying to do this, I have a dynamic text and in this dynamic text I call a value, in my HTML I have a PARAM color, he change the color of my dynamic text, so far works fine, but I have 4 products, and each product I have a especific value, example: in product 2 I wanna change de color of my value, my problem is I cann´t change this color.
In my HTML I have the PARAM " cp=006699 " it is the color of the values of the 4 products, 1 default color for the 4 values of my 4 products, but I would like to change the color of my 2º product, some special color " cp2=330099 ", and so on.
HTML
Code:
arquivo.swf?cp=006699&cp2=330099........
my AS.
code:
//alterar cor dos preços dos produtos 2 = cp2
if (cp != undefined) {
new Color (preco2_2_mc.preco2_mc).setRGB (parseInt (cp, 16));
}
else {
new Color (preco2_2_mc.preco2_mc).setRGB (parseInt (cp2, 16));
}
Sorry about my English.
[F8] Color Swatch Or Change - Color Object?
You know how on retail sites or even a car site you can swap the color by clicking on the swatch and than the image changes the color. I wanted to do this in flash preferably with actionscripting but I have NO CLUE how to do it. Can anyone show me a tutorial or advise me o how to do this. This is just a BASIC example in flash five but this is the same concept I want. http://www.adobe.com/support/flash/i...y/colorobject/ If anyone knows of a high level example with tutorial I would appreciate it.
Turtle
To Show Color Default, Or Color Param.
I´m trying to do this, I have a dynamic text and in this dynamic text I call a value, in my HTML I have a PARAM color, he change the color of my dynamic text, so far works fine, but I have 4 products, and each product I have a especific value, example: in product 2 I wanna change de color of my value, my problem is I cann´t change this color.
In my HTML I have the PARAM " cp=006699 " it is the color of the values of the 4 products, 1 default color for the 4 values of my 4 products, but I would like to change the color of my 2º product, some special color " cp2=330099 ", and so on.
HTML
Code:
arquivo.swf?cp=006699&cp2=330099........
my AS.
ActionScript Code:
//alterar cor dos preços dos produtos 2 = cp2
if (cp != undefined) {
new Color (preco2_2_mc.preco2_mc).setRGB (parseInt (cp, 16));
}
else {
new Color (preco2_2_mc.preco2_mc).setRGB (parseInt (cp2, 16));
}
Sorry about my English.
|