InteractiveScene3DEvent and dae models

View: New views
15 Messages — Rating Filter:   Alert me  

InteractiveScene3DEvent and dae models

by mlp1 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hi
 
I'm trying to set an interactive material on an imported max model, all the examples i've seen use papervision primitives, do interactive materials work on dae imports?
 
I have set the viewport as interactive
var viewport:Viewport3D = new Viewport3D(0, 0, true, true);
 
Here's how im setting the materials;
   controlMat01 = new BitmapAssetMaterial("rewind_jpg");
   controlMat01.interactive = true;
   controlMat01.name = "rewind_button";
   mats.addMaterial(controlMat01, "vid_control01");

 
Here's my button code and event called after the dae loads
private function setModel(e:Event):void {
   trace("setModel called");
   var vidButton01 :DisplayObject3D = dae.getChildByName( "vid_button01" );
   vidButton01.addEventListener( InteractiveScene3DEvent.OBJECT_PRESS, onObjPress);
   trace("vidButton01.x "+vidButton01.x);
}
function onObjPress( e:InteractiveScene3DEvent ):void {
   trace("press on " + e.face3d.material.name);

}
 
But it don't work... any ideas.
 
Cheers Mark
 


Think you know your TV, music and film? Try Search Charades!
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org

Re: InteractiveScene3DEvent and dae models

by tmyers :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

try listening for events on the "id" of the object rather than by "name"



mlp1 wrote:
Hi
 
I'm trying to set an interactive material on an imported max model, all the examples i've seen use papervision primitives, do interactive materials work on dae imports?
 
I have set the viewport as interactive
var viewport:Viewport3D = new Viewport3D(0, 0, true, true);
 
Here's how im setting the materials;
   controlMat01 = new BitmapAssetMaterial("rewind_jpg");   controlMat01.interactive = true;   controlMat01.name = "rewind_button";   mats.addMaterial(controlMat01, "vid_control01");
 
Here's my button code and event called after the dae loads
private function setModel(e:Event):void {   trace("setModel called");   var vidButton01 :DisplayObject3D = dae.getChildByName( "vid_button01" );   vidButton01.addEventListener( InteractiveScene3DEvent.OBJECT_PRESS, onObjPress);   trace("vidButton01.x "+vidButton01.x);}function onObjPress( e:InteractiveScene3DEvent ):void {   trace("press on " + e.face3d.material.name);
}
 
But it don't work... any ideas.
 
Cheers Mark
 
_________________________________________________________________
Get Hotmail on your mobile, text MSN to 63463!
http://mobile.uk.msn.com/pc/mail.aspx
_______________________________________________
Papervision3D mailing list
Papervision3D@osflash.org
http://osflash.org/mailman/listinfo/papervision3d_osflash.org

Re: InteractiveScene3DEvent and dae models

by zhivko :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Mark,

had the same problem. You need to attach the event to a child of the DAE object, not to the DAE object directly. It is a bit quirky getting down to the name of the child - you need to attach a Event.COMPLETE to your DAE, and within it try trace myDAE.childrenList() to get the name of the first object in your DAE, then myDAE.getChildByName("name of the first object in your DAE").childrenList() and so on until you reach the innermost object. my code looked like this:


var plane:DAE = new DAE();
plane.load("plane.dae", materialsList);
plane.scale = 100;
default_scene.addChild(plane);
plane.addEventListener(Event.COMPLETE, daeCompleteHandler);
function daeCompleteHandler( event:Event ):void
        { plane.getChildByName("COLLADA_root").getChildByName("Plane").getChildByName("6").addEventListener( InteractiveScene3DEvent.OBJECT_OVER, onOver );
        }







mlp1 wrote:
Hi
 
I'm trying to set an interactive material on an imported max model, all the examples i've seen use papervision primitives, do interactive materials work on dae imports?
 
I have set the viewport as interactive
var viewport:Viewport3D = new Viewport3D(0, 0, true, true);
 
Here's how im setting the materials;
   controlMat01 = new BitmapAssetMaterial("rewind_jpg");   controlMat01.interactive = true;   controlMat01.name = "rewind_button";   mats.addMaterial(controlMat01, "vid_control01");
 
Here's my button code and event called after the dae loads
private function setModel(e:Event):void {   trace("setModel called");   var vidButton01 :DisplayObject3D = dae.getChildByName( "vid_button01" );   vidButton01.addEventListener( InteractiveScene3DEvent.OBJECT_PRESS, onObjPress);   trace("vidButton01.x "+vidButton01.x);}function onObjPress( e:InteractiveScene3DEvent ):void {   trace("press on " + e.face3d.material.name);
}
 
But it don't work... any ideas.
 
Cheers Mark
 
_________________________________________________________________
Get Hotmail on your mobile, text MSN to 63463!
http://mobile.uk.msn.com/pc/mail.aspx
_______________________________________________
Papervision3D mailing list
Papervision3D@osflash.org
http://osflash.org/mailman/listinfo/papervision3d_osflash.org

Re: InteractiveScene3DEvent and dae models

by Daniel Auer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

+100, zhivko
Thanks a lot!

Re: InteractiveScene3DEvent and dae models

by claygraffix :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This post saved me. Thanks so much.



Re: InteractiveScene3DEvent and dae models

by im_a_tryer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The problem I'm having is that my dae object has no childrenList - it just fires back with an empty string. Object displays fine with texture and everything! But while trying to add interactivity to all the child objects I seem to have hit a brick wall. Any ideas?

Cheers,

Si

Re: InteractiveScene3DEvent and dae models

by Tyler Egeto :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Are you making sure that the DAE has fully loaded before applying the listeners? When calling load() on a DAE, it will dispatch an event when load has completed, "FileLoadEvent.LOAD_COMPLETE"

Hope that helps.

Tyler.

im_a_tryer wrote:
The problem I'm having is that my dae object has no childrenList - it just fires back with an empty string. Object displays fine with texture and everything! But while trying to add interactivity to all the child objects I seem to have hit a brick wall. Any ideas?

Cheers,

Si
Tyler Egeto
TylerEgeto.com
Have question? Email me at tyleregeto[at]gmail[dot]com

Re: InteractiveScene3DEvent and dae models

by im_a_tryer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Tyler - managed to sort this problem. It was the COLLADA_Scene hierarchy (after dae has fully loaded as you said) I needed to get to grips with. I can now add click listeners to my daes. This has inevitably uncovered another problem: I am cloning the dae through a for-loop. Problem is that when you click on one of the daes - a completely different one will register the click event. Whats wierder is that if i change my listener to OBJECT_OVER the event seems to fire by itself randomly, even if the mouse cursor isnt even on the swf!!

This is my job today...

Seasons greetings btw!

Si


Are you making sure that the DAE has fully loaded before applying the listeners? When calling load() on a DAE, it will dispatch an event when load has completed, "FileLoadEvent.LOAD_COMPLETE"

Hope that helps.

Tyler.

im_a_tryer wrote:
The problem I'm having is that my dae object has no childrenList - it just fires back with an empty string. Object displays fine with texture and everything! But while trying to add interactivity to all the child objects I seem to have hit a brick wall. Any ideas?

Cheers,

Si


Re: InteractiveScene3DEvent and dae models

by boysknow :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Anyone know how to update this code from zhivko? I get the following error:
"1120: Access of undefined property onOver"

 I'm assuming its because I'm running PV3D 2.0?

My code looks like this:
//
daeFile.addEventListener(FileLoadEvent.LOAD_COMPLETE, myOnLoadCompleteHandler);
//
function myOnLoadCompleteHandler( event:Event ):void{
daeFile.getChildByName("COLLADA_Scene").getChildByName("polySurface1").addEventListener(InteractiveScene3DEvent.OBJECT_OVER, onOver );
}


Hi Mark,

had the same problem. You need to attach the event to a child of the DAE object, not to the DAE object directly. It is a bit quirky getting down to the name of the child - you need to attach a Event.COMPLETE to your DAE, and within it try trace myDAE.childrenList() to get the name of the first object in your DAE, then myDAE.getChildByName("name of the first object in your DAE").childrenList() and so on until you reach the innermost object. my code looked like this:


var plane:DAE = new DAE();
plane.load("plane.dae", materialsList);
plane.scale = 100;
default_scene.addChild(plane);
plane.addEventListener(Event.COMPLETE, daeCompleteHandler);
function daeCompleteHandler( event:Event ):void
        { plane.getChildByName("COLLADA_root").getChildByName("Plane").getChildByName("6").addEventListener( InteractiveScene3DEvent.OBJECT_OVER, onOver );
        }


mlp1 wrote:
Hi
 
I'm trying to set an interactive material on an imported max model, all the examples i've seen use papervision primitives, do interactive materials work on dae imports?
 
I have set the viewport as interactive
var viewport:Viewport3D = new Viewport3D(0, 0, true, true);
 
Here's how im setting the materials;
   controlMat01 = new BitmapAssetMaterial("rewind_jpg");   controlMat01.interactive = true;   controlMat01.name = "rewind_button";   mats.addMaterial(controlMat01, "vid_control01");
 
Here's my button code and event called after the dae loads
private function setModel(e:Event):void {   trace("setModel called");   var vidButton01 :DisplayObject3D = dae.getChildByName( "vid_button01" );   vidButton01.addEventListener( InteractiveScene3DEvent.OBJECT_PRESS, onObjPress);   trace("vidButton01.x "+vidButton01.x);}function onObjPress( e:InteractiveScene3DEvent ):void {   trace("press on " + e.face3d.material.name);
}
 
But it don't work... any ideas.
 
Cheers Mark
 
_________________________________________________________________
Get Hotmail on your mobile, text MSN to 63463!
http://mobile.uk.msn.com/pc/mail.aspx
_______________________________________________
Papervision3D mailing list
Papervision3D@osflash.org
http://osflash.org/mailman/listinfo/papervision3d_osflash.org


Re: InteractiveScene3DEvent and dae models

by oletk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You have to create the function.

public function onOver(evt:InteractiveScene3DEvent):void
{
    // Function properties here.
}


On Fri, May 29, 2009 at 7:18 AM, boysknow <simonwestlake76@...> wrote:

Anyone know how to update this code from zhivko? I get the following error:
"1120: Access of undefined property onOver"

 I'm assuming its because I'm running PV3D 2.0?

My code looks like this:
//
daeFile.addEventListener(FileLoadEvent.LOAD_COMPLETE,
myOnLoadCompleteHandler);
//
function myOnLoadCompleteHandler( event:Event ):void{
daeFile.getChildByName("COLLADA_Scene").getChildByName("polySurface1").addEventListener(InteractiveScene3DEvent.OBJECT_OVER,
onOver );
}


zhivko wrote:
>
> Hi Mark,
>
> had the same problem. You need to attach the event to a child of the DAE
> object, not to the DAE object directly. It is a bit quirky getting down to
> the name of the child - you need to attach a Event.COMPLETE to your DAE,
> and within it try trace myDAE.childrenList() to get the name of the first
> object in your DAE, then myDAE.getChildByName("name of the first object in
> your DAE").childrenList() and so on until you reach the innermost object.
> my code looked like this:
>
>
> var plane:DAE = new DAE();
> plane.load("plane.dae", materialsList);
> plane.scale = 100;
> default_scene.addChild(plane);
> plane.addEventListener(Event.COMPLETE, daeCompleteHandler);
> function daeCompleteHandler( event:Event ):void
>       {
> plane.getChildByName("COLLADA_root").getChildByName("Plane").getChildByName("6").addEventListener(
> InteractiveScene3DEvent.OBJECT_OVER, onOver );
>       }
>
>
>
> mlp1 wrote:
>>
>>
>> Hi
>>
>> I'm trying to set an interactive material on an imported max model, all
>> the examples i've seen use papervision primitives, do interactive
>> materials work on dae imports?
>>
>> I have set the viewport as interactive
>> var viewport:Viewport3D = new Viewport3D(0, 0, true, true);
>>
>> Here's how im setting the materials;
>>    controlMat01 = new BitmapAssetMaterial("rewind_jpg");
>> controlMat01.interactive = true;   controlMat01.name = "rewind_button";
>> mats.addMaterial(controlMat01, "vid_control01");
>>
>> Here's my button code and event called after the dae loads
>> private function setModel(e:Event):void {   trace("setModel called");
>> var vidButton01 :DisplayObject3D = dae.getChildByName( "vid_button01" );
>> vidButton01.addEventListener( InteractiveScene3DEvent.OBJECT_PRESS,
>> onObjPress);   trace("vidButton01.x "+vidButton01.x);}function
>> onObjPress( e:InteractiveScene3DEvent ):void {   trace("press on " +
>> e.face3d.material.name);
>> }
>>
>> But it don't work... any ideas.
>>
>> Cheers Mark
>>
>> _________________________________________________________________
>> Get Hotmail on your mobile, text MSN to 63463!
>> http://mobile.uk.msn.com/pc/mail.aspx
>> _______________________________________________
>> Papervision3D mailing list
>> Papervision3D@...
>> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>>
>>
>
>

--
View this message in context: http://www.nabble.com/InteractiveScene3DEvent-and-dae-models-tp15850889p23774372.html
Sent from the Papervision3D mailing list archive at Nabble.com.


_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org


_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org

Re: InteractiveScene3DEvent and dae models

by boysknow :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks oletk. I don't get any errors anymore but I can't get that OnOver function to run. This is how that part of my code looks:

function myOnLoadCompleteHandler( event:Event ):void{
          trace(daeFile.getChildByName("COLLADA_Scene").getChildByName("polySurface1").childrenList());
daeFile.getChildByName("COLLADA_Scene").getChildByName("polySurface1").addEventListener(InteractiveScene3DEvent.OBJECT_OVER, onOver );
}
//
function onOver(evt:InteractiveScene3DEvent):void
{
    trace("onOver");
}

Any ideas?


oletk wrote:
You have to create the function.

public function onOver(evt:InteractiveScene3DEvent):void{
    // Function properties here.
}


On Fri, May 29, 2009 at 7:18 AM, boysknow <simonwestlake76@hotmail.com>wrote:

>
> Anyone know how to update this code from zhivko? I get the following error:
> "1120: Access of undefined property onOver"
>
>  I'm assuming its because I'm running PV3D 2.0?
>
> My code looks like this:
> //
> daeFile.addEventListener(FileLoadEvent.LOAD_COMPLETE,
> myOnLoadCompleteHandler);
> //
> function myOnLoadCompleteHandler( event:Event ):void{
>
> daeFile.getChildByName("COLLADA_Scene").getChildByName("polySurface1").addEventListener(InteractiveScene3DEvent.OBJECT_OVER,
> onOver );
> }
>
>
> zhivko wrote:
> >
> > Hi Mark,
> >
> > had the same problem. You need to attach the event to a child of the DAE
> > object, not to the DAE object directly. It is a bit quirky getting down
> to
> > the name of the child - you need to attach a Event.COMPLETE to your DAE,
> > and within it try trace myDAE.childrenList() to get the name of the first
> > object in your DAE, then myDAE.getChildByName("name of the first object
> in
> > your DAE").childrenList() and so on until you reach the innermost object.
> > my code looked like this:
> >
> >
> > var plane:DAE = new DAE();
> > plane.load("plane.dae", materialsList);
> > plane.scale = 100;
> > default_scene.addChild(plane);
> > plane.addEventListener(Event.COMPLETE, daeCompleteHandler);
> > function daeCompleteHandler( event:Event ):void
> >       {
> >
> plane.getChildByName("COLLADA_root").getChildByName("Plane").getChildByName("6").addEventListener(
> > InteractiveScene3DEvent.OBJECT_OVER, onOver );
> >       }
> >
> >
> >
> > mlp1 wrote:
> >>
> >>
> >> Hi
> >>
> >> I'm trying to set an interactive material on an imported max model, all
> >> the examples i've seen use papervision primitives, do interactive
> >> materials work on dae imports?
> >>
> >> I have set the viewport as interactive
> >> var viewport:Viewport3D = new Viewport3D(0, 0, true, true);
> >>
> >> Here's how im setting the materials;
> >>    controlMat01 = new BitmapAssetMaterial("rewind_jpg");
> >> controlMat01.interactive = true;   controlMat01.name = "rewind_button";
> >> mats.addMaterial(controlMat01, "vid_control01");
> >>
> >> Here's my button code and event called after the dae loads
> >> private function setModel(e:Event):void {   trace("setModel called");
> >> var vidButton01 :DisplayObject3D = dae.getChildByName( "vid_button01" );
> >> vidButton01.addEventListener( InteractiveScene3DEvent.OBJECT_PRESS,
> >> onObjPress);   trace("vidButton01.x "+vidButton01.x);}function
> >> onObjPress( e:InteractiveScene3DEvent ):void {   trace("press on " +
> >> e.face3d.material.name);
> >> }
> >>
> >> But it don't work... any ideas.
> >>
> >> Cheers Mark
> >>
> >> _________________________________________________________________
> >> Get Hotmail on your mobile, text MSN to 63463!
> >> http://mobile.uk.msn.com/pc/mail.aspx
> >> _______________________________________________
> >> Papervision3D mailing list
> >> Papervision3D@osflash.org
> >> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/InteractiveScene3DEvent-and-dae-models-tp15850889p23774372.html
> Sent from the Papervision3D mailing list archive at Nabble.com.
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>

_______________________________________________
Papervision3D mailing list
Papervision3D@osflash.org
http://osflash.org/mailman/listinfo/papervision3d_osflash.org

Re: InteractiveScene3DEvent and dae models

by oletk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Is the polysurface material set to interactive, and is the viewport interactive?

On Fri, May 29, 2009 at 9:48 AM, boysknow <simonwestlake76@...> wrote:

Thanks oletk. I don't get any errors anymore but I can't get that OnOver
function to run. This is how that part of my code looks:

function myOnLoadCompleteHandler( event:Event ):void{

trace(daeFile.getChildByName("COLLADA_Scene").getChildByName("polySurface1").childrenList());
daeFile.getChildByName("COLLADA_Scene").getChildByName("polySurface1").addEventListener(InteractiveScene3DEvent.OBJECT_OVER,
onOver );
}
//
function onOver(evt:InteractiveScene3DEvent):void
{
   trace("onOver");
}

Any ideas?



oletk wrote:
>
> You have to create the function.
>
> public function onOver(evt:InteractiveScene3DEvent):void{
>     // Function properties here.
> }
>
>
> On Fri, May 29, 2009 at 7:18 AM, boysknow
> <simonwestlake76@...>wrote:
>
>>
>> Anyone know how to update this code from zhivko? I get the following
>> error:
>> "1120: Access of undefined property onOver"
>>
>>  I'm assuming its because I'm running PV3D 2.0?
>>
>> My code looks like this:
>> //
>> daeFile.addEventListener(FileLoadEvent.LOAD_COMPLETE,
>> myOnLoadCompleteHandler);
>> //
>> function myOnLoadCompleteHandler( event:Event ):void{
>>
>> daeFile.getChildByName("COLLADA_Scene").getChildByName("polySurface1").addEventListener(InteractiveScene3DEvent.OBJECT_OVER,
>> onOver );
>> }
>>
>>
>> zhivko wrote:
>> >
>> > Hi Mark,
>> >
>> > had the same problem. You need to attach the event to a child of the
>> DAE
>> > object, not to the DAE object directly. It is a bit quirky getting down
>> to
>> > the name of the child - you need to attach a Event.COMPLETE to your
>> DAE,
>> > and within it try trace myDAE.childrenList() to get the name of the
>> first
>> > object in your DAE, then myDAE.getChildByName("name of the first object
>> in
>> > your DAE").childrenList() and so on until you reach the innermost
>> object.
>> > my code looked like this:
>> >
>> >
>> > var plane:DAE = new DAE();
>> > plane.load("plane.dae", materialsList);
>> > plane.scale = 100;
>> > default_scene.addChild(plane);
>> > plane.addEventListener(Event.COMPLETE, daeCompleteHandler);
>> > function daeCompleteHandler( event:Event ):void
>> >       {
>> >
>> plane.getChildByName("COLLADA_root").getChildByName("Plane").getChildByName("6").addEventListener(
>> > InteractiveScene3DEvent.OBJECT_OVER, onOver );
>> >       }
>> >
>> >
>> >
>> > mlp1 wrote:
>> >>
>> >>
>> >> Hi
>> >>
>> >> I'm trying to set an interactive material on an imported max model,
>> all
>> >> the examples i've seen use papervision primitives, do interactive
>> >> materials work on dae imports?
>> >>
>> >> I have set the viewport as interactive
>> >> var viewport:Viewport3D = new Viewport3D(0, 0, true, true);
>> >>
>> >> Here's how im setting the materials;
>> >>    controlMat01 = new BitmapAssetMaterial("rewind_jpg");
>> >> controlMat01.interactive = true;   controlMat01.name =
>> "rewind_button";
>> >> mats.addMaterial(controlMat01, "vid_control01");
>> >>
>> >> Here's my button code and event called after the dae loads
>> >> private function setModel(e:Event):void {   trace("setModel called");
>> >> var vidButton01 :DisplayObject3D = dae.getChildByName( "vid_button01"
>> );
>> >> vidButton01.addEventListener( InteractiveScene3DEvent.OBJECT_PRESS,
>> >> onObjPress);   trace("vidButton01.x "+vidButton01.x);}function
>> >> onObjPress( e:InteractiveScene3DEvent ):void {   trace("press on " +
>> >> e.face3d.material.name);
>> >> }
>> >>
>> >> But it don't work... any ideas.
>> >>
>> >> Cheers Mark
>> >>
>> >> _________________________________________________________________
>> >> Get Hotmail on your mobile, text MSN to 63463!
>> >> http://mobile.uk.msn.com/pc/mail.aspx
>> >> _______________________________________________
>> >> Papervision3D mailing list
>> >> Papervision3D@...
>> >> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/InteractiveScene3DEvent-and-dae-models-tp15850889p23774372.html
>> Sent from the Papervision3D mailing list archive at Nabble.com.
>>
>>
>> _______________________________________________
>> Papervision3D mailing list
>> Papervision3D@...
>> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>

--
View this message in context: http://www.nabble.com/InteractiveScene3DEvent-and-dae-models-tp15850889p23775755.html
Sent from the Papervision3D mailing list archive at Nabble.com.


_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org


_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org

Re: InteractiveScene3DEvent and dae models

by boysknow :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The viewport is set to be interactive but not the material. How can I set the material to be interactive?
 
I've been looking at the following example for making a DAE material interactive, but its missing important bits, like not declaring what 'mainMaterialList' is(?):
http://circstar.com/FlashLabUnderground/?p=39

Your help is much appreciated

oletk wrote:
Is the polysurface material set to interactive, and is the viewport
interactive?

On Fri, May 29, 2009 at 9:48 AM, boysknow <simonwestlake76@hotmail.com>wrote:

>
> Thanks oletk. I don't get any errors anymore but I can't get that OnOver
> function to run. This is how that part of my code looks:
>
> function myOnLoadCompleteHandler( event:Event ):void{
>
>
> trace(daeFile.getChildByName("COLLADA_Scene").getChildByName("polySurface1").childrenList());
>
> daeFile.getChildByName("COLLADA_Scene").getChildByName("polySurface1").addEventListener(InteractiveScene3DEvent.OBJECT_OVER,
> onOver );
> }
> //
> function onOver(evt:InteractiveScene3DEvent):void
> {
>     trace("onOver");
> }
>
> Any ideas?
>
>
>
> oletk wrote:
> >
> > You have to create the function.
> >
> > public function onOver(evt:InteractiveScene3DEvent):void{
> >     // Function properties here.
> > }
> >
> >
> > On Fri, May 29, 2009 at 7:18 AM, boysknow
> > <simonwestlake76@hotmail.com>wrote:
> >
> >>
> >> Anyone know how to update this code from zhivko? I get the following
> >> error:
> >> "1120: Access of undefined property onOver"
> >>
> >>  I'm assuming its because I'm running PV3D 2.0?
> >>
> >> My code looks like this:
> >> //
> >> daeFile.addEventListener(FileLoadEvent.LOAD_COMPLETE,
> >> myOnLoadCompleteHandler);
> >> //
> >> function myOnLoadCompleteHandler( event:Event ):void{
> >>
> >>
> daeFile.getChildByName("COLLADA_Scene").getChildByName("polySurface1").addEventListener(InteractiveScene3DEvent.OBJECT_OVER,
> >> onOver );
> >> }
> >>
> >>
> >> zhivko wrote:
> >> >
> >> > Hi Mark,
> >> >
> >> > had the same problem. You need to attach the event to a child of the
> >> DAE
> >> > object, not to the DAE object directly. It is a bit quirky getting
> down
> >> to
> >> > the name of the child - you need to attach a Event.COMPLETE to your
> >> DAE,
> >> > and within it try trace myDAE.childrenList() to get the name of the
> >> first
> >> > object in your DAE, then myDAE.getChildByName("name of the first
> object
> >> in
> >> > your DAE").childrenList() and so on until you reach the innermost
> >> object.
> >> > my code looked like this:
> >> >
> >> >
> >> > var plane:DAE = new DAE();
> >> > plane.load("plane.dae", materialsList);
> >> > plane.scale = 100;
> >> > default_scene.addChild(plane);
> >> > plane.addEventListener(Event.COMPLETE, daeCompleteHandler);
> >> > function daeCompleteHandler( event:Event ):void
> >> >       {
> >> >
> >>
> plane.getChildByName("COLLADA_root").getChildByName("Plane").getChildByName("6").addEventListener(
> >> > InteractiveScene3DEvent.OBJECT_OVER, onOver );
> >> >       }
> >> >
> >> >
> >> >
> >> > mlp1 wrote:
> >> >>
> >> >>
> >> >> Hi
> >> >>
> >> >> I'm trying to set an interactive material on an imported max model,
> >> all
> >> >> the examples i've seen use papervision primitives, do interactive
> >> >> materials work on dae imports?
> >> >>
> >> >> I have set the viewport as interactive
> >> >> var viewport:Viewport3D = new Viewport3D(0, 0, true, true);
> >> >>
> >> >> Here's how im setting the materials;
> >> >>    controlMat01 = new BitmapAssetMaterial("rewind_jpg");
> >> >> controlMat01.interactive = true;   controlMat01.name =
> >> "rewind_button";
> >> >> mats.addMaterial(controlMat01, "vid_control01");
> >> >>
> >> >> Here's my button code and event called after the dae loads
> >> >> private function setModel(e:Event):void {   trace("setModel called");
> >> >> var vidButton01 :DisplayObject3D = dae.getChildByName( "vid_button01"
> >> );
> >> >> vidButton01.addEventListener( InteractiveScene3DEvent.OBJECT_PRESS,
> >> >> onObjPress);   trace("vidButton01.x "+vidButton01.x);}function
> >> >> onObjPress( e:InteractiveScene3DEvent ):void {   trace("press on " +
> >> >> e.face3d.material.name);
> >> >> }
> >> >>
> >> >> But it don't work... any ideas.
> >> >>
> >> >> Cheers Mark
> >> >>
> >> >> _________________________________________________________________
> >> >> Get Hotmail on your mobile, text MSN to 63463!
> >> >> http://mobile.uk.msn.com/pc/mail.aspx
> >> >> _______________________________________________
> >> >> Papervision3D mailing list
> >> >> Papervision3D@osflash.org
> >> >> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> >> >>
> >> >>
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/InteractiveScene3DEvent-and-dae-models-tp15850889p23774372.html
> >> Sent from the Papervision3D mailing list archive at Nabble.com.
> >>
> >>
> >> _______________________________________________
> >> Papervision3D mailing list
> >> Papervision3D@osflash.org
> >> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> >>
> >
> > _______________________________________________
> > Papervision3D mailing list
> > Papervision3D@osflash.org
> > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/InteractiveScene3DEvent-and-dae-models-tp15850889p23775755.html
> Sent from the Papervision3D mailing list archive at Nabble.com.
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>

_______________________________________________
Papervision3D mailing list
Papervision3D@osflash.org
http://osflash.org/mailman/listinfo/papervision3d_osflash.org

Parent Message unknown Re: InteractiveScene3DEvent and dae models

by xero :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

what do you get when you:
 
trace(daeFile.getChildByName("COLLADA_Scene").getChildByName("polySurface1"));
???
 
if its null then your not targeting the correct thing.
____  ___
\   \/  /___________  ____
.\     // __ \_  __ \/ _  \
./     \  ___/ | | \( <_>  )
/___/\  \___  >__|---\____/
|     \_/   \/        |
| xero harrison       |
| xero.nu@gmail.com   |
| http://xero.nu      |
| http://fontvir.us   |
| http://hexarray.nu  |
| http://xero.owns.us |
`---------------------'  

---------- Forwarded message ----------
From: boysknow <simonwestlake76@...>
To: papervision3D@...
Date: Fri, 29 May 2009 00:48:19 -0700 (PDT)
Subject: Re: [Papervision3D] InteractiveScene3DEvent and dae models

Thanks oletk. I don't get any errors anymore but I can't get that OnOver
function to run. This is how that part of my code looks:

function myOnLoadCompleteHandler( event:Event ):void{

trace(daeFile.getChildByName("COLLADA_Scene").getChildByName("polySurface1").childrenList());
daeFile.getChildByName("COLLADA_Scene").getChildByName("polySurface1").addEventListener(InteractiveScene3DEvent.OBJECT_OVER,
onOver );
}
//
function onOver(evt:InteractiveScene3DEvent):void
{
   trace("onOver");
}

Any ideas?



oletk wrote:
>
> You have to create the function.
>
> public function onOver(evt:InteractiveScene3DEvent):void{
>     // Function properties here.
> }
>
>
> On Fri, May 29, 2009 at 7:18 AM, boysknow
> <simonwestlake76@...>wrote:
>
>>
>> Anyone know how to update this code from zhivko? I get the following
>> error:
>> "1120: Access of undefined property onOver"
>>
>>  I'm assuming its because I'm running PV3D 2.0?
>>
>> My code looks like this:
>> //
>> daeFile.addEventListener(FileLoadEvent.LOAD_COMPLETE,
>> myOnLoadCompleteHandler);
>> //
>> function myOnLoadCompleteHandler( event:Event ):void{
>>
>> daeFile.getChildByName("COLLADA_Scene").getChildByName("polySurface1").addEventListener(InteractiveScene3DEvent.OBJECT_OVER,
>> onOver );
>> }
>>
>>
>> zhivko wrote:
>> >
>> > Hi Mark,
>> >
>> > had the same problem. You need to attach the event to a child of the
>> DAE
>> > object, not to the DAE object directly. It is a bit quirky getting down
>> to
>> > the name of the child - you need to attach a Event.COMPLETE to your
>> DAE,
>> > and within it try trace myDAE.childrenList() to get the name of the
>> first
>> > object in your DAE, then myDAE.getChildByName("name of the first object
>> in
>> > your DAE").childrenList() and so on until you reach the innermost
>> object.
>> > my code looked like this:
>> >
>> >
>> > var plane:DAE = new DAE();
>> > plane.load("plane.dae", materialsList);
>> > plane.scale = 100;
>> > default_scene.addChild(plane);
>> > plane.addEventListener(Event.COMPLETE, daeCompleteHandler);
>> > function daeCompleteHandler( event:Event ):void
>> >       {
>> >
>> plane.getChildByName("COLLADA_root").getChildByName("Plane").getChildByName("6").addEventListener(
>> > InteractiveScene3DEvent.OBJECT_OVER, onOver );
>> >       }
>> >
>> >
>> >
>> > mlp1 wrote:
>> >>
>> >>
>> >> Hi
>> >>
>> >> I'm trying to set an interactive material on an imported max model,
>> all
>> >> the examples i've seen use papervision primitives, do interactive
>> >> materials work on dae imports?
>> >>
>> >> I have set the viewport as interactive
>> >> var viewport:Viewport3D = new Viewport3D(0, 0, true, true);
>> >>
>> >> Here's how im setting the materials;
>> >>    controlMat01 = new BitmapAssetMaterial("rewind_jpg");
>> >> controlMat01.interactive = true;   controlMat01.name =
>> "rewind_button";
>> >> mats.addMaterial(controlMat01, "vid_control01");
>> >>
>> >> Here's my button code and event called after the dae loads
>> >> private function setModel(e:Event):void {   trace("setModel called");
>> >> var vidButton01 :DisplayObject3D = dae.getChildByName( "vid_button01"
>> );
>> >> vidButton01.addEventListener( InteractiveScene3DEvent.OBJECT_PRESS,
>> >> onObjPress);   trace("vidButton01.x "+vidButton01.x);}function
>> >> onObjPress( e:InteractiveScene3DEvent ):void {   trace("press on " +
>> >> e.face3d.material.name);
>> >> }
>> >>
>> >> But it don't work... any ideas.
>> >>
>> >> Cheers Mark
>> >>
>> >> _________________________________________________________________
>> >> Get Hotmail on your mobile, text MSN to 63463!
>> >> http://mobile.uk.msn.com/pc/mail.aspx
>> >> _______________________________________________
>> >> Papervision3D mailing list
>> >> Papervision3D@...
>> >> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/InteractiveScene3DEvent-and-dae-models-tp15850889p23774372.html
>> Sent from the Papervision3D mailing list archive at Nabble.com.
>>
>>
>> _______________________________________________
>> Papervision3D mailing list
>> Papervision3D@...
>> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>

--
View this message in context: http://www.nabble.com/InteractiveScene3DEvent-and-dae-models-tp15850889p23775755.html
Sent from the Papervision3D mailing list archive at Nabble.com.




_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org



_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org

Re: InteractiveScene3DEvent and dae models

by Vinicius Krauspenhar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi, I use this:
 
for each(var child:DisplayObject3D in dae.children) {
    for each( var triangle:Triangle3D in child.geometry.faces ) {
        var x : CompositeMaterial = new CompositeMaterial();
        x.addMaterial(triangle.material);
        triangle.material = x;
        triangle.material.interactive = true;
    }       
    child.addEventListener(InteractiveScene3DEvent.OBJECT_OVER, onOver);
    child.addEventListener(InteractiveScene3DEvent.OBJECT_OUT, onOut);
 

 
2009/5/29 xero <xero.nu@gmail.com>
what do you get when you:
 
trace(daeFile.getChildByName("COLLADA_Scene").getChildByName("polySurface1"));
???
 
if its null then your not targeting the correct thing.
____  ___
\   \/  /___________  ____
.\     // __ \_  __ \/ _  \
./     \  ___/ | | \( <_>  )
/___/\  \___  >__|---\____/
|     \_/   \/        |
| xero harrison       |
| xero.nu@gmail.com   |
| http://xero.nu      |
| http://fontvir.us   |
| http://hexarray.nu  |
| http://xero.owns.us |
`---------------------'  

---------- Forwarded message ----------
From: boysknow <simonwestlake76@...>
To: papervision3D@...
Date: Fri, 29 May 2009 00:48:19 -0700 (PDT)
Subject: Re: [Papervision3D] InteractiveScene3DEvent and dae models

Thanks oletk. I don't get any errors anymore but I can't get that OnOver
function to run. This is how that part of my code looks:

function myOnLoadCompleteHandler( event:Event ):void{

trace(daeFile.getChildByName("COLLADA_Scene").getChildByName("polySurface1").childrenList());
daeFile.getChildByName("COLLADA_Scene").getChildByName("polySurface1").addEventListener(InteractiveScene3DEvent.OBJECT_OVER,
onOver );
}
//
function onOver(evt:InteractiveScene3DEvent):void
{
   trace("onOver");
}

Any ideas?



oletk wrote:
>
> You have to create the function.
>
> public function onOver(evt:InteractiveScene3DEvent):void{
>     // Function properties here.
> }
>
>
> On Fri, May 29, 2009 at 7:18 AM, boysknow
> <simonwestlake76@...>wrote:
>
>>
>> Anyone know how to update this code from zhivko? I get the following
>> error:
>> "1120: Access of undefined property onOver"
>>
>>  I'm assuming its because I'm running PV3D 2.0?
>>
>> My code looks like this:
>> //
>> daeFile.addEventListener(FileLoadEvent.LOAD_COMPLETE,
>> myOnLoadCompleteHandler);
>> //
>> function myOnLoadCompleteHandler( event:Event ):void{
>>
>> daeFile.getChildByName("COLLADA_Scene").getChildByName("polySurface1").addEventListener(InteractiveScene3DEvent.OBJECT_OVER,
>> onOver );
>> }
>>
>>
>> zhivko wrote:
>> >
>> > Hi Mark,
>> >
>> > had the same problem. You need to attach the event to a child of the
>> DAE
>> > object, not to the DAE object directly. It is a bit quirky getting down
>> to
>> > the name of the child - you need to attach a Event.COMPLETE to your
>> DAE,
>> > and within it try trace myDAE.childrenList() to get the name of the
>> first
>> > object in your DAE, then myDAE.getChildByName("name of the first object
>> in
>> > your DAE").childrenList() and so on until you reach the innermost
>> object.
>> > my code looked like this:
>> >
>> >
>> > var plane:DAE = new DAE();
>> > plane.load("plane.dae", materialsList);
>> > plane.scale = 100;
>> > default_scene.addChild(plane);
>> > plane.addEventListener(Event.COMPLETE, daeCompleteHandler);
>> > function daeCompleteHandler( event:Event ):void
>> >       {
>> >
>> plane.getChildByName("COLLADA_root").getChildByName("Plane").getChildByName("6").addEventListener(
>> > InteractiveScene3DEvent.OBJECT_OVER, onOver );
>> >       }
>> >
>> >
>> >
>> > mlp1 wrote:
>> >>
>> >>
>> >> Hi
>> >>
>> >> I'm trying to set an interactive material on an imported max model,
>> all
>> >> the examples i've seen use papervision primitives, do interactive
>> >> materials work on dae imports?
>> >>
>> >> I have set the viewport as interactive
>> >> var viewport:Viewport3D = new Viewport3D(0, 0, true, true);
>> >>
>> >> Here's how im setting the materials;
>> >>    controlMat01 = new BitmapAssetMaterial("rewind_jpg");
>> >> controlMat01.interactive = true;   controlMat01.name =
>> "rewind_button";
>> >> mats.addMaterial(controlMat01, "vid_control01");
>> >>
>> >> Here's my button code and event called after the dae loads
>> >> private function setModel(e:Event):void {   trace("setModel called");
>> >> var vidButton01 :DisplayObject3D = dae.getChildByName( "vid_button01"
>> );
>> >> vidButton01.addEventListener( InteractiveScene3DEvent.OBJECT_PRESS,
>> >> onObjPress);   trace("vidButton01.x "+vidButton01.x);}function
>> >> onObjPress( e:InteractiveScene3DEvent ):void {   trace("press on " +
>> >> e.face3d.material.name);
>> >> }
>> >>
>> >> But it don't work... any ideas.
>> >>
>> >> Cheers Mark
>> >>
>> >> _________________________________________________________________
>> >> Get Hotmail on your mobile, text MSN to 63463!
>> >> http://mobile.uk.msn.com/pc/mail.aspx
>> >> _______________________________________________
>> >> Papervision3D mailing list
>> >> Papervision3D@...
>> >> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/InteractiveScene3DEvent-and-dae-models-tp15850889p23774372.html
>> Sent from the Papervision3D mailing list archive at Nabble.com.
>>
>>
>> _______________________________________________
>> Papervision3D mailing list
>> Papervision3D@...
>> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>

--
View this message in context: http://www.nabble.com/InteractiveScene3DEvent-and-dae-models-tp15850889p23775755.html
Sent from the Papervision3D mailing list archive at Nabble.com.




_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org



_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org



_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org