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.