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
Similar Posts:
Sep 26, 2010
I did make a eraser tool. But once I begin to erase a layer, the background layer is visible. I want the layer just below the topmost layer to be visible.
For eg consider 2 layers. Layer2 is above Layer1. When I perform erase on Layer2, I see the stage background. I want to actually see Layer1 when I erase from Layer2.
Here is the code I used: The comment entry shows that, I have tried that possiblity.
import flash.display.BitmapData;
var linkageId:String = "myimage";
var myBitmapData:BitmapData = BitmapData.loadBitmap(linkageId);
[Code]...
View 3 Replies
Mar 13, 2010
Mac OS 10.4.11; Flash CS3.I cannot change the tool any more. It's stuck on the eraser. It doesn't erase anything, but I can't change it to another tool.I uninstalled Flash, preferences and all, and re-installed it, but the problem persists. Interesting is, my customized workspace is still there, even though I had all preferences and anything else that has the name "Flash" deleted.At the same time the computer opens both CD trays when booting up. Never did that before. So I re-installed the OS, but that didn't help either.
View 1 Replies
Jul 4, 2011
I have a requirement to create a drawing tool. I have completed till where on mouse down i can draw and on mouse up i stop the drawing. Now i want a eraser in place; something very similar to what is there in paint. So on mouse down of the eraser and moving over the line segment should erase the portion of the lines.
View 5 Replies
Nov 11, 2010
I simulate a pencil tool in my application, now i want simulate a eraser tool, but no success. how can i eraser that lines draw by pencil in as 3? i try removeChildAt(0); it work's but all draw is erased. [code]...
View 1 Replies
Dec 29, 2010
How can I implement an eraser in Flex so that when it erases on an mx:Image, it makes the area transparent?
View 4 Replies
Aug 26, 2009
Ive got this problem: the users of my webapplication can upload pictures and draw on them, but would it be possible to let the user erase parts of their uploaded picture (jpg or png) using the eraser tool?. like upload the picture and then convert it to a file that the user can manipulate?
View 2 Replies
Apr 16, 2007
I try to make a simple copy of a flv video in a new MovieClip using the BitmapData class.
Here is my code :
Code:
var video1:MovieClip = this.attachMovie("mcVideo","videoMC",1);
var objVideo = video1.v;
var _nc:NetConnection = new NetConnection();
[Code]......
View 6 Replies
Feb 15, 2010
In the previous version, the eraser tool only erase things on the single current active layer, but then in CS4 (maybe it's just my problem), the eraser tool simply erase everything on the stage, no matter which layer they are in, except in locked layer.
Is it a bug for cs4 or hv I set something wrong or what?
View 4 Replies
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
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
Apr 14, 2009
I am trying to make a flash file that has wmode=transparent that takes up 100% width and height of the browser. I need to take a copy of the contents underneath the flash (the HTML page its floated over) and use that BitmapData to manipulate the content visually.
View 2 Replies
Jan 31, 2007
I'm using Flash 8, with this code in the first frame:
import flash.display.BitmapData;
rissa._x=Stage.width/2;
rissa._y=Stage.height/2;[code].....
When I publish the file, I'm getting the following error message in the Output panel:
**Error** Scene=Scene 1, layer=Layer 2, frame=1:Line 7: The class or interface 'BitmapData.loadBitmap' could not be loaded.
var plaid:BitmapData.loadBitmap("plaid");
Total ActionScript Errors: 1 Reported Errors: 1
View 8 Replies
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
Sep 3, 2010
How can I copy or duplicate the bitmapdata from a mx:image component?
I need to display the same image in multiple screens of my application and don't want to have to download the image multiple times.
I could just use a urlrequest to download the image as a bitmap and copy that but I like the way you can can just set the source of the image component.
View 2 Replies
Apr 6, 2011
For the class spark.components.Image
I can access the bitmapData object (readonly) (unscaled). I know the scaling factors of the Image.
How can I get a scaled version of the bitmapData?
View 3 Replies
Aug 30, 2011
I'm trying to copy the bitmapdata of a movieclip in which i have a mask. And it copies by ignoring the mask. It's there a way to make it copy what i see (including the mask applied)?
View 7 Replies
Jul 21, 2011
I am doing a looping background with 2 identical BG movieClip (B1 and B2). Those 2 are "new" by the same class.
var B1:MovieClip = new BG();
var B2:MovieClip = new BG();
But because this BG class picture is loader from the internet and the picture is rather big. When I addressed its loading by using progressEvent. The picture is really loaded 2 times. Is there anyway I create B2 based on B1 without using new BG() again? Since it definitely makes a new BG with Loader code inside.
[Code]....
View 2 Replies
Jan 19, 2011
I have a movieclip with an image that has transparency and filters applied to the movieclip.I know I can use "draw" to copy the movieclip to a bitmapdata object, but it doesn't seem to copy the filters and the transparency of the image. How can I copy these so the bitmapdata matches the original movieclip in appearance?
View 5 Replies
Feb 17, 2012
Having trouble trying to scroll BitmapData on a half pixel here is my original code
var speed:Number = 1;
_bitmapData.copyPixels(_backgroundParallax, _screenRect, _zeroPoint, null, null, true);
_backgroundParallax.copyPixels(_backgroundParallax, new Rectangle(0, 0, speed, _backgroundParallax.height), new Point(_backgroundParallax.width-speed,0), null, null, false);
_backgroundParallax.scroll( (speed*-1) , 0);
which works until i change the var speed to .5, which is because .scroll method is expecting int's so i replicated what scroll is doing to try and allow .5 pixels
[Code]...
View 1 Replies
Dec 1, 2009
I'm making a copy of a Sprite via the BitmapData Draw method. It kind of works other than the top portion of the bitmap gets cut off (replaced with transparent pixels). It looks like it's about the same height as the Sprite's y value.
looks like this:
_________________________
| |
| TRANSPARENT PIXELS |
|_________________________|
| |
| IMAGE |
| |
| |
| |
| |
| |
| |
|_________________________|
View 5 Replies
Oct 7, 2011
A web channel streaming service streams to a certain IP range, it only checks the IP in example.com/cmd.php?id=xxx (channel number) and outputs an rtmpe stream URL, nothing else.How do I trick it to get my local URL instead of the one on their server? I have considered squid proxy, but is there some way to do it with a firefox plugin or greasemonkey script?
Edit:I will try to specify:It's a streaming service from an ISP and cable provider. They stream for free to people on their IP's. On their webtv page, which is called webtv.example.com, there is a flash player. If you are not on an IP from their ISP, you can't stream anything but the test channel.When you try to change channel via. javescript:videoplayer_changechannel(xxx) it makes this HTTP request:
[URL]
If you are on one of their IP's you will get an RTMP URL, like this:
[URL]
This is what the flash player requests, and if it get's this response it load the channel requested. There is no HTML on the php page, just the URL. Note that the rtmp URL is static.If you are not on one of their IP's it will return a random sentence (something stupid, the programmers having fun).I wan't to trick the flash player into getting the right value, even though it's not on one of the ISP's IP's.
View 1 Replies
Sep 5, 2003
does any1 know how to do a flash interactive eraser?it's something like the other flash paint programs,but unlike those programs i have found so far,they only have a button for erasing the whole screen...i need a flash program that uses an interactive eraser tool...
View 9 Replies
Oct 14, 2009
I am trying to use the reflect class from "http://pixelfumes.blogspot.com/2007/03/reflection-class-v3-with-source .html" but I keep getting this error:
ArgumentError: Error #2015: Invalid BitmapData.
at flash.display::BitmapData()
at Reflect()
at Site_fla::GalleryPage_29/loadThumbs()
at Site_fla::GalleryPage_29/sortXML()
[Code]...
btw, first I used assigned thumbContainer as the mc argument (outside the loadThumbs() function) and it worked but not exactly what I wanted... because I thought it is supposed to update when the movieclip is animated but it actually didn't... when I use a scroller, only the thumbs that are first loaded to the stage get the reflection..
View 10 Replies
Nov 15, 2011
I am having an issue with compiling a .swf. I get the following error on what seems to be related to the images. There is about 40 that are all very similar the the error code listed below:
5000: The class 'com.decalmywall.Emb_EMB_BORDER' must subclass 'flash.display.BitmapData' since it is linked to a library symbol of that type.
View 8 Replies
Sep 5, 2011
In my flash IDE library there's an imported jpg Image. Its class base is automatically BitmapData. How to get its data ? The following doesn't work:[code]But how to do without using away3d just for it!?
View 5 Replies
Mar 5, 2009
I've been experimenting with Senocular's Transformation Tool, and keep getting this warning at Line 1309 of the Transformation Tool Class version 0.9.11:
Warning: 3553: Function value used where type Boolean was expected. Possibly the parentheses () are missing after this function reference.
Line 1309: if (interactionMethod && _transformTool.currentControl == this) {
I just commented out the line and put:
if (_transformTool.currentControl == this) {
And the swf runs fine.
View 2 Replies
May 3, 2011
[ Embed('Assests/ui/Main.swf', symbol='backgroundImage')]
private var background01:Class;
private function getBitmapData(className:String):BitmapData[code]....
I want to return bitmapData from a symbol that is embedded in a flash swf file. background01 is the class name exported to as3 in the flash swf file. As you can see from above I'm finding the swf with no problem. and I'm pullin the data back from the swf file with no prob. I can type addChild(new background01) and the image will show up. But when I've tried to cast to a bitmap , bitmapasset and movieclip. It always returns null. I want to get access to the bitmapdata of this image/movieclip. It should be returning a vertex circle drawn in flash and created to be a movieclip symbol. So what I would expect to be returned would be a MovieClip.
View 1 Replies
Nov 4, 2008
I am working with the BitmapData class for the first time for a transition and I am running into a problem loading a new image from the array. I have modified a tutorial from flash-db by Jorge Solis. The function dissImg is firing but I can't work out how to load another image from the array into the container! Please see the code below:
Code:
import flash.display.*
import flash.geom.*
[code].....
View 5 Replies
Mar 6, 2012
I am using BitmapData to draw the objects in my game. But, I'm not sure I am using this in the best way.In each class I have a draw method where I call a renderer where copy the pixels of my object to the game canvas.For example, I have an Avatar class and its contains a BitmapData instance. There is a method where I draw my character into the bitmapdata of this class and I apply the filters or visual modification I need frame by frame. When I finish this process I copy the result to the main canvas. It is in a renderer class that contains another bitmapdata.I believe this is not the best way to render the objects of a game.
View 1 Replies