Notifications
Clear all

[Closed] MapButton, get map as BitmapTexture

In my script there’s a mapButton into which it can only be inserted bitmaps. Since MapButtons doesn’t have filters like the pickButton, I verify whether classOf map == BitmapTexture in the picked event. But then I need to cast the map given as parameter (which is a TextureMap) to a BitmapTexture which is a subclass of TextureMap, because I need to work with bitmap specific stuff, for example, get its dimensions. But I get an error when I try this m_Map = map as BitmapTexture, it says “Type error: Type conversion needs a class argument, got BitmapTexture”. But HEY, BitmapTexture is a class, I cant understand it damn…please help :argh:

Thanks in adv

2 Replies
 lo1

Could you please clarify? Not sure I understand your logic.

If you are already verifying that the chosen map variable is a bitmaptexture, then there is no need to convert it, it already IS a bitmaptexture.

you can access the information of its actual bitmap file using map.bitmap.width etc.

OOH! I was trying map.width instead of map.bitmap.width…so I thought I didnt have a BitmapTexture object but a TextureMap instead but I was not accessing the member correctly =/. Thank you