Skip navigation
Currently Being Moderated

Away 3D question (not AwayBuilder yet)

Jul 19, 2013 2:58 PM

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.

 
Replies

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points