Re: [flexcoders] Bitmap width/height 0 when loading image from hard drive
Thanks Alex for the follow-up. Your questions prompted me to dig into the memory load more and it looks like we had some bad memory issues. Specifically, when the user selects a bunch of photos, we load those images in using file.load() and then generate small thumbnails from the loaded data. The problem was we were keeping around the file references while the files were also being uploaded. The full file data (stored in the data property on FileReference) was no longer needed in the app after the thumbnail was generated but we were hanging onto it anyway. By calling file.data.clear() after generating each thumbnail we were able to free up that memory...which was a LOT of memory. So, the short story is there DOES seem to be some funky business in Loader when Flash Player is under a lot of memory stress. On the flip side we've reduced the memory stress sufficiently to hopefully not run into the issue in the first place. To answer your questions anyway: The process memory was up around 1 GB before we starting running into trouble (with proper memory cleanup this is dramatically lower). This is on a 4 GB memory Windows Vista machine and I had quite a few other applications open (Flex Builder, Illustrator, etc.) I had loaded in 450 images with each being roughly 1.5 MB each as compressed JPGs and we were creating thumbnails at about 150x100 pixels each (~60k in BitmapData each or ~27MB for 450 thumbnails). Reports from other people show they were getting problems with less than 200 images but we haven't dug into the details of the size of their images, etc. In our test, all 450 thumbnails were still around which took up around 27 MB. And, because of improper memory cleanup, 450 full bitmaps loaded from the hard drive were still in memory also. Thanks for the help. Hopefully that will clear up our problems. Aaron On Mon, Feb 22, 2010 at 11:15 PM, Alex Harui aha...@adobe.com wrote: How much process memory is the browser using when you run into trouble? How many images have you loaded? How many of those images are still around? On 2/22/10 4:48 PM, Aaron Hardy aaronius...@gmail.com wrote: And yet another update. Sorry for the large number of emails. It looks like the more and more I use the application and add stress to the Flash Player the smaller the image must be in order to avoid the 0 dimensions issue. In other words, if the Flash Player doesn't have much stress I can load an image that's 24 million pixels just fine. As I add more stress and then attempt to load the same image, I'll start to get 0 width and height, but I'll be able to load a 14 million pixel image (4350x3263=14.1 million pixels) just fine. If I continue adding stress to the Flash Player and I continue to load the same 14 million pixel image I'll start to get 0 width and height for that image, even if it's under the bitmap limits. At that point I can load a 12 million pixel image fine. If I continue to use the app and add stress, I'll soon not be not even be able to load the same 12 million pixel image. This imaginary limit seems to get smaller and smaller over time and has very little, if anything, to do with Flash's max bitmap dimensions. Aaron On Mon, Feb 22, 2010 at 5:12 PM, Aaron Hardy aaronius...@gmail.com wrote: I've gathered additional information. It appears that it's due to bitmaps that are over the supported size (16,777,215 pixels). While the bitmaps load in fine when the Flash Player isn't under much stress, the width/height choke when there is stress. Again, it isn't consistent, but that seems to be the issue. I read somewhere that when loading a bitmap in using Loader that the maximum dimensions didn't apply, but that appears to not be the case and from Adobe I've only heard that all bets are off with bitmaps over 16,777,215 pixels. I'll update the thread if it turns out to be something different. Aaron On Mon, Feb 22, 2010 at 4:28 PM, Aaron Hardy aaronius...@gmail.com wrote: It's not any particular photo or set of photos. Sometimes we can run the app and load the photos just fine then the next day we'll attempt to load the same files and the width/height will return 0. It seems that once the issue starts to occur that any time we try to upload any photo within that session it continues reporting width/height of 0. There's not a very reproducible pattern though it seems to occur more frequently when the Flash Player is under heavy stress like when it's trying to load in many files at the same time. It also seems to happen more frequently if we have two tabs open with the same application loaded in both and we're attempting to load the same images in both tabs (this may be related to the stress the Flash Player is under rather than some sort of file locking issue). Again, it doesn't always happen, just more frequently under those scenarios. We've created a queue so only one photo is loading in at a time and we even threw in the
Re: [flexcoders] Bitmap width/height 0 when loading image from hard drive
IMHO, the player and the hosting browser get really unpredictable once you get past 500MB or so. Hopefully you’ll be able to stay below that and your app will be stable. On 2/23/10 9:08 AM, Aaron Hardy aaronius...@gmail.com wrote: Thanks Alex for the follow-up. Your questions prompted me to dig into the memory load more and it looks like we had some bad memory issues. Specifically, when the user selects a bunch of photos, we load those images in using file.load() and then generate small thumbnails from the loaded data. The problem was we were keeping around the file references while the files were also being uploaded. The full file data (stored in the data property on FileReference) was no longer needed in the app after the thumbnail was generated but we were hanging onto it anyway. By calling file.data.clear() after generating each thumbnail we were able to free up that memory...which was a LOT of memory. So, the short story is there DOES seem to be some funky business in Loader when Flash Player is under a lot of memory stress. On the flip side we've reduced the memory stress sufficiently to hopefully not run into the issue in the first place. To answer your questions anyway: The process memory was up around 1 GB before we starting running into trouble (with proper memory cleanup this is dramatically lower). This is on a 4 GB memory Windows Vista machine and I had quite a few other applications open (Flex Builder, Illustrator, etc.) I had loaded in 450 images with each being roughly 1.5 MB each as compressed JPGs and we were creating thumbnails at about 150x100 pixels each (~60k in BitmapData each or ~27MB for 450 thumbnails). Reports from other people show they were getting problems with less than 200 images but we haven't dug into the details of the size of their images, etc. In our test, all 450 thumbnails were still around which took up around 27 MB. And, because of improper memory cleanup, 450 full bitmaps loaded from the hard drive were still in memory also. Thanks for the help. Hopefully that will clear up our problems. Aaron On Mon, Feb 22, 2010 at 11:15 PM, Alex Harui aha...@adobe.com wrote: How much process memory is the browser using when you run into trouble? How many images have you loaded? How many of those images are still around? On 2/22/10 4:48 PM, Aaron Hardy aaronius...@gmail.com http://aaronius...@gmail.com wrote: And yet another update. Sorry for the large number of emails. It looks like the more and more I use the application and add stress to the Flash Player the smaller the image must be in order to avoid the 0 dimensions issue. In other words, if the Flash Player doesn't have much stress I can load an image that's 24 million pixels just fine. As I add more stress and then attempt to load the same image, I'll start to get 0 width and height, but I'll be able to load a 14 million pixel image (4350x3263=14.1 million pixels) just fine. If I continue adding stress to the Flash Player and I continue to load the same 14 million pixel image I'll start to get 0 width and height for that image, even if it's under the bitmap limits. At that point I can load a 12 million pixel image fine. If I continue to use the app and add stress, I'll soon not be not even be able to load the same 12 million pixel image. This imaginary limit seems to get smaller and smaller over time and has very little, if anything, to do with Flash's max bitmap dimensions. Aaron On Mon, Feb 22, 2010 at 5:12 PM, Aaron Hardy aaronius...@gmail.com http://aaronius...@gmail.com wrote: I've gathered additional information. It appears that it's due to bitmaps that are over the supported size (16,777,215 pixels). While the bitmaps load in fine when the Flash Player isn't under much stress, the width/height choke when there is stress. Again, it isn't consistent, but that seems to be the issue. I read somewhere that when loading a bitmap in using Loader that the maximum dimensions didn't apply, but that appears to not be the case and from Adobe I've only heard that all bets are off with bitmaps over 16,777,215 pixels. I'll update the thread if it turns out to be something different. Aaron On Mon, Feb 22, 2010 at 4:28 PM, Aaron Hardy aaronius...@gmail.com http://aaronius...@gmail.com wrote: It's not any particular photo or set of photos. Sometimes we can run the app and load the photos just fine then the next day we'll attempt to load the same files and the width/height will return 0. It seems that once the issue starts to occur that any time we try to upload any photo within that session it continues reporting width/height of 0. There's not a very reproducible pattern though it seems to occur more frequently when the Flash Player is under heavy stress like when it's trying to load in many files at the same time. It also seems to happen more frequently if we have two tabs open with the same application loaded in
[flexcoders] Bitmap width/height 0 when loading image from hard drive
Flexers, We have an app that allows a user to upload images. When the user selects an image, we load the bitmap from the hard drive and create a thumbnail from it. However, every once in a while the bitmap will return 0 for both width and height which causes issues later on. That vast majority of the time the width/height are returned correctly. Here's the basic code of the image loading--it's nothing special: override public function execute():void { file.addEventListener(Event.COMPLETE, fileLoadedHandler); file.addEventListener(IOErrorEvent.IO_ERROR, fileLoadErrorHandler); file.load(); } /** * The files bytes were loaded successfully. */ protected function fileLoadedHandler(event:Event):void { file.removeEventListener(Event.COMPLETE, fileLoadedHandler); file.removeEventListener(IOErrorEvent.IO_ERROR, fileLoadErrorHandler); var ba:ByteArray = file.data; loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, bitmapLoadedHandler); loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, bitmapLoadFailedHandler); loader.loadBytes(ba); } /** * The bitmap was successfully loaded from the file's bytes. */ protected function bitmapLoadedHandler(event:Event):void { loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, bitmapLoadedHandler); loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, bitmapLoadFailedHandler); try { var fullSizeBitmap:Bitmap = Bitmap(loader.content); if (fullSizeBitmap.width == 0 || fullSizeBitmap.height == 0) { // There's a problem. } ... Any idea why this would be the case? Is it a Flash Player bug? Any help is much appreciated. Aaron
Re: [flexcoders] Bitmap width/height 0 when loading image from hard drive
Is there a particular file that gives you trouble or wil it load successfully at some other point? On 2/22/10 10:06 AM, Aaron Hardy aaronius...@gmail.com wrote: Flexers, We have an app that allows a user to upload images. When the user selects an image, we load the bitmap from the hard drive and create a thumbnail from it. However, every once in a while the bitmap will return 0 for both width and height which causes issues later on. That vast majority of the time the width/height are returned correctly. Here's the basic code of the image loading--it's nothing special: override public function execute():void { file.addEventListener(Event.COMPLETE, fileLoadedHandler); file.addEventListener(IOErrorEvent.IO_ERROR, fileLoadErrorHandler); file.load(); } /** * The files bytes were loaded successfully. */ protected function fileLoadedHandler(event:Event):void { file.removeEventListener(Event.COMPLETE, fileLoadedHandler); file.removeEventListener(IOErrorEvent.IO_ERROR, fileLoadErrorHandler); var ba:ByteArray = file.data; loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, bitmapLoadedHandler); loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, bitmapLoadFailedHandler); loader.loadBytes(ba); } /** * The bitmap was successfully loaded from the file's bytes. */ protected function bitmapLoadedHandler(event:Event):void { loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, bitmapLoadedHandler); loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, bitmapLoadFailedHandler); try { var fullSizeBitmap:Bitmap = Bitmap(loader.content); if (fullSizeBitmap.width == 0 || fullSizeBitmap.height == 0) { // There's a problem. } ... Any idea why this would be the case? Is it a Flash Player bug? Any help is much appreciated. Aaron -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
Re: [flexcoders] Bitmap width/height 0 when loading image from hard drive
It's not any particular photo or set of photos. Sometimes we can run the app and load the photos just fine then the next day we'll attempt to load the same files and the width/height will return 0. It seems that once the issue starts to occur that any time we try to upload any photo within that session it continues reporting width/height of 0. There's not a very reproducible pattern though it seems to occur more frequently when the Flash Player is under heavy stress like when it's trying to load in many files at the same time. It also seems to happen more frequently if we have two tabs open with the same application loaded in both and we're attempting to load the same images in both tabs (this may be related to the stress the Flash Player is under rather than some sort of file locking issue). Again, it doesn't always happen, just more frequently under those scenarios. We've created a queue so only one photo is loading in at a time and we even threw in the Grant Skinner hack of forcing garbage collection between each load to see if that would help. That did actually decrease the frequency of the issue quite a bit but not sufficiently. Since posting we've tweaked the code slightly to use the width/height properties on the bitmapdata instead of the bitmap itself. I doubt it will make any difference but at least it narrows it down a bit. Aaron On Mon, Feb 22, 2010 at 1:05 PM, Alex Harui aha...@adobe.com wrote: Is there a particular file that gives you trouble or wil it load successfully at some other point? On 2/22/10 10:06 AM, Aaron Hardy aaronius...@gmail.com wrote: Flexers, We have an app that allows a user to upload images. When the user selects an image, we load the bitmap from the hard drive and create a thumbnail from it. However, every once in a while the bitmap will return 0 for both width and height which causes issues later on. That vast majority of the time the width/height are returned correctly. Here's the basic code of the image loading--it's nothing special: override public function execute():void { file.addEventListener(Event.COMPLETE, fileLoadedHandler); file.addEventListener(IOErrorEvent.IO_ERROR, fileLoadErrorHandler); file.load(); } /** * The files bytes were loaded successfully. */ protected function fileLoadedHandler(event:Event):void { file.removeEventListener(Event.COMPLETE, fileLoadedHandler); file.removeEventListener(IOErrorEvent.IO_ERROR, fileLoadErrorHandler); var ba:ByteArray = file.data; loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, bitmapLoadedHandler); loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, bitmapLoadFailedHandler); loader.loadBytes(ba); } /** * The bitmap was successfully loaded from the file's bytes. */ protected function bitmapLoadedHandler(event:Event):void { loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, bitmapLoadedHandler); loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, bitmapLoadFailedHandler); try { var fullSizeBitmap:Bitmap = Bitmap(loader.content); if (fullSizeBitmap.width == 0 || fullSizeBitmap.height == 0) { // There's a problem. } ... Any idea why this would be the case? Is it a Flash Player bug? Any help is much appreciated. Aaron -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
Re: [flexcoders] Bitmap width/height 0 when loading image from hard drive
I've gathered additional information. It appears that it's due to bitmaps that are over the supported size (16,777,215 pixels). While the bitmaps load in fine when the Flash Player isn't under much stress, the width/height choke when there is stress. Again, it isn't consistent, but that seems to be the issue. I read somewhere that when loading a bitmap in using Loader that the maximum dimensions didn't apply, but that appears to not be the case and from Adobe I've only heard that all bets are off with bitmaps over 16,777,215 pixels. I'll update the thread if it turns out to be something different. Aaron On Mon, Feb 22, 2010 at 4:28 PM, Aaron Hardy aaronius...@gmail.com wrote: It's not any particular photo or set of photos. Sometimes we can run the app and load the photos just fine then the next day we'll attempt to load the same files and the width/height will return 0. It seems that once the issue starts to occur that any time we try to upload any photo within that session it continues reporting width/height of 0. There's not a very reproducible pattern though it seems to occur more frequently when the Flash Player is under heavy stress like when it's trying to load in many files at the same time. It also seems to happen more frequently if we have two tabs open with the same application loaded in both and we're attempting to load the same images in both tabs (this may be related to the stress the Flash Player is under rather than some sort of file locking issue). Again, it doesn't always happen, just more frequently under those scenarios. We've created a queue so only one photo is loading in at a time and we even threw in the Grant Skinner hack of forcing garbage collection between each load to see if that would help. That did actually decrease the frequency of the issue quite a bit but not sufficiently. Since posting we've tweaked the code slightly to use the width/height properties on the bitmapdata instead of the bitmap itself. I doubt it will make any difference but at least it narrows it down a bit. Aaron On Mon, Feb 22, 2010 at 1:05 PM, Alex Harui aha...@adobe.com wrote: Is there a particular file that gives you trouble or wil it load successfully at some other point? On 2/22/10 10:06 AM, Aaron Hardy aaronius...@gmail.com wrote: Flexers, We have an app that allows a user to upload images. When the user selects an image, we load the bitmap from the hard drive and create a thumbnail from it. However, every once in a while the bitmap will return 0 for both width and height which causes issues later on. That vast majority of the time the width/height are returned correctly. Here's the basic code of the image loading--it's nothing special: override public function execute():void { file.addEventListener(Event.COMPLETE, fileLoadedHandler); file.addEventListener(IOErrorEvent.IO_ERROR, fileLoadErrorHandler); file.load(); } /** * The files bytes were loaded successfully. */ protected function fileLoadedHandler(event:Event):void { file.removeEventListener(Event.COMPLETE, fileLoadedHandler); file.removeEventListener(IOErrorEvent.IO_ERROR, fileLoadErrorHandler); var ba:ByteArray = file.data; loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, bitmapLoadedHandler); loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, bitmapLoadFailedHandler); loader.loadBytes(ba); } /** * The bitmap was successfully loaded from the file's bytes. */ protected function bitmapLoadedHandler(event:Event):void { loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, bitmapLoadedHandler); loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, bitmapLoadFailedHandler); try { var fullSizeBitmap:Bitmap = Bitmap(loader.content); if (fullSizeBitmap.width == 0 || fullSizeBitmap.height == 0) { // There's a problem. } ... Any idea why this would be the case? Is it a Flash Player bug? Any help is much appreciated. Aaron -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
Re: [flexcoders] Bitmap width/height 0 when loading image from hard drive
And yet another update. Sorry for the large number of emails. It looks like the more and more I use the application and add stress to the Flash Player the smaller the image must be in order to avoid the 0 dimensions issue. In other words, if the Flash Player doesn't have much stress I can load an image that's 24 million pixels just fine. As I add more stress and then attempt to load the same image, I'll start to get 0 width and height, but I'll be able to load a 14 million pixel image (4350x3263=14.1 million pixels) just fine. If I continue adding stress to the Flash Player and I continue to load the same 14 million pixel image I'll start to get 0 width and height for that image, even if it's under the bitmap limits. At that point I can load a 12 million pixel image fine. If I continue to use the app and add stress, I'll soon not be not even be able to load the same 12 million pixel image. This imaginary limit seems to get smaller and smaller over time and has very little, if anything, to do with Flash's max bitmap dimensions. Aaron On Mon, Feb 22, 2010 at 5:12 PM, Aaron Hardy aaronius...@gmail.com wrote: I've gathered additional information. It appears that it's due to bitmaps that are over the supported size (16,777,215 pixels). While the bitmaps load in fine when the Flash Player isn't under much stress, the width/height choke when there is stress. Again, it isn't consistent, but that seems to be the issue. I read somewhere that when loading a bitmap in using Loader that the maximum dimensions didn't apply, but that appears to not be the case and from Adobe I've only heard that all bets are off with bitmaps over 16,777,215 pixels. I'll update the thread if it turns out to be something different. Aaron On Mon, Feb 22, 2010 at 4:28 PM, Aaron Hardy aaronius...@gmail.comwrote: It's not any particular photo or set of photos. Sometimes we can run the app and load the photos just fine then the next day we'll attempt to load the same files and the width/height will return 0. It seems that once the issue starts to occur that any time we try to upload any photo within that session it continues reporting width/height of 0. There's not a very reproducible pattern though it seems to occur more frequently when the Flash Player is under heavy stress like when it's trying to load in many files at the same time. It also seems to happen more frequently if we have two tabs open with the same application loaded in both and we're attempting to load the same images in both tabs (this may be related to the stress the Flash Player is under rather than some sort of file locking issue). Again, it doesn't always happen, just more frequently under those scenarios. We've created a queue so only one photo is loading in at a time and we even threw in the Grant Skinner hack of forcing garbage collection between each load to see if that would help. That did actually decrease the frequency of the issue quite a bit but not sufficiently. Since posting we've tweaked the code slightly to use the width/height properties on the bitmapdata instead of the bitmap itself. I doubt it will make any difference but at least it narrows it down a bit. Aaron On Mon, Feb 22, 2010 at 1:05 PM, Alex Harui aha...@adobe.com wrote: Is there a particular file that gives you trouble or wil it load successfully at some other point? On 2/22/10 10:06 AM, Aaron Hardy aaronius...@gmail.com wrote: Flexers, We have an app that allows a user to upload images. When the user selects an image, we load the bitmap from the hard drive and create a thumbnail from it. However, every once in a while the bitmap will return 0 for both width and height which causes issues later on. That vast majority of the time the width/height are returned correctly. Here's the basic code of the image loading--it's nothing special: override public function execute():void { file.addEventListener(Event.COMPLETE, fileLoadedHandler); file.addEventListener(IOErrorEvent.IO_ERROR, fileLoadErrorHandler); file.load(); } /** * The files bytes were loaded successfully. */ protected function fileLoadedHandler(event:Event):void { file.removeEventListener(Event.COMPLETE, fileLoadedHandler); file.removeEventListener(IOErrorEvent.IO_ERROR, fileLoadErrorHandler); var ba:ByteArray = file.data; loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, bitmapLoadedHandler); loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, bitmapLoadFailedHandler); loader.loadBytes(ba); } /** * The bitmap was successfully loaded from the file's bytes. */ protected function bitmapLoadedHandler(event:Event):void
Re: [flexcoders] Bitmap width/height 0 when loading image from hard drive
How much process memory is the browser using when you run into trouble? How many images have you loaded? How many of those images are still around? On 2/22/10 4:48 PM, Aaron Hardy aaronius...@gmail.com wrote: And yet another update. Sorry for the large number of emails. It looks like the more and more I use the application and add stress to the Flash Player the smaller the image must be in order to avoid the 0 dimensions issue. In other words, if the Flash Player doesn't have much stress I can load an image that's 24 million pixels just fine. As I add more stress and then attempt to load the same image, I'll start to get 0 width and height, but I'll be able to load a 14 million pixel image (4350x3263=14.1 million pixels) just fine. If I continue adding stress to the Flash Player and I continue to load the same 14 million pixel image I'll start to get 0 width and height for that image, even if it's under the bitmap limits. At that point I can load a 12 million pixel image fine. If I continue to use the app and add stress, I'll soon not be not even be able to load the same 12 million pixel image. This imaginary limit seems to get smaller and smaller over time and has very little, if anything, to do with Flash's max bitmap dimensions. Aaron On Mon, Feb 22, 2010 at 5:12 PM, Aaron Hardy aaronius...@gmail.com wrote: I've gathered additional information. It appears that it's due to bitmaps that are over the supported size (16,777,215 pixels). While the bitmaps load in fine when the Flash Player isn't under much stress, the width/height choke when there is stress. Again, it isn't consistent, but that seems to be the issue. I read somewhere that when loading a bitmap in using Loader that the maximum dimensions didn't apply, but that appears to not be the case and from Adobe I've only heard that all bets are off with bitmaps over 16,777,215 pixels. I'll update the thread if it turns out to be something different. Aaron On Mon, Feb 22, 2010 at 4:28 PM, Aaron Hardy aaronius...@gmail.com wrote: It's not any particular photo or set of photos. Sometimes we can run the app and load the photos just fine then the next day we'll attempt to load the same files and the width/height will return 0. It seems that once the issue starts to occur that any time we try to upload any photo within that session it continues reporting width/height of 0. There's not a very reproducible pattern though it seems to occur more frequently when the Flash Player is under heavy stress like when it's trying to load in many files at the same time. It also seems to happen more frequently if we have two tabs open with the same application loaded in both and we're attempting to load the same images in both tabs (this may be related to the stress the Flash Player is under rather than some sort of file locking issue). Again, it doesn't always happen, just more frequently under those scenarios. We've created a queue so only one photo is loading in at a time and we even threw in the Grant Skinner hack of forcing garbage collection between each load to see if that would help. That did actually decrease the frequency of the issue quite a bit but not sufficiently. Since posting we've tweaked the code slightly to use the width/height properties on the bitmapdata instead of the bitmap itself. I doubt it will make any difference but at least it narrows it down a bit. Aaron On Mon, Feb 22, 2010 at 1:05 PM, Alex Harui aha...@adobe.com wrote: Is there a particular file that gives you trouble or wil it load successfully at some other point? On 2/22/10 10:06 AM, Aaron Hardy aaronius...@gmail.com http://aaronius...@gmail.com wrote: Flexers, We have an app that allows a user to upload images. When the user selects an image, we load the bitmap from the hard drive and create a thumbnail from it. However, every once in a while the bitmap will return 0 for both width and height which causes issues later on. That vast majority of the time the width/height are returned correctly. Here's the basic code of the image loading--it's nothing special: override public function execute():void { file.addEventListener(Event.COMPLETE, fileLoadedHandler); file.addEventListener(IOErrorEvent.IO_ERROR, fileLoadErrorHandler); file.load(); } /** * The files bytes were loaded successfully. */ protected function fileLoadedHandler(event:Event):void { file.removeEventListener(Event.COMPLETE, fileLoadedHandler); file.removeEventListener(IOErrorEvent.IO_ERROR, fileLoadErrorHandler); var ba:ByteArray = file.data; loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, bitmapLoadedHandler); loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,
[flexcoders] Bitmap with Scale9 in custom border
Hi, I'm trying to implement a custom border (based on Border) with a bitmap at its bottom. Only the middle part of the bitmap must be stretched (kinda Scale3). As Border is based on a FlexShape, I can't add an Image as child -- and I can't get the solution in RectangularBorder.initBackgroundImage to work, either (i.e. add the child to the parent). The current state is as follows: protected function drawBorder(w:Number, h:Number):void { var g:Graphics = graphics; var border:Bitmap = new borderImage(); // setup scale9 here border.width = w; g.beginBitmapFill(border.bitmapData); g.drawRect(0, h - 19, w, 19); g.endFill(); } ...but doesn't work, as the bitmapData is not affected by setting a scaling value for the Bitmap, I assume. What would be a neat solution here? Kind regards, -- Steffen Beyer sbe...@reactor.de GnuPG key fingerprint: CA00 1611 242B 89D4 E643 E235 05F3 7689 DD3E EB26 Public key available upon request or at http://wwwkeys.de.pgp.net
[flexcoders] Bitmap downsampling
Hi, I'm having a lot of trouble with down-sampling a bitmapData. I tried the smoothing option first public function produceResizedBitmapData(image:DisplayObject, transform:Matrix):BitmapData { var temp:BitmapData = new BitmapData(image.width, image.height, true, 0x00FF); temp.draw(image); var clone:BitmapData = new BitmapData(image.width*transform.a, image.height*transform.d, true, 0x00FF); clone.draw(temp, transform, null, null, null, true); temp.dispose(); return clone; } except the quality was poor, once the image was of a certain size. For example scaling a 2500px image down to 200px. I've tried using clevrLib plus a pixelBender bilinear sampler but no go. I've noticed it works in picnik so it must be possible. Can anyone push me in the right direction.
RE: [flexcoders] Bitmap downsampling
Bjorn, Does the current method you're using appear to have any anti-aliasing at all? In the past, resizing with Image using img.resize((height, width), Image.ANTIALIAS) (where img is mx.controls.Image) has worked - I'm sure there'd be a similar method for BitmapData. Of course, if you're not specifying antialiasing and the method call doesn't assume it by default, then yeah, you're going to get horrible image quality on downsize as a typical algorithm will pick nearest-neighbor to the new target pixel. --Tim From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Bjorn Schultheiss Sent: Thursday, 2 July 2009 2:34 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Bitmap downsampling Hi, I'm having a lot of trouble with down-sampling a bitmapData. I tried the smoothing option first public function produceResizedBitmapData(image:DisplayObject, transform:Matrix):BitmapData { var temp:BitmapData = new BitmapData(image.width, image.height, true, 0x00FF); temp.draw(image); var clone:BitmapData = new BitmapData(image.width*transform.a, image.height*transform.d, true, 0x00FF); clone.draw(temp, transform, null, null, null, true); temp.dispose(); return clone; } except the quality was poor, once the image was of a certain size. For example scaling a 2500px image down to 200px. I've tried using clevrLib plus a pixelBender bilinear sampler but no go. I've noticed it works in picnik so it must be possible. Can anyone push me in the right direction.
[flexcoders] Bitmap Data of a non Rectangular Shape Component
Hi all, I am here with a issue related to the BitmapData.I want to get the bitmapdata of a component which is not the rectangular shape.When creates the object of the BitmapData Class then I have to pass the width and height of the component which's bitmapdata I want to get.But it is giving me the error 'Invalid Bitmap Data'.As per as my thinking it is due to the uncertaintity in the width and height of that component.So can anybody suggest me how to get the bitmap data of a component which is not the Rectangular shape. with Thanks.. Shardul Singh Bartwal Connect with friends all over the world. Get Yahoo! India Messenger at http://in.messenger.yahoo.com/?wm=n/
[flexcoders] Bitmap Data - setting the quality
Hi All, This is more of an AS3 question. I am not sure if this is the correct forum to ask. I have a SWF which is loaded into the display list and I need to take a snapshot of it using BitmapData.draw() method. I am doing it, but as the SWF is of high quality and have got lot of objects in it, its taking extra time, which is not affordable for me. Can we take a snapshot of the SWF with very low quality or low resoltion? I just need a low quality representation of the SWF, so the quality can be very low. Regards, Jen-
[flexcoders] bitmap bitmapdata 500+ objects
I was wondering if there is a better way to create several hundred objects with reflections using bitmaps and bitmapdata objects. I have several hundred objects that can be 1 of 50 different kinds, which all have reflections. I was wondering what the best way is to create all 500 items that won't consume the users CPU? Right now I have 2gb of ram and one heck of a processor and its eating up 55% of my CPU when all 500 objects are finally created. Each object has its own bitmap of course and its own bitmapdata because each one can be, as I said, 1 of 50 different types of objects. And each of these objects is drawn on the screen with the flash drawing api. I know each item you add to the display list which is drawn slows your CPU down even more so what is a better way of going about this? Draw all 50 objects in Flash and then use them as sprites or MC's or some other solution? Anyone done anything like this before? Thanks in advance.
[flexcoders] bitmap fonts
I tried to get bitmap fonts with external swfs working on my application but no go. would someone send me an swf with a bitmap font in it and some code/css that uses it? This would really help me out with my school project. -e
[flexcoders] bitmap hitTest method
Hi, my question is about basically pixel level collision. lets say I have two Image display objects and I get it's bitmap Data respectively for the first one and the 2nd one. Below is the code -- var shipBmpData:BitmapData = new BitmapData(shipBox.width,shipBox.height,false,0); shipBmpData.draw(shipBox); var hitImageBmpData:BitmapData = new BitmapData(shipBoxHit.width,shipBoxHit.height,false,0); hitImageBmpData.draw(shipBoxHit); if (hitImageBmpData.hitTest(new Point(shipBoxHit.x,shipBoxHit.y),255,shipBmpData,new Point(shipBox.x,shipBox.y),255)) { Alert.show(quot;final hitquot;); } -- I cannot understand why I can't exact pixel level detection. Basically one of them is moving towards the other and when it is over it, it should detect collision. Can anyone give the correct way? I want to get a collision at pixel level. Thanks in advance!
Re: [flexcoders] bitmap hitTest method
On Wednesday 20 Feb 2008, n3moncic wrote: one of them is moving towards the other and when it is over it, it should detect collision. You don't need hitTest() here, do you, because you know where they both are and their size... ? -- Tom Chiverton Helping to paradigmatically lead industry-wide developments on: http://thefalken.livejournal.com This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by The Solicitors Regulation Authority. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 2500. For more information about Halliwells LLP visit www.halliwells.com. -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
RE: [flexcoders] Bitmap: Please, please help.
no, not quite. Think of my need to be something like Photoshop layers. I can create a layer, then another, and be able to see the first layer behind the second. _ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Sherif Abdou Sent: Wednesday, January 30, 2008 1:06 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Bitmap: Please, please help. do u mean sort of like this but you want to be able to drag and drop? http://www.tileui.com/ http://www.tileui.com/ just warp the mouse around all of them, is that kinda it?. - Original Message From: Noyes, Jeff [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Wednesday, January 30, 2008 11:44:43 AM Subject: [flexcoders] Bitmap: Please, please help. I want to be able to drag and drop multiple images onto one object - and have the images layer one on top of the other (see one through the other). Can that be done? _ From: [EMAIL PROTECTED] ups.com http://ups.com/ [mailto:flexcoders@ yahoogroups. com] On Behalf Of Kyle Neath Sent: Wednesday, January 30, 2008 11:53 AM To: [EMAIL PROTECTED] ups.com http://ups.com/ Subject: Re: [flexcoders] got any good air styling references? The best method I've found is to just remove all native controls (by uncommenting a directive in the air xml file, and adding showChrome= false to your WindowedApplication ). From there, it's pretty trivial to mimic native functions. Here's the ones used for beta 3 (they changed it, so googling around gets confusing): this.nativeWindow. minimize( ); // minimizes the window this.nativeWindow. close(); // closes the window this.nativeWindow. startResize( ); // call this within a MouseDown event on your resizing handle this.nativeWindow. startMove( ); // call this within a MouseDown event on your moving handle (title bar) All assuming this is the current window. - Kyle _ Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://us.rd.yahoo.com/evt=51734/*http://tools.search.yahoo.com/newsear ch/category.php?category=shopping
[flexcoders] Bitmap: Please, please help.
I want to be able to drag and drop multiple images onto one object - and have the images layer one on top of the other (see one through the other). Can that be done? _ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Kyle Neath Sent: Wednesday, January 30, 2008 11:53 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] got any good air styling references? The best method I've found is to just remove all native controls (by uncommenting a directive in the air xml file, and adding showChrome=false to your WindowedApplication). From there, it's pretty trivial to mimic native functions. Here's the ones used for beta 3 (they changed it, so googling around gets confusing): this.nativeWindow.minimize(); // minimizes the window this.nativeWindow.close(); // closes the window this.nativeWindow.startResize(); // call this within a MouseDown event on your resizing handle this.nativeWindow.startMove(); // call this within a MouseDown event on your moving handle (title bar) All assuming this is the current window. - Kyle
Re: [flexcoders] Bitmap: Please, please help.
do u mean sort of like this but you want to be able to drag and drop? http://www.tileui.com/ just warp the mouse around all of them, is that kinda it?. - Original Message From: Noyes, Jeff [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Wednesday, January 30, 2008 11:44:43 AM Subject: [flexcoders] Bitmap: Please, please help. I want to be able to drag and drop multiple images onto one object - and have the images layer one on top of the other (see one through the other). Can that be done? From: [EMAIL PROTECTED] ups.com [mailto:flexcoders@ yahoogroups. com] On Behalf Of Kyle Neath Sent: Wednesday, January 30, 2008 11:53 AM To: [EMAIL PROTECTED] ups.com Subject: Re: [flexcoders] got any good air styling references? The best method I've found is to just remove all native controls (by uncommenting a directive in the air xml file, and adding showChrome= false to your WindowedApplication ). From there, it's pretty trivial to mimic native functions. Here's the ones used for beta 3 (they changed it, so googling around gets confusing): this.nativeWindow. minimize( ); // minimizes the window this.nativeWindow. close(); // closes the window this.nativeWindow. startResize( ); // call this within a MouseDown event on your resizing handle this.nativeWindow. startMove( ); // call this within a MouseDown event on your moving handle (title bar) All assuming this is the current window. - Kyle Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs
RE: [flexcoders] Bitmap: Please, please help.
First, trying arranging mx:Images inside an mx:Canvas to overlap and set their 'alpha' to something like 0.5 to make them semitransparent. Then look at drag-drop examples. Gordon Smith Adobe Flex SDK Team From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Noyes, Jeff Sent: Wednesday, January 30, 2008 9:45 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Bitmap: Please, please help. I want to be able to drag and drop multiple images onto one object - and have the images layer one on top of the other (see one through the other). Can that be done? From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Kyle Neath Sent: Wednesday, January 30, 2008 11:53 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] got any good air styling references? The best method I've found is to just remove all native controls (by uncommenting a directive in the air xml file, and adding showChrome=false to your WindowedApplication). From there, it's pretty trivial to mimic native functions. Here's the ones used for beta 3 (they changed it, so googling around gets confusing): this.nativeWindow.minimize(); // minimizes the window this.nativeWindow.close(); // closes the window this.nativeWindow.startResize(); // call this within a MouseDown event on your resizing handle this.nativeWindow.startMove(); // call this within a MouseDown event on your moving handle (title bar) All assuming this is the current window. - Kyle
Re: [flexcoders] Bitmap or BitmapData used for backgroundImage
On Monday 12 Feb 2007, polestar11 wrote: My reason for this is that I store all my styling assets in a swf file have a method that extracts them as MovieClips transforms them into Bitmaps. Why can't you just have PNG's or whatever in the style sheet and have it Just Work ? -- Tom Chiverton Helping to apprehensively embrace eligible products This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law Society. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. For more information about Halliwells LLP visit www.halliwells.com. -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] Bitmap or BitmapData used for backgroundImage
Hi there I want to know if its possible to use Bitmap or BitmapData for the backgroundImage style property of a Flex Container component. My reason for this is that I store all my styling assets in a swf file have a method that extracts them as MovieClips transforms them into Bitmaps. An alternative would be to call the graphics.beginBitmapFill method on that component redraw it accordingly when the component resize, which seems like too long a way round. Any ideas? Tracy
[flexcoders] Bitmap Fonts
Any solutions for using Bitmat fonts or fonts used with no anti-alias in Flex? cheers Tink
[flexcoders] Bitmap Analysis
Does anyone know any resources for advanced bitmap analysis with a flex app. I'm looking through the Bitmap Class but I'm a little in over my head on the algorithms side. There are two things I'm trying to do.First, how can I tell if one object (objects defined by what is drawn not the bounding rectangle) is completely overlapped/inside by another. (I'm not asking about parent/child relationship, I'm asking about visual representation). Put another way, I'm looking for a hitTest function/algorithm that tests if every pixel hits another supplied object, instead of simply at least one pixel hitting it. Second, assuming the first question is found to be true, how can I get the list of pixels from the larger object that overlaps the visual border (remember the border could be arbitrarily shaped) of the small object. One possibly useful simplifying assumption here is that the larger object is only a single pixel thick border. I know these questions are a little in depth, so I'm not expecting a complete solution (although I'd take it), so can anyone point me in the right direction (tutorials, examples, utility classes, etc)?- Dan __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Software development tool Software development Software development services Home design software Software development company Your email settings: Individual Email|Traditional Change settings via the Web (Yahoo! ID required) Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe __,_._,___
Re: [flexcoders] Bitmap
On 2/28/06, Richard Schutten [EMAIL PROTECTED] wrote: [snip] Now i want to add a bitmap to an VBox in my project. function showPic(event:Event) : void { var bmp:Bitmap = new Bitmap(pictLdr.content); vboxImageContainer.addChild(bmp) } I can't get it done. I'm getting the runtime error code 1009 (null has no properties). Flex containers (like VBox) can only take objects of type IUIComponent. So the best way is to add the Bitmap to a UIComponent and then add the UIComponent to the VBox. Manish -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
Re: [flexcoders] Bitmap
something else which should work vBoxInstance.allChildrenList.addChild(pDisplayObject); i would go with what manish says simply because the framework will play nicer with itOn 3/1/06, Manish Jethani [EMAIL PROTECTED] wrote:On 2/28/06, Richard Schutten [EMAIL PROTECTED] wrote:[snip] Now i want to add a bitmap to an VBox in my project. function showPic(event:Event) : void { var bmp:Bitmap = new Bitmap(pictLdr.content ); vboxImageContainer.addChild(bmp) } I can't get it done. I'm getting the runtime error code 1009 (null has no properties).Flex containers (like VBox) can only take objects of type IUIComponent.So the best way is to add the Bitmap to a UIComponentand then add the UIComponent to the VBox.Manish--Flexcoders Mailing ListFAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txtSearch Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links * To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/* To unsubscribe from this group, send an email to: [EMAIL PROTECTED]* Your use of Yahoo! Groups is subject to:http://docs.yahoo.com/info/terms/ -- j:pn http://www.lennel.org -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Re: [flexcoders] Bitmap
On 3/1/06, Johannes Nel [EMAIL PROTECTED] wrote: something else which should work vBoxInstance.allChildrenList.addChild(pDisplayObject); Depending on what you want to do, this might be better. This will add the Bitmap as a chrome object, so positioning it will be entirely upto you (which defeats the purpose of putting it in a VBox - might as well use a UIComponent). Putting it in a UIComponent wrapper is slightly better but still requires that the UIComponent be sized explicitly (width=n height=n). Manish -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] Bitmap
Hi, I'm having trouble displaying a Bitmap with Flex 2. Just as in the Help documentation i've added the following code: var pictLdr:Loader = new Loader(); var pictURL:String = image.jpg pictLdr.addEventListener(Event.COMPLETE, showPict); var pictURLReq:URLRequest = new URLRequest(pictURL); pictLdr.load(pictURLReq); I also added an event listener COMPLETE. Now i want to add a bitmap to an VBox in my project. function showPic(event:Event) : void { var bmp:Bitmap = new Bitmap(pictLdr.content); vboxImageContainer.addChild(bmp) } I can't get it done. I'm getting the runtime error code 1009 (null has no properties). Good someone help me out! Richard -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/