Thanks for the help so far. It really is appreciated.

@Pete I tried jpg and gif and still same error ...

@katopz I had tried that example before and I got it to work with my
own image, etc but was never able to get listeners working.

It felt a bit over my head (working off a template :-/) so I found a
sample away3dlite piece of code that Videometry was kind enough to put
up (chopper code) and based off that came up with code below.

I get no errors but only a black screen ... no plane rotating ... :-S
Any ideas?

I'm using CS4.
Do I have to do anything special with the fla for lite?

package
{
        import flash.display.Sprite;
        import flash.ui.Keyboard;
        import flash.events.Event;
        import away3dlite.cameras.Camera3D;
        import away3dlite.containers.*;
        import away3dlite.materials.BitmapFileMaterial;
        import away3dlite.materials.BitmapMaterial;
        import away3dlite.events.MouseEvent3D;
        import away3dlite.primitives.Plane;
        import away3dlite.core.render.*;
        import away3dlite.core.utils.Cast;
        import away3dlite.core.base.Object3D;
        import flash.events.*;
        import flash.display.StageQuality;

        public class flyexample2L extends Sprite
        //public class flyexample2L extends BasicTemplate
        {
                //[Embed (source="samp_mat.jpg")]
                //private var basicMat:Class;

                private var scene:Scene3D;
                private var view:View3D;
                private var camera:Camera3D;

                private var camPitch:Number=0;
                private var camPan:Number=0;
                private var camHeight:Number=0;

                private var lastKey:uint=0;
                private var keyIsDown:Boolean = false;
                private var mouseDwn:Boolean = false;

                private var plainPlane:Plane;



                public function flyexample2L()
                {
                        initStuff();
                        //initMaterials();
                        //initObjects();
                        initListeners();
                }


                private function initStuff():void
                //override protected function onInit():void
                {
                        scene = new Scene3D();
                        camera = new Camera3D();
                        camera.z = -900;

                        view = new View3D(scene, camera, new BasicRenderer());
                        addChild( view );
                        view.x = 800/2;
                        view.y = 600/2;

                        plainPlane = new Plane(new BitmapFileMaterial("assets/
samp_mat.jpg"),256,256,1,1);
                        plainPlane.bothsides = true;
                        //plainPlane.y = 0;
                        //plainPlane.z = 50;
                        //plainPlane.x = 0;
                        view.addChild(plainPlane);
                        stage.quality = StageQuality.LOW;
                }


                private function initListeners():void
                {
                        addEventListener(Event.ENTER_FRAME,onEnterFrame);
                        stage.addEventListener(KeyboardEvent.KEY_DOWN,keyDown);
                        stage.addEventListener(KeyboardEvent.KEY_UP,keyUp);
                }


                private function onEnterFrame( e:Event ):void
                //override protected function onPreRender():void
                {

                         if(keyIsDown){
                                  switch(lastKey){
                                    case Keyboard.LEFT  :
                                        plainPlane.rotationY = -1;
                                    break;


                                    case Keyboard.RIGHT :
                                        plainPlane.rotationY = 1;
                                    break;


                                    case Keyboard.UP   :
                                        plainPlane.rotationX = 1;
                                    break;


                                    case Keyboard.DOWN :
                                        plainPlane.rotationX = -1;
                                    break;
                                   }

                           }

                           plainPlane.rotationX+=1;
                           view.render();
                               }

                              private function keyDown
(e:KeyboardEvent):void
                              {
                                lastKey = e.keyCode;
                                keyIsDown = true;
                              }

                             private function keyUp
(e:KeyboardEvent):void
                             {
                              keyIsDown = false;
                             }

               }
}

-Joe

On Oct 7, 9:32 pm, katopz <[email protected]> wrote:
> > plainPlane = new Plane({material:basicBFM,width:500,height:
> > 500,segmentsW:3,segmentsH:3,bothside:true});
>
> may be this line, there is no initObj in lite. do try this example*(s) ;p*
>
> http://away3d.googlecode.com/svn/trunk/fp10/Examples/Away3DLite/as/sr...
>
> hth
>
> 2009/10/8 Peter Kapelyan <[email protected]>
>
>
>
>
>
> > Did you get the error with a gif or jpg? Also try:
>
> > basicMat.bitmapData
>
> > -Pete
>
> > On Wed, Oct 7, 2009 at 2:20 PM, Joseph <[email protected]> wrote:
>
> >> I contiue to get the following error with the code below:
>
> >> "1118: Implicit coercion of a value with static type Object to a
> >> possibly unrelated type away3dlite.materials:Material."
>
> >> I've tried several different ways to import the png file and put it
> >> onto the plane (as can be seen from commented lines). However, I
> >> continue to get this error over and over again.
>
> >> Am I doing something wrong code wise? It appears that away3dlite uses
> >> the same syntax from examples I've seen ...
>
> >> package
> >> {
> >>        import flash.display.Sprite;
> >>        import flash.ui.Keyboard;
> >>        import flash.events.Event;
> >>        import away3dlite.cameras.Camera3D;
> >>        import away3dlite.containers.*;
> >>        import away3dlite.core.base.Mesh;
> >>        //import away3dlite.events.Loader3DEvent;
> >>        import away3dlite.materials.BitmapFileMaterial;
> >>        import away3dlite.materials.BitmapMaterial;
> >>        import away3dlite.events.MouseEvent3D;
> >>        import away3dlite.primitives.Plane;
> >>        import away3dlite.core.render.*;
> >>        import away3dlite.core.utils.Cast;
> >>        import away3dlite.core.base.Object3D;
> >>        import flash.events.*;
> >>        import flash.display.StageQuality;
>
> >>        public class flyexample1L extends Sprite
> >>        {
> >>                //[Embed (source="samp_mat.png")]public var basicMat:Class;
>
> >>                private var scene:Scene3D;
> >>                private var view:View3D;
> >>                //private var clipping:Clipping;
>
> >>                private var camera:Camera3D;
> >>                private var camPitch:Number=0;
> >>                private var camPan:Number=0;
> >>                private var camHeight:Number=100;
>
> >>                private var lastKey:uint=0;
> >>                private var keyIsDown:Boolean = false;
> >>                private var mouseDwn:Boolean = false;
> >>                private var freePan:Boolean = true;
>
> >>                private var plainPlane:Plane;
>
> >>                private var basicBFM:BitmapFileMaterial;
> >>                private var basicBM:BitmapMaterial;
>
> >>                public function flyexample1L()
> >>                {
> >>                        initEngine();
> >>                        initMaterials();
> >>                        initObjects();
> >>                        initListeners();
> >>                        stage.quality = StageQuality.LOW;
> >>                }
>
> >>                private function initEngine():void
> >>                {
> >>                        camera = new Camera3D();
> >>                        camera.x = 500;
> >>                        camera.z = 500;
> >>                        camera.y=camHeight;
>
> >>                        view = new View3D(scene, camera, new
> >> BasicRenderer());
> >>                        view.x = stage.stageWidth / 2;
> >>                                                view.y =
> >> stage.stageHeight / 2;
> >>                        stage.quality = StageQuality.LOW;
>
> >>                        addChild( view );
> >>                }
>
> >>                private function initMaterials():void
> >>                {
> >>                        basicBFM = new BitmapFileMaterial("samp_mat.png");
> >>                        //basicBM = BitmapMaterial(Cast.bitmap(basicMat));
> >>                }
>
> >>                private function initObjects():void
> >>                {
>
> >> //plainPlane = new Plane({material:basicBM,width:500,height:
> >> 500,segmentsW:3,segmentsH:3,bothside:true});
>
> >> plainPlane = new Plane({material:basicBFM,width:500,height:
> >> 500,segmentsW:3,segmentsH:3,bothside:true});
>
> >> //plainPlane = new Plane({material:basicMat,width:500,height:
> >> 500,segmentsW:3,segmentsH:3,bothside:true});
> >>                        plainPlane.y = 250;
> >>                        plainPlane.z = 0;
> >>                        plainPlane.x = 0;
> >>                }
>
> >>                private function initListeners():void
> >>                {
> >>                        addEventListener(Event.ENTER_FRAME,onEnterFrame);
>
> >>  stage.addEventListener(KeyboardEvent.KEY_DOWN,keyDown);
> >>                        stage.addEventListener(KeyboardEvent.KEY_UP,keyUp);
> >>                }
>
> >>                private function onEnterFrame( e:Event ):void
> >>                {
>
> >>                if(keyIsDown){
> >>                        switch(lastKey){
> >>                        case Keyboard.LEFT      :
>
> >>  plainPlane.rotationY = -1;
> >>                                        //camera.moveLeft(20);
> >>                                        break;
>
> >>                        case Keyboard.RIGHT     :
> >>                                        plainPlane.rotationY = 1;
> >>                                        //camera.moveRight(20);
> >>                                        break;
>
> >>                        case Keyboard.UP        :
> >>                                        plainPlane.rotationX = 1;
> >>                                        //camera.moveForward(35);
> >>                                        break;
>
> >>                        case Keyboard.DOWN      :
> >>                                        plainPlane.rotationX = 1;
> >>                                        //camera.moveBackward(35);
> >>                                        break;
> >>                        }
> >>                }
>
> >>                view.render();
> >>                }
>
> >>                private function onMouseDown(e:MouseEvent):void
> >>                {
> >>                        mouseDwn=true;
> >>                }
>
> >>                private function onMouseUp(e:MouseEvent):void
> >>                {
> >>                        mouseDwn=false;
> >>                }
>
> >>                private function keyDown(e:KeyboardEvent):void
> >>                {
> >>                        lastKey = e.keyCode;
> >>                        keyIsDown = true;
> >>                }
>
> >>                private function keyUp(e:KeyboardEvent):void
> >>                {
> >>                        keyIsDown = false;
> >>                }
>
> >>                private function onResize(event:Event):void
> >>                {
> >>                        view.x = stage.stageWidth / 2;
> >>                                                view.y =
> >> stage.stageHeight / 2;
> >>                }
>
> >>        }
> >> }
>
> > --
> > ___________________
>
> > Actionscript 3.0 Flash 3D Graphics Engine
>
> > HTTP://AWAY3D.COM
>
> --
> katopzhttp://www.sleepydesign.com- Hide quoted text -
>
> - Show quoted text -

Reply via email to