As said in reply. Drop in Prefab and select the export that you want to try.
Fabrice On Apr 25, 2011, at 15:36, andrew barry <[email protected]> wrote: > Hi, > > I dont get warnings and the reason i placed my code here to view is > because i dont know what is wrong with the code. > I tried a dae file as you can and this works so obj is trickier. My > code works for a dae file but not obj. > > How do i convert a obj file to as3? I have blender 2.57 and this is > time consuming i have to say. You cant import/export different file > types as i thought. > > here is my total file > > package > { > import away3d.cameras.Camera3D; > import away3d.containers.Scene3D; > import away3d.containers.View3D; > import away3d.core.base.Vertex; > import away3d.materials.WireColorMaterial; > import away3d.materials.WireframeMaterial; > import away3d.materials.BitmapMaterial; > import away3d.primitives.Cube; > import away3d.primitives.LineSegment; > import away3d.primitives.Sphere; > import away3d.primitives.Torus; > import away3d.core.utils.Cast; > import away3d.loaders.Loader3D; > import away3d.loaders.Obj; > import away3d.events.Loader3DEvent; > import away3d.containers.ObjectContainer3D; > import away3d.loaders.Collada; > > > import flash.display.Bitmap; > import flash.display.BitmapData; > import flash.display.Loader; > import flash.display.MovieClip; > import flash.display.Sprite; > import flash.display.Stage; > import flash.display.StageAlign; > import flash.display.StageDisplayState; > import flash.display.StageQuality; > import flash.display.StageScaleMode; > import flash.events.Event; > import flash.events.KeyboardEvent; > import flash.geom.Matrix3D; > import flash.geom.Point; > import flash.geom.Rectangle; > import flash.text.*; > import flash.ui.Keyboard; > > //project proprties > // add src tab not library and point to src folder od away3d > // C:/HOME/08659543/flashbuilder4_2/away3d_3_6_0/src > > [SWF(width="800", height="600", frameRate="30", > backgroundColor="#FFFFFF")] > > > public class mytest5 extends MovieClip > { > private var scene:Scene3D; > private var camera:Camera3D; > var dict:Object=new Object(); > private var view:View3D; > private var cube:Cube; > private var torus:Torus; > private var canvas1:Sprite; > private var tm:Matrix3D = new Matrix3D(); > private var xx:int; > private var bmpData1:BitmapData; > private var bmat1:BitmapMaterial; > private var tt:ObjectContainer3D; > > > public function mytest5() > { > > > init3D(); > createScene(); > > // prep for handling resizing events > // stage.scaleMode = StageScaleMode.NO_SCALE; > // stage.align = StageAlign.TOP; > > > } > > private function init3D():void { > scene = new Scene3D(); > camera = new Camera3D({zoom:20, focus:30, x:100, y:50, z:-500}); > view = new View3D({scene:scene, camera:camera}); > > // center the viewport to the middle of the stage > view.x = stage.stageWidth / 2; > view.y = stage.stageHeight / 2; > addChild(view); > } > private function createScene():void { > > > // var loader3D:Loader3D = Collada.load("./daeModel/cow.dae"); > // loader3D.addEventListener(Loader3DEvent.LOAD_SUCCESS, > onModelLoadSuccess); > > var loader3D:Loader3D = Collada.load("./treehouse/tree house.dae"); > loader3D.addEventListener(Loader3DEvent.LOAD_SUCCESS, > onModelLoadSuccess); > > // var loader3D:Loader3D = Obj.load("daeModel/m4_sherman.obj"); > // loader3D.addEventListener(Loader3DEvent.LOAD_SUCCESS, > onModelLoadSuccess); > > > > > } > private function onModelLoadSuccess(event:Loader3DEvent):void > { > trace("asdsadsad"); > tt = event.loader.handle as ObjectContainer3D; > tt.scale(100); > tt.moveDown(1); > view.scene.addChild(tt); > > stage.addEventListener(Event.ENTER_FRAME,gameLoop,false,0,true); > } > > > private function gameLoop(e:Event):void { > view.render(); > //if (tt==true) > > tt.yaw(2); > // tt.z+=10; > > > } > } > } > > On Apr 25, 10:49 pm, Fabrice3D <[email protected]> wrote: >> Try drop it in Prefab. If you get no errors, no warnings pop up and it shows >> up. Then you have something wrong in your code. If the warnings are >> triggered, open the log from menu, you might find usefull infos in there. >> >> You might also consider export if it loads, to another format such as As3 >> this would fix your issues and simplify your code. >> >> Fabrice >> >> On Apr 25, 2011, at 14:30, andrew barry <[email protected]> wrote: >> >>> I can get a dae file to load but not obj. i dont get an error but no >>> display and the files are in same folder >>> private function createScene():void { >> >>> var loader3D:Loader3D = Collada.load("./daeModel/cow.dae"); >>> loader3D.addEventListener(Loader3DEvent.LOAD_SUCCESS, >>> onModelLoadSuccess); >>> // var loader3D:Loader3D = Obj.load("daeModel/m4_sherman.obj"); >>> // loader3D.addEventListener(Loader3DEvent.LOAD_SUCCESS, >>> onModelLoadSuccess); >> >>> } >> >>
