help me please,,
this not working,,
what wrong with this Class??
ModelingClass.as
package
{
import away3d.entities.Mesh;
import away3d.events.AssetEvent;
import away3d.library.AssetLibrary;
import away3d.library.assets.AssetType;
import away3d.loaders.parsers.MD2Parser;
/**
* ...
* @author adr
*/
public class ModelingClass extends Mesh
{
public function ModelingClass(_modele:Class)
{
AssetLibrary.enableParser(MD2Parser);
AssetLibrary.loadData(_modele);
AssetLibrary.addEventListener(AssetEvent.ASSET_COMPLETE, onAssetComplete);
}
private function onAssetComplete(e:AssetEvent):void
{
if (e.asset.assetType == AssetType.MESH)
{
this = Mesh(e.asset);
this.scale(10);
this.y = 20;
}
}
}
}
and then, this is Main.as
package
{
import away3d.containers.View3D;
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Vector3D;
/**
* @author GaryWaw
*/
public class Main extends Sprite
{
[Embed(source = 'Danbo_Cirik.md2', mimeType = 'application/octet-stream')]
private var _modelDong:Class;
//call ModelingClass.as
private var _ModelClass:ModelingClass = new ModelingClass(_modelDong);
private var _view:View3D;
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);
// entry point
initView();
_view.scene.addChild(_ModelClass);
stage.addEventListener(Event.ENTER_FRAME, Rendering);
}
private function initView():void
{
_view = new View3D();
_view.camera.z = -200;
_view.camera.y = 150;
_view.camera.lookAt(new Vector3D());
stage.addChild(_view)
}
private function Rendering(e:Event):void
{
_view.render();
}
}
}