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


Similar Posts:


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

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 :: 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 3.0 :: Check Pixel Transparency?

Aug 4, 2009

I am trying to get the alpha values in the rect of one (playball_mc) clip inside another bigger clip (dst_mc). The clip dst_mc has a bitmap attatched and also has a shaderFilter that calculates the alpha values.ut I only get alpha values of 0xFF.Does anyone know what I am doing wrong or where the alpha value gets lost?

CODE:var rSource:Rectangle=new Rectangle(playball_mc.x,playball_mc.y,80,80)
dst_bmp.draw(dst_mc);bmd1.copyPixels( dst_bmp , rSource, new Point(0,0) );
for

[code]........

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 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 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

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

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

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 3.0 :: Click Through A Transparent Area Of A Bitmap?

Sep 18, 2008

I am importing some graphics on the fly, and want to be ableto drag them around the stage, which all works great. My issue isthat if I add a large element, like a border around the edge of thestage, this covers up all the other items so that clicking on themis not possible. I can see them, but when I click, the large itemgets the event, even though visually, it is transparent. There arethings I could do if I was doing all the development of thegraphics in the IDE, but these items load at runtime, so it has towork with bitmap

View 1 Replies

ActionScript 3.0 :: Remove Transparent Area From Bitmap?

Sep 17, 2010

So I have a BitmapData object that's 400x400, and is mostly transparent with a small area (up to 50x50) of color somewhere inside. That's drawn to a bitmap, and now I somehow need to generate a Sprite that is only the dimensions of the small colored area, and sits in the same place on the screen.The size and position of the colored area is variable, and the operation to create the new Sprite must be near-instantaneous, so no lengthy pixel comparison exercises.

View 2 Replies

ActionScript 3.0 :: Detecting/omitting Transparent Area In Bitmap?

May 29, 2009

i am loading a background bitmap into a sprite. after that i make this sprite draggable. now i would like to have a copy of this sprite where just the area with the non-transparent parts of the bitmap react to the click.

i know that i can determine if a pixel is transparent with the getPixel32() method, but it seems to be overkill to anylyze every pixel... or is it not?

View 9 Replies

ActionScript 3.0 ::make All White Pixels In Bitmap Transparent?

Jul 29, 2008

i want to make all white pixels in my Bitmap transparent. i found the treshold-method and try to use it:

Code:
var pt:Point = new Point(0, 0);
var rect:Rectangle = new Rectangle(0, 0, 2000, 2000);
var threshold:uint = 0x00FFFFFF; // all white Pixels

[Code]....

View 3 Replies

Actionscript 3 :: Convert Text Into Bitmap Or Movieclip With Transparent Background?

Feb 13, 2011

how to convert text into a bitmap or a mocieclip with transparent background. i could convert the text into bitmap but it has got a white background..

View 1 Replies

Flash :: Forward MouseEvent In Transparent Bitmap To Underlying MovieClip

Mar 24, 2011

So I'm Bitmaping some heavy stuff to try bring down the [pre-render] and [render] which is quite high according to FlashBuilder's profiling. I thought this was going well until I realised that as soon as you change a MovieClip to a Bitmap, you lose the pixel based accuracy of the mouse move events (Over, Out, Move...), all your left with is the entire bounding box of the Bitmap, something which is less than desirable. I've got a game where many Bitmapped assets would be on top of each other in a scene, on the stage, arranged in various ways and need to have that pixel accuracy moving between each one and have exhausted my efforts as to how to achieve the same mouse move results with the Bitmapped guys as normal.

This, [URL], is a FLA which shows this operation, and you can see how it works here, [URL]. When it loads up, both items on stage are drawn Shapes, encapsulated in MovieClips, both that get a glow, if you hover over them. If you click the stage at all, the purple guy gets turned into a Bitmap and now, his 'hit area', when it comes to MouseEvents is his whole bounding box and you can only get through to the back green item at the edge slivers.

I'm also tracing the pixel which the mouse is over, so I can clearly tell when the mouse is over a transparent area, it's 0, but how can I tell the event to forward itself on down the chain to the green MovieClip?

Below is how it's now pretty much working for me,

var bitmap:Bitmap = this['bitmap'];
var shouldMouseOver:Boolean = bitmap.bitmapData.getPixel(event.localX - bitmap.x, event.localY - bitmap.y);
if(shouldMouseOver)

[Code].....

I shut off mouseEnabled for my item, when I know it's wrong, then I search for another item that properly fits the bill and if there is one, send an Event to that and break. If that one's also wrong, it'll do the same again, but each time taking themselves out of the loop.

This does work exactly how I want it to, but I'd always prefer to keep things like globalToLocal and looping, and reading from arrays for not frequently updated methods like listeners to MOUSE_MOVE. Is there a more efficient way to do this?

View 2 Replies

ActionScript 3.0 :: Transparent Bitmap - Preload Images Then Multiply Them On Scene

Mar 5, 2008

what i want to do is to preload some images, then multipy them on my scene ( the files are transparent png containing clouds ) the problem is that when i copy the bitmap data to create a new cloud, i loose transparency, and i can't get WHY here's my code

[Code]...

View 6 Replies

ActionScript 3.0 :: Use The BitmapData.setPixels Method To Set Certain Pixels In The Bitmap Transparent?

May 2, 2009

I am trying to use the bitmapData.setPixels method to set certain pixels in the bitmap transparent.But no matter what I do, it always seems to set the pixel(s) black (non-transparent).Here is my code:

[AS]
bmpd = new ImageFromLibrary(0, 0);
bmpd.setPixel(0, 0, 0x00000000);
[/AS]

why its not setting the pixel(s) transparent?

View 4 Replies

ActionScript 3.0 :: Avoid Transparent Part Of Bitmap To React With Mouse Events?

Dec 20, 2011

What I have is a bitmap as render cache for a sprite, and there're many of them present on the stage. I expected that they would react like sprites with mouse-click event, but they didn't. They're like rectangles all around, matter what the original sprite look like, And I tried put bitmap cache into sprite container and use sprite's hitArea property like [code]...

View 1 Replies

Professional :: Transparent Background Is Not Working With Vmode Transparent?

Oct 17, 2010

I imported a video into flash and have a transparent photoshop layer to create an iPod skin. The video works fine, but I cannot get the "stage" to be transparent so that you do not see the flash background color behind the iPod skin.
 
I've read in the forums and have followed the instructions here from Adobe. If you look at my code, I have

[Code]...

View 6 Replies

Actionscript 3 :: Draw Transparent Graphics Onto Transparent BitmapData?

Feb 5, 2012

I'm trying to draw PNGs onto BitmapData that is transparent.

I create my BitmapData like this (using ARGB for the color):

new BitmapData(width, height, true, 0x00000000);

And clean it by using the same ARGB value:

bitmapData.fillRect(bitmapData.rect, 0x00000000);

When I use copyPixels() to draw graphics onto the cleaned BitmapData, I get this result:

If I don't use ARGB for the BitmapData color, it works fine:

But I have to specify a solid fillColor, meaning I can't render what's behind the Bitmap.

How can I make my BitmapData transparent, but not have the above occur?

View 1 Replies

ActionScript 3.0 :: Remove Transparent Pixels From Transparent Png?

Feb 27, 2010

I am creating a map in flash cs4 with all the countries on it. I used photoshop for creating the map and separated countries. Now I imported all pngs in Flash and I want to give Mouse CLICK event and Mouse Hover on all pngs, but as the transparent pixels are overlapping the other states, it is getting difficult. So, I converted all pngs in movieclips and now then I broke up pngs. Now I want to delete all pixels having alpha 0 using eraser tool, as per the borders. And I have to do it manually for individual countries. So is there a way to remove transparent pixels from the bitmap data?

View 2 Replies

ActionScript 3.0 :: Transparent Png Not Acting Very Transparent?

Oct 6, 2009

I have two png's that kind of look like paint brush strokes. they have some transparency in them that lets the stage colour bleed through a bit.

I am adding two of these images to the stage in AS 3. One adds quite fine - looks as expected. The second one however doesn't have any transparency other than around its edges. What i mean is it looks more like GIF than a PNG. Rough around the edges, no transparency "inside" the image itself (where there should be)

i have tried re-creating the image (yes it IS a PNG) which did nothing. I ensured the library item is not being treated as a JPEG. I also even tried externally calling the PNG to see if that made a difference. Unfortunately it did not.

why this second PNG doesn't seem to have a transparency set?

View 8 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.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

Flex - Function To Redraw Bitmap On Sprite Without Passing In Said Bitmap?

Feb 22, 2011

If I have a BitmapData that's already been drawn onto a Sprite. Is there a way to redraw the BitmapData onto a Sprites Graphics object without having to invoke beginBitmapFill and passing in the same BitmapData?

View 1 Replies

ActionScript 3.0 :: Drawing From Bitmap To Bitmap Overrides Earlier Graphics?

Dec 29, 2010

I'm working on a game, and to keep performance good, instead of addChild'ing 50 new sprites to the stage every second, I decided to have each player draw to their own bitmap, and then to the 'master' bitmap. This introduces an issue though: the second player would override all data the first player has put into to bitmap...My basic debugging proof of concept:

Code:
// bitmap test

import flash.display.Bitmap;
import flash.display.Bitmap;[code]......

View 1 Replies

ActionScript 3.0 :: Copying A Rotated Bitmap Into A Bigger Bitmap?

May 9, 2011

I have a bitmap which has several frames (packed along the horizontal axis). In order to render them I copy it to the backbuffer (larger bitmap) as follows:

Actionscript Code:
public override function copyToBackBuffer(db:BitmapData):void{ if (active)  var drawRect:Rectangle = new Rectangle((currentFrame-1) * frameWidth, 0, frameWidth,

[code].....

View 5 Replies







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