Thanks Ben, that's awesome! Maybe Katopz or someone will include this into Away3D, it seems like it will be handy.
Best -Pete On Fri, Jul 10, 2009 at 11:08 AM, ben <[email protected]> wrote: > > Away3D (did you copyrighted this nickname???) > > Your question was puzzling me, hope someone else will give you a > better answer...), > so I decide to create a method that make you access to a used > bitmapMaterial from the name of the texture used, so you don't have to > think about the name in sketchup: > materialLibrary.getTextureByName(string):IMaterial; > > - How to call: > just when your collada loader is complete : > > var surgeryMaterial:BitmapMaterial = (e.loader.handle as > Object3D).materialLibrary.getTextureByName("surgery.jpg") as > BitmapMaterial; > > now you can concentrate on adding new mouse Event to that > bitmapmaterial. > > - How to implement : > paste those few lines in your MaterialLibrary class : > > public function getTextureByName(id:String):IMaterial > { > var materialName:Array =new Array(); > var materialType:Array =new Array(); > for each (_materialData in this) > { > > materialName.push(_materialData.textureFileName); > } > for each (_materialData in this) > { > materialType.push(_materialData.material); > } > return materialType[materialName.indexOf(id)]; > } > > now you have access of the material imported from collada depending on > the name of the picture file used. > > before, if you wan't to have access to all the filename of texture in > your imported collada scene, add this method in the same > MaterialLibrary class : > > public function getTextureFileNames():Array > { > var MaterialName:Array =new Array(); > for each (_materialData in this) > { > > MaterialName.push(_materialData.textureFileName); > } > return MaterialName; > } > > and call it. > > Hope this is USEFULL !! > > > > > > -- ___________________ Actionscript 3.0 Flash 3D Graphics Engine HTTP://AWAY3D.COM
