Search code examples
away3d

Is it possible to contain the view3d instance into a movieclip ?


Trying to do something like this :

   _plane = new Mesh(new PlaneGeometry(124, 179), new TextureMaterial(Cast.bitmapTexture( CardBack)));
   _view.scene.addChild(_plane);

   container_mc.addChild(_view);
    addChild(container_mc);

    container_mc.scaleX =0.5

But i cannot see the plane, getting sqeezed in the x dimension ? So, is there something wrong i am doing here?


Solution

  • away3d 4 uses stage3D API for this reason you have to use objectcontainer3D scene graph for hold all mesh & other display object.

    update : you can use movieclip but it isn't possible to add any mesh & model object into the away3d scene graph. For inspiration you can add your score bar or other element like this;

    // you should add main your class 
    var scoreDisplay : MovieClip = new ScoreDisplay();
    addChild(scoreDisplay);
    

    now your code should be like that

    var container_mc:ObjectContainer3D = new ObjectContainer3D();
    _view.scene.addChild(container_mc);
    
    _plane = new Mesh(new PlaneGeometry(124, 179), new TextureMaterial(Cast.bitmapTexture( CardBack)));
    _view.scene.addChild(_plane);
    
    container_mc.addChild(_view);
    addChild(container_mc);
    container_mc.scaleX =0.5