Hi, how to drag the model in this examples ?
package
{
import away3d.containers.*;
import away3d.controllers.*;
import away3d.debug.*;
import away3d.entities.*;
import away3d.events.*;
import away3d.library.assets.*;
import away3d.lights.*;
import away3d.loaders.*;
import away3d.loaders.misc.*;
import away3d.loaders.parsers.*;
import away3d.materials.*;
import away3d.materials.lightpickers.*;
import away3d.materials.methods.*;
import away3d.primitives.*;
import away3d.utils.*;
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
[SWF(backgroundColor="#000000", frameRate="30", quality="LOW")]
public class Basic_Load3DS extends Sprite
{
[Embed(source="/../embeds/signature.swf", symbol="Signature")]
public static var SignatureSwf:Class;
[Embed(source="/../embeds/soldier_ant.jpg")]
public static var AntTexture:Class;
[Embed(source="/../embeds/soldier_ant.3ds",mimeType="application/octet-stream")]
public static var AntModel:Class;
[Embed(source="/../embeds/CoarseRedSand.jpg")]
public static var SandTexture:Class;
private var _view:View3D;
private var _cameraController:HoverController;
private var _signature:Sprite;
private var _signatureBitmap:Bitmap;
private var _light:DirectionalLight;
private var _lightPicker:StaticLightPicker;
private var _direction:Vector3D;
private var _groundMaterial:TextureMaterial;
private var _loader:Loader3D;
private var _ground:Mesh;
private var _move:Boolean = false;
private var _lastPanAngle:Number;
private var _lastTiltAngle:Number;
private var _lastMouseX:Number;
private var _lastMouseY:Number;
public function Basic_Load3DS()
{
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
_view = new View3D();
_view.addSourceURL("srcview/index.html");
addChild(_view);
_view.camera.lens.far = 2100;
_cameraController = new HoverController(_view.camera, null, 45, 20, 1000, 10);
_light = new DirectionalLight(-1, -1, 1);
_direction = new Vector3D(-1, -1, 1);
_lightPicker = new StaticLightPicker([_light]);
_view.scene.addChild(_light);
Parsers.enableAllBundled();
var assetLoaderContext:AssetLoaderContext = new AssetLoaderContext();
assetLoaderContext.mapUrlToData("texture.jpg", new AntTexture());
_groundMaterial = new TextureMaterial(Cast.bitmapTexture(SandTexture));
_groundMaterial.shadowMethod = new FilteredShadowMapMethod(_light);
_groundMaterial.lightPicker = _lightPicker;
_groundMaterial.specular = 0;
_ground = new Mesh(new PlaneGeometry(1000, 1000), _groundMaterial);
_view.scene.addChild(_ground);
_loader = new Loader3D();
_loader.scale(300);
_loader.z = -200;
_loader.addEventListener(AssetEvent.ASSET_COMPLETE, onAssetComplete);
_loader.loadData(new AntModel(), assetLoaderContext);
_view.scene.addChild(_loader);
_signature = new SignatureSwf();
_signatureBitmap = new Bitmap(new BitmapData(_signature.width, _signature.height, true, 0));
stage.quality = StageQuality.HIGH;
_signatureBitmap.bitmapData.draw(_signature);
stage.quality = StageQuality.LOW;
addChild(_signatureBitmap);
addChild(new AwayStats(_view));
addEventListener(Event.ENTER_FRAME, onEnterFrame);
stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
stage.addEventListener(Event.RESIZE, onResize);
onResize();
}
private function onEnterFrame(event:Event):void
{
if (_move) {
_cameraController.panAngle = 0.3*(stage.mouseX - _lastMouseX) + _lastPanAngle;
_cameraController.tiltAngle = 0.3*(stage.mouseY - _lastMouseY) + _lastTiltAngle;
}
_direction.x = -Math.sin(getTimer()/4000);
_direction.z = -Math.cos(getTimer()/4000);
_light.direction = _direction;
_view.render();
}
private function onAssetComplete(event:AssetEvent):void
{
if (event.asset.assetType == AssetType.MESH) {
var mesh:Mesh = event.asset as Mesh;
mesh.castsShadows = true;
} else if (event.asset.assetType == AssetType.MATERIAL) {
var material:TextureMaterial = event.asset as TextureMaterial;
material.shadowMethod = new FilteredShadowMapMethod(_light);
material.lightPicker = _lightPicker;
material.gloss = 30;
material.specular = 1;
material.ambientColor = 0x303040;
material.ambient = 1;
}
}
private function onMouseDown(event:MouseEvent):void
{
_lastPanAngle = _cameraController.panAngle;
_lastTiltAngle = _cameraController.tiltAngle;
_lastMouseX = stage.mouseX;
_lastMouseY = stage.mouseY;
_move = true;
stage.addEventListener(Event.MOUSE_LEAVE, onStageMouseLeave);
}
private function onMouseUp(event:MouseEvent):void
{
_move = false;
stage.removeEventListener(Event.MOUSE_LEAVE, onStageMouseLeave);
}
private function onStageMouseLeave(event:Event):void
{
_move = false;
stage.removeEventListener(Event.MOUSE_LEAVE, onStageMouseLeave);
}
private function onResize(event:Event = null):void
{
_view.width = stage.stageWidth;
_view.height = stage.stageHeight;
_signatureBitmap.y = stage.stageHeight - _signature.height;
}
}
}