private function onComplete(e:LoaderEvent):void{
                        for(var i:uint = 0; i<100; i++){
                                                                var 
ObjContainer:ObjectContainer3D = new ObjectContainer3D();
                                                                ObjContainer  =
ObjectContainer3D(AssetLibrary.getAsset('main'));
                                                                fishArr[i] = 
new ObjectContainer3D();
                                                                for(var j:uint 
= 0; j<ObjContainer.numChildren; j++)
                                                                {
                                                                        var 
obj3D:Object3D = new Object3D();
                                                                        obj3D = 
ObjContainer.getChildAt(j).clone();
////////////////
/// The object above returns the cloned object3d and I can see it in
the debugger but when I go to cast it as ObjectContainer3D it is then
null.
/////////////
                                                                        
fishArr[i].addChild(obj3D as ObjectContainer3D);
                                                                }
                                                                fishArr[i] .x = 
randRange(0,600);
                                                                fishArr[i] .y = 
randRange(0,600);
                                                                fishArr[i] .z = 
randRange(0,600);
                                                                
_view.scene.addChild(fishArr[i]);
                        }


Is this a bug?  I should be able to cast an Object3D as an
ObjectContainer3D and then add it as a child.  Please let me know if
this is a bug or I am simply doing this incorrectly thanks in advance.


On May 10, 1:29 am, richardolsson <[email protected]> wrote:
> Cloning is (currently at least) completely unrelated to the library.
> Do it the same way you always have. Get the asset you want to clone
> (e.g. through the library getAsset() method, or any other way) and
> invoke that object's clone method. If something is not working, let us
> know.
>
> /R
>
> On May 10, 4:28 am, seacloud9 <[email protected]> wrote:
>
>
>
>
>
>
>
> > Questions:
> > 1)What is the easiest way to clone anObject3Dproperly.
> > 2) Is their a new way to do this task with the Asset Library?
> > It also looks like this guys is having the same 
> > issue.http://groups.google.com/group/away3d-dev/browse_thread/thread/b1bbc2...
>
> > I could always hack the library to make it do what I need it to do but
> > I would prefer a clean and recommended solution for the best possible
> > outcome.  Thank you again!  You guys are really doing an excellent job
> > on the library so I think you can understand my enthusiasm.  -Thanks
>
> > On May 8, 10:44 pm, seacloud9 <[email protected]> wrote:
>
> > > I noticed the new changes to implement the Asset Loader and Loader3D
> > > class here 
> > > ->http://groups.google.com/group/away3d-dev/browse_thread/thread/7ae67b...
>
> > > I have downloaded the latest code and now I have the code able to
> > > place an AWD file in the scene.  I noticed that on the loader3D
> > > "handle" is not an option.  The AWD once parsed becomes and
> > >ObjectContainer3D.
>
> > > I guess I am still having some confusion when it comes to Cloning.
>
> > > Questions:
> > > 1)What is the easiest way to clone anObject3Dproperly.
> > > 2) Is their a new way to do this task with the Asset Library?
>
> > > It also looks like this guys is having the same 
> > > issue.http://groups.google.com/group/away3d-dev/browse_thread/thread/b1bbc2...
>
> > > Side Note:
> > > I noticed that the loader3D class automagically loads the model into
> > > the AssetLibrary awesome work and I like the new feature to embed a
> > > file and the ability to embed just the parsers you need.  Awesome
> > > looks like you guys are really making leaps and bounds on a daily
> > > basis so thanks for all your hard work.
>
> > > Thanks in advance for all the help and advice.
>
> > > On May 2, 6:45 am, seacloud9 <[email protected]> wrote:
>
> > > > Thanks @richardolsson looking forward to seeing the documentation.
>
> > > > On May 2, 4:40 am, richardolsson <[email protected]> wrote:
>
> > > > > @Seacloud9:
> > > > > Be advised that there will be a major refactor to the loading code
> > > > > pushed to github later today or tomorrow. It completely removes the
> > > > > ResourceManager, so you will need to take a look at the new ways of
> > > > > loading. I will publish a document detailing this when I push, but in
> > > > > the meantime you can check my fork at github.com/richardolsson if you
> > > > > want to se what's going on.
>
> > > > > Cheers
> > > > > /R
>
> > > > > On May 2, 2:09 am,seacloud9<[email protected]> wrote:
>
> > > > > > Thank you I have seen that 
> > > > > > examplehttps://github.com/away3d/away3d-examples-broomstick/raw/master/src/L...
> > > > > > and I used the code to base much of what I have create off of.
>
> > > > > > I am trying to clone theObjectContainer3Dwithin -> function
> > > > > > onResourceRetrieved(e : ResourceEvent)
>
> > > > > > 1.Is their an easy way to retrieve the Mesh data with
> > > > > > ResourceManager.instance.getResource(url, false, AWD1Parser )  when
> > > > > > the object has been retrieved?
> > > > > > 2.What is the easiest way to clone theObjectContainer3D?
> > > > > > 3.Is their an easy way to retrieve a Mesh from anObjectContainer3D?
> > > > > > 4.It looks like in older versions of Away3D the loader3d had a 
> > > > > > handle
> > > > > > property where the mesh data was stored it now looks like the Away3D
> > > > > > AssetLoader class has a handle property that works similar.  So is 
> > > > > > it
> > > > > > required to use this class instead of the resource manager?
>
> > > > > > I have noticed lots of changes inBroomstickand it is awesome so
> > > > > > excellent work.
>
> > > > > > On May 1, 6:33 pm, Fabrice3D <[email protected]> wrote:
>
> > > > > > > I have added an example class for awd1. It will change soon as 
> > > > > > > awd2 is progressing nicely.
>
> > > > > > > But you should unless necessary, asign the resource only when the 
> > > > > > > complete event has fired.
>
> > > > > > > Fabrice
>
> > > > > > > On May 2, 2011, at 0:59,seacloud9<[email protected]> wrote:
>
> > > > > > > > It looks like in older versions of Away3D the loader3d had a 
> > > > > > > > handle
> > > > > > > > property where the mesh data was stored it now looks like the 
> > > > > > > > Away3D
> > > > > > > > AssetLoader class has a handle property that works similar.  So 
> > > > > > > > is it
> > > > > > > > required to use this class instead of the resource manager?
>
> > > > > > > > Is their an easy way to retrieve the Mesh data with
> > > > > > > > ResourceManager.instance.getResource(url, false, AWD1Parser )  ?
>
> > > > > > > > On May 1, 1:54 pm,seacloud9<[email protected]> wrote:
> > > > > > > >> Couple of questions it looks like after the object has been 
> > > > > > > >> added to
> > > > > > > >> the scene theObjectContainer3Dhas a protected item
> > > > > > > >> fish.implicitPartition._updatedEntityList.mesh this item 
> > > > > > > >> contains the
> > > > > > > >> mesh although it is protected.
> > > > > > > >> When I clone the fish it will return anObject3Dand that can be 
> > > > > > > >> cast
> > > > > > > >> to anObjectContainer3Dbut when I add it to the scene it 
> > > > > > > >> complains
> > > > > > > >> because it is null?  I do see that most of the parsers parse 
> > > > > > > >> out the
> > > > > > > >> data and then place the item in anObjectContainer3Dthe 
> > > > > > > >> exception to
> > > > > > > >> this case so far being the md5mesh that will return a mesh.
>
> > > > > > > >> 1.What is the easiest way to clone theObjectContainer3D?
> > > > > > > >> 2. Is their an easy way to retrieve a Mesh from 
> > > > > > > >> anObjectContainer3D?
>
> > > > > > > >> I have been looking at the different methods and any input on 
> > > > > > > >> this
> > > > > > > >> would be greatly appreciated.
>
> > > > > > > >> fishArr[i] =ObjectContainer3D();
> > > > > > > >> for(var j:uint = 0; j<fish.numChildren; j++)
> > > > > > > >> {
> > > > > > > >>         fishArr[i].addChild(fish.getChildAt(j).clone() as
> > > > > > > >>ObjectContainer3D);
>
> > > > > > > >> }
>
> > > > > > > >> On Apr 27, 4:14 am, Fabrice3D <[email protected]> wrote:
>
> > > > > > > >>> yes, Sven is right, tho, to make it clearer, i would first 
> > > > > > > >>> parse to retrieve the mesh you do need,
> > > > > > > >>> then proceed the cloning
>
> > > > > > > >>> Also to make something clear, I read often remarks when 
> > > > > > > >>> people assume data is of different nature coming from a 
> > > > > > > >>> different type of 3d formats.
> > > > > > > >>> It is not true.
> > > > > > > >>> Each file format holds a description of objects, the parsers 
> > > > > > > >>> deserialize this info and "translate" it to a data structure 
> > > > > > > >>> that Away understands/can use.
> > > > > > > >>> Once this point is reached. Each and every bits of data is 
> > > > > > > >>> exactly the same, that you load from obj, 3ds, ac. collada or 
> > > > > > > >>> declare a new AS3 instance.
>
> > > > > > > >>> Fabrice
>
> > > > > > > >>> On Apr 27, 2011, at 1:28 AM, sven wrote:
>
> > > > > > > >>>> I have no experience with awd stuff, but with obj I had to 
> > > > > > > >>>> clone the meshes - cloning the ObjectContainer didn't work 
> > > > > > > >>>> for me.. So maybe try something like this in your loop:
>
> > > > > > > >>>> fishArr[i] =ObjectContainer3D();
> > > > > > > >>>> for(var j:uint = 0; j<fish.numChildren; j++)
> > > > > > > >>>> {
> > > > > > > >>>>         fishArr[i].addChild( 
> > > > > > > >>>> Mesh(fish.getChildAt(j).clone()) );
> > > > > > > >>>> }
>
> > > > > > > >>>> cheers,
> > > > > > > >>>> sven

Reply via email to