Hello.

I am trying to load double side object from 3ds file. After digging
into archive I have created such a code

package {
        import flash.display.*;
        import flash.events.*;
        import away3d.core.base.*;
        import away3d.containers.*;
        import away3d.primitives.*;
        import away3d.materials.*;
        import away3d.loaders.*;

        public class Tailor extends Sprite {
                var view:View3D;
                var obj:Object3DLoader;
                var obj2:Object3DLoader;
                var obj3:Object3DLoader;
                var obj4:Object3DLoader;
                var loadedObjects:Number;
                var material:BitmapFileMaterial;

                function Tailor() {
                        stage.frameRate=60;
                        addEventListener(Event.ENTER_FRAME,away3dloop);
                        away3dcreate();
                }
                function away3dcreate():void {
                        addChild(view=new View3D({x:stage.stageWidth/2, 
y:stage.stageHeight/
2}));
                        material = new 
BitmapFileMaterial("assets/cloth120.jpg",{color:
0xFF0000,repeat:true, scaleX:0.3, scaleY:0.3,smooth:true});
                        obj = 
Max3DS.load("assets/men_normal_fit.3DS",{material:material});
                        obj.addOnSuccess(objOnSuccess);
                        autoZoom(obj.handle);
                }
                function setBothSides(container:ObjectContainer3D) {
                for each (var child:Object in obj.children) {
                                if (child is ObjectContainer3D)
                {
                        this.setBothSides(child as ObjectContainer3D);
                }
                else
                                if (child is Mesh) {
                                        trace("FOUNDED MESH!!!");
                                        (child as Mesh).bothsides = true;
                                        (child as Mesh).back = material;
                                }
                        }
                }
                function objOnSuccess(event:Event):void {
                        view.scene.addChild(obj.handle);
                        setBothSides(obj);
                }
}

So actually I try to find meshes in loaded ObjectContainer3D and set
bothsides for all of them. I got trace error 1 time, but bothsides
didnt set.

Any suggestions on how I can activate bothsides mode for the 3ds
object?

Online demo is here
http://files.rightinpoint.com/3d_5iZJeQ/tailor.html

Reply via email to