Flash run time error because of IBitmapDrawable

I can compile to flash, but as the project runs, I get this error:

ArgumentError: Error #2005: Parameter 0 is of the incorrect type. Should be type IBitmapDrawable.
at flash.display::BitmapData/draw()
at com.clientside::Icon$/bitmapData()[src/com/clientside/Icon.hx:80]
at MethodInfo-1995()[ui/android/skins.xml:32]
at ru.stablex.ui.widgets::Widget/set_skinName()[/usr/lib/haxe/lib/stablexui/1,1,5/src/ru/stablex/ui/widgets/Widget.hx:628]
at MethodInfo-1924()[ui/android/defaults.xml:355]
at com.clientside.main::Main/start()[ui/main/index.xml:541]
at com.clientside.main::FlashBootstrap/_start()[src/com/clientside/main/FlashBootstrap.hx:264]
at com.clientside.main::FlashBootstrap/pullFlashVars()[src/com/clientside/main/FlashBootstrap.hx:137]
at com.clientside.main::FlashBootstrap/start()[src/com/clientside/main/FlashBootstrap.hx:124]
at com.clientside.main::Main/startBooting()[src/com/clientside/main/Main.hx:678]
at com.clientside.main::Main$/main()[src/com/clientside/main/Main.hx:188]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at Function/()
at ApplicationMain$/start()[Export/flash/haxe/ApplicationMain.hx:811]
at MethodInfo-4()[Export/flash/haxe/ApplicationMain.hx:714]
at lime.app::Promise/complete()[/usr/lib/haxe/lib/lime/2,6,9/lime/app/Promise.hx:32]
at lime.app::Promise/complete()[/usr/lib/haxe/lib/lime/2,6,9/lime/app/Promise.hx:32]
at MethodInfo-3398()[/usr/lib/haxe/lib/swf/2,1,2/format/swf/SWFLibrary.hx:153]

I have openfl 3.3.9 and swf 2.1.2

Although I have tried to cast the passed parameter at Icon.hx:80 to IBitmapDrawable

tempData.draw(cast(Assets.getBitmapData(aFullPath), openfl.display.IBitmapDrawable), mtrx);

but I still get the error, can any one help?

Casting will only help with compile-time errors. If it isn’t an IBitmapDrawable at runtime, you’ll get that error no matter how many casts you do.

Add this just before line 80 to see what you’re passing:


Thanks!, I added those two lines 80, 81:

trace (aFullPath);
trace (Assets.getBitmapData(aFullPath));

I’ve got:

Icon.hx:80: assets/grab.png
Assets.hx:310: [Assets] There is no Image asset with an ID of "assets/grab.png"
Icon.hx:81: null

but, grab.png is there, so I’ve checked my build xml, I removed include="*.swf" from assets tag, and it worked! does this mean that include attribute will include only what is typed in the filter “*.swf” ? and include everything incase if not setting the filter ?

Yep, there’s a default include filter, if you specify include yourself, then, it will ignore the other files by default :slight_smile:

Thanks, but how to include multiple filters?

You can use a vertical bar ("|") to separate multiple entries :smile:

<assets path="Assets" rename="assets" include="*.jpg|*.png" />

You can read more asset tags here:


1 Like

Thanks very much :smile: