ActionScript 3.0 :: Getting The Average Pixel Value Of The Rectangular Area Behind A Mc?

Nov 28, 2009

I have a vector movie-clip of a cat. Behind it, there is a picture of a park. The picture of the park takes up the entire stage, but the cat is only 32x16. How could I use BitmapData to sample all pixels (of everything, not just the park) within the cat's bounding box (but not including the cat itself in the samples (so like the cat is invisible); also 4 pixels wider in each direction, so it would effectively be 40x24) and then return the RGB average (in hexidecimal) so that I can set a masked transparent mc in front of the cat to that value?

Basically, so it looks like the color of the cat's surroundings affect its tint, to crudely simulate global illumination in 2d.

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Calculate What The Average Color Is By Retrieving The Color Of Each Pixel

Jun 19, 2009

I need a function that retrieves the average hexadecimal color values of a group of pixels in a square. Like a 4x4 area, and I want to be able to calculate what the average color is by retrieving the color of each pixel.

View 4 Replies

ActionScript 3.0 :: Movieclip Hit Area, Set To Dimension, Instead Of Pixel Perfect?

Dec 4, 2010

i have a simple movieclip, based off text, with a few frames, and instead of creating an invisible area to do the hit test, is there any way to set the hit area to equal the movieclip's dimensions?, google seems to not be able to provide results, i don't need pixel perfect hit detection, but rectangle detection

View 2 Replies

ActionScript 3.0 :: Detect Color Of A Pixel / An Area In A Display Object?

Jul 11, 2009

Can I detect the color of a pixel or an area in a Display Object?

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 :: Average Input NaN?

Jun 14, 2011

I made involving the user inputting 4 different numbers into seperate InputText component boxes. I have an output showing "Your Average Is _____ " but i keep running into a problem saying "Your average is NaN". Here's my code, tell me what is wrong with it.also, Flash shows no errors in my code. It's just shows NaN.

Code:
var average:Number;
grade1.restrict = "0-9";
grade2.restrict = "0-9";[code].....

View 6 Replies

ActionScript 3.0 :: Get Average Brightness Of A JPG Movieclip?

Feb 22, 2011

I was working on a project a few months ago, which I had to put on hold but am finally getting back to. One major feature I need that I wasn't able to figure out before was how to measure the average brightness of an image file loaded as a movieclip. I remember spending hours going through tutorials but I wasn't able to get it working. Now I don't even remember what or where I read before and I'm not keen on rereading all of it and still not knowing what to do.

I just want the simplest possible way to get an average brightness level of an image, I don't care which way the brightness is measured as it is only important relative to other images which will be measured the same way.

View 9 Replies

ActionScript 2.0 :: Average Colour From BitmapData?

Oct 27, 2008

Is there a way to loop through all the pixels of a bitmapData object to find the "average" colour or light level? I basically want to make a light level detector using the webcam. Does anybody havehow I could accomplish this? All searches I have tried return tutorials on motion tracking.

View 3 Replies

ActionScript 2.0 :: Average X Coordinate With Arrays?

Jan 16, 2012

I am wanting to take the average x co-ordinate of several movieclips, mc_01, mc_02, etc. using arrays. That is, I would like to sum all the x co-ordinates and then divide by the number of movieclips.

View 1 Replies

Get Dominant / Average Color In GetPixels ByteArray?

Jan 10, 2010

So, I've got this [code]...

Is there a way to get, efficiently and quickly, the dominant color and/or the average color in pixels ByteArray.

noise is used for the example here. I'll be having something else drawn on that BitmapData instead.

I found some ways to extract the average color palate from a BitmapData, but this isn't enough for me since I want the average from a rect over that image.

View 2 Replies

Capture Numeric Input From User And Calculate Average?

Feb 26, 2010

This can't be too difficult but its killing me. I want my user to be able to type 3 numbers into 3 different input boxes, capture those numbers, calculate and display their average in a fourth text box.

I am not sure how to capture input from a textbox in AS3 in order to do these calculoatilo.

View 1 Replies

ActionScript 3.0 :: Creating A Mathematical Curve(like Test Average)?

Feb 11, 2009

I'm trying to create a balance beam for an education video game and am having trouble making the balance look just right.When the student slides the weight on a triple beam balance, the beam rotates from its pivot to show how far off the weight is. The student then continues adjusting it until the weight matches. My problem occurs because the length of the weight arm means the rotation values are very small, range -4 to 4 degrees, and when the student gets within a few grams it appears level.

My question is how to create a mathematical curve. Like 100 = 20, 50 = 15, 20 = 10, 1 = 4, .2 = 2, etc, so that I can have large movements towards the more accurate side and less when the weight is far off.

View 3 Replies

ActionScript 3.0 :: Calculate The Average Of A Series Of Numbers In An Array?

May 27, 2011

So I've got an input box on the UI, where integers are entered and stored in an array. I want to find out the average of the integers, but how would I calculate the sum?

View 1 Replies

ActionScript 2.0 :: Cannot Be A Dynamic Text Because The Font Is Not A Normal Average One?

Nov 24, 2004

I know it's possible i saw it on several websites does some one know how i can use a static text in preloader counting to 100%? For an example look at ILOVETECHNO.BE The preloader a heart use a static text i think it cannot be a dynamic text because the font is not a normal average one

View 1 Replies

ActionScript 3.0 :: Getting Specific Average Number - Stack Over Flow Error

Nov 8, 2010

I'm having AS3 create 12 random var (play1, play2, etc) and then I ask it to average the 12 vars (numbers) until I get a specific average number. When I run this in AS2 I get the "script time error, keep running?" question. I tell it to keep running and eventually AS2 finds the right set of 12 numbers to equal a specific average number. In AS3 I get a "stack over flow error". I know that all my AS3 swf needs is just more time to find it.

View 12 Replies

ActionScript 2.0 :: Load A Value From A .php File Labeled $average Into A Dynamic Textbox?

Jan 18, 2008

I'm trying to load a value from a .php file labeled $average into a dynamic textbox. I'm using this code to accomplish this, but I only get "undefined" in my textbox. Can anybody see if there's anything wrong or just a syntax error, or anything..

[Code]...

View 6 Replies

Button In A Different Shape Than Rectangular?

Aug 2, 2009

is it possible to make button in a different shape for example i have a figure that i cut from image on a transparent background an i was wonder if it is possible to make that person in to a button but just that person not the transparent background.

View 1 Replies

ActionScript 3.0 :: Non-Rectangular Buttons With Images?

Feb 11, 2009

is it possible to create a non-square "button" in flash cs4 programmatically using as3?

Using a xml document, i'm trying to be able to retrieve a png file with transparency, and have said transparent area's be not clickable.

Long story short, I'm creating a map with a bunch of clickable areas. These areas are non-rectangular and I need them to not obscure other area's which would be in their rectangle. I need this to be done programmatically since the area's are going to be dynamic as is the data attached to them.

fyi: I have a fairly good grasp of OOP, so don't be afraid to post up complex instructions.

View 8 Replies

ActionScript 3.0 :: Fit Bitmap To Non Rectangular MovieClip?

Nov 27, 2009

I'm loading bitmaps dynamically using AS3 and I'd like to fit/tile them within a movieclip. (like a texture but in 2D)

However, my movieclip is not rectangular and everything I tried resulted in the texture getting out of the boundaries of my movieclip and being displayed as a big rectangle.

View 5 Replies

ActionScript 2.0 :: Using A Non Rectangular Drag Boundary?

Jan 17, 2007

When you call startDrag on a Sprite/MovieClip/whatever, you can specify a rectangle which the object in question will stay within.

Eg... startDrag(false, rect1); where rect1 is of type :Rectangle

how you would go about constraining the dragging to an arbitrary shape, say a triangle or a circle rather than a rectangle?

I figure I could just have a Timer calling a function to check the whole time but that doesn't seem particularly nice.

View 1 Replies

Actionscript :: Calculate The Average Frequency Of An Audio Recording Captured As A ByteArray In Flash?

Nov 30, 2011

Keeping it simple for now but assuming i have a ByteArray full of sample data is it possible to calculate the average frequency (thus a pitch) from the entire recording? Is this along the right lines? p = 69 + 12 x log2(f/440hz) ...

View 1 Replies

ActionScript 3.0 :: Change Shape Of This Rectangular Bounding Box?

Feb 18, 2010

I have a movie clip which contains a circular image, and by default Flash CS4 gives it a rectangular bounding box. This is a problem however because I am using this movie clip as a button, so the rollover area includes the entire rectangular bounding box and not just the circular image. How can I change the shape of this rectangular bounding box?

View 2 Replies

ActionScript 1/2 :: HitTest For Rectangular MC Over Irregular Shape

Jan 15, 2010

In my app, a user must drag and release a rectangular mc object (rectx) over an irregular shape within another mc object (irregx). There are 13 rect/irreg pairs. Each obj shares an AS2 file that checks whether rectx is over irregx, and proceeds _only_ if the check is true. The script uses hitTest, on mouse release, to grab the number (x) of the rectx being dragged and checks whether it's over irregx. Right now, the check comes back true when rectx is _anywhere_ inside irregx's bounding box whether it's over the actual image or not.

I've noticed that, when the (unpressed) mouse rolls over any irregx, it's oblivious to irregx's rectangular bounding box. It only reacts when it reaches the edge of the irregular shape inside, toggling from arrow to hand at the image edges. Since the mouse knows where the irregx image boundary is, is there a simple way to tap the mouse's 'eyesight' to verify whether rectx is over the correct irregx shape (meaning not just within the bounding box, within the shape inside it)? This can't be that hard.

View 6 Replies

Flex :: Crop Image Using A Non-rectangular Shape?

Oct 30, 2009

I've been following this tutorial to crop images in flex: [URL]

At the heart of its cropping is using a method called "copyPixels". However, this method takes as one of its arguments a rectangular shape for its crop region. Are there other strategies I can use to crop it not using a rectangle.

I am going after letting the user specify the region that should be cropped using a series of points.

View 1 Replies

ActionScript 3.0 :: Specify Rectangular Region Zoom Into Video

Jul 3, 2009

If it's possible to zoom into a video? For example specify a rectangular region in the video and zoom in.

View 1 Replies

Actionscript 3 :: Find Where A Line Collides With A Rectangular Object?

Nov 9, 2011

I am developing a game with Flixel as a base, and part of what I need is a way to check for collisions along a line (a line from point A to point B, specifically). Best way to explain this is I have a laser beam shooting from one ship to another object (or to a point in space if nothing is overlapping the line). I want the line to reach only until it hits an object. How can I determine mathematically / programatically where along a line the line is running into an object?

I could try measuring the length of the line and checking points for collision until one does, but that seems like way too much overhead to do every frame when I'm sure there is a mathematical way to determine it.

Edit: Before checking an object for collision with the line itself, I would first eliminate any objects not within the line's bounding box - defined by the x of the left-most point, the y of the top-most point, the x of the right-most point, and the y of the bottom-most point. This will limit line-collision checks to a few objects.

Edit again: My question seems to still not be fully clear, sorry. Some of the solutions would probably work, but I'm looking for a simple, preferably mathematical solution. And when I say "rectangle" I mean one whose sides are locked to the x and y axis, not a rotatable rectangle. So a line is not a rectangle of width 0 unless it's at 90 or -90 degrees (assuming 0 degrees points to the right of the screen).

View 4 Replies

ActionScript 3.0 :: Resize A Rectangular MovieClip At Run-time Dynamically?

Sep 22, 2009

I am trying to resize a rectangular MovieClip at run-time (dynamically). But, the problem is that it changes the width in both directions (left and right) from its transformation point. The same is the case with its height.

I want the width of the clip increase from left to right or decrease from right to left only.

View 6 Replies

ActionScript 1/2 :: Decrease Hit Area - That Mouse Out Of To Make The Drop Down Area Pull Back?

Jul 28, 2009

i have a drop down menu am working on and each button tab (although they are not button instances !) when clicked opens up the "drop down" section which you can mouse over to choose another specific button etc - if you mouse out of that drop down area then it pulls back up to the original tab state ..  what do i change to the code below to decrease the area that you mouse out of to make the drop down area pull back .....at the moment it at least two inches on the screen below and to the right of boundaries of the drop down box before it pulls up - i want to it pull up as the mouse leaves the boundary box .... hope this makes sense .... there is some part of the actionscipt below that controls this but can work out which bit and how to change it !!! (am guessing the x mouse and y mouse bits - but how to change it ???)

[Code]...

View 1 Replies

Actionscript 3 :: Get BitmapData From A DisplayObject Included Transparent Area, And Effect Area

Aug 5, 2011

I have this function:

public static function cloneDpObj(target:DisplayObject):Bitmap
{
var duplicate:Bitmap;

[code]....

to clone target displayObject (MovieClip or Sprite) and return Bitmap Object.

It can get bitmap from the target object, but it seem don't get all the area of the image.

By give the width and height of target object, but the target object in design was applied by Glow Effect, so my question can we get the all view of bitmapdata from a displayobject?

View 4 Replies







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