Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

AS3/Papervision can I nest a 3D text using DisplayObject3D

Avatar of mankis
mankisFlag for Croatia asked on
Adobe Flash
1 Comment1 Solution1084 ViewsLast Modified:
I have  text Class for displaying text in 3D papervision. I'm trying to learn how to nest this 3D text with other object. You can see code attached. With this code I'm getting error:
1067: Implicit coercion of a value of type TextNested to an unrelated type org.papervision3d.objects:DisplayObject3D.
so this is probably the wrong way. Do you know some tutorial or is there some other way to to that?
package {
	import flash.events.Event;
	import org.papervision3d.view.BasicView;
	import org.papervision3d.objects.DisplayObject3D;
	import org.papervision3d.objects.primitives.*;

	public class TestPivot extends BasicView {
		private var pivot3D:DisplayObject3D;
		private var easeOut:Number = 0.6;
		private var reachX:Number = 0.5;
		private var reachY:Number = 0.5;
		private var reachZ:Number = 0.5;
		public function TestPivot() {
			pivot3D= new DisplayObject3D();
		private function init():void {


			var sfera:Sphere = new Sphere(null,100,12,8);
			var plan:Plane = new Plane(null,300,300,8,8);
			var tekst:TextNested = new TextNested("test 3D tekst",stage.stageWidth,stage.stageHeight);
		override protected function onRenderTick(e:Event=null):void {
			var xDist:Number = mouseX - stage.stageWidth * 0.5;
			var yDist:Number = mouseY - stage.stageHeight * 0.5;
			camera.x += (xDist - camera.x * reachX) * easeOut;
			camera.y += (yDist - camera.y * reachY) * easeOut;
			//camera.z += (-mouseY * 2 - camera.z ) * reachZ;
package {
	import flash.events.Event;
	import org.papervision3d.materials.special.Letter3DMaterial;
	import org.papervision3d.typography.Font3D;
	import org.papervision3d.typography.Text3D;
	import org.papervision3d.typography.fonts.Square721BT;
	import org.papervision3d.view.BasicView;

	public class TextNested extends BasicView {
		private var material:Letter3DMaterial;
		private var font3D:Font3D;
		private var text3D:Text3D;
		private var easeOut:Number = 0.6;
		private var reachX:Number = 0.5;
		private var reachY:Number = 0.5;
		private var reachZ:Number = 0.5;
		private var text:String;
		private var stagewidth:Number;
		private var stageheight:Number;

		public function TextNested(teksts:String,stagew:Number,stageh:Number) {

			text = teksts;
			stagewidth = stagew;
			stageheight = stageh;
		private function init():void {
			material = new Letter3DMaterial(0xFFFFFF);
			font3D = new Square721BT();
			text3D = new Text3D(text,font3D,material);
			text3D.scale = 0.5;
			text3D.align = "left";
			text3D.letterSpacing = -3;
			text3D.lineSpacing = -30;
			text3D.material.lineThickness = 0;
			text3D.material.lineAlpha = 1;
			text3D.material.lineColor = 0xFF0000;

Avatar of mankis
mankisFlag of Croatia image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answers