ActionScript 3.0 :: Loading Bitmaps Into BitmapData?

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


Similar Posts:


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

Actionscript 3 :: BitmapData Built-in To Bitmaps?

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

ActionScript 3.0 :: Clear Out Bitmapdata On Different Sized Bitmaps?

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

ActionScript 3.0 :: Crashing Flash Consistently By Trying To Add Too Many Bitmaps To A Sprite - Get A 2015 Error - Invalid BitmapData?

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

ActionScript 2.0 :: Saving And Loading Bitmaps?

Jun 5, 2007

Ok I wrote an application where I have panels that the user can draw on, kind of like paint, but they can create panels. Now I want them to be able to save and load their work. Using Quasimondo's bitmap exporter, I was able to save a bitmap (200x200), and the application prompts the user where they were to save the image file. However, my problem is that the user will probably have 6-12 panels to save, and so I want the program to save all those panels so they can be loaded later.

Now in order to load, I don't want the user to manually select each panel to load. I want the user to select one file and it will load all the images into the panels. I was thinking about maybe loading a zip file and flash would extract the images and load them, but I don't know if that's possible. I think the user would need to select an XML file,which would direct Flash to what files to load and in what order. For this, and I'm assuming when it saves the flash application/php, it would need to write a new xml file.So I guess what I need to know how to do is:- How do I get flash to save several images to the server or the users hard drive- flash to generate an xml file- is there any way to make flash combine all the files into one file so that the user doesn't have to deal with several files?

View 3 Replies

ActionScript 3.0 :: Loading Bitmaps From The Library?

Feb 11, 2009

I've been learning AS3 for a while now, and it's my first Actionscript language, but not my first coding language. I've learned a lot so far, but I started off doing things in the not so efficient, or correct ways. I was putting all of my actionscript on frames. I'm trying to get in the habit of doing it the right way now. But I'm having a basic problem. I can't figure out how to load a bitmap from the library in AS3.

View 6 Replies

ActionScript 3.0 :: Loading Bitmaps On Runtime?

Feb 18, 2009

To do this does it mean that I have to store them in another external location rather than my library and only load them when I need to use them from a URL request?

View 2 Replies

ActionScript 3.0 :: Comparing And Matching Bitmaps Against An Array Of Saved Bitmaps

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

Bitmaps - Loading Graphics From Game Into SWF File

Dec 17, 2009

I have 2 questions regarding bitmaps. Say I'm loaing graphics from a game off a server into a .swf file:
1) Which format is the best to use - gif, jpeg,png? (for non transparent images)
2) When a user plays a .swf movie it gets saved to their browser cache and its loaded the next time they access the same file, but when your externally loading images does flash have to re-download all the images or is it all stored in the browser cache?

View 2 Replies

ActionScript 3.0 :: Loading Bitmaps And Storing In Array?

Mar 19, 2010

I'm trying to setup a program that loads a set number of pictures (the exact number is stored in resources/data.txt). Pictures are labled picture# starting at 0 and increasing.

My problem is that I want to store the loaded pictures, which is giving me trouble. When I try to trace the bitArray length, it says it is zero..

My Code:

//Variable Initilizing
//Loaders:
var mLoader:URLLoader;[code]....

View 8 Replies

ActionScript 3.0 :: Loader Event/loading External Bitmaps

Nov 30, 2009

I have my .fla file and .swf file in a folder on my desktop

i want to add to that file a bitmap. everytime my flash project receives a the String "loadBITMAP" i want it to reload that bitmap into a designated area on the stage. (i am using a system of binary sockets to recieve data, but don't worry about that...i know how to process that already.) so basically my code will say

Code:
if(socket.readUTFBytes="loadBitmap"){
need code here on how to load bitmap
}

View 21 Replies

ActionScript 2.0 :: Loading Bitmaps With Custom ARGB Data?

Mar 31, 2010

BTW, this should be in actionscript 3.

What's the fastest way to dump your data (not in a file) into a bitmap for display?

I had it working with setPixels and colored rects but that's way too slow.

Is there a way to load in the raw bytes or hijack the loader class to put in custom loader data?

View 0 Replies

ActionScript 3.0 :: Bitmaps Loading An Image And Tracing The Result After The Loader Completes

Dec 12, 2009

I'm trying to clone / duplicate an object loaded in at runtime via the

--
ldr = new Loader();
var mRequest:URLRequest = new URLRequest(targetFile);
--

technique. The problem I think I'm having, is in understanding what exactly the loader returns and how it can be used. after loading an image and tracing the result after the loader completes like this ...

trace(ldr.content); // - traces [object Bitmap]

I have a fuction I built that returns an arrar of clones / duplicates of a passed bitmap ...

[Code]...

View 2 Replies

ActionScript 3.0 :: Loading BitmapData Into An Array Or Vector?

Dec 10, 2009

I've been working on this for a while, and thought I understood the BitmapData class at least well enough to do basic stuff with it, but I'm doing something wrong.

I'm trying to make a preload function that will load external JPEGs, store them in an Array as BitmapData objects, then distribute them to thumbnail objects after all the images are loaded. The thumbnails are based on an external class I wrote, which already has a function to accept variable data.

My problem is, I can't seem to find a way to store BitmapData objects in an Array. I've even tried using a Vector.<BitmapData> object, but I get the same result, which is no data stored.

Here's the function, isolated from the rest of the script.

[Code]....

The result of this function is supposed to be, a series of images loaded one after the other, stacked 5 pixels down from each other. However, the actual result is, only the last loaded image is displayed. That's true for any number I place in the 'for' loop, only the last loaded image gets displayed.

Obviously I'm doing something wrong with the loading of the 'bitBucket' BitmapData, because it seems to be writing over the previous BitmapData in the Vector series.

View 0 Replies

ActionScript 2.0 :: Loading Image Into MovieClip Then Into BitmapData (Renamed)

Nov 6, 2006

I am trying to load an image into a movieclip and then draw the contents of the movieclip to a bitmapData object.

Below is some sample code.
target.jpg_mc.loadMovie(url);
target.createEmptyMovieClip("loader_mc", 100);
target.loader_mc.bmc = target.jpg_mc; // movieclip where to load original image
target.loader_mc.tmc = target.bmp_mc; // movieclip with smoothed image
target.loader_mc.onEnterFrame = function(){
[Code] .....

For some reason it always draws a white box rather than the image. Has anyone ever seen this happen with the bitmapData class?

View 4 Replies

Actionscript 3.0 :: Loading XML Imgs To BitmapData And Adding To Dynamic Thumbs

Dec 21, 2009

I'm trying to do something a little crazy from what it seems here, I have a carousel that I am modifying to have thumbnail images added to dynamically from an XML file. Now me being the practical persona I am I did NOT want to make little images for each picture in the gallery so I used a neat little class from a blog called soulwire

[URL]

the class lets me use the bitmap properties of flash to fit a copy of my image into the thumbnail are for my carousel Icons, later I will use the same info to click and show the large image for each of these icons.

My problem is that I can get it to work but only the last generated MovieClip gets an image, and it's not even the correct one. it gets image #2 in clip #5.

It seems as though my Event.COMPLETE for my loader is not firing for each image, if it is I'm not sure why I'm just getting the image in 1 icon.

here is my Code:

Code: Select all// Import the required classes
import uk.soulwire.utils.display.Alignment;
import uk.soulwire.utils.display.DisplayUtils;

[Code].....

View 1 Replies

Actionscript 3 - Loading Giant Images Into Flash - Exceeding The BitmapData Limitations?

Nov 29, 2011

I am trying to let the user import giant images into a flash application. Unfortunately the BitmapData object's dimensions cannot exceed "8,191 pixels in width or height, and the total number of pixels cannot exceed 16,777,215 pixels" (see Reference)

Obviously with FlashPlayer11 these limitations vanish - BUT: As I only get bytes from the FileReference, I need to convert these via Loader.loadBytes(), to get access to the image data. This doesn't seem to work for images exceeding the old BitmapData limitations.

[Code]...

View 1 Replies

ActionScript 2.0 :: Flash 8 BitmapData - Getting Error : The Class Or Interface 'BitmapData.loadBitmap' Could Not Be Loaded?

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

ActionScript 3.0 :: Error #2015: Invalid BitmapData At Flash.display::BitmapData()

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

Actionscript 3 :: Quickly Rotate The Pixels That Make Up BitmapData Without Using BitmapData.draw()?

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

ActionScript 3.0 :: BitmapData.hitTest - What Angle Or Coordinate Of The BitmapData The Collision Happens?

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

Flex :: AddChild A BitmapData Or Draw A BitmapData To Screen?

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

ActionScript 3.0 :: BitmapData = New BitmapData(); Eating Up Memory?

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

ActionScript 2.0 :: BitmapData Copying - "cache Images In" Upon Loading SWF

Aug 3, 2009

I'm attempting to "cache images in" upon loading my SWF, and I am not sure what the standard is for this. Basically I have (let's say) 5 buttons and 5 accompanying images. When the SWF is loading on a server, I want all 5 of my images to be loaded into memory, but not copied. Then when I click on one of the buttons it would bring up the corresponding image for that button id. Couple of things to point out: I don't don't if I need multiple clip loaders or one multiple BitmapData instances or one I *do* know that I need multiple movieclips, FWIW. Here's my start:

[Code]...

View 3 Replies

ActionScript 3.0 :: Using BitmapData.draw(stage) - Error #2123 Security Sandbox Violation: BitmapData.draw

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

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

IDE :: Add Bitmaps By Using AddChild()

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

ActionScript 3.0 :: Using Multiple Bitmaps?

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

ActionScript 3.0 :: Bitmaps Won't Smooth?

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







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