Hey Justin yes this is an interesting point - having a material aware of when it's been added to/removed from a mesh, and even when it's visible in the view, would be a very useful addition.
i would expect we would need an event dispatched from the material (which in the majority of cases would be a moviematerial) so that you could setup listeners before and rendering is done, and have a listener function that could be placed anywhere - in the case of moviematerial the listener function could be inside the moviecip being used, to initialise content or start/stop animation or code. what do you think? Rob On Thu, Jun 25, 2009 at 3:05 PM, Justin Lawerance Mills <[email protected] > wrote: > Rob and team, > I had a look at some away3D for a friend last night and it seems that when > loaded Collada does not make it easy to access meshes that materials are > related to. > > trace( getQualifiedClassName(loader.children[0]) ); > trace( loader.children.length ); > > traces > away3d.primitives::Cube > 1 > > (also tried this in the render) > > Now this might not be an away3d problem it might be something else in the > code... but it struck me as rather a pain to get the mesh from a MovieClip > used as a material... looking at the turtles which confused me... it seems > that if mouse events are routed from a mesh hittest to a movieclip then an > event propogation could be added that allows the MovieClip to find its mesh. > > mat.hasMeshListener = true; > mc.addEventListener( Event.LISTENFORMESH, foundMesh ); > > After all it should not be so complex for a movie to change its own > position in 3D space and a real hassle to be getting meshes by name... at > the end of the day once a movie is used as a material it is destined to be > in a mesh or plane. To just add magic mesh and materials to a MovieClip is > not ideal and a listener structure allows a MovieClip to do something each > time it gets assigned to a mesh.. like fade in. It would really allow you > to work with a MovieClip, less having to worry about Collada or away3d > details, like mouse events really simple. > > Realise Rob is busy getting ready for later.. so I will try to quiz him > after the meeting. > > Cheers > > ;j > > -- Rob Bateman Flash Development & Consultancy [email protected] www.infiniteturtles.co.uk www.away3d.com
