ActionScript 2.0 :: Invert Colors/channel Of A BitmapData Object?

Aug 1, 2007

reason is i'm copying this grayscale Perlinnoise smoke image and makig it such that the darker the color, the more transparent it is. (I'musingcopyChannel.RED/GREEN/BLUE->CopyChannel.ALPHA). But right now, it's the other way round at the moment (ie. the brighter the pixel, the more opaque it is.). I want it to be more transparent instead (inversely proportional), so if i could find simple & fast way invert the alpha channel, it would do me so much more good. (I need a fast method...performance is critical!)

View 6 Replies


Similar Posts:


Flash :: Transform Single Channel Of BitmapData Object

Dec 30, 2009

I have a BitmapData object with an alpha channel. I'd like to know the fastet way to offset that alpha channel in ActionScript3 (FlashPlayer10). By offsetting I mean shifting all pixels of that channel in one direction (wrapping around the image borders) while leaving the color channels as they were.Is there a good way to apply a such a transform to one channel only?

View 2 Replies

Actionscript 3 :: Flash - Combine Two BitmapData Objects Via Max( Channel )?

Feb 2, 2010

I have two BitmapData objects with alpha channels. I'd like to combine them into a single one by using max(channel_image_one, channel_image_two) for each channel, including the alpha. Is there an easy way to achieve this result?

View 2 Replies

Flash :: Copy Channel (BitmapData Class) - Eraser Tool

May 3, 2011

I am developing an application similar to MS Paint. I am building a Flash Paint application. The basic structure is this. I have two layers namely topLayer_mc and bottomLayer_mc. The actual vector drawing is drawn on the top layer and onmouseUp of the tool, a bitmap copy of the vector graphics on the top layer is taken and added as a bitmap to the bottom layer. The top layer is cleared subsequently. It is working for the pencil tool.

Now I need to create an eraser tool. This is where things get tricky. In the application there is an option to save the image as png, so alpha has top be preserved. So the coventional method of draw a brush using the vector and using the draw method of bitmap will not work. Of course, on a visual level it would work if the brush drawn using the vector is to have the same color as that of the background. The eraser's are rectangular in shape.

The technique I am tring to use is to use the copyChannel method of BitmapData class. Specify a channels (say GREEN channel )hex value as 00 and make it as the source. Then make the destination channel ALPHA. I got it working without using movieclips as shown below.

[Code]....

View 1 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 :: Remove Similar Colors Of A BitmapData?

Jul 28, 2011

I was wondering if there is a filter or something in ActionScript 3 that lets me remove colors that are similar to other colors in a photo?

I have BitmapData of a JPEG image but the JPEG was saved with pretty low quality so there are some pixels that make it look ugly (JPEG artifacts). Without those pictures it would look okay, is there a way of removing them in AS3?

Was thinking something like a ColorMatrixFilter or similar?

View 1 Replies

ActionScript 3.0 :: Mouse Event Under An Object That Has An Alpha Channel

Jun 21, 2010

I'm building a custom UI for a program and I'm having trouble with a mouse event on an object that is visible, but is |. Imagine the top object being a frame and the lower object being a photo. I want to detect mouse events on the photo. So what happens currently is that only mouse events on the top object are detected. Thoughts on how to get around this?

View 3 Replies

Flex :: Does A Channel Set On Remote Object Gets Logged Out On Its Own After Some Time Interval

Apr 8, 2009

I have implemented the login capability to my application using Flex(Blazeds)channelset login. But there is a strange problem, after about 2 minutes of inactivity if I try to perform any operation I see that my channelset has been been forcefully logged out Is there some configuration which I need to do in order to prevent this from happening. I tried adding this in my web.xml, so that the session persists but it didnt help my cause.

<session-config>
<session-timeout>10</session-timeout>
</session-config>

View 10 Replies

Actionscript 3 :: Graphic Object BitMapData Type The Same As BitmapData Type?

Dec 29, 2009

The title might be a little misleading. Look at my code and I will explain

public static function loadTile(tileDir:String = "empty"):void
{
if(tileDir != "empty")
{
tPoint = new Point(0,0);
tRect = new Rectangle(0,0,30,30);

[Code]...

I am trying to do tiling with sprites. I want my tiles to be interactive, so that is why I am using the sprite object instead of using regular bitMaps to represent my tiles. You might be wondering why I wouldnt just use graphics.beginBitmapFill(tImage); and graphics.drawRect(0, 0,tWidth ,tHeight ); to pick out the tiles I want to use. Well reason being is because it turns out that drawRect() first and second parameters actually alter the location of where the actual sprite sits at.

So if I set the x and y properties of the sprite to x = 20, and y = 20. then I set my drawRect(20,20). it actually adds an extra 20 pixels to my x and y coords of my sprite. And I know the reason why, I just need to know a better way.

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

ActionScript 3.0 :: Assign Colors To Flash Object From XML?

Sep 6, 2010

Here i have creating a dynamic square and trying to assing a color from XML DataI have XML file with color code

<data>
<colour>
0x0000FF

[code].....

View 7 Replies

ActionScript 3.0 :: Make An Object Change Colors Randomly?

Jun 14, 2010

I have a simple .fla file with a circle on the stage. I want to set actionscript to make the circle randomly change colors when playing. I've tried all sorts of script commands using math random but to no avail

View 4 Replies

ActionScript 3.0 :: Determine X Colors Between 2 Defined Colors?

Apr 26, 2010

I wonder what kind of class(es) I should use to accomplish this task. I have two predefined colors, 0xFF0000 and 0x00FF00 (red and green), and I would like to set a number of gradiants of colors between these two colors. [code]This generates a random color, but I don't want to generate just any random one. Does anyone know what kind of color class I should use to accomplish my task objective?

View 5 Replies

Erase An Area In A BitmapData Object?

Oct 11, 2009

Flex 3, ActionScript 3, Flash player 9.

I have a picture in a BitmapData object. And an array of points. I nead to erase the part of the picture inside a polygon specified by the points. In other words, draw a polygon specified by the points and fill it with transparency.

View 2 Replies

Actionscript 3 :: Adding A Object To A BitMapData?

Dec 28, 2009

I have 3 objects. One BitMap that acts as my canvas. And 2 bitmapDatas. One is my buffer and another is my tiles. I am creating a tiling effect for a game. I would like to take my tile:BitMapData, and turn it into a custom object. reason being is I want each tile to be interactive. So I can click on each one. Is it possible to turn my bitMapData that represents a tile, into a custom object that has properties and methods. Sort of like a movie clip. and draw it into my buffer ?? Could I create a new class that extends bitMapData ?? Or would I have to get rid of the buffer and draw the tile objects directly into the BitMap ??

In other words, what is the best way to put Sprite or a tile into a BitMapData object or even a Bitmap.

View 2 Replies

Flash :: Use HitTest Between BitmapData And An Object?

Aug 23, 2011

I have converted a PNG into a bitmap, then converted that into bitmapData.

I have a object called _player, and I wish to add collision detection, however I can seem to get it to work.

my code is:

if(bmd1.hitTest(new Point(_player.x, _player.y))){
trace("hit");
}

bmd1 is my bitmapData,_player is the object is wish to test against.

I am getting the following error:

1136: Incorrect number of arguments, Expected 3

I have looked around but cannott find what argument I am missing

I have tried

if(bmd1.hitTest(new Point(_player.x, _player.y), 50, _player)){
trace("hit");
}

I should mention that the reason for me taking this approach is that I have a PNG, with transparent areas, I need to test for collisions in the non-transparent areas, which is why I was using this approach

I have a PNG, i import that and convert to bitmap, then convert to bitmapData

View 3 Replies

ActionScript 3.0 :: Split BitmapData Object In Two?

Sep 30, 2009

I'm really struggling to work out how to split a BitmapData object into two separate bjects, and eventually add them to a mc and animate them.I can successfully create a new Bitmap out of the left half, but when I try changing the Rectangle props for the second Bitmap draw method to make a Bitmap out of the right half, it doesn't work?Here's my code:

ActionScript Code:
// 'image' being a MovieClip on the stage
var bit1:BitmapData = new BitmapData(image.width*0.5, image.height, true, 0xff000000);

[code]....

View 4 Replies

ActionScript 2.0 :: Creating BitmapData Object Of Jpg

Sep 4, 2007

I am trying to create a BitmapData object of a jpg that is loaded into a movieClip, so that I can then remove the jpg and have just the BitmapData of the image to manipulate. I have the original image loading into my temporary MC without any problems..and am using a listener to check to make sure that the image has been fully loaded before it moves onto creating an empty movie clip for the BitmapData... but for some reason the BitmapData isn't working as nothing shows up in my holderMC.. and it says the width of the holderMC is 0 when it should be something liek 367 for the 'surf.jpg' test image I am using. My code is below..

Code:
import flash.display.BitmapData;
stop();
_root.createEmptyMovieClip("tempMC", 1, {_alpha:0});

[Code].....

View 1 Replies

ActionScript 3.0 :: Convert Loader Object To BitmapData?

Jun 30, 2011

I am writing a script in which i want to do collision detection with Bitmap. Actually i took the script from book. I am using Loader class instead of Embed tag because i am using Flash IDE CS 5. If you see the code then everything is fine except one thing. That in hitTest() method i am using Loader instead of Bitmap. So it gives me error that parameter type should be Bitmap. Now my question is how can i convert Loader object to Bitmap so i can use it in my hitTest() method. Here is my code

[Code]...

View 3 Replies

ActionScript 3.0 :: Invert Mouse X And Y?

Jun 24, 2010

Im trying to make the cursor invert so when you go left on your mouse the mouse pointer goes right, basically the cursor goes the opposite way to your mouse. I have no idea where to start or even if its possible. I assume it be a case of hiding the original mouse pointer then using a MC of a pointer which has the inverted movement applied to it?? The inverted cursor also needs to be able to click a button that would put the cursor back to normal. Im using CS5 so either AS2 or 3

View 4 Replies

Flash :: Invert A Mask In It?

Feb 9, 2010

I've been looking for a simple way to invert a mask in flash. Its just amazing how it doesn't have this feature.

I just really need to paint shape and whatever is below (in layers) wont show up.

View 1 Replies

ActionScript 2.0 :: Possible To Invert A Mask?

Jan 16, 2009

well, i was wondering. there is the regular masking way, where we can draw an area and what that drawing catches behind will take the drawing form.but what i was trying to do is the inverse, so that the image from behind will appear, but the masked area will be empty

View 9 Replies

Actionscript 3 :: Avoid Create New BitmapData Object In Loop?

Nov 17, 2010

I want to store the bitmap data from _sampleTile in array, but I was wondering how to increase the performance. If I do it like this:

var _sampleTile:BitmapData;
var _arrayLenght:int = _tileClipArray.length;
for(var i:int = 0; i < _arrayLenght; ++i){

[code].....

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

ActionScript 3.0 :: Drawing Object In Rotated Container To BitmapData?

Feb 6, 2011

I have the following display hierarchy:- - container- - - objectI need to draw 'object' to a BitmapData instance which matches object.getBounds(stage) rectangle area. So the first part is easy:

ActionScript Code:
var rect:Rectangle = object.getBounds(stage);
var bmp:BitmapData = new BitmapData(rect.width, rect.height, true, 0x00000000);

[code]......

View 2 Replies

ActionScript 2.0 :: Load An External Image As A BitmapData Object?

Apr 8, 2007

I've been looking at one of senocular's rather brilliant source files, specifically the 'rising grid transition', which performs a transition effect by using the bitmapData class. Currently,it loads a variable called 'tempbmp' by using the bitmapData.loadBitmap function:

var tempbmp = flash.display.BitmapData.loadBitmap('hill');

where hill is a jpg in the library with a linkage ID of 'hill'. what i'd like to know is if this process could use an image that is not in the Flash library. Is there a way to load an external image as a bitmapData object?

View 1 Replies

Actionscript 3 :: Invert And Convert Slider Value

Jun 27, 2011

I currently have a vertical slider that is controlled by the user using startDrag. The puck is restricted in movement by a track movieclip that is 115px high.

[Code]....

View 2 Replies

ActionScript 2.0 :: Try To Invert Mouse Movement

Jul 10, 2009

i try to invert the mouse movement. when you move the mouse the the left it will go to the right and viceversa. the same for the Y axe.

View 9 Replies

ActionScript 3.0 :: Invert Columns And Rows?

Feb 12, 2010

i was wondering if it's possible to invert columns and rows - I need the rows to become columns a columns to become rows.

[Code]...

Problem is becouse number of rows (1,2,3) is changed dynamically. I was trying to create new arrayCollection and use different variations of addItem but non of them works and I'm stuck. Maybe some of you know how to do this?

View 0 Replies

ActionScript 2.0 :: Invert The Y-axis From The Cursor?

Mar 30, 2010

Is it possible to invert the Y-axis from the cursor? So moving up would move the cursor down?

View 4 Replies







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