Ah, responded too soon... Away3D 4 uses Stage3D, there is only 1 of these
and Away3D 4 is still in alpha... Probably got a few static / singleton
instances going on in the API and Stage3D being the only place GPU 3D can be
rendered then is probably going to cause some issues.

See what happens with multiple swfs if not place all the objects and
backgrounds in 1 scene just keep them quite far apart so they are never in
view and you can then just move the camera.

D



On 25 October 2011 03:44, Darcey Lloyd <[email protected]> wrote:

> if the view is in a sprite / movieclip try setting that visible = false;
> not the view. Same for mxml ui components.
>
>
> On 24 October 2011 19:36, Hamid Reza <[email protected]> wrote:
>
>> yes i think , i need to go for loading SWFs , but still the question
>> is for me that why we cannot change the visibility of views , the only
>> way i can remove a view from the stage is when i dispose the view
>> (view.dispose) ,,, view.visible = false or removechild(view) both of
>> them they do not remove the view from the stage. im using away 3d 4
>>
>> On Oct 24, 11:37 pm, Darcey Lloyd <[email protected]> wrote:
>> > Probably best to load SWFs in then with each view in each SWF, or hunt
>> down
>> > the singleton instances in the Away3D version you are using.
>> >
>> > On 24 October 2011 08:42, Hamid Reza <[email protected]> wrote:
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > > Thanks for the advice ,
>> > > i also have tried the same thing , but unfortunately it didn't work
>> > > for me , what i figured out was , if we have 2 views the view which is
>> > > added the latest is kinda take over the whole app 3d view and if we
>> > > want to switch to the prevues views again we need to initial them
>> > > again  .
>> >
>> > > On Oct 24, 8:46 am, Darcey Lloyd <[email protected]> wrote:
>> > > > 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 <[email protected]>
>> 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 <[email protected]> wrote:
>> > > > > > wouldn't it be easier to switch only the current camera?
>> >
>> > > > > > 2011/10/23 Hamid Reza <[email protected]>
>> >
>> > > > > > > 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