[SOLVED] SWF loads fine locally, crashes with "Invalid BitmapData" when loaded from server

I’m able to build my project for Flash just fine, and the SWF works beautifully locally. After putting it up on my server, I tried accessing it from my browser. Unfortunately it crashes after starting up!

ArgumentError: Error #2015: Invalid BitmapData.
at flash.display::BitmapData/ctor()
at flash.display::BitmapData()

I’m using the Tilelayer lib, and it’s while getting the spritesheet using openfl.Assets.getBitmapData() that it crashes. This is well after preloading is complete, so I don’t know what’s wrong. I use the embed="true" attribute for all of my assets. It crashes the same way, regardless of whether I load the HTML page containing the SWF or the SWF itself directly.

I couldn’t find any helpful information on past forums, because they would see this crash behavior locally. But my case is a bit different. Any help will be super appreciated, thanks! :slight_smile:

The crash still happens if I remove the embed="true" attribute for the spritesheet.

I thought about it overnight, and I figured that maybe something was going wrong in the copying process from local to the server. And indeed that was the problem. When I try opening the SWF from another online location (direct Dropbox link) it works perfectly, everything is preloaded properly and then all assets are loaded :slight_smile:

If you use embed="true" it should go in the SWF, and be available after (keyword: after :smile:) the preloader. This is also the default if you do not set an embed attribute. If you set embed="false" then it will copy the files into the Export directory, and you can use Assets.loadBitmapData to load asynchronously, but it will not be in the SWF, so you cannot Assets.getBitmapData since it still needs to be loaded.

Glad it’s working! :success: