oh, got it.

Event.addedToStage listener was not set. So everything went wrong.



On 5 Mai, 11:29, leerraum <[email protected]> wrote:
> Hi,
>
> I'm new to Away3D, so don't go crazy if this question was already
> here.
>
> I'm building up a site with a couple of triangles rotating in front of
> a picture. Everythings works but I'm getting errors when I'm loading
> the site. As far as I can judge it there must be a problem with the
> render() method in my class.
>
> The projects structure looks like this
>
> -Main
> --Background Picture
> --Triangles
>
> The first of the five errors tells me this:
>
> TypeError: Error #1009: Der Zugriff auf eine Eigenschaft oder eine
> Methode eines null-Objektverweises ist nicht möglich. (means null
> object reference)
>         at away3d.containers::View3D/updateScreenClipping()[H:\Classes
> \AS3\away3d\containers\View3D.as:811]
>         at away3d.cameras::Camera3D/update()[H:\Classes\AS3\away3d\cameras
> \Camera3D.as:303]
>         at away3d.containers::Scene3D/update()[H:\Classes\AS3\away3d
> \containers\Scene3D.as:172]
>         at away3d.containers::Scene3D/onUpdate()[H:\Classes\AS3\away3d
> \containers\Scene3D.as:50]
>         at flash.events::EventDispatcher/dispatchEventFunction()
>         at flash.events::EventDispatcher/dispatchEvent()
>         at away3d.containers::View3D/notifySceneUpdate()[H:\Classes\AS3\away3d
> \containers\View3D.as:227]
>         at away3d.containers::View3D/render()[H:\Classes\AS3\away3d\containers
> \View3D.as:851]
>         at de.kai_reinhardt::LoadingSphere/update()[J:\Customer\Christoph Zill
> \zill-music\Project Files\zill-music\src\de\kai_reinhardt
> \LoadingSphere.as:84]
>
> The class looks like this:
>
> package de.kai_reinhardt
> {
>         import away3d.containers.View3D;
>         import away3d.core.base.Vertex;
>         import away3d.loaders.Obj;
>         import away3d.materials.ColorMaterial;
>         import away3d.primitives.Triangle;
>         import flash.display.Sprite;
>         import flash.events.Event;
>         import flash.filters.DropShadowFilter;
>         import gs.TweenLite;
>
>         public class LoadingSphere extends Sprite
>         {
>
>                 private var view:View3D;
>                 private var refArray:Array;
>                 private var schwarz : ColorMaterial;
>
>                 public function LoadingSphere(x:int , y:int)
>                 {
>
>                         refArray = [];
>
>                         view = new View3D({x:x, y:y});
>
>                         schwarz = new ColorMaterial(0x000000);
>
>                         genTriangles();
>                         addChild(view);
>
>                         // re-render every frame
>                         addEventListener(Event.ENTER_FRAME, update);
>
>                 }
>
>                 private function genTriangles () : void {
>                         for (var i : int = 0; i < 20; i++)
>                         {
>                                 var tri : Triangle = new Triangle();
>                                 tri.a = new Vertex(0,Math.random()*100+100,0);
>                                 tri.b = new Vertex(Math.random()*20+20,0,0);
>                                 tri.c = new Vertex(Math.random() * -20 - 20, 
> 0, 0);
>
>                                 tri.rotationX = int(Math.random()*360);
>                                 tri.rotationY = int(Math.random()*360);
>                                 tri.rotationZ = int(Math.random()*360);
>                                 tri.bothsides = true;
>                                 tri.faceMaterial = schwarz;
>
>                                 view.scene.addChild(tri);
>                                 refArray.push(tri);
>
>                         }
>                 }
>
>                 private function update(e:Event):void
>                 {
>                         for (var b : int = 0; b < refArray.length; b++)
>                         {
>                                 refArray[b].rotationY++;
>                                 refArray[b].rotationX++;
>
>                         }
>                         view.render();
>                 }
>
>         }
>
> }
>
> It's a very simple structure, so I'm confused of the errors. Can
> someone give me a hint where the things are going wrong?
>
> Thanks
> Kai

Reply via email to