That made the cube display, thanks!

On Sat, Jun 11, 2011 at 3:05 PM, Choons <chadkim...@gmail.com> wrote:
> Cube needs a material.
>
> import away3d.materials.ColorMaterial;
>
> add to initObjects:
> var myMaterial:ColorMaterial = new ColorMaterial(0xFF0000);
> cube.material = myMaterial
>
> I've never seen that example either. Looks like it's from back when
> objects got a default material?
>
> On Jun 11, 1:25 pm, Jeffrey Kesselman <jef...@gmail.com> wrote:
>> It doesn't look like anything that FB would automatically create.  Its
>> in my Broomstick example project pulled from the SVN.  Code below:
>>
>> package
>> {
>>         import flash.display.Sprite;
>>         import flash.events.Event;
>>         import away3d.containers.*;
>>         import away3d.lights.PointLight;
>>         import flash.display.StageAlign;
>>         import flash.display.StageScaleMode;
>>         import away3d.primitives.Cube;
>>
>>         public class Main extends Sprite
>>         {
>>
>>                 private var _view : View3D;
>>                 //private var _ctr : ObjectContainer3D;
>>                 private var _light : PointLight;
>>
>>                 public function Main()
>>                 {
>>                         addEventListener(Event.ADDED_TO_STAGE, init);
>>
>>                 }
>>
>>                 private function init(e:Event):void
>>                 {
>>                         _view = new View3D();
>>                         initView();
>>                         initObjects();
>>                         this.addEventListener(Event.ENTER_FRAME, 
>> _handleEnterFrame);
>>                 }
>>
>>                 private function initView():void
>>                 {
>>                         _view = new View3D();
>>
>>                         this.addChild(_view);
>>                         _view.camera.x = 50;
>>                         _view.camera.y = 100;
>>                         _view.camera.z = -800;
>>
>>                         _light = new PointLight();
>>                         _light.x = -1000;
>>                         _light.y = 1000;
>>                         _light.z = -1000;
>>                         _light.radius = 1000;
>>                         _light.fallOff = 4000;
>>                         _light.color = 0x66FFFFF;
>>
>>                         _view.scene.addChild(_light);
>>
>>                         stage.scaleMode = StageScaleMode.NO_SCALE;
>>                         stage.align = StageAlign.TOP_LEFT;
>>                         stage.addEventListener(Event.RESIZE, onStageResize);
>>                 }
>>
>>                 private function initObjects():void
>>                 {
>>                         var cube:Cube = new Cube();
>>                         _view.scene.addChild(cube);
>>                 }
>>
>>                 private function onStageResize(event : Event) : void
>>                 {
>>                 _view.width = stage.stageWidth;
>>                 _view.height = stage.stageHeight;
>>                 }
>>
>>                 private function _handleEnterFrame(ev : Event) : void
>>                 {
>>                         _view.render();
>>                 }
>>         }
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> }
>> On Sat, Jun 11, 2011 at 2:13 PM, richardolsson <r...@richardolsson.se> wrote:
>> > What is this "Main.as" that you are referring to? Is it not just what
>> > your IDE (e.g. FlashDevelop) creates as a main entry point? I don't
>> > believe we are supplying any example class called "Main.as", so where
>> > are you getting it from, and what does it contain?
>>
>> > Cheers
>> > /R
>>
>> > On Jun 11, 5:56 pm, Jeffrey Kesselman <jef...@gmail.com> wrote:
>> >> So, Main.as looks on paper to be exactly what i am looking for in a
>> >> "HelloWorld", a minimal display of a cube.
>>
>> >> When i run it however all I get is a black view.
>>
>> >> is it broken or am I doing something wrong still? AnimatedBitmapTest
>> >> seems to run fine.
>>
>> >> JK
>>
>> >> --
>> >> It's always darkest just before you are eaten by a grue.
>>
>> --
>> It's always darkest just before you are eaten by a grue.



-- 
It's always darkest just before you are eaten by a grue.

Reply via email to