ActionScript 3.0 :: Editing Bitmaps Using BitmapData?
Oct 12, 2010
I has a series of bitmaps which have been broken apart in flash, I want to know if it is possible to go into these bitmaps using their bitmapdata and edit them based on information on the arrays that I get. I.E. I want to delete the transparent pixels each one has.
Obviously I can do this by hand in photoshop or just using the lasso tool, but I have several thousand bitmaps that I have to edit, so I'm hoping theres a way to do this through code.
View 8 Replies
Similar Posts:
May 25, 2010
i've used a Loader and URLRequest to download a .png from the internet and add it to my display list. since it's already a bitmap, does it have built in bitmap data already? or do i have to create the bitmap data myself?also, why does the same trace statement return false in the mouseMoveHandler when it outputs true in the displayImage function?
var imageLoader:Loader = new Loader();
imageLoader.load(new URLRequest("http://somewebsite.com/image.png"));
imageLoader.contentLoaderInfo.addEventListener
[code].....
View 1 Replies
Mar 5, 2009
I want to load .jpg images into flash and store them as BitmapData objects. I've coded the loading of images many many times but I've never tried to store them as BitmapData, I just usually add the Loader to the display list and manipulate the image through its loader.
I feel like this is a very poor approach and so I want to try just saving BitmapData, because on the Model side of things thats really all I need.
Now the only way I have found to extract BitmapData from a loaded JPEG is to load the JPEG and upon completion write:
myBitmapData = Bitmap(loader.content).bitmapData;
First, is there a way to extract the BitmapData without encumbering the code with the Bitmap class? In other words, is there a way to extract that information without involving the Bitmap class - BitmapData while useful for a Bitmap is not dependent on Bitmap so ideally I would never involve Bitmap here.
Also, why is this Bitmap type-casting so widely accepted? loader.content is a DisplayObject and therefore is not necessarily compatible with Bitmap. Further, for all Flash knows we just loaded an SWF and as far as I know you can't typecast that to a Bitmap.
View 1 Replies
Nov 2, 2009
I am trying to copy multiple movieclips to one movieclip using BitmapData.
I am trying to clear out the old bitmapdata from the movieclip that I am adding my bitmapdata to. The two movieclips I am copying are different sizes and shapes so I can't just overlap them.
View 4 Replies
Jan 18, 2010
I've been working on a simple mosaic generator for a project and have been crashing Flash consistently by trying to add too many bitmaps to a Sprite. I can crash Flash every time with the following:
for(var i:int = 0; i < 10000; i++){
var d:BitmapData = new BitmapData(20,20);
addChild(new Bitmap(d));
}
I get a 2015 error - invalid BitmapData.9000 works without issue... 10000 crashes. Problem is I need 10000.Is this a known limitation? I could try using multiple sprites and adding say 5000 to each, but that wouldn't be easy with this project. But if I have to I have to...
View 6 Replies
Jul 31, 2009
I'm trying to figure out the best way to compare a single bitmap against perhaps an array of saved bitmaps to see how close of a match it may be to any one of the bitmaps stored in the array. Right now I'm running a for loop that uses the bitmapData.compare() method to try to compare to see how much of a variance there is but... to be honest I'm at a loss as to how to use the resulting data to do so. Does anyone know of any good method to accomplish what I am trying to do? Forget looking at my code it's a waste of time because simply, it's not working.
View 4 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
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
Dec 29, 2011
I've been using BitmapData.copyPixels() to draw graphics onto a canvas (Bitmap).I need to rotate the resulting graphics without the use of draw() because it's vastly slower.How can I rotate the target graphic? I'm assuming that there might be a formula or library that I can use which will first reorganize the pixels that make up a graphic based on an origin (point) and radians.I'm pretty certain that I'm not capable of creating such logic, so if there are any known libraries that do this, that would be awesome.I'd like to achieve something similar to XNA's SpriteBatch.Draw() method, which accepts rotation as its 5th argument.
View 3 Replies
Sep 1, 2011
how to use the bitmapData collision method. Now I'm trying to figure out if there is a way to see at what angle or coordinate of the bitmapData the collision happens? I need it in order to figure the accurate bounce angle after the collision occurs.
View 2 Replies
Jul 15, 2009
I'm currently working on a flash game and I need to know how to addChild a BitmapData or draw a BitmapData to screen. If I can't than how can I give a DisplayObject my BitmapData?
View 2 Replies
Dec 22, 2011
I've made a mobile version of my software, with low-res images and such, and I can now fully buffer all my content (including a 360 frame animation which is buffered to memory). Problem is, that everytime I update the view, more memory is used.When I write image = new BitmapData();, does it store the previously created BitmapData's in memory? Do I have to flush the memory somehow before I draw my second picture in BitmapData?Example:
ActionScript Code:
// In this example I draw using the same bitmapData several times, also
//overwriting the first image. Do I have to somehow delete the data first, to
[code].....
View 1 Replies
Jan 9, 2012
I am having an issue with using BitmapData.draw(stage). I am getting the following error:
SecurityError: Error #2123: Security sandbox violation: BitmapData.draw: file:///C|/Documents%20and%20Settings/bla...bla...bla.swf cannot access null. No policy files granted access. Here is a portion of my code:
var bd:BitmapData = new BitmapData(2800, 2100); bd.draw(stage);//this is where the error happens All of the files referenced (.xml/.jpg/.swf) are located in the same local folder as the main .swf. How do I get around this error? The main objective is to print the stage using PrintJob(). I am using Flash Professional CS5.5 and publishing to Flash 10.0/10.1. Let me know if I need to supply any more info.
View 4 Replies
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
Jan 15, 2009
I have a movie clip that I add Bitmaps by using addChild(). I was wonding how would I go about displaying the next image that I added because as of now it is stuck on the first image.
View 3 Replies
May 6, 2010
I was wondering which method would be the most efficient (run faster)...Lets say I have multiple layering of animations, say a moving sky, then birds, then fireworks ordered respectively. Is better to have one bitmapdata (called BD) then do a copypixel of sky, then bird, then firework at every tick (I'm using a timer) and put it in one bitmap.
Or is it better to have 3 bitmaps (and put into 3 different sprites) with the animations separated, so when I update the birds I don't have to update the sky.share any knowledge on pros or cons of using multiple bitmaps vs using one bitmap in that situation. Aside for the increase of initial memory used.
View 5 Replies
Nov 18, 2009
I'm loading some external images and trying to get them to smooth, but for some reason it's not happening. i've been trying everything i can find on the internet over the past 10 hours or so, and nothing's worked.The code on my movieclip (first frame) is:
[code]...
my images are very high-res, so i know it isn't a resolution issue. anyway, they look crappy when they're sized down too. also, i'm pretty sure smoothing is the issue, because i have a very similar image in the library (a detail from the same shot, and similar resolution, etc.), and it looks great when i allow smoothing in the bitmap properties panel.
View 3 Replies
Dec 16, 2010
I want to know if there is a faster way to take several bitmaps and arrange them one after another in a single layer in a movie clip.
This is how I am doing it currently.
Stage 1: Import the bitmaps to the stage
Stage 2: Distribute the bitmaps to layers
Stage 3: Make the first bitmap a movie clip symbol and cut the other bitmaps' frames
Stage 4: Go into the symbol, create a new layer, and paste the frames.
Stage 5: Click and drag the other frames into one layer, one after the other.
I now have a single movie clip with all my bitmaps ordered one after the other in the timeline.
View 2 Replies
Oct 28, 2011
I have a Bitmap where I can draw on. After some seconds I want to let the drawing fade away and blend over to the original picture/bitmap. Can I do this with the blend mode by drawing the original bitmap on it? I tried something like this and of course it isn't right. Just copying the alpha channel if I get the documentation right.
dstBitmapData.draw(srcBitmap,null,null,BlendMode.ALPHA,null)
dstBitmap = new Bitmap(dstBitmapData);
I want to put some percentage to the destination bitmap. So that after doing this some frames the original picture will be visible. As the user can interrupt this by start drawing again I want to use the BitmapData object dstBitmapData.
View 1 Replies
Oct 20, 2009
I wish to add some 3D bitmaps to my 2D game. Everything is currently drawn via copypixels into the only movieclip and that is rendered. Am I correct in that I need to create (for example) a sprite, add a bitmap to it, perform all my 3d transformations and then simply .draw the result into my bitmap? If so are there any simple examples of doing so, also what about camera, focal length, perspective etc. etc. Are they taken into account before the .draw?
View 0 Replies
Mar 17, 2012
I'm working on better performance on mobile device with gpu rendering set to on. I use only bitmaps for animations, but I have some doubts:
1. If my content is poor bitmap (jpg or png file) should I cache its container as bitmap?
2. Shoud I use cacheAsBitmapMatrix for my bitmaps to have smoother animations or poor bitmaps are already optimized?
View 0 Replies
Feb 27, 2009
I have a jpeg that I have exported to actionscript via the library. The jpeg class is "adcouncil". If I want to add it to the stage I would use the following code:
Code:
var adcouncil = new adcouncil1(150,150);
var myImage:Bitmap = new Bitmap(adcouncil)
printMC.addChild(myImage);
The problem is that I want to ad these Bitmaps to the stage dynamically. My first instinct is:
Code:
var adcouncil = new this["adcouncil1"](150,150);
var myImage:Bitmap = new Bitmap(adcouncil)
printMC.addChild(myImage);
[Code].....
View 2 Replies
Apr 18, 2009
Trying to add EventListeners to Bitmaps.Can I add an EventListener directly to a bitmap?If I load an image to a UILoader then addEventListener to the UILoader instance that works just fine, but if I use a Bitmap instead, nada...I could load the Bitmap into a Sprite and add the EventListener to that, but would prefer the direct method...
View 4 Replies
Feb 25, 2011
Sometimes I have a problem publishing to an xfl file. The bitmaps in the library do not save with the xfl save to the LIBRARY folder. I've tried resaving as another .fla before re-exporting as an xfl. but I do not seem to find the proper way to overcome this?
View 1 Replies
Jul 22, 2009
I'm having an issue where after 24 bitmaps are placed inside a sprite, the first bitmaps start to disappear. When the last added Bitmaps get removed from the display list, the older ones start to reappear. Go here and check it out: http:[url].... draw 24 dots or whatever with the pencil tool (the only one that draws to a bitmap). You should notice that the 24th dot will cause the 1st one to disappear. Undoing (which simple removes the top bitmap/sprite) causes the 24th one to be removed (which is correct) but the 1st one also reappears which means its still there just not visible .Here are the relevant methods:
Code:
private function nextShape() : void {
newShape = new Sprite();
newShape.mouseEnabled = false;[code].....
View 11 Replies
Jan 20, 2012
I'm confused by a tip in Adobe's own documentation that says:Avoid using gradients, because they require many colors and calculations to be processed, which is more difficult for a computer processor to render.I understand how this would be true in a vector shape fill, but they aren't specifying vector. It seems to be implied they include bitmaps too, since the next couple tips are bitmap related.If they do in fact include bitmaps in this tip, can someone explain to me how this is possibly true? In a bitmap a pixel is a pixel. I don't see how it matter that the pixels form a gradiated color or not, the software still has to read and write each pixel regardless.
View 1 Replies
Nov 13, 2007
I'm looking for a good method to resize bitmap images to fit within the constraints of a container object whose size will change based on the browser window dimensions, etc. Basically, it needs to scale to fit. I'm using the following for resizing by height. "largeImage is a bitmap object.
[Code]....
View 2 Replies
Apr 24, 2009
I would like to have a SWC file with many bitmaps stored in it, which can the be called and loaded dynamically when they are needed.The SWC has been made, with the Bitmaps set to export.In my main class I am running into trouble trying to access these classes.Different sources are offering different advice, could someone advise the best way to gain access to these classes within the SWC, and the best way to access the SWC from within my file.URL]they offer a solution which involves having to statically name the classes at runtime (these arent exported bitmapdata classes but same idea)this second link is a person describing a solution to the problem described in the first link. His solution involves what appear to be either flex or command line compiler directives
View 2 Replies
Jun 25, 2009
I'm working on a flash website that consists of 3 frames (1 = preloader, 2 = instances of symbols, 3 = the main page/view). I've gone through and optimized all my static bitmaps/movieClips and removed any symbol that I've exported for ActionScript from exporting in the first frame. Even after all these steps frame one is still the longest to load (797kb on a 32.6 kbps simulated download), only showing the preloader when the whole file is at 86% complete. Any further steps to take to get frame one's size down?
View 3 Replies
Sep 22, 2009
I've imported 29 bitmaps into my library (gifs, each one 1728x1152, size ranges from 4-14kb, in each case the vast majority of the image is transparent). I add each one to the stage in the following manner:
var img1Data = new img1(1728,1152);
var img1Map = new Bitmap(img1Data);
containerMC.addChild(img1Map); // MovieClip to which all of the bitmaps are added
[code]......
View 12 Replies