I would do the following test app:

1. Create a simple app with 2 views running side by side.
2. Put different primitives spinning around in each view / scene
3. Place buttons to disable render and visibility of the views on click
4. Place buttons to enable render and visibility of the view on click

Having done the above steps should solve your problem.
If not, try loading in swf's running your views.

D



On 23 October 2011 19:57, Hamid Reza <eabluebir...@gmail.com> wrote:

> Thanks Diogo , but i have lots of different objects to load im my
> views , and each view got different backgrounds, and so on , if you,
> do you think is there any way i can solve this problem , i have posted
> some part of my sample code in here .. thanks
>
>
>
>
>
>
> in this main class i do the switching btween my views
> (myNinja3d:MyNinja3d and friendNinja3d:FriendNinja3d )
>
>
> // Main Class ----------------------
>
>
> [SWF(width="760", height="640" , backgroundColor="#95E795",
> frameRate="30")]
>
>        public class Main extends Sprite
>        {
>                private var myNinja3d:MyNinja3d;
>                private var friendNinja3d:FriendNinja3d;
>
>                public function Main()
>                {
>
>
>                        myNinja3d = new MyNinja3d();
>                        friendNinja3d = new FriendNinja3d();
>
>
>                        addChild(myNinja3d.view);
>
>
>                        stage.addEventListener(KeyboardEvent.KEY_DOWN,
> onKeyDown);
>                }
>
>
>
>
>                private function onKeyDown(event : KeyboardEvent) : void
>                {
>                        if(event.keyCode == Keyboard.SPACE)
>                        {
>                                if(GlobalClass.currentScene == "MyNinja3d")
>                                {
>                                        removeChild(myNinja3d.view);
>
>                                        addChild(friendNinja3d.view);
>                                        GlobalClass.currentScene =
> "FriendNinja3d";
>
>                                }else if(GlobalClass.currentScene ==
> "FriendNinja3d")
>                                {
>                                        removeChild(friendNinja3d.view);
>
>                                        addChild(myNinja3d.view);
>                                        GlobalClass.currentScene =
> "MyNinja3d"
>                                }
>                        }
>                }
>
>  -----------------------------------
>
>
>
>
> this class extends my world 3d class and i simply add a cube on it
> with adiffrent background color and onframe enter it moves the cube
>
> // MyNinja3d class -----------------------
>
> package myClasses
> {
>        import away3d.materials.BitmapMaterial;
>        import away3d.primitives.Cube;
>
>        import flash.display.BitmapData;
>        import flash.events.Event;
>
>        public class MyNinja3d extends World3d
>        {
>                public var myTestCube:Cube;
>
>                public function MyNinja3d()
>                {
>                        view.backgroundColor = 0X0000CC;
>
>                        testAddCube();
>
>                        this.addEventListener(Event.ENTER_FRAME,
> enterFrame,false,0,true);
>                }
>
>                private function enterFrame(event:Event):void
>                {
>                        if( GlobalClass.currentScene == "MyNinja3d" )
>                        {
>                                view.render();
>
>                                myTestCube.rotationX += 2;
>                                myTestCube.rotationY += 2;
>
>                                trace("MyNinja3d")      ;
>                        }
>
>                }
>
>
>                public function testAddCube():void
>                {
>                        var bmp : BitmapData = new BitmapData(64,64);
>                        bmp.perlinNoise(200, 200, 2, Math.random(), true,
> true);
>                        var mat : BitmapMaterial = new BitmapMaterial(bmp);
>
>                        myTestCube = new Cube();
>                        myTestCube.scale(4);
>
>                        myTestCube.material = mat;
>
>                        this.view.scene.addChild(myTestCube);
>                }
>        }
> }
>
>  -----------------------------------
>
>
> // FriendNinja3d class ------------------
>
> package myClasses
> {
>        import away3d.materials.BitmapMaterial;
>        import away3d.primitives.Cube;
>
>        import flash.display.BitmapData;
>        import flash.events.Event;
>
>        public class FriendNinja3d extends World3d
>        {
>                public var friendTestCube:Cube;
>
>                public function FriendNinja3d()
>                {
>                        view.backgroundColor = 0XFF00CC;
>
>                        friendTestAddCube();
>
>                        this.addEventListener(Event.ENTER_FRAME,
> enterFrame,false,0,true);
>                }
>
>                private function enterFrame(event:Event):void
>                {
>                        if( GlobalClass.currentScene == "FriendNinja3d" )
>                        {
>                                view.render();
>
>                                friendTestCube.rotationX -= 0.5;
>                                friendTestCube.rotationY -= 0.5;
>
>                                trace("FriendNinja3d");
>                        }
>
>                }
>
>
>                public function friendTestAddCube():void
>                {
>                        var bmp : BitmapData = new BitmapData(64,64);
>                        bmp.perlinNoise(200, 200, 2, Math.random(), true,
> true);
>                        var mat : BitmapMaterial = new BitmapMaterial(bmp);
>
>                        friendTestCube = new Cube();
>                        friendTestCube.scale(3);
>
>                        friendTestCube.material = mat;
>
>                        this.view.scene.addChild(friendTestCube);
>                }
>        }
> }
>
> ----------------------------
>
>
>
>
> world 3d class is simply initial 3d scene
>
>
> //  world 3d class ---------------------------
>
>        public class World3d extends Sprite
>        {
>                public var view:View3D;
>
>                public function World3d()
>                {
>                        initWorld();
>                }
>
>                private function initWorld():void
>                {
>                        view = new View3D();
>                        setViewSize((Main.instance.stage.stageWidth),
> (Main.instance.stage.stageHeight));
>                        setViewPosition();
>
>                }
>
>                public function setViewSize(worldWidth:int ,
> worldHeight:int):void
>                {
>                        view.width = worldWidth;
>                        view.height = worldHeight;
>                }
>
>                public function setViewPosition(worldX:int = 0, worldY:int =
> 0):void
>                {
>                        view.x = worldX;
>                        view.y = worldY;
>                 }
>
>        }
>
> }
>
>
>
>
>
>
>
>
>
>
> On Oct 23, 10:44 pm, Diogo Moraes <srto....@gmail.com> wrote:
> > wouldn't it be easier to switch only the current camera?
> >
> > 2011/10/23 Hamid Reza <eabluebir...@gmail.com>
> >
> >
> >
> >
> >
> >
> >
> > > Hi every body,
> > > I have created 2 simple 3d views and what im trying to do is to switch
> > > between these 2 views , what i do at first i add the first view using
> > > addchild() and through some events i remove the current child using
> > > removechild() and then ad the other view ,, till here it works fine ,
> > > i can go to the new view , but once i want to switch back ( what i do
> > > remove the current view and add the view which i previously removed )
> > > the view dose not change , it just stops the current view
> > > interactions . if i do the switch action again the current view starts
> > > interaction agin, and seems like the last view is totally replaced ,
> > > dose and body can help me about it ? Thanks
>

Reply via email to