ActionScript 3.0 :: Erasing A Circle From Bitmap Data?

Sep 29, 2009

I'm trying to create sort of an eraser to remove sections of a bitmap on stage.

I have achieved this by creating a MovieClip in flash that is a circle and exporting it as a Class called Hole.

Now I use this MovieClip to erase a circle section of the image using the following.

var mat = new Matrix();
var ct = new ColorTransform();
var hole = new Hole();
mat.translate(x,y);
image.draw(hole, mat, ct, "erase");

Now what im trying to do is scale the size of the circle depending on a certain variable but no matter what I try the scale doesn't seem to change and. The size seems to stay the same as I drew it in Flash. I tried adding the following line

hole.width = hole.height = size;

I even created a class file called Hole and the size as a parameter

var hole = new Hole(200);

This didn't work either it still appeared to have the same size. I have even tried altering the scaleX and Y values with no success.

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Erasing Parts Of A Bitmap?

Mar 20, 2009

I'm in need, again, of some assistance. I'm making a game with 2 pictures. and the concept is built on that you erase part of the top-bitmap to see the bitmap under.How can I accomplish this?I tried to wrap my head around the bitmaps and the draw and the FillRect but can't get it to work completely.Basically I want 2 bitmaps, and a cursor which erases parts of the top one to show the one underneath.

View 5 Replies

ActionScript 3.0 :: Slow Performance With Bitmap Erasing?

Nov 26, 2008

for the past couple of weeks I've been learning AS3, and for a school project I'm doing a remake of the popular DOS game Liero. Everything is working fine, I got a layer of dirt that I am shooting away, but the problem is that after a few hundred bullets, the game starts to lag heavily whenever a shot is fired.I'm using a simple bitmap and a brush to erase the parts where the bullets hit.

// Drawing stage
bmap = new BitmapData(1100,800, true, 0);
dispBmp = new Bitmap(bmap);

[code]...

View 1 Replies

Flash :: Erasing A Specific Selected Portion Of A Bitmap?

Apr 20, 2011

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.

What I need is to excatly erase the pixels.Now I have created a brush tool using the conventional technique and clearing is possible but what I need is to exactly erase the pixels. Is there some technique to draw this ? This is the code that I am using: I have also uploaded the swf and source code, When trying out, please draw all over the stage using the pencil (press Pencil button and start drawing)The source fla is also provided.

View 4 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 :: Find Out Different Circle's Center Point Of A Bitmap?

Dec 6, 2009

How to find out different circle's center point of a bitmap?

just like photo above, how can i locate the 2 center points of circles?

i only know using .getColorBoundsRect to get a point, but this only apply to one circle, in fact i wanna get different points according to the bitmap.

View 1 Replies

Flex :: Override Data Tip Circle?

Jan 31, 2012

In flex charting you can customize the box which displays datatip information, but is there any easy way of changing the little circle which is displayed next to the datatip box?

http:[url].....

I've found the method positionDataTips() in ChartBase which appears to do the drawing of the circle. I was going to subclass LineChart and override the method with my modified version of it. However, this method needs access to a lot of private instance variables which are only accessible to ChartBase.

View 1 Replies

Actionscript 3 :: Clever Data Structure To Represent Layered Circle?

Feb 9, 2010

I'm making a game and I need to represent a "layered" circle in some clever datastructure.A circle can have any number of layers. Each layer has a number of "slices", they can be of different lengths and pieces can be missing. The innermost layer is always a full circle.Each segment has a color, multiple segments with the same color can be next to each other. Realistically a circle wont have more than about 40 layers or about 1500 individual slices.I will need to be able to easily find adjacent pieces to a specific piece, see if a piece is "hanging in free air" (imagine gravity towards the center), and to remove pieces leaving a hole in their place.

View 7 Replies

ActionScript 2.0 :: Calculate The Direction And Speed A Circle Has After Colliding With A Static (non-moving) Circle?

Mar 8, 2005

I'm developing a game atm, and I need some help on the mathematics/coding of colliding circles (and their change in x/y speed). What i need to know is how to calculate the direction and speed a circle has after colliding with a static (non-moving) circle. I know how to detect a collision between the two, but I'm not sure about the maths I need to give the circle the right speed and direction after the collision

If i do know how far away the two circle-points (in the middle of each) are to each other (in both x and y coords) would it be easy for me to find the new speed and direction of the large circle in the example above? I know that I somehow should use the angles to pretend the circle hits a flat "wall" (as it only hits one point), and then calculate the new speed/direction. My only problem is that I'm not sure how to decide the angle of this flat "wall" and how x and y speeds should change when colliding with a wall that is angled. Does anyone here have any insight, links or tips on how I can du this?

View 6 Replies

ActionScript 2.0 :: Make One Circle Follow The Mouse Cursor Inside Another Circle

Sep 30, 2005

i want to make one circle follow the mouse cursor, inside another circle. Similar to an eye looking at the cursor. Ive attached an example.

View 4 Replies

ActionScript 2.0 :: If Statement / Variable - Say If Circle Shows Up Change It To Circle (french)

Nov 5, 2008

I have text in a dynamic field showing up as circle. I want to say if circle shows up change it to cercle (french).

[Code]...

View 1 Replies

ActionScript 2.0 :: Calculate Direction And Speed Circle Has After Colliding With A Static Circle?

Mar 8, 2005

What i need to know is how to calculate the direction and speed a circle has after colliding with a static (non-moving) circle. I know how to detect a collision between the two, but I'm not sure about the maths I need to give the circle the right speed and direction after the collision.If i do know how far away the two circle-points (in the middle of each) are to each other (in both x and y coords) would it be easy for me to find the new speed and direction of the large circle in the example above? I know that I somehow should use the angles to pretend the circle hits a flat "wall" (as it only hits one point), and then calculate the new speed/direction. My only problem is that I'm not sure how to decide the angle of this flat "wall" and how x and y speeds should change when colliding with a wall that is angled.

View 6 Replies

ActionScript 3.0 :: Graphics - Paint (change Color) Inside Of Circle When A User Draw A Circle

Aug 24, 2009

I`m working on a app that you can draw lines.....like circles, rectangles... my problem is when a user draw a circle for example....i wanna be able to paint (change color) inside of this circle. I`ve tried working on Shapes with cacheAsBitmap = true and Bitmaps with BitmapData but it doesn`t seens to work.

View 4 Replies

Actionscript 3 :: Change Shape Of Circle By Dragging Point On Circle

Mar 16, 2012

I want to create circle, and put 8 points on it. So, user can drag each point in order to change it's shape.

Is there any way to do this in flash?

I have some following code:

Ref. - How to draw a continuous curved line from 3 given points at a time

package{import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.geom.Point;

[Code].....

So, can anyone convert these three point curve line to 8 points circle?

View 1 Replies

ActionScript 2.0 :: Drawing A Circle - Circle Diameter Has To Be Controlled By A Button

Oct 6, 2009

I have to draw a circle using action script. The Circle Diameter has to be controlled by a button.

View 0 Replies

ActionScript 3.0 :: Circle Circle Frame Independant Collision Reaction?

Apr 10, 2010

Trying to do circle circle collisions via math which I'm really having trouble with. One circle (player) just moves from keyboard. The ball reacts to the player. All the code shown is in my players class and I passed in a reference to the ball.

On my enterframe I have:

Code:
var xmov1 = xSpeed;
var ymov1 = ySpeed;
var xmov2 = ballRef.xSpeed;
var ymov2 = ballRef.ySpeed;

[code]....

Perhaps I'll go with a box2d equivalent instead of trying out my own physics shenanigans.

View 2 Replies

ActionScript 1/2 :: Bitmap Data Can't Draw MC With FLV

Aug 1, 2010

I've created a prototype that will copy the pixel data from a movie clip then create a JPG image from it via PHP. It works perfectly. But when the MovieClip (called mcImage) contains a Video Object loaded with a streamed FLV, it won't copy the pixel data to the Bitmap object. The image generated is white. Here's a sample code:
 
var oBitmap:BitmapData = new BitmapData(nW, nH, true);
var oMatrix = new Matrix();
var oColorTrans:ColorTransform = new ColorTransform();

[Code].....

View 4 Replies

Professional :: Displaying A Bitmap Data?

Oct 24, 2011

i did a function the captures the stage and save it to bitmap datai want to display that bitmap data on a different frame what code should i do (the bitmap changes becuse the capture function triggerd alot);

View 3 Replies

Php :: Send Bitmap Data From Flex

Aug 5, 2010

I want to save a screenshot from my Flex app on the Webserver (LAMP). Here is the Flex code:

[Code]...

View 1 Replies

ActionScript 3.0 :: Any Way To Crop Bitmap Data?

Mar 1, 2009

Is there any easy way to crop my BitmapData without converting it to Bitmap (I only want the first 300x200 pixels).

View 9 Replies

IDE :: Putting Bitmap Data To The Stage?

Dec 16, 2009

I have made a little drawing program for my daughter, and I have worked in the ability to save and load images that you have made. It's a simple line drawing thing, but she's 3, and it works.Whatand I'm still new with Flash and AS3) is that I can "addChild" to put the jpeg on the stage, but it's on (or over top of) the drawing area. That means that when I start to draw, I don't really add to the picture, instead, it's drawing behind it. I used the line drawing tutorial as the basis for this little app, the basic code is :

Code:
public function DrawMain(){
graphics.lineStyle(theLine,0x000000); //default to black lines

[code]....

View 2 Replies

ActionScript 2.0 :: Start Drawing First Circle And When First Circle Is On Half Way?

Sep 19, 2004

Here I what i need is : Start drawing first circle and when first circle is on half way, Start second circle.same way second and third circles. and after completing 3 circles, just gotoAndPlay 2nd Frame .

View 3 Replies

Actionscript 3 :: Erasing A Movieclip?

Oct 14, 2010

I have a fully working flash application, made in as3. Now i dynamicly added a movieclip and i would like to be able to erase that movieclip with a eraser of some sort, my goal is to be able pick up a sponge with the mouse and then start dragging over the movieclip and erasing the parts where i dragged over it.

View 2 Replies

ActionScript 3.0 :: Capturing Bitmap Data In FullScreen

Jun 19, 2009

I am trying to do an image capture while in full screen, however the full image area is only partially captured, or the coordinates are off. In the source files you will see a few of my attempts commented off.

View 6 Replies

ActionScript 3.0 :: Remove A Bitmap Data From A CanvasBitmap?

Jan 25, 2010

I am adding a bunch of bitmap data (images) inside a canvas bitmap (using copyPixel) which is added to the stage (addChild(cavasBitmap)) how can I remove a bitmap data from a canvasBitmap?

View 5 Replies

ActionScript 2.0 :: Webcam - Bitmap Data Capture Every 5 Min

Sep 24, 2010

I have to take a snapshots form my webcam every 5 minutes. Now my script is whit a button and its working but my file have to take the picture alone and then again whitout button to send them? I saw something on the net but when I try to do it its not working.

View 1 Replies

Actionscript 3 :: Flex - Get The Bitmap Data From A Component

Jan 18, 2010

Is it possible to get the bitmap data from a component using ActionScript? I dynamically load an image. onComplete I create a Flex Image component and add the loaded image to the source

[Code]...

Later I want to create a new Image component and get the bitmapData from the first Image. I have tried this canvas.getChildAt(0) Which seems to give me the Image, but I can not figure out how to get the bitmap data. canvas.getChildAt(0).bitmapData; gives me a compile error "... undefined property" how ot get the bitmap data so I can use it in my new Image component?

View 3 Replies

As3 :: Upload Bitmap Data To Server Using HttpRequest?

Feb 23, 2010

I captured screenshot of my ui element, and would like to send it to server, using httpService.

Currently I am doing the following:

var httpService:HTTPService = new HTTPService();
httpService.method = "POST";
httpService.url = "/admin/compositions/add/";

[Code].....

View 1 Replies

Flash :: Bitmap Data As Movie Clip?

Apr 13, 2010

I import my images with

imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
imageLoader.load(imageRequest);
and then try and cast as a movieclip:

[code]....

View 2 Replies

Actionscript 3 :: Extract Bitmap Data From An Flv Stream?

Jan 17, 2011

extract bitmap data from an flv stream?

View 2 Replies







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