Nothing happens when I try to render a cube using Away3D

658 Views Asked by At

when I try to render a cube using Away3D + Molehill, I only get a white default screen, I followed the instructions here: http://johnlindquist.com/2011/02/28/quickstart-for-molehill-and-away3d/

The only thing I did not do, was the part that talks about the patch, cuz If I do that I get errors like when I try to import the Sprite class, for example.

Im using FB 4.5.

Thanks!

This is my code:

package
{
    import away3d.containers.View3D;
    import away3d.materials.ColorMaterial;
    import away3d.primitives.Cube;

    import flash.display.Sprite;
    import flash.events.*;

    public class Molehill extends Sprite
    {
        private var view:View3D;
        private var cube:Cube;

        public function Molehill()
        {
            view = new View3D();
            addChild(view);

            var material:ColorMaterial = new ColorMaterial(0xFF0000);
            cube = new Cube(material);

            view.scene.addChild(cube);

            addEventListener(Event.ENTER_FRAME, onEnterFrame);

        }

        private function onEnterFrame(e:Event):void
        {
                cube.rotationY += 10;
        }
    }
}
1

There are 1 best solutions below

0
On

Everything is OK in your code if you have added in onEnterFrame view.render();.

Make sure that you have set wmode to "direct" in html-template/index.template.html and that you have downloaded beta release of Flash Player.