Skip navigation
Currently Being Moderated

"Hello, world" example

Jun 21, 2012 11:37 AM

I always like to start with the very basics to get a sense of how a new system works.  For this, you can't beat a classic "Hello, world" example.  There are some great tutorials and samples included with Proscenium, but they start quite a bit further up the complexity level than that.  So I've just worked backwards until I couldn't get it any simpler.  This just creates a cube and a light to see it by.  Nothing else.

 

package
{
     // Import required libraries
     import com.adobe.scenegraph.BasicScene;
     import com.adobe.scenegraph.MeshUtils;
     import com.adobe.scenegraph.SceneLight;
     import com.adobe.scenegraph.SceneMesh;
     
     
     // Extend BasicScene, the Proscenium scene framework
     public class HelloWorld extends BasicScene
     {
          
          // BasicScene will call initLights() to create lights
          override protected function initLights():void
          {
               // Create a point light
               var light:SceneLight = new SceneLight(SceneLight.KIND_POINT);
               
               // Add it to the scene
               scene.addChild(light);
          }
          
          
          // BasicScene will call initModels() to create models
          override protected function initModels():void
          {
               // Create a cube
               var cube:SceneMesh = MeshUtils.createCube();
               
               // Move it into view
               cube.appendTranslation(0, 0, -2);
               
               // Add it to the scene
               scene.addChild(cube);
          }
     }
}
 
Replies

More Like This

  • Retrieving data ...

Bookmarked By (0)