6 Replies Latest reply on Mar 10, 2009 3:56 AM by nikos101

    papervision3d plane

    nikos101 Level 2
      What's the easiest way to add a canvas with all its children to a papervision3d plane?
        • 1. Re: papervision3d plane
          nikos101 Level 2
          I figured it out:

          var movieMat:MovieMaterial=new MovieMaterial(it);

          <mx:Canvas id="canvasPv3D" width="511" height="434" y="10" x="15.5" backgroundColor="#FFFFFF"/>
          <mx:Panel x="177" y="452" width="266" height="116" layout="absolute" id="it">
          <mx:Button x="10" y="44" label="Button"/>
          </mx:Panel>
          • 2. Re: papervision3d plane
            nikos101 Level 2
            However the annoying thing is that if I create a component and instantiate it in the parent application:

            private var canv2:Test = new Test();

            var movieMat2:MovieMaterial=new MovieMaterial(canv2,true,true,true);
            movieMat2.smooth = true;
            movieMat2.interactive = true;


            and then assign this to the movie material, I see nothing. However if I define the component in the parent mxml and give it an ID then it works.

            Any ideas whats going on?
            • 3. Re: papervision3d plane
              Level 7

              "nikos101" <webforumsuser@macromedia.com> wrote in message
              news:gootiq$p46$1@forums.macromedia.com...
              > However the annoying thing is that if I create a component and instantiate
              > it
              > in the parent application:
              >
              > private var canv2:Test = new Test();
              >
              > var movieMat2:MovieMaterial=new MovieMaterial(canv2,true,true,true);
              > movieMat2.smooth = true;
              > movieMat2.interactive = true;
              >
              >
              > and then assign this to the movie material, I see nothing. However if I
              > define
              > the component in the parent mxml and give it an ID then it works.
              >
              > Any ideas whats going on?

              Try:

              canv2.setActualSize(canv2.measuredWidth, canv2.measuredHeight);

              If that doesn't work, try adding the canvas to the display list.

              HTH;

              Amy


              • 4. Re: papervision3d plane
                nikos101 Level 2
                Wow thanks Amy

                canv2.setActualSize(canv2.measuredWidth, canv2.measuredHeight)

                works a treat.
                • 5. Re: papervision3d plane
                  nikos101 Level 2
                  After researching this more only
                  this.addChild(canv2);
                  gets it added to the display list instead of :

                  canv2.setActualSize(canv2.measuredWidth, canv2.measuredHeight);

                  • 6. Re: papervision3d plane
                    nikos101 Level 2
                    Sorry to keep coming back to this.
                    The problem with this.addChild(canv2); Is that I draws it onto the application, I don't want to actually see this extra child. I just want it to be visible as a material in my 3d objects. Do you think the only work around would be to set this child to a canvas and just set the canvas to not visible, so that my material will render?