Skip to main content
Known Participant
February 10, 2010
Question

point3d

  • February 10, 2010
  • 1 reply
  • 339 views

i am following some tutorial and i am stuck on 1 thing.

it was not explained and couldnt find how to it on google.

i have my point3D

var point3D:Vector3D = new Vector3D(0,0,0);

i have my text      /// (myText is the exported class movieclip and only has text_txt in it) ////

var myText:MYText = new MYText();      

i need like it to become like this, so i can use the point3D values.

(myText.point3D.z - camera.z);

(myTex.point3D.x - camera.x)

(myTex.point3D.x - camera.x)

but how do I assign/define the point3D to the textfield???

current i just getting

TypeError: Error #1010:  not defined

This topic has been closed for replies.

1 reply

Inspiring
February 10, 2010

(myTex.point3D.x - camera.x)

^ typo, myTex, instead of myText, that'll for sure return undefined.

Other than that, if you put the var point3D statement inside the MyText class then it will be a recognized variable and should work fine.

Also keep in mine that (myText.point3D.z - camera.z); is not a proper statement, you might mean:

myText.point3D.z = myText.point3D.z - camera.z;

or abbreviated as:

myText.point3D.z -= camera.z;

Known Participant
February 10, 2010

i put the

var point3D:Vector3D = new Vector3D(0,0,0);

inside the movieclip class MYText,

still its not recognized?

or should i use other method to store those locations?

function addText():void{

     for( var t:int = 0; t < nameArray.length; t++){

          var myText:MYText = new MYText();

         

          myText.MYText_txt.text = String(nameArray); //trace(String(nameArray));

          myText.buttonMode = true;

          myText.useHandCursor = true;

          myText.mouseChildren = false;

          //random location

          myText.x = myText.point3D.x = Math.random()*stageWidth - stageWidth/2;

          myText.y = myText.point3D.y = Math.random()*stageHeight - stageHeight/2;

          myText.point3D.z = Math.random()*focalLength*2 - focalLength;

          myText.addEventListener(MouseEvent.MOUSE_DOWN, mouseClick);

          addChild(myText);

         

          myTextArray.push(myText);

          trace(myText.point3D); // null?

     } //end for t

} // end function addText