[Papervision3D] Error 1009, help

Gaurav Khanna gauravk92 at gmail.com
Tue Jun 12 23:34:55 EDT 2007


wait ok then would it be like cube.container.car1 =("...wait its not a cube
i can't use cube what would the correct syntax be

On 6/12/07, Collin Cusce <rafajafar at gmail.com> wrote:
>
> DisplayObject3D is a container.
>
> On 6/12/07, Gaurav Khanna <gauravk92 at gmail.com> wrote:
> >
> > rootNode exists...i think
> >
> > private var rootNode:DisplayObject3D;
> >
> > peter, i posted in my last reply that i took out the this and then it
> > threw some error about not being allowed to execute it or something, gah why
> > are the errors so vague in as3
> > umm the car is an object not a container, at least i think so, i dont
> > fully understand what your talking about with the container so i might be
> > wrong
> >
> >
> > On 6/12/07, Peter Kapelyan <flashnine at gmail.com> wrote:
> > >
> > > Maybe try to delete "this"...?
> > > also can try naming a container with container.name - Stefan posted a
> > > way like this:
> > > cube.container.name = ("Cube" + String( num ) );
> > >
> > > hope it helps
> > > -Pete
> > >
> > > On 6/12/07, Gaurav Khanna <gauravk92 at gmail.com > wrote:
> > > >
> > > > Thanks for your quick reply, should've thought of that myself but i
> > > > figured it out, var car1 and var car2 defined in loop3D are null, and i cant
> > > > figure out how to make them ..umm unnull, in the old code the line was like
> > > > this
> > > >
> > > > var car :DisplayObject3D = this.rootNode.getChildByName( "Focus" );
> > > >
> > > > so i tried these and they didnt work one way or another
> > > >
> > > > var car1 :DisplayObject3D = this.rootNode.Focus.getChildByName(
> > > > "raceCar1" );
> > > > var car1 :DisplayObject3D = this.rootNode.getChildByName( "raceCar1"
> > > > );
> > > > var car1 :DisplayObject3D = rootNode.getChildByName( "Focus" );
> > > >
> > > > i can post more code if need be
> > > >
> > > > On 6/12/07, Collin Cusce <rafajafar at gmail.com > wrote:
> > > > >
> > > > > Trace your variables with the trace function, find out which one
> > > > > is null, figure out why it's null. If you still have questions, ask again. I
> > > > > dont see anything there that would return null based only on your code. It's
> > > > > probably something mispelled earlier in the program or something that you
> > > > > sent a wrong value to.
> > > > >
> > > > >  On 6/12/07, Gaurav Khanna < gauravk92 at gmail.com > wrote:
> > > > >
> > > > > > I've been working with the Focus example to try and get two cars
> > > > > > in there, and i've learned a lot about pv3d as i am a newbie, but i keep
> > > > > > getting this really vague error no matter what i do.
> > > > > >
> > > > > > TypeError: Error #1009: Cannot access a property or method of a
> > > > > > null object reference.
> > > > > > at main/::loop3D()
> > > > > >
> > > > > > Heres the loop3D() that its referring too
> > > > > >
> > > > > > private function loop3D(event:Event):void {
> > > > > > camera.z=-300 + scene.container.mouseX * 10;
> > > > > > camera.y=Math.max(0,this.mouseY) * 5;
> > > > > >
> > > > > >
> > > > > > // Get plane from rootNode
> > > > > > var Car1:DisplayObject3D=this.rootNode.getChildByName
> > > > > > ("raceCar1");
> > > > > > var Car2:DisplayObject3D=this.rootNode.getChildByName
> > > > > > ("raceCar2");
> > > > > >
> > > > > > // Check if car has been loaded
> > > > > > if (Car1) {
> > > > > > // Get plane from rootNode, we obviously don't need to check if
> > > > > > it has been loaded.
> > > > > > var plane:DisplayObject3D=this.rootNode.getChildByName("Plane");
> > > > > > }
> > > > > > // Check if car hits plane and change color
> > > > > > if (Car1.hitTestObject(plane)) {
> > > > > > plane.material.fillColor=0xFFFFFF;
> > > > > > } else {
> > > > > > plane.material.fillColor=0x333333;
> > > > > > }
> > > > > > if (Car2.hitTestObject(plane)) {
> > > > > > plane.material.fillColor=0xFFFFFF ;
> > > > > > } else {
> > > > > > plane.material.fillColor=0x333333 ;
> > > > > > }
> > > > > > // Calculate current steer and speed
> > > > > > driveCar1();
> > > > > > driveCar2();
> > > > > >
> > > > > > // Update car model
> > > > > > updateRaceCar1(Car1);
> > > > > > updateRaceCar2(Car2);
> > > > > > // Render the scene
> > > > > > this.scene.renderCamera(camera);
> > > > > > }
> > > > > >
> > > > > > On a side note i am having problems working with the heirarchy
> > > > > > of the moodels, in maya i made it so that everything is under Focus group,
> > > > > > in that theres a raceCar1 and raceCar2 group, so i'm not sure if i did this
> > > > > > correctly
> > > > > >
> > > > > > private function updateRaceCar1(Car1:DisplayObject3D):void {
> > > > > > //Get raceCar Materials
> > > > > > //var raceCar1:DisplayObject3D=Car1.getChildByName("raceCar1");
> > > > > >
> > > > > > // Steer front wheels
> > > > > > var steerFR1:DisplayObject3D= Car1.getChildByName("Steer_FR1");
> > > > > > var steerFL1:DisplayObject3D=Car1.getChildByName("Steer_FL1");
> > > > > >
> > > > > > steerFR1.rotationY=steer;
> > > > > > steerFL1.rotationY=steer;
> > > > > >
> > > > > > // Rotate wheels
> > > > > > var wheelFR1:DisplayObject3D= steerFR1.getChildByName
> > > > > > ("Wheel_FR1");
> > > > > > var wheelFL1:DisplayObject3D=steerFL1.getChildByName
> > > > > > ("Wheel_FL1");
> > > > > > var wheelRR1:DisplayObject3D=Car1.getChildByName("Wheel_RR1");
> > > > > > var wheelRL1:DisplayObject3D= Car1.getChildByName("Wheel_RL1");
> > > > > >
> > > > > > var roll:Number=speed / 2;
> > > > > > wheelFR1.roll(roll);
> > > > > > wheelRR1.roll(roll);
> > > > > > wheelFL1.roll(- roll);
> > > > > > wheelRL1.roll(- roll);
> > > > > >
> > > > > > // Steer car
> > > > > > Car1.yaw(speed * steer / 500);
> > > > > >
> > > > > > // Move car
> > > > > > Car1.moveForward(speed);
> > > > > > }
> > > > > >
> > > > > >
> > > > > > Everything in there is the same except switch #1 to #2, i think
> > > > > > i got it right but i'm not postive because there could be an error there
> > > > > > too, anyway any help is appreciated
> > > > > >
> > > > > >
> > > > > > _______________________________________________
> > > > > > Papervision3D mailing list
> > > > > > Papervision3D at osflash.org
> > > > > > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> > > > > >
> > > > > >
> > > > >
> > > > > _______________________________________________
> > > > > Papervision3D mailing list
> > > > > Papervision3D at osflash.org
> > > > > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> > > > >
> > > > >
> > > >
> > > > _______________________________________________
> > > > Papervision3D mailing list
> > > > Papervision3D at osflash.org
> > > > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> > > >
> > > >
> > >
> > > _______________________________________________
> > > Papervision3D mailing list
> > > Papervision3D at osflash.org
> > > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> > >
> > >
> >
> > _______________________________________________
> > Papervision3D mailing list
> > Papervision3D at osflash.org
> > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> >
> >
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20070612/ba16eb4c/attachment.htm


More information about the Papervision3D mailing list