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 <[email protected]> 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 <[email protected]>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 <[email protected]> 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" <[email protected]> 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
>>>  
>>>
>>
>>
>

Reply via email to