Get Child By Name

Software: Away3D 4.x

OlivierHuntemann, Newbie
Posted: 07 June 2013 12:35 AM   Total Posts: 2

Hi All,

I’ve needed some features as getting child by name and i’ve not found anything about that in current revision, so… i’ve added it myself, if it can help someone…

Open awayd3d/containers/ObjectContainer3D.as :

          public function getChildByName(childName:String)
  {
  for (var i:int = 0; i < _children.length; i++) {
  if (_children.name == childName) {
    return _children;
  }
    }
  return null;
  }

Open away3d/containers/Scene3D.as :

          public function getChildByName(childName:String)
  {
  for (var i:int = 0; i < _sceneGraphRoot.numChildren; i++) {
  if (_sceneGraphRoot.getChildAt(i).name == childName) {
    return _sceneGraphRoot.getChildAt(i);
  }
    }
  return null;
  }


And then I’ve compiled the swc file with Flash Builder, you can do it too.

Updated revision in attachment,

Thanks all

 

File Attachments
Away3D.swc  (File Size: 870KB - Downloads: 0)
   

Pierce, Jr. Member
Posted: 07 June 2013 05:38 PM   Total Posts: 40   [ # 1 ]

You should be able to get this functionality by utilizing the AssetLibrary. I recommend studying those classes at length as they can be extremely useful across most projects.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X