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


Similar Posts:


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

Flash :: Bitmap Data .draw() With Transform Matrix

Jun 29, 2011

I'm working on a project wherein a user can take a snapshot of themselves using their webcam and then edit this image by transforming scale and rotation and save the result.

I've got most of it working, the user can take a snapshot of themselves, transform the object using Senocular's Transform Tool and i'm using .draw() to then save this transformed object. The problem is .draw() is only grabbing data from the top left corner of the stage. It is drawing the transformed object but only from the top left corner.

Why does it only draw from the top left corner and how can i get set the coordinates to only draw from the area where the captured image is set?

You can view the file as is at: [URL]

And i've zipped the FLA and relevant classes at [URL]

import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;

[Code]....

View 2 Replies

Actionscript 3.0 :: Bitmap Data .draw() With Transform Matrix

Jun 29, 2011

Long time since i've been on here. I'm working on a project wherein a user can take a snapshot of themselves using their webcam and then edit this image by transforming scale and rotation and save the result. I've got most of it working, the user can take a snapshot of themselves, transform the object using Senocular's Transform Tool and i'm using .draw() to then save this transformed object. The problem is .draw() is only grabbing data from the top left corner of the stage. It is drawing the transformed object but only from the top left corner. Why does it only draw from the top left corner and how can i get set the coordinates to only draw from the area where the captured image is set?

[Code]....

View 2 Replies

Flash :: Transformation Using MovieClip.transform.matrix ?

Jul 2, 2009

I have problem when dealing with transform in Flash cs4 ....When I rotate my movieclip and trace the output, my movieclip's width also changed....

View 4 Replies

Actionscript :: Get Transformations From Transformation Matrix In Flash?

Sep 1, 2010

I have transformation matrix properties (a,b,c,d). How to calculate scaleX, scaleY, scewX, scewY and rotation angle from those values?

When only one type of transformation is applied, I can figure out that:

scaleX = a
scaleY = d
scewX = c
scewY = b
rotation = arccos(a) or -arcsin(c)

But when multiple transformations are applied at once I don't know how to calculate those values.

I need to do this outside of flash so I can't use any flash helper methods.

View 1 Replies

Actionscript 3 :: Use Transformation Table In Matrix Class?

Aug 2, 2011

How can I, if it's even possible, use this transformation table provided in my question's accepted answer here in Actionscript 3 in Flash? I understand it might have something to do with Matrix, but I really have no clue if that transformation provided in the answer is possible to implement there. Is it? If so how?

View 1 Replies

ActionScript 3.0 :: Recalculate Point X / Y Value After Matrix Transformation

Jun 16, 2010

I am doing a matrix transformation on a Display Object. I got this function from another site, but basically it scales a display object around any point.
ActionScript Code:
public static function scaleAroundExternalPoint(m:Matrix, x:Number, y:Number, multiplier:Number):void{
m.translate(-x, -y);
m.scale(multiplier, multiplier);
m.translate(x, y);
}

But my problem is that I have to do multiple scales in a sequence and after scaling, the points defined in the XML no longer correspond. Let me first say that all the points being scaled around are located in an XML file. They are all relative to the display object's registration point (0,0) when it is normal, i.e. a scale of 1. Also, I have created a class that retains the target object's original Matrix so that the percentage you pass in is relative to the original scale instead of the scale after each call. But basically, with the scaleAroundExternalPoint function by itself, if I have an object that I scaled to twice it's size, the multiplier would be 2. but say I want it back to it's original size. The multiplier would NOT be 1 since that would just leave it at a scale of 2x. It would have to be .5. The important parts of the class are below.

ActionScript Code:
public function ZoomUIComponent(isKeyboardControlled:Boolean = false, disabledAlpha:Number = .25,
max:Number = 2, min:Number = .5, precision:uint = 2,
seconds:Number = 1, step:Number = .1):void{
this.disabledAlpha = disabledAlpha;
this.inControl = InteractiveObject(getChildByName("zoomIn"));
_isKeyboardControlled = isKeyboardControlled;
[Code] .....

It's retaining the original matrix and then calculating based on that EACH TIME. So how would I find the new X and Y values of the original points so that I can scale around them?

View 1 Replies

Flex :: Animating A Transformation Based On Transform Matrix?

Oct 18, 2010

I have a UI component that I wish to relocate and scale, but in a rather complex way. I've figured out the necessary transformations using the transform matrix, to which I applied several translate and scale operations. I can set the new transform matrix for this UI component to be the above calculated matrix, and the results are accurate; but I need to animate the transition. I can't use the Scale/Move effects alone because they aren't as powerful when it comes to calculating the necessary transformation as the matrices are.So how can I animate the transition of an object given a source and a target transform matrix?Figured it outUsing a tweener and its onUpdate event to reassign the matrix with each intermediate value:

var animMatrix : Matrix = gi.transform.matrix;
TweenMax.to(animMatrix, 1, {
a : m.a,

[code]......

View 1 Replies

ActionScript 2.0 :: BitmapData And Transformation Matrices - Shift The Newly Created Bitmap?

Jan 29, 2007

I've started getting to grips with using the BitmapData class and a Transformation Matrix in the hope that I can start making some interesting image effects. However, at the moment Im having trouble figuring out how to shift the newly created bitmap so that any scale transformations are applied from the center rather than the top left corner. See here for example: [URL] The flower on the left is the original, the flower on the right is the new image created using "bitmapData.draw()". It has been scaled up to twice the size, but I want this to happen from the center of the image.

[Code]...

View 5 Replies

Flash :: Reading And Drawing A Pixel Font In ActionScript

Feb 16, 2011

I've created a small pixel-font that I want to use in a Flash game. Each letter is 6 pixels tall, and 7 pixels wide. I've saved a PNG file with all the letters from A-Z lined up next to each other. Basically, I'd like to be able to have a system where I point to the PNG file and say "A is position (0,0) to (7,6), B is position (7,0) to (14, 6), etc" then render those individually on the screen as letters in my font.

I was inspired to do this by watching (the creator of Minecraft) Notch do it in a video of him making Megagun. So, has anyone done anything like this before? Is there a simple library that will let me do it already?

View 1 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 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 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 :: 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 :: 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 1/2 :: Reading Data From A Text File But Can't Use The Data Outside Of The Function?

Mar 26, 2009

I am trying to load a variable from data in a text file.I can read the text file fine but the variable data seemsonly to be available with in the function that reads it. I need to use the variable data outside of the function.This is the actionscript code i'm using.

var pathVars= new LoadVars();
pathVars.onLoad=function(ok) {
if(ok)

[code].....

View 3 Replies

IDE :: Reading Data From A Text File But Can't Use The Data Outside Of The Function?

Mar 26, 2009

I am trying to load a variable from data in a text file.I can read the text file fine but the variable data seems only to be available with in the function that reads it. I need to use the variable data outside of the function.

This is the actionscript code i'm using.

var pathVars= new LoadVars();
pathVars.onLoad=function(ok) {
if(ok)
{

[code]....

This is where the path_var becomes undefined

trace("This is outside the function... "+path_var);
pathVar1="This is outside the function... "+path_var;

View 2 Replies

ActionScript 2.0 :: Matrix Algebra And Matrix Inverse?

Apr 5, 2003

Has anyone here ever developed a function (or general library of relevant functions) that will allow one to find the inverse of a matrix? I've searched the forum archives, as well as the internet more generally, but haven't found anything. If anyone has some leads, I hope you'll pass them along.

If I don't hear anything within the next few days, I might try to develop something on my own, but I'd hate to do so if someone has already done the dirty work.

A solution to this problem would be very useful for 3-D work or anyone doing mathematical programming more generally.

View 14 Replies

IDE :: External Jpgs & Exporting Pixel Data?

Jun 24, 2009

I wondering if with flash would be able to load in an external jpg file and then export the pixel data into a php application to rebuild the image?My concern is when an application loads an external resource it is just that, external and not local and therefore when I come to grab the pixel data will it grab the external resource in this case the image I've placed inside a movie clip?

View 3 Replies

Flash 9 :: Reset Transformation Point/Set Transformation Point?

Feb 8, 2008

When I right-click a symbol the options "set transformation point" and "reset transformation point" come up. They don't seem to do anything for me. I thought it would center them or something. This is not the case. I have the white transformation point in one corner in one keyframe and a different corner in another keyframe I click "reset transformation point" on both frames and they don't move.

View 3 Replies

Actionscript 3 :: Analyze A Video's Pixel Data In Flash

Apr 9, 2012

I'm using FFmpeg to do some video analysis on my PC but I'd like to see if I can do something similar in the browser using Flash.

Does Flash offer any way to take a video file as input, crack it open, and get access to the pixel data?

View 1 Replies

Flex :: Reading Data From XML File?

May 31, 2010

How to read data from XML file in flex?

View 4 Replies

ActionScript 3.0 :: Reading POST XML Data In JSP?

Aug 7, 2009

I am currently doing a simple project, and I need to save the players' scores into database for later retrieval. I used URLLoader and URLRequest to send XML object containing game score to a JavaServer Page (storedata.jsp) running on Apache Tomcat server. The AS3 code snippet is shown below:

public function sendData(xmlData:XML):void
{
var xmlData:XML = <block>
<chapter1>

[code]....

However, here comes the problem. The pageContext.request.reader doesn't return a parsed XML object. When I display using c: out, I saw [#document null] output. Hence, the x:set statement generates runtime error.

View 2 Replies

ActionScript 2.0 :: Reading XML Data And Drawing?

Nov 1, 2004

I'm trying to generate a chart using XML data which gives flash output....With fixed stage dimension I can do it....But my Data can be dynamic too.... Means X,Y axis can be of any length...In that case I was not able to resize the stage...Is there any way to create .swf file runtime whose dimensions can be decided runtime?I thought of proportenate drawing.... but font sizes will become too small..unless zoomed...

View 1 Replies







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