[Papervision3D] Interactive Objects (Mouse Events)

Danny danny.mcgillick at gmail.com
Thu Apr 16 21:45:44 PDT 2009


Here's some code I set up to do it today on my Blender produced DAE.
_lightsBaeNode is a FLARBaseNode, an AR toolkit object that is a very simple
extension of DisplayObject3D and has my DAE added to it. Cylinder_001
through 007 (skipping 4 because I deleted it) are set up with event
handlers.
Is it possible you're setting your COLLADA_Scene up with a handler rather
than your actual cube. That's the first child of your DAE object I think?
Cube might be a child again of that?

(_lightsBaseNode as
DisplayObject3D).getMaterialByName("OHLightBodyMat").interactive
= true;

var colladaScene = _modelStore.lightsDAE.getChildByName("COLLADA_Scene")

for(var i=1; i<=7; i++) {

if(i!=4) {

var lightBody = colladaScene.getChildByName("Cylinder_00"+i);

lightBody.addEventListener(InteractiveScene3DEvent.OBJECT_OVER, overLsnr);

lightBody.addEventListener(InteractiveScene3DEvent.OBJECT_OUT, outLsnr);

lightBody.addEventListener(InteractiveScene3DEvent.OBJECT_RELEASE,
lightClickLsnr);

}

}



On Fri, Apr 17, 2009 at 9:40 AM, Paul Tondeur <paul at paultondeur.nl> wrote:

> Hi Derek,
>
> Have you tried setting mat.interactive = value recursively on all children
> of the targetobject inside your setInteractiveMaterials method? You define
> eventlisteners recursively for all the child objects of your collada , but
> you don't set mat.interactive = true recursively.
>
> You could try to replace your setInteractiveMaterials method by this one:
>
> private function setInteractiveMaterials(targetObject:DisplayObject3D,
> value:Boolean):void
> {
>        for each(var mat:MaterialObject3D in
> targetObject.materials.materialsByName)
>        {
>                mat.interactive = value;
>        }
>        for each(var child:DisplayObject3D in targetObject.children) {
>                setInteractiveMaterials(child,value);
>        }
> }
>
> Hope that works!
>
> Paul
>
>
> On Apr 17, 2009, at 1:17 AM, derekobrien wrote:
>
>
>> Thanks,
>>
>> I modified my actionscript to:
>> [Actionscript]
>>        private function setupPV3D():void
>>                {
>>                        scene = new Scene3D();
>>                        cam = new Camera3D();
>>                        cam.z = -1000;
>>                        cam.y = 300;
>>                        vp = new Viewport3D(600, 400, false, true, true,
>> true);
>>                        bre = new BasicRenderEngine();
>>                        addChild(vp);
>>                }
>> [/Actionscript]
>>
>> but still nothing, flash renders cube with material but when I click on
>> the
>> cube.... nothing. :-(
>>
>> Derek
>> --
>> View this message in context:
>> http://www.nabble.com/Interactive-Objects-%28Mouse-Events%29-tp23087249p23088381.html
>> Sent from the Papervision3D mailing list archive at Nabble.com.
>>
>>
>> _______________________________________________
>> Papervision3D mailing list
>> Papervision3D at osflash.org
>> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>



-- 
.......................................

Among the things Billy Pilgrim could not change were the past, the present,
and the future.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20090417/4097f66f/attachment-0001.html>


More information about the Papervision3D mailing list