Flash :: Search BitmapData Object For Matching Pixel Values From Another Bitmap?

Jun 16, 2010

Using Actionscript 3 is there a way to search one bitmap for the coordinates matching pixels of another bitmap?

[URL]

Somehow you would have to loop through the bigger bitmap to find and the the pixel range that matches and return those coordinates. For example the Bitmap with the "E" is 250 pixels over and 14 pixels down in the bigger bitmap.

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Use The BitmapData Property Of A Bitmap And Pass It To The Constructor Of A New Bitmap Object?

Aug 20, 2009

I know the topic of "duplicating" movieclips is a hot issue with the new virtual machine. Luckily, I understand the implications. I only am [currently] interested in duplicating a Bitmap. See, I load an image from an URL using 'flash.display.Loader.load', which is a non-blocking operation in Flash Player.However,I may use multiple copies of the loaded image (which is reported to be a Bitmap, naturally) in the display list at the same time.Hence, I naturally do not want to load the image from an URL every time, because I don't want to wait for a non-blocking call to complete. Nor do I need to - I mean one copy is already loaded, so it should be possible to just "duplicate" it, right?

My idea is to do use the bitmapData property of a Bitmap and pass it to the constructor of a new Bitmap object. I have not tried the following in action, but I want to hear whether any of you did and if the following would not work, what would:

Code:

var original_bitmap: Bitmap;
var copy_of_original_bitmap: Bitmap = new Bitmap(original_bitmap.bitmapData);

LiveDocs mention that the BitmapData being passed to a Bitmap constructor is "being referenced", which to me might suggest it cannot be used twice? There is also the BitmapData::clone() method, which I am not sure is applicable here or not.I know this is a lot of talk instead of just trying this out, but I test so much Flash Player code daily just to see "what works" (which should be documented instead by Adobe),

View 4 Replies

Flash :: Load A Bitmap File Into A BitmapData Object?

Mar 31, 2009

In Flash, the BitmapData object can be used to store bitmaps in RAM, you can later draw them to a MovieClip using the beginBitmapFill() method.

How do you load an external bitmap file (.jpg) into a BitmapData object?

View 5 Replies

Flash :: AS3 Bitmap Object Not Smoothing At Low Scale Values

Feb 7, 2012

What I am doing now is loading a .png image with a Loader object. After loading the file I cast the loaderInfo's content to a bitmap and set the smoothing value to true. This works without a problem until I reach a ScaleX and ScaleY value less than 0.5.

For example, if I have a 1000x1000 object, scaling it down to 200x200 causes the bitmap smoothing to no longer work.[code]...

View 1 Replies

AS3 :: Flash - Bitmap Object Not Smoothing At Low Scale Values?

Dec 9, 2003

getting a bitmap to apply smoothing properly after being scaled very small.What I am doing now is loading a .png image with a Loader object. After loading the file I cast the loaderInfo's content to a bitmap and set the smoothing value to true. This works without a problem until I reach a ScaleX and ScaleY value less than 0.5.

For example, if I have a 1000x1000 object, scaling it down to 200x200 causes the bitmap smoothing to no longer work.I can reproduce the problem using all of the following Sizing methods:

Change the scaleX and scaleY properties on the bitmap. Directly change the height and width properties of the bitmap. Add the bitmap as a child of another sprite and change the scaleX and scaleY properties of the sprite. Add the bitmap as a child of another sprite and change the height and width properties of the sprite. Creating a new BitmapData object with a matrix scale and then drawing the original BitmapData onto it.I've also tried some other workarounds that I found when searching, such as:setting the scaleX of the image to 1.001 or 0.999 forcing the height and width of the Bitmap object to be even numbers.

Below is some sample code for reproducing the problem. (I am running this locally so I have a copy of testimage.png in my bin-debug folder)

public class MainObj
{
public var comp:UIComponent;
public function MainObj()

[code]....

View 2 Replies

ActionScript 3.0 :: Trace The Path Of An Object By Using SetPixel On The Object's Position Every Frame In A BitmapData/Bitmap Pairing?

Feb 16, 2011

I'm trying to trace the path of an object by using setPixel on the object's position every frame in a BitmapData/Bitmap pairing. These pixels aren't showing up normally and I suspect I have a fundamental misunderstanding of the BitmapData class. Here's what I'm doing:

public var contrailBase:BitmapData;
public var contrail:Bitmap;
private var contrailColor:uint;[code].....

Using this code, the red pixels don't show up. If I initialize contrailBase to 0xFF000000 instead then I get a black screen on which the red pixels DO draw, but I need the bitmap to be transparent except for the contrail. What am I doing wrong?

View 2 Replies

Flex :: Comparing Bitmap Data In AS3 Pixel For Pixel

Mar 30, 2010

I am looking for a fairly simple image comparison method in AS3. I have taken an image from a web cam (with no subject) passed it in to bitmap data, then a second image is taken (this time with a subject) to compare this data, from these two images I would like to create a mask from the pixels that match on both bitmaps. I have been scratching my head for a while, and I am not really making any progress. Could any one point me in the right direction for pixel comparison method, something like getPixel32()

View 2 Replies

ActionScript 3.0 :: Get Pixel-by-pixel Bitmap Data?

Nov 23, 2009

I have a 100x100px image. I want to get 1 pixel vertical line from x- 1 to 100. How can I do that?

View 7 Replies

ActionScript 3.0 :: Bitmapdata.hitTest - Bitmap 'emptyBitmap' With Bitmap Data Created

Feb 3, 2009

I'm cutting my teeth in actionscript 3 on a game that has a character running through a world. So, I have set up my Hit Testing by using the bitmap data hit test method, since I figured my world is going to be destructible - it'd be nice to update the level and then redraw it and have the character interact with the new change. (That works beautifully) I am however; a bit confused as to how I have my hit Testing set up. I've been messing around with it, and it works for now - but I'm not sure why.. currently, I have a character set up by using a class I built and using a series of animations I created. So, this character has a walking and falling animation, etc. This is a movie clip.

Then there's a bitmap 'emptyBitmap' with bitmap data created - however; I never really added this as a child to the character. This is sized to the dimensions of my character. My level is created as a movielip, then it's drawn to a bitmap - when the level movieclip is changed, the bitmap redraws, and that's how this updates.

[Code]....

View 1 Replies

Actionscript 3 :: Flash: Bitmap Inaccuracy - Image Appears To Shift One Pixel?

Oct 12, 2011

I load a bitmap to the stage, it's a GIF and set to lossless compression. I have ensured its coordinates are integers and have not allowed smoothing (smoothing somewhat fixes the issue but reduces quality of the image).The problem is the image appears to shift one pixel to the left and add that pixel on to the right side meaning one side has no border and the other a double border.The original bitmap does not have this issue, and there is no transparency .etc in the image.

View 1 Replies

ActionScript 2.0 :: Getting The Closest Matching Color In Bitmap?

Aug 18, 2009

I want to find a script that compares colors in a given region and gets the closest websafe color.I found the color sampler class that returns the average color. So now I just need to learn how to get the closest websafe color to the average color. how to compare color values and get the difference?

View 0 Replies

Flash :: Show A Bitmap Which Is Only A Portion Of Its BitmapData In AS3?

May 14, 2011

I am writing a screen scroller for a game I'm making. There's a BitmapData object which holds the background graphic, yet I do not want to show/render it on screen all at once.

For example, I want to show only a 500x500 section of the data but the entire BitmapData is 1000x1000. I wanted to use the scroll() method to scroll the data but my problem is that I cannot restrict how much of the BitmapData is drawn on the Bitmap. I tried setting the height/width properties of the BitmapData to 500x500 (and draw all the 1000x1000), but any data drawn beyond the boundaries I defined is not really drawn.

Another option I considered is to store a different BitmapData object which holds the entire data, and then use copyPixels() from it to the one used on the Bitmap itself, although then I cannot use scroll() and have to use different methods to achieve scrolling.

View 4 Replies

IDE :: Matching Text String When Filtering Node Values

May 18, 2009

Kirupa's tutprial "Using XML in Flash CS3/AS3" when filtering the node values, how can I match a text string say "Stephen" with "Stephen E. Ambrose"
var authorList:XMLList = bookInput.Book.(author == "Stephen E. Ambrose");
Using the above code it only searches the node which author value is "Stephen E. Ambrose" but I want to search only "Stephen" and want to get this node returned.

View 2 Replies

ActionScript 1/2 :: MovieClip Pixel Manipulation With BitmapData

Jan 30, 2010

I have a MovieClip in the library exported for actionscript. How do i convert or attachMovie it to a BitmapData class so that i can manipulate its pixel data? I will need that so that i can distort the MovieClip.

View 3 Replies

Professional :: Pixel Colors In BitmapData.noise?

Oct 5, 2010

I am wondering if there is any way to set the pixel colors exclusively to black and white (instead of gray) in a bitmapData.noise animation. The previous related thread is: [URL]..For the function:
 
function makeNoise():void { _bitmapData.noise(getTimer(), 100, 255, 7, true);
 
Is there any way to set the noise color pattern to black and white? In the scripting reference, it seems the choices are R||G||B||Alpha channels, so I am not sure if there is any way to combine these to get black and white only.

View 16 Replies

Actionscript 3 :: BitmapData Copy Pixels Half Pixel?

Feb 17, 2012

Having trouble trying to scroll BitmapData on a half pixel here is my original code

var speed:Number = 1;
_bitmapData.copyPixels(_backgroundParallax, _screenRect, _zeroPoint, null, null, true);
_backgroundParallax.copyPixels(_backgroundParallax, new Rectangle(0, 0, speed, _backgroundParallax.height), new Point(_backgroundParallax.width-speed,0), null, null, false);
_backgroundParallax.scroll( (speed*-1) , 0);

which works until i change the var speed to .5, which is because .scroll method is expecting int's so i replicated what scroll is doing to try and allow .5 pixels

[Code]...

View 1 Replies

Actionscript 3 :: Finding A Pixel Position (x And Y Coordenate) Within A Bitmapdata

Feb 22, 2012

How can I find a pixel position, based in its color, within a bitmapdata?Say, we have a path drawed (a movieclip), we make it a bitmapdata.The path´s color is red.How can I find a given pixel red, within that bitmapdata?

View 1 Replies

Flash :: Search For Specific Words And Values In A Long String?

Apr 12, 2011

my objective is:

1.Read in a text file. e.g containing text like this, teacher/student/1/sn/2/3/4/5/9/f/tn/02/

2.pass it to a string.

3.then beable to extract different parts of the string and place them in different arrays.

The bit I dont know how to do is the extracting specific parts of the string? Is it possible to search for / and to treat what comes after it as a specific peice of information until the next / is read? Or perhaps there is a more efficient approach?

View 3 Replies

ActionScript 3.0 :: Writing Directly Into Bitmapdata Cause Flash To Refresh Bitmap In Case Of CacheAsBitmap

Dec 26, 2011

So if i have a bitmap in a mc that doesnt animate (because i write directly into the bitmapdata) can i use CACHEASBITMAP?

View 3 Replies

Flash :: Find The Size Of The Area In A Bitmap Which Has Been Filled Using The Bitmapdata.floodfill Method?

Sep 27, 2011

I am using the floodfill method to colour-in sections of a bitmap image. That part is easy enough but the issue comes in with the way I am adding an effect to the colour fill routine.

To add the effect, first a copy of the bitmap data is created and floodfill is used on that instead of the original bitmap. Then the bitmapdata.compare method is used to set the alpha value of everything apart from the filled-in section to 0 and the result is saved in another bitmapdata. After that, a 1 px radius circle sprite is added to the stage and is being tweened to the image dimensions and its mask is set to the sprite which contains the result of the compare operation.

This works perfectly except for the fact that the fill sprite has to be tweened to the complete image dimensions irrespective of how small the area is being coloured-in since I am not able to find a way to get the dimensions of the fill area. I am doing an bitmap image update at the end of the tween and I have to disable user interaction till the tween is complete to avoid the errors which come in if another fill-in operation is started before the base image has been updated. If I could somehow get the dimensions of the fill area then the time during which I have to disable the user interaction will go down considerably.

View 3 Replies

Actionscript 3 :: Itarating Each Pixel Of A Bitmap Image

Mar 11, 2011

Is it possible to iterate each pixel of a bitmap image? Eventually what I'm trying to achieve is that I need to get the coordinate values of each pixel of a bitmap image and change the color of those pixels according to their coordinate values. As I see it, I need to use the getPixels() method but I still did not understand exactly what I should do.

View 3 Replies

ActionScript 2.0 :: Check When Pixel Is Transparent / Not In A Bitmap?

May 31, 2010

Can I check if a pixel is transparent or not in a bitmap?

I want to count the nr of transparent pixels and nontransparent pixels.

View 0 Replies

ActionScript 2.0 :: Get Whole Pixel Values?

Jan 25, 2005

I was wondering what the code to get something to go to a whole pixel value is. I'm using pixel fonts inside of a movieclip and when the movie clip is moved through actionscript and lands in a different spot with easing, the fonts look bad because i suspect that they are no longer on pixel values.

View 9 Replies

ActionScript 3.0 :: Convert Bitmap Into Sprite Pixel At A Time?

Nov 21, 2010

I'm making a game where the player moves around a map, where the player can walk and where they can't is decided by the color of the pixel they are trying to move onto, which I get using the Bitmap.getPixel method.

What I'd like to do though is when the map image is loaded process it into a sprite or something which I can then use the DisplayObject.hitTest methods on. So I have an array of colors whcih the user can walk on, is there way I could go through each pixel and build something that would let me do that?

View 4 Replies

ActionScript 3.0 :: Check Pixel Color Value Of Bitmap Through MouseEvent

Oct 5, 2011

I have a bitmap with many colors on it. When the user clicks each color needs to trigger a different method. However, I have no idea how to check the color value of the selected bitmap. I can create a new sprite and check the value of that fine through bitmapdata.getpixel() but when I need to actually check the actual bitmap I cannot get it to work.

View 2 Replies

ActionScript 2.0 :: Bitmap Hit Testing - Pixel Perfect Collisions

Mar 31, 2007

I have been desperately searching for a way to do pixel perfect collisions, and for someone to explain it to me in detail. explain the code in the .fla file, posted by the Canadian in the frequently asked questions thread on bitmapData hit testing:

[Code]...

after looking through the help files, i must admit they are terribly vague. All you are doing is checking if _alpha is above a certain amount. With movieClips you would use 0->100 but with this hittest you have to use 0->255 (0x00->0xFF)so an _alpha of 50 would correspond to approx 128 (0x80). Nearly all the time you could just use 1 as a hittest parameter so you are checking for any hit at all but maybe you have a shadow in a mc layer and you do not want to check a hit. This is when you might be able to use your threshold parameter. In other words, the hit test will only react to parts of the bitmap which have a greater or equal alpha than the alpha threshold, mostly useful for a shadow.

View 1 Replies

ActionScript 2.0 :: Code To Get Whole Pixel Values?

Jan 25, 2005

I was wondering what the code to get something to go to a whole pixel value is. I'm using pixel fonts inside of a movieclip and when the movie clip is moved through actionscript and lands in a different spot with easing, the fonts look bad because i suspect that they are no longer on pixel values.

View 9 Replies

ActionScript 3.0 :: Pixel Alignment Of Children Bitmap With Scale/rotate?

Dec 14, 2008

I'm implementing a frame class that builds a graphical frame around children using 9 bitmaps (4 corners and 5 middle pieces).The frame extends sprite, and the 9 frame bitmaps are attached as children. They are repositioned as necessary to encompass any other children on the sprite.

This works fine, normally, but as soon as I rotate or scale the frame, the children split apart, showing what appears to be a one pixel or partial pixel gap between the pieces.

I've tried setting pixelSnapping = PixelSnapping.NEVER on the 9 bitmaps. I've tried turning smoothing=true. The children bitmaps are always positioned at integer x, y's, never fractional. I've tried setting the scale of the children bitmap to 1.01 and PixelSnapping to AUTO. None of it works.

View 4 Replies

ActionScript 3.0 :: Inaccurate Pixel Values Using GetPixel?

Sep 18, 2008

I'm writing an applicaton which acts based on different colour values of pixels in a png image created in Microsoft paint. However, when I load the image into a BitmapData object, and then parse through the pixels reading their values using getPixel() or getPixel32() (I've tried both) I seem to be getting values which are slightly inaccurate compared to what was saved. For example a pure white pixel which should be read as 0xFFFFFFFF often comes out as 0xFFFFFFFE. The behaviour of the program is dependent on the exact value of the pixel so these errors usually break it.

Sometimes the problem is intermittent so seems fixed but actually isn't. Is it to do with the PNG format? I thouht png was lossless so should deliver accurate pixel values at all times?

View 5 Replies

Actionscript 3 :: Get An Accurate Reading Of The Pixel Data From A Bitmap With A Matrix Transformation?

Mar 24, 2011

i've filled a circle shape with the bitmap data of a bitmap asset.i need to rotate the circle from the center, so i added the bitmap to the center of the circle and used a matrix transformation to shift the bitmapdata upward and leftward so it appears centered.
now i'm trying to read the bitmap data with getPixel() but the return value is off since it is returning the untransformed position of the bitmap data instead of the visible transformed bitmapdata.

Bitmap(Sprite(evt.currentTarget).getChildAt(0)).bitmapData.getPixel(evt.localX, evt.localY)

how can i get an accurate reading of the pixel data from a bitmap with a matrix transformation? updated with code. assume the redCircleData in my example is more colorful and something worth retrieving pixel data.

var redCircleData:Sprite = new Sprite();
redCircleData.graphics.beginFill(0xFF0000, 1.0);
redCircleData.graphics.drawCircle(0, 0, 100);[code]............

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved