Hi,

Excellent, would be great if I could include away 2.5 for project release
using TexfField3D.


The code I was referencing from was the one on the away3d.com site you
mentioned, I am unsure as to how the fonts are being handled, so I
downloaded the Arial.ttf from the left menu and used that in my project.

I'm not clued up with flex mxml, as in the [BINDABLE] usage:

[Bindable] private var _fontArray:Array

and am not sure how _targetFont is getting it's ref' to the ttf or the font
classes?.


So for:
var _theFont:*;
var _textfield:TextField3D = new TextField3D("hello",theFont,
{textSize:40});


1. I set _theFont to a string ref to the Arial.ttf downloaded from the
away3d site example and nothing shows but I also get no errors.

2. How would I use _theFont to reference the Arial.as class and give that to
the TextField3D class?

var c:Object = new Arial();
_textfield = new TextField3D("hello", c, {textSize:40});

results in an error.


Any ideas?
Full class code below.

Thanks

Darcey




Full code:






Darcey







package aftc.content.home
{
    //
--------------------------------------------------------------------------------------------
    import aftc.core.AssetManager;
    import aftc.core.Core;
    import aftc.utils.debug.Ttrace;

    import away3d.cameras.HoverCamera3D;
    import away3d.containers.Scene3D;
    import away3d.containers.View3D;
    import away3d.materials.ColorMaterial;
    import away3d.primitives.Cube;
    import away3d.primitives.Skybox6;
    import away3d.primitives.TextField3D;

    import flash.display.Bitmap;
    import flash.display.Stage;
    import flash.events.Event;
    import flash.events.KeyboardEvent;
    import flash.events.MouseEvent;
    import flash.ui.Keyboard;
    //
--------------------------------------------------------------------------------------------


    //
--------------------------------------------------------------------------------------------
    public class HomePanoramic extends Core
    {
        //
--------------------------------------------------------------------------------------------
        // Vars
        //
--------------------------------------------------------------------------------------------
        private var t:Ttrace;


      private var move:Boolean = false;
      private var lastPanAngle:Number;
      private var lastTiltAngle:Number;
      private var lastMouseX:Number;
      private var lastMouseY:Number;
        //
--------------------------------------------------------------------------------------------




        //
--------------------------------------------------------------------------------------------
        private var away3D:Object;
        private var scene:Scene3D;
        private var camera:HoverCamera3D;
        private var view:View3D;

        private var cube:Cube;
        private var _textfield:TextField3D;

        public function HomePanoramic()
        {
            // Class specific tracer
            t = new Ttrace();
            t.enabled = true;

            t.ttrace("HomePanoramic()");

            away3D = oContainerManager.getAway3DScene("scene1");

            scene = away3D.scene;
            camera = away3D.camera;
            view = away3D.view;

            camera.zoom = 15;
            camera.focus = 50;
            camera.mintiltangle = -80;
            camera.maxtiltangle = 20;
            camera.targetpanangle = camera.panangle = 0;
            camera.targettiltangle = camera.tiltangle = 0;

            view.scene = scene;
            view.camera = camera;

            t.ttrace("away3D.scene:" + away3D.scene);
            t.ttrace("away3D.view:" + away3D.view);
            t.ttrace("away3D.camera:" + away3D.camera);

            var oAssetManager:AssetManager = new AssetManager();
            var b:Bitmap = oGlobalVariables.bLoader.getBitmap("homeskybox");


            cube = new Cube({width:200,height:100,depth:300});
            cube.x = 100;
            cube.y = 10;
            cube.z = -1000;
            scene.addChild( cube );



            _textfield = new TextField3D("hello",
"assets/embedded/fonts/Arial.ttf", {textSize:40});
            _textfield.material = new ColorMaterial(0xFFFFFF);
            _textfield.extrudeMaterial = new ColorMaterial(0x333333);
            _textfield.extrude(10);
            scene.addChild(_textfield);




            initEventListeners();
        }
        //
--------------------------------------------------------------------------------------------







        //
--------------------------------------------------------------------------------------------
        // Setup event listeners
        //
--------------------------------------------------------------------------------------------
        private var appStage:Stage;

        private function initEventListeners():void
        {
            appStage = oGlobalVariables.mcApplicationContainer.parent.stage;

           addEventListener(Event.ENTER_FRAME, handleEnterFrame);

        }
        //
--------------------------------------------------------------------------------------------




        //
--------------------------------------------------------------------------------------------
        private function handleEnterFrame(e:Event):void
        {


            cube.rotationX += 2;
            cube.rotationY += 2;
            //_textfield.yaw(4);

         if (move) {
            camera.targetpanangle = 0.3 * (appContainer.mouseX - lastMouseX)
+ lastPanAngle;
            camera.targettiltangle = 0.3 * (appContainer.mouseY -
lastMouseY) + lastTiltAngle;
         }
         camera.hover();
         view.render();
      }
      //
--------------------------------------------------------------------------------------------



      //
--------------------------------------------------------------------------------------------
      private function onMouseDown(event:MouseEvent):void
      {
         lastPanAngle = camera.targetpanangle;
         lastTiltAngle = camera.targettiltangle;
         lastMouseX = appContainer.mouseX;
         lastMouseY = appContainer.mouseY;
         move = true;
         appContainer.addEventListener(Event.MOUSE_LEAVE,
onStageMouseLeave);
      }
      //
--------------------------------------------------------------------------------------------




        //
--------------------------------------------------------------------------------------------
        private function onMouseUp(event:MouseEvent):void
        {
            move = false;
            appContainer.removeEventListener(Event.MOUSE_LEAVE,
onStageMouseLeave);
        }
        //
--------------------------------------------------------------------------------------------


        //
--------------------------------------------------------------------------------------------
        private function onStageMouseLeave(event:Event):void
        {
            move = false;
            appContainer.removeEventListener(Event.MOUSE_LEAVE,
onStageMouseLeave);
        }
        //
--------------------------------------------------------------------------------------------



    }
    //
--------------------------------------------------------------------------------------------
}

Reply via email to