I wanted to know Away3D basics first, before getting my hands dirty with Broomstick. So, currently I'm using version 3.6.
I looked at the Ferrari sample, and i replicated it - all seemed fine.
But when I created my own model - I wasn't able to apply material in Away3D.
Funny thing - a lot of people seem to have the same issue and no results have been posted yet. So after Google(Nasdaq GOOG.. lol.. that outta belittle you) finished playing cruel tricks on me, I was finally able to figure out the issue on my own.
Step 1: Modelling
Create the 3D Model and Unwrap UV
Go to Material Editor - Select a material and set a name for it - This is very important!
Apply this material and export it as a 3DS Model
Note: I'm using some old 3DS Max 2008 trial version that I got in a DVD along with some boring useless book, so a lot of things may be different or changed. And yeah, the new Blender is apparently awesome - gotta try it.
In Away3D, get the mesh ready and do the following
// Load the model, use load or parse - me use parse
// Gift me a server or shut up
myMesh = Max3DS.parse( /* Embedded Resource */);
// Apply the material
// Note: The name "SKIN" is same as the one we set before
myMesh .materialLibrary.getMaterial("SKIN").material = Cast.material(/* Embedded Texture*/);
Just an FYI how I found this -
I opened the binary 3ds file in notepad++ and found only few things that were human readable - model name, material name and texture filename. So, yeah, it was a brute force attack.
NTFS: Prefer NOT to apply "texture or image" before export - will give resource not found run time error