Accessing Cloned object textures.

16 views
Skip to first unread message

edwinlimlx

unread,
Aug 20, 2010, 9:37:42 AM8/20/10
to Away3D.dev
Hi,

I've a 3D game, where after the alienship is being shot, it should
have some kind of feedback, like tint it red or something. However
there's no properties that i can do that(kindly enlighten if there
is). Thus, I've decided to change the texture of the alienship upon
being shot.

I have something like..

private function onSuccess(event:Loader3DEvent):void {
alienship = event.loader.handle as ObjectContainer3D;
//Cloning from the imported model.
var clonedAlienShip:Object3D = alienship.clone() as Object3D;
scene.addChild(clonedAlienShip);

trace(alienship.materialLibrary.getMaterial("Material
#309").material)
// [object BitmapMaterial]
trace(clonedAlienShip.materialLibrary.getMaterial("Material
#309").material)
// TypeError: Error #1009: Cannot access a property or method of a
null object reference.
}

However the clonedAlienShip appears on the scene with proper texture
as the original.

How do i access and modifies it?

Thanks!
Edwin
Reply all
Reply to author
Forward
0 new messages