I'm have imported an OBJ file with texture (a shark). It shows up fine
when I compile.

I want to make multiple instances of the same shark and place 10 of
them next to each other. I have tried it, but only one shark shows up
every time. Some help would be greatly appreciated.

Here is the code I tried:

ResourceManager.instance.addEventListener(ResourceEvent.RESOURCE_RETRIEVED,
onResourceRetrieved);
                        _container =
ObjectContainer3D(ResourceManager.instance.parseData(new OBJ(),
"shark", true));
                        _container.scale(90);
                        _container.y = -400;
                        _view.scene.addChild(_container);

                        _container2 =
ObjectContainer3D(ResourceManager.instance.parseData(new OBJ(),
"shark", true));
                        _container.y = -400;
                        _container2.x = 200;
                        _view.scene.addChild(_container2);

private function onResourceRetrieved(ev : ResourceEvent) : void
                {
                        var mesh : Mesh;
                        var len : uint = _container.numChildren;
                        var material : BitmapMaterial = new BitmapMaterial(new
Albedo().bitmapData);
                        material.gloss = 10;
                        material.lights = [ _yellowLight, _blueLight ];
                        material.specular = .25;

                        for (var i : uint = 0; i < len; ++i) {
                                mesh = Mesh(_container.getChildAt(i));
                                mesh.material = material;
                        }
                }

Reply via email to