Posts Tagged ‘Uncategorized’

This tutorial is an expansion on Loading 3D objects created in Max (using COLLADA)…

There are 3 main methods that can be use in Flash Actionscript to import bitmaps (i.e. textures)
BitmapAssetMaterial doesn’t work because the function expects a linkage id, linkage ids were in as2, not as3. so this will never work (I think).
BitmapFileMaterial Just links to a url file and therfore doesn’t need anything in the library.
BitmapMaterial is the one to use when you have a bitmap in the library. it expects a Bitmapdata object.
so, to get it to work with a material called examplematerial in the library with the class name examplematerial use:
BitmapMaterial(new examplematerial(width, height));
changing the width and height to the dimentions of the examplematerial image.
Also, this is assuming your examplematerial parent class is bitmapData (the default for an image so it should be).
So if you find that for some reason BitmapFileMaterial is not being loaded from your .DAE file, then simply change it and use BitmapMaterial.
To do this firstly in your .FLA file in the toolbar:
File > Import >  Import to Library
select your texture file and choose ok (I would use a .PNG file type, as they keep file sizes small, allow for transparency, and retain original quality)
once your texture is imported into the library make sure you right click it and select Linkage…
this will pop up with a window, make sure you have the relevant boxes ticked and have filled in the Class section with the name of your texture, in this case “examplematerial”
once this is done, go back into you .as file and add the following lines of code:
var myobjMaterials:MaterialsList = new MaterialsList();myobjMaterials.addMaterial(new BitmapMaterial(new sacktexture(1024, 1024)));

and thats all there is to it!

Follow me on Twitter
free counters
PayPal Donation
If you like this blog and the help it has given you, why not donate for this good cause? Click on the button below to pay Safely and Securely through PayPal.