Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid BitmapData randomness

I started converting this flex application to run on android using the new flex hero sdk. I already replaced all mobile-incompatible components and got it running a few times succesfully.

When I use the same libraries running the original webapplication it works perfectly.

The big problem however are these random Invalid BitMapdata errors while starting the mobile application. Here's the whole output.

ArgumentError: Error #2015: Invalid BitmapData.
at flash.display::BitmapData/ctor()
at flash.display::BitmapData()
at spark.primitives::BitmapImage/http://www.adobe.com/2006/flex/mx/internal::applySource()[E:\dev\hero_private_beta\frameworks\projects\spark\src\spark\primitives\BitmapImage.as:1337]
at spark.primitives::BitmapImage/http://www.adobe.com/2006/flex/mx/internal::validateSource()[E:\dev\hero_private_beta\frameworks\projects\spark\src\spark\primitives\BitmapImage.as:1652]
at spark.primitives::BitmapImage/commitProperties()[E:\dev\hero_private_beta\frameworks\projects\spark\src\spark\primitives\BitmapImage.as:902]
at spark.primitives.supportClasses::GraphicElement/validateProperties()[E:\dev\hero_private_beta\frameworks\projects\spark\src\spark\primitives\supportClasses\GraphicElement.as:3487]
at spark.components::Group/commitProperties()[E:\dev\hero_private_beta\frameworks\projects\spark\src\spark\components\Group.as:931]
at mx.core::UIComponent/validateProperties()[E:\dev\hero_private_beta\frameworks\projects\framework\src\mx\core\UIComponent.as:8095]
at mx.managers::LayoutManager/validateProperties()[E:\dev\hero_private_beta\frameworks\projects\framework\src\mx\managers\LayoutManager.as:597]
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\hero_private_beta\frameworks\projects\framework\src\mx\managers\LayoutManager.as:760]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\hero_private_beta\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1157]

I debugged many times and I found that when it reaches this method

mx_internal function applySource():void
{

in BitmapImage.as, at this statement

if (!bitmapData && tmpSprite)

the bitmapData == null. When I run the original webapplication however, bitmapData is not null. The bitmapData value should be determined in this line of code

<s:BitmapImage id="smallTriangle" smooth="true" source="@Embed('/com/xploreplus/components/containers/panel/assets/images/smallTriangle.png')" />

Now it seems to me that, wile running the mobile application, it is unable to find the image, as when I run the webapplication, using the same library where the above line of code is, it is able to find the image.

This problem has been haunting me for days now and I'm really starting to think this is a bug, especially because it sometimes DOES run. Or is there something I'm missing here.

like image 316
vegasaurus Avatar asked Feb 23 '11 12:02

vegasaurus


1 Answers

I'm almost certain this is a memory issue. The fact that the error is in the BitmapData constructor says that either the app is trying to create a BitmapData with invalid dimensions (not likely since it works in your other build and the image is fetched on compile time) or the most likely scenario that Flash has run out of memory and can't create the BitmapData (mobile devices usually have much less memory than a PC).

like image 113
Cay Avatar answered Nov 07 '22 18:11

Cay