1 Reply Latest reply on Jul 19, 2013 3:44 PM by markerline

    Away 3D question (not AwayBuilder yet)

    markerline Level 4

      Hi.  I am trying to instantiate a simple Sphere with a Class called SphereDemo.as .

       

      Here is the code for that class:

       

      package

      {

          import away3d.Away3D;

          import away3d.primitives.SphereGeometry;

       

          public class SphereDemo extends Away3D

          {

              public function SphereDemo()

              {

                  super();

              }

              public function initScene(stage:Object):void

              {

                  //super.init();

                  var sphere:SphereGeometry = new SphereGeometry(50,15,12,true);

                  var obj:Object = new Object();

                  obj.x=0;

                  obj.y=0;

                  obj.z=500;

                  //sphere=new SphereGeometry(obj);

                  stage.addChild(sphere);

              }

          }

      }

       

      ----------------------------------------

      and here is my code for the mxml document:

       

      <?xml version="1.0" encoding="utf-8"?>

      <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"

                             xmlns:s="library://ns.adobe.com/flex/spark"

                             xmlns:mx="library://ns.adobe.com/flex/mx"

                             creationComplete="init();">

          <fx:Declarations>

              <!-- Place non-visual elements (e.g., services, value objects) here -->

          </fx:Declarations>

          <fx:Script>

              <![CDATA[

                  //import SphereDemo;

                 

                  public function init():void{

                      SphereDemo;

                  }

                 

              ]]>

          </fx:Script>

      </s:WindowedApplication>

      --------------------------------------------

       

      Why won't the SphereDemo display a sphere?  How can I position the Sphere so it shows up in the camera.  My initial belief is since I'm not getting any errors the sphere is behind the camera at the present.