Author Topic: info_object  (Read 524 times)

Daimon Fox   «   on: July 24, 2012, 06:56:58 PM »
Hi Ivan,
need h?lp when I click on object appeared information http://img826.imageshack.us/img826/1158/boxw.jpg in my case is the name of object, here some code  http://pastebin.com/BTyJ0Rwq



Sam Chau   «   Reply #1 on: July 25, 2012, 12:18:29 PM »
stage.addChild(txt);

Daimon Fox   «   Reply #2 on: July 26, 2012, 10:36:56 AM »
for XML is probably value  object.getChildByName(node.@named)  ?

Sam Chau   «   Reply #3 on: July 26, 2012, 10:50:57 AM »
If you need to retrieve the name to pass to your textfield, that would not help as you would need to know the name first in order to call getChildByName()

After the ojbect instantiation code (line 20), you can add:
object.name = node.@id;

Now, in the MouseEvent you should be able to get the name using e.target.name (txt.text = e.target.name).

Sam Chau   «   Reply #4 on: July 26, 2012, 10:51:48 AM »
sorry, it should be object.name = node.@named;

Daimon Fox   «   Reply #5 on: July 26, 2012, 11:47:41 AM »
Thx. Sam for help!
but why I do not see the name when move an object I can not understand, no errors ?

Sam Chau   «   Reply #6 on: July 26, 2012, 11:57:03 AM »
Have you tried tracing out the e.target.name? It may not return the object (Pivot3D) but a child of it instead (Mesh3D).

If you mean the textbox isn't showing, have you tried the code I wrote in my first post?

Daimon Fox   «   Reply #7 on: July 26, 2012, 12:22:47 PM »

Sam Chau   «   Reply #8 on: July 26, 2012, 12:36:57 PM »
Change e.target.name (txt.text = e.target.name) to just txt.text = e.target.name. I probably should have been clearer. Maybe also try trace("object name = " + e.target.name);

Sam Chau   «   Reply #9 on: July 26, 2012, 12:37:52 PM »
Also, MouseEvents should be MouseEvent3D

Daimon Fox   «   Reply #10 on: July 26, 2012, 01:28:44 PM »
here there is a problem when the test - scale

             scene.addEventListener( MouseEvent3D.MOUSE_OVER, mouseOverEvent );
             scene.addEventListener( MouseEvent3D.MOUSE_OUT, mouseOutEvent );
            
            private function mouseOverEvent(e:MouseEvent3D):void    {
                e.target.setScale( 1.2, 1.2, 1.2 );
            }           
            private function mouseOutEvent(e:MouseEvent3D):void     {
                e.target.setScale( 1, 1, 1 );
            }
when loaded object through XML - box.f3d he did not see, but when   created primitive cube-type scale works !


Daimon Fox   «   Reply #11 on: July 27, 2012, 08:15:54 AM »
"Maybe also try trace("object name = " + e.target.name);"

trace I can not do, work with Adobe Flash CS5.5 - an error =>
        Error #1014:Could not find class flash.display3D::Context3D - only I see the result in HTML :(

Daimon Fox   «   Reply #12 on: July 27, 2012, 01:00:19 PM »
guys help plz, as reach object for function scale http://pastebin.com/pcHEKWwu

Ivan Vodopiviz   «   Reply #13 on: July 27, 2012, 01:44:00 PM »
Adding the event listeners to the scene won't work, you have to add them to the objects themselves. Something like this: http://pastebin.com/5TLj7DAh


Daimon Fox   «   Reply #14 on: July 27, 2012, 02:46:38 PM »
I wrote, when created primitive type - cub it works, but in me when loaded object through XML
 not working, how to find path   to object?