error insert text in papervision typography class
Posted
by safeDomain
on Stack Overflow
See other posts from Stack Overflow
or by safeDomain
Published on 2009-09-30T19:58:39Z
Indexed on
2010/04/15
23:03 UTC
Read the original article
Hit count: 454
hi evryone , i am encounter with a small problem i want to make a 3d rtl text animation with papervision this code generet a problem to this :
[Fault] exception, information=TypeError: Error #1009: Cannot access a property or method of a null object reference. but when using a english text this error dont genereta my code :
package {
import flash.display.Sprite;
import flash.events.Event;
import org.papervision3d.scenes.Scene3D
import org.papervision3d.view.Viewport3D
import org.papervision3d.cameras.Camera3D
import org.papervision3d.render.BasicRenderEngine
import org.papervision3d.typography.Font3D
import org.papervision3d.typography.fonts.HelveticaBold
import org.papervision3d.typography.Text3D
import org.papervision3d.materials.special.Letter3DMaterial
import flash.text.engine.FontDescription
import flash.text.engine.ElementFormat
import flash.text.engine.TextElement
import flash.text.engine.TextBlock
import flash.text.engine.TextLine
/**
* ...
* @author vahid
*/
public class Main extends Sprite
{
private var fd:FontDescription
private var ef:ElementFormat
private var te:TextElement
protected var st:String;
private var scene:Scene3D
private var view:Viewport3D
private var camera:Camera3D
private var render:BasicRenderEngine
private var vpWidth:Number = stage.stageWidth;
private var vpHeight:Number = stage.stageHeight;
private var text3d:Text3D
private var font3d:Font3D
//private var font:HelveticaBold
private var textMaterial:Letter3DMaterial
private var text:String
public function Main():void {
if (stage)
init();
else
addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void {
removeEventListener(Event.ADDED_TO_STAGE, init);
// rtl block
fd = new FontDescription ()
ef = new ElementFormat (fd)
te = new TextElement ("?????? ?????? ???? ?????? ?? papervision", ef)
text = te.text
//3d block
scene = new Scene3D ()
view = new Viewport3D (vpWidth,vpHeight,true,true,false,false)
camera = new Camera3D ()
render = new BasicRenderEngine()
addChild (view)
this.addEventListener (Event.ENTER_FRAME , renderThis)
textMaterial = new Letter3DMaterial(0xFF0000,1)
font3d = new HelveticaBold()
text3d = new Text3D (text, font3d, textMaterial)
scene.addChild (text3d)
}
protected function renderThis(e:Event):void
{
text3d.rotationY +=5
render.renderScene(scene,camera,view)
}
}
} i am using flashdevelop. please help me thank's
© Stack Overflow or respective owner