Hi there,
After some fiddling around with the Textfield3D class I thought I had
it figured out pretty well, until I came across this curious problem.
What I am trying to do is put two Textfield3Ds - header and content -
into an ObjectContainer3D so that I can manipulate them as one object.
The content-Textfield3D is positioned at 0/0/0 while the header-
Textfield3D is positioned at the same x and z coordinates and only the
y-value is offset so the header sits on top of the content with a
little gap in between.
My code so far works for Textfield3Ds with a certain maximum amount of
chars in them, the number seems to be dependent on the Textfield3D's
textsize.
For every char added to the Textfield3D that exceeds that mamixum
number, the whole Textfield3D object is translated in the -y direction
by that Textfield3D's objectHeight - though only visually, as when
tracing the value, the y-position remains the same.
I'm pretty much out of ideas right now, so I'm seeking the community's
help.
I've posted the relavent part of my code down below, hope it helps.
Oh, btw, the maximum number of chars for the textfields before they
"flip":
_headerTextfield3D: 6
_contentTextfield3D : 9
Any helpful reply will be greatly appreciated.
Kind regards,
Kuttel
*************CODE***************
/*
* The following code creates and positions two Textfield3Ds within an
ObjectContainer3D.
* The text for the Textfield3Ds is passed to the class constructor ;
* the font loading is happening in a helper class, the font used is
"Arial".
*/
// Create Textfield3D for content text
this._contentTextfield3D = new
TextField3D(this._contentText,
ttfData, {textSize:40});
// Set material for Textfield3D
this._contentTextfield3D.material = new
ShadingColorMaterial
(0x00FF00);
this._contentTextfield3D.extrudeMaterial = new
ShadingColorMaterial
(0x00FF00);
this._contentTextfield3D.extrude(50);
// Create Textfield3D for header text
this._headerTextfield3D = new
TextField3D(this._headerText,
ttfData, {textSize:60});
// // Set material for Textfield3D
this._headerTextfield3D.material = new
ShadingColorMaterial
(0x0000FF); // Material der Schrift
this._headerTextfield3D.extrudeMaterial = new
ShadingColorMaterial
(0x00FF00); // Material des Extrude
this._headerTextfield3D.extrude(50); // Raeumliche Dicke
der Schrift festlegen
// Add Textfield3Ds to stage
this.addChild(this._contentTextfield3D);
this.addChild(this._headerTextfield3D);
// Inhalt positionieren ; Center ist links-unten
this._contentTextfield3D.position = new Number3D(0, 0,
0);
// Ueberschrift positionieren ; Center ist links-unten
this._headerTextfield3D.position = new Number3D(0,
this._contentTextfield3D.objectHeight + 10, 0);
}