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


Similar Posts:


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

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 :: 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 :: Erasing Drawing From Stage?

Jan 12, 2010

I tried to erase whatever was drawn on the stage by using a similar function in a recent previous post but I'm not getting it.when I try to use it an error says that this is no longer supported. I tried addChildAt() and inserted different Num but it only erased everything including my button.the current code is:
 
var drawing:Boolean = false; 
this.graphics.lineStyle(5,0x000000);this.graphics.moveTo(mouseX,mouseY);
this.addEventListener(Event.ENTER_FRAME, onLoop, false, 0, true);stage.addEventListener(MouseEvent.MOUSE_DOWN, onDown, false,0,true);stage.addEventListener(MouseEvent.MOUSE_UP, onUp, false,0,true);

[code]....

View 2 Replies

Flex - Erasing Components On Canvas?

Oct 6, 2010

The problem is when background of top or below label is changed, the top or below button is erased.

<mx:Canvas width="100%" height="100%">
<mx:LinkButton icon="{icon1}" width="25" x="10" y="10"/>
<mx:LinkButton icon="{icon2}" width="25" x="10" y="100" />
<s:VGroup width="100%" height="100%" id="lst" click="highlight(event.target as Label)" gap="0">
<s:Label />

[Code]...

So do anyone know the possible solution for this problem?

View 1 Replies

Actionscript 3 :: Erasing A Layer Where Mouse Is Over It?

Jul 18, 2011

I got the following question.

i added the following elements to the stage:

homeBg = new HomeBg();
homeMask = new HomeDrawBg();
addChild(homeBg);
addChild(homeMask);

I allready instantiated them in the beginning of the document. But my problem is the following. the homeBg layer is a image, the homeMask layer is the same image but it has a pencil scetch look. What i want is that wherever i move my mouse, the homemask layer should be erased so the bottom layer becomes visible(only where the mask is erased). So how can i tell the mask layer to erase itself if the mouse is over it?

View 2 Replies

IDE :: Erasing Text Effect Masks?

Feb 25, 2009

I'm attempting to create a dry erase board style animation effect in my flash movie where I'm erasing the text, like a dry erase board type effect. I've tried doing a frame by frame mask animation and it's not turning out very well. Has anyone attempted this before? Are there any tutorials or maybe after effects > flash tricks?

View 2 Replies

ActionScript 2.0 :: Blendmode - Erasing One MovieClip From Another

Nov 10, 2009

I am trying to erase one movieclip from another using the blendmode="erase" setting, but can only get it to work on the stage as the parent. This means it erases a hole through everything! The attachmovie also doesn't seem to work as I was expecting and I was hoping that when you drag the movieclip, the attached clip would move with it? If you check out the FLA [URL] you can see whats happening right now and what I want to achieve (diagrams provided in FLA).

View 1 Replies

Actionscript 3 :: Flash: Erasing Area Dynamically?

Mar 27, 2012

flash: Erasing area dynamically?

View 2 Replies

ActionScript 2.0 :: Erasing Lines Drawn With Root?

Aug 20, 2009

How can I erase lines I've drawn using
_root.lineStyle()
_root.moveTo()
And
_root.lineTo

View 1 Replies

ActionScript 3.0 :: Pixel Have Changed To Get The Percentage Of The Complete Erasing?

Feb 2, 2010

I'm working with Threshold on BitmapData class. I need the threshold return the modified pixel (the pixels match with the equation).I need to detect how many pixel have changed  to get the percentage of the complete erasing! I did it with getPixel32/setPixel32 but it's faster with threshold (i'm doing it on 15 bitmapdata at the same time)

pixelChanged += bmp.bitmapData.threshold(bmpBrush, bmpBrush.rect, new Point(this.stage.mouseX, this.stage.mouseY), ">", 0);
 
so, each pixel bigger than 0 should match this equation ... and they will be set to 0 after that (default color value). Next time, because they are 0, pixels are not suppose to change again because 0 is not bigger than 0 ! But it still return me a value, like if the pixel have changed! I've tried with different combinaison of mask/threshold .I join a sample of my problem (drag the triangle and check the output window ... the number increase even if the pixel is transparent 0x00000000)

View 1 Replies

ActionScript 3.0 :: Coloring (or Erasing) An Object And Checking When Complete

Jul 21, 2011

I've got to build a kids game at the moment for my school, and I was planning to have a sort of archaeological dig, with the kids required to rub the screen (it's for a touch-screen) to "un-earth" the bones underneath.I was thinking of either erasing an overlay and checking for a hitTest between the two objects, or coloring in with a line or something.Is it possible to color something in and check when the object has been completely colored? or possible to erase an overlying object? and if so, can you point me in the direction of a tutorial or a quick explanation?

View 2 Replies

ActionScript 2.0 :: DragOver - Drawing White Line By Erasing Dots

May 19, 2010

I have the raster of dots on white background. I would like it when I DragOver each dot it becomes white so it looks like you are actually drawing white line by erasing the dots. Ive somehow found the way how to do it by making it transparent when I rollover. But it doesnt work with dragover. How to do it only when I hold down the mouse button and drag my mouse over the dots?

This is the script assigned to MC with one black dot (I copied this MC with one dot into another MC and multiplied it to have the raster):
this.onRollOver = function () {
this._alpha = 0;
} this.onPress = function () {
this._alpha = 50;
}

I've tried also this, but it doesn't work:
var erasepoint = false;
this.onMouseDown = function(){erasepoint = true;}
this.onMouseUp = function(){erasepoint = false;}
this.onRollOver = function () {
if(erasepoint){
this._alpha = 0;
}}

View 6 Replies

ActionScript 2.0 :: Difference Between RemoveMovieClip() And UnloadMovie() For Use In Erasing Duplicated Movie Clips?

Sep 21, 2006

What (if any) is the actual differance between removeMovieClip() and unloadMovie() for use in erasing duplicated movie clips (using duplicateMovieClip() )? I was looking over some of my code and noticed I used both without much rhyme or reason as to why one over the other.

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

Actionscript 3 :: Update A Portion Of A Bitmap With A Pixelbender Instead Of The Whole Bitmap?

Feb 17, 2012

In pure AS3, I have a pixelbender and a large bitmap. The pixelbender is configurable with a distance parameter to affect only a small area of the bitmap. The problem is that the pixelbender is executing over the whole bitmap. What would be the best way to update only the effected region of the bitmap? Given this config:

[Code]...

View 1 Replies

ActionScript 2.0 :: Bitmap Font Text Drawn To Bitmap

Oct 8, 2006

Is there a way to write a bitmap font right into the bitmap being desplayed? Mabey better worded: myBitmap.draw(image, t) draws a picture is there a way to draw text? I'm stuck even if its just a work around in some way I would like to know... (the current work around i have in my head is writing it in a movieclip turning that into bitmap data and drawing it... esentially creating a prototype answering my question... but a built in way would be easier probably).

View 2 Replies

Actionscript 3 :: Bitmap Too Big - Limitation Is In Bitmap And Loader?

Mar 30, 2011

In AS3, I am loading a png from a zip file (nochump's zip library through ByteArray to Loader). The png can be up to 45k pixels wide but only 120 tall. This creates a problem in flash, as images can only be ~8000 pixels wide. A possible solution would be to split the images into 6 columns somehow. This would probably need to be done in the ByteArray state, because the limitation is in Bitmap and Loader.

View 2 Replies

ActionScript 3.0 :: Draw Bitmap Instead Of Export Bitmap?

Nov 5, 2009

I'm using Sandy to animate some objects in 3D. What I currently do to images which are EXPORTED in the library, I want to do to some bitmaps that I create using the DRAW technique. But it wont work :-(

CODE FOR 'CREATED BITMAP' :
ActionScript Code:
var bData:BitmapData = new BitmapData(myObject.width,myObject.height);
bData.draw(mask5);

[Code]....

Sandy doesn't seem to treat the 'created' bitmap the same as those that are exported from the library.

View 0 Replies

Map And Id Of The Their Parts?

Aug 31, 2010

my friend make me doing a map (in ActionScript). After the click on the some place in the map starts the redirect, e.g.

Code:

on (release) {
getURL("http://www.yahoo.com/"_blank);
}

I'm not a flash developer, but I would be to want add the every part of the map a identificator, e.g. id="part1"

PS: I have now the map, where every part have some ID. After the click on that ID I call jQuery event 'click' -- and this I need also in the new flash map.. Is it?

View 1 Replies

ActionScript 3.0 :: TextField Not "Erasing"?

Jun 5, 2009

I am using Actionscript 3 to dynamically add text the screen (stage) with the TextField command.  The problem is when I navigate to another screen (frame), all the text that was added stays on the screen.
 
how to make the text for only the frame that you want it to show up on?

View 9 Replies

Character With Connected Parts?

Aug 5, 2010

Is it possible to make something like the "Bone tool" does in older Flash CS3?I mean make all limbs for a character and connect them together in the joints, so if I drag the hand, the rest of the arm follows in a natural way. So I can easly make motion tween animations.

View 3 Replies

How To Handle Video Parts

May 5, 2011

I have a project where I need to have a video clip play as soon as the SWF starts, and once it's done, the video stops at the end and a prompt to continue appears to transition into another video.I just need to figure out how to handle the video parts of this project, and I need to do this without showing any playback controls on the screan.

View 1 Replies

ActionScript 2.0 :: Protect Parts Of FLA

Feb 6, 2009

I have created a flash file and the company I have created it for now wants the fla.so they can make changes to certain parts of the action script. There are some elements that I want to protect as it took me months to develop. Can anybody give me a solution of how I can send them the FLA but at the same time protect the most important parts of my code? I was thinking that I could maybe create an external .as file for the bits of code that they want to change and like my fla to those parts.

View 3 Replies







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