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

Reply via email to