Sorry.  I forgot if I post the file that way it required a password.
I've simply pasted the code below.  Thanks.

package{
        import away3d.containers.View3D;
        import away3d.events.MouseEvent3D;
        import away3d.lights.DirectionalLight3D;
        import away3d.materials.ShadingColorMaterial;
        import away3d.primitives.Sphere;

        import flash.display.MovieClip;
        import flash.events.Event;
        import flash.events.MouseEvent;

        /*
         * I commented this out because I use Flash IDE.  Put it back in if
you use Flex
         * [SWF(width="500",height="200", backgroundColor="#ffffff")]
         */

        public class Basic09_ShadingColorMaterial extends MovieClip{   //
<--- CHANGE THIS BACK TO Sprite IF NOT USING FLASH IDE
                private var view:View3D;
                private var sp:Sphere;
                private var mat:ShadingColorMaterial;
                private var changed:Boolean = true;

                public function Basic09_ShadingColorMaterial(){
                        view = new View3D();
                        view.x = 250;
                        view.y = 100;
                        addChild(view);

                        var l:DirectionalLight3D = new 
DirectionalLight3D({x:-300, y:500,
z:-200});
                        view.scene.addLight(l);

                        // add spheres that increase in complexity
                        for(var i:uint = 1; i<11; i++){
                                sp = new 
Sphere({radius:45,segmentsW:i*2,segmentsH:i*2});
                                sp.x = (i*50)-280;
                                i%2 == 0 ? sp.y = -50 : sp.y = 50;
                                sp.material = new 
ShadingColorMaterial(0xffffff);
                                view.scene.addChild(sp);
                                
sp.addEventListener(MouseEvent3D.MOUSE_DOWN,setColor);
                        }
                        this.addEventListener(Event.ENTER_FRAME,update);
                }
                private function update(e:Event):void{
                        // only update if something was changed
                        if(changed){
                                view.render();
                                changed = false;
                        }
                }
                private function setColor(e:MouseEvent3D):void{
                        // Change material to a new random colored material
                        if(e.currentTarget is Sphere){
                                var sp:Sphere = e.currentTarget as Sphere;
                                sp.material = new ShadingColorMaterial();
                                changed = true;
                        }
                }
        }
}

On Apr 21, 12:08 pm, joeyparcels <[email protected]> wrote:
> Thanks Fabrice but that wasn't it.
>
> The solution is that you now have to use view.scene.addLight() instead
> of view.scene.addChild();    I found it after digging around in the
> SVN logs from around build 2379.
>
> My problem now is the light supposedly gets added, but any materials
> that are supposed to use the light are flat -- phong materials and
> shaded materials -- no specular, shininess, or anything.   Is anyone
> else experiencing this with the latest build?    No matter what I try
> I can't get lighting.
>
> I attached a simple example for your reference.    This example was
> taken from the tutorials over at Flash Magazine  
> (http://www.flashmagazine.com/Tutorials/detail/away3d_basics_6_-_materials_an...).
> I simply changed it to use addLight() instead of addChild() ... (and I
> changed the .as to extend MovieClip instead of Sprite in order to work
> with the Flash IDE).
>
> download:
>
> http://www.envirant.com/temp/Basic09_ShadingColorMaterial.zip
>
> Thanks!
>
> On Apr 20, 4:24 pm, Fabrice3D <[email protected]> wrote:
>
>
>
> > Lights are no longer extending  Object3D.
>
> > Sent from an iPhone without Flash
>
> > On Apr 20, 2010, at 21:03, joeyparcels <[email protected]> wrote:
>
> > > Hello, I am having the same problem, but it is in Away3D, not Away
> > > Lite.   It's really straight forward so I don't see what I can
> > > possibly be doing wrong:
>
> > > import away3d.lights.PointLight3D;
>
> > > var light:PointLight3D;
> > > var view:View3D;
>
> > > view = new View3D();
> > > addChild(view);
>
> > > light = new PointLight3D();
>
> > > view.scene.addChild(light);
>
> > > Throws the same old error:  Implicit coercion of a value of type
> > > away3d.lights:PointLight3D to an unrelated type
> > > away3d.core.base:Object3D.   Any help greatly appreciated!
>
> > > --
> > > Subscription 
> > > settings:http://groups.google.com/group/away3d-dev/subscribe?hl=en-Hide 
> > > quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

Reply via email to