Hey Cyril the MouseEvent3D returns a property "material" which is the material instance you have rolled over in the mesh. if you use an if statement in your listener, you can check which instance is which by comparing it to all material instances:
if (mouseEvent3D.material is myFirstMaterial) ...do something else if (mouseEvent3D.material is mySecondMaterial) ...do something else else if (mouseEvent3D.material is myThirdMaterial) ...etc I agree that keeping a name property in the material object would help though - will look into implementing that in the future cheers Rob On Fri, Jul 10, 2009 at 7:58 AM, Away3D <[email protected]> wrote: > > The problem is that i will have a lot of room (it will be a plan of an > hospital) and i can't name my mesh in sketchup...so it will be very > long to setup correct information on correct room: > I will have to trace each mesh name and associated the room action.... > and find for example " mesh12 = urgency " it will be very long.... > an another trouble is that my room have commun plan so 1mesh can be 2 > or more room... > It will be very easier if i can use material: in sketuchup i define > the name of material with the name of a service and apply action for > one color... > > I see in the api an intersting property which is "view.mouseMaterial" > but i haven't find the way to use it.... > thanks > > On 9 juil, 21:41, ben <[email protected]> wrote: > > Hi Cyril ! > > " implement differente action on each room/material " > > well if you won't change the material, why not use the mesh as > > reference for your actions ?? > > > > Object3D(yourMesh).addOnMouseOver(action); > > > > function action(e:MouseEvent3D):void > > { > > var id:String = e.target.name; > > switch(id){ > > case "horseAss": > > kickit(); > > break; > > case " LauraBushAss" > > kickItTwice(); > > break; > > case " CarlaAss" > > kickItTen(); > > break; > > default: > > trace(e.target.name); > > } > > > > } > > > > if not, I know that a materialData (including name property) do exist, > > but don't know how to access it... take a look at the API ! > -- Rob Bateman Flash Development & Consultancy [email protected] www.infiniteturtles.co.uk www.away3d.com
