Can’t convert a 3d model to ActionScript

Software: Away3D 2.x

WEich1213, Newbie
Posted: 17 November 2011 07:31 AM   Total Posts: 4

Hello,
I’m trying to convert a 3d model to actionscript after having imported it successfully into Away3d, but I get this error when I try to do it:


TypeError: Error #1009: Cannot access a property or method of a null object reference.
at away3d.exporters::AS3Exporter/write()[/Users/BillEichman/Desktop/Away3dProj/away3d/exporters/AS3Exporter.as:234]
at away3d.exporters::AS3Exporter/parse()[/Users/BillEichman/Desktop/Away3dProj/away3d/exporters/AS3Exporter.as:481]
at away3d.exporters::AS3Exporter/export()[/Users/BillEichman/Desktop/Away3dProj/away3d/exporters/AS3Exporter.as:549]
at LoadingExternalModels/_onClick()[/Users/BillEichman/Desktop/Away3dProj/LoadingExternalModels.as:40]

I was wondering if this is a bug in away3d or maybe it’s because I’m using a mac. Here is the code I’m using to try to convert the 3d model to actionscript:

package {
import away3d.containers.*;
import away3d.core.base.*;
import away3d.core.utils.*;

import away3d.events.*;
import away3d.exporters.*;
import away3d.loaders.*;
import flash.system.*;
import flash.events.*;


public class LoadingExternalModels extends Chapter04SampleBase{

  private var _loader:LoaderCube;
 
  public function LoadingExternalModels() {
  // constructor code
  super();
  }
  protected override function _createScene():void
  {
  _loader = new LoaderCube();
  var url:String = ‘monkey.3ds’;
 
  _loader.addEventListener(Loader3DEvent.LOAD_SUCCESS, _onSuccess);
  _loader.loadGeometry(url, new Max3DS());
  _loader.scale(10);
  _view.scene.addChild(_loader);
  }
  protected function _onSuccess(ev:Loader3DEvent):void
  {
  trace(‘Finished Loading’);
  stage.addEventListener(MouseEvent.CLICK, _onClick);
  }
  protected function _onClick(e:MouseEvent):void
  {
  var exporter:AS3Exporter = new AS3Exporter();
  exporter.addEventListener(ExporterEvent.COMPLETE, _onComplete);
  exporter.export(_loader.handle, ‘MonkeyMesh’,‘flash3dbook.common’);
  }
  protected function _onComplete(e:ExporterEvent):void
  {
  trace(‘Export completed’);
  System.setClipboard(e.data);
  }
}

}

If someone could help me with the correct way of doing it I’d appreciate it. Thank you, WEich1213. I got the code from “The Essential Guide to 3D in Flash,” chap. 4 thanks.

   

Jack Dracon, Newbie
Posted: 17 November 2011 07:07 PM   Total Posts: 27   [ # 1 ]

Hi, if you want to load a 3d Model, I reccommend to you the Prefab tool.
Do you have any other option? .MD5, .OBJ, .3DS?
Good lucky?!

   

WEich1213, Newbie
Posted: 18 November 2011 12:53 AM   Total Posts: 4   [ # 2 ]

I’m not having trouble loading the model, just converting the 3d model to actionscript. I don’t know what the prefab tool is. thanks though

   

Avatar
Fabrice Closier, Administrator
Posted: 18 November 2011 04:27 PM   Total Posts: 1265   [ # 3 ]

http://www.closier.nl/prefab

   

WEich1213, Newbie
Posted: 19 November 2011 12:36 AM   Total Posts: 4   [ # 4 ]

Thanks, I downloaded it and it solved the problem.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X