1 package
2 {
3 import away3d.events.MouseEvent3D;
4 import away3d.primitives.Cube;
5
6 import flash.filters.*;
7
8 import gs.TweenMax;
9
10 public class ApplicationManager extends BaseObject
11 {
12 protected var mesh:MeshObject = null;
13 protected var meshRotateTween:TweenMax = null;
14 protected var meshScaleTween:TweenMax = null;
15 protected var rotation:Number = 0;
16
17 public function ApplicationManager(engineManager:EngineManager)
18 {
19 super(engineManager);
20 }
21
22 public function startupApplicationManager():ApplicationManager
23 {
24 super.startupBaseObject();
25
26 mesh = new MeshObject(engineManager).startupObject3DMeshObject(
27 new Cube(
28 {material:engineManager.MyResourceManager.Cube_Tex,
29 width:30,
30 height:30,
31 depth:30,
32 segmentsH:3,
33 segmentsW:3}));
34 mesh.model.addEventListener(MouseEvent3D.MOUSE_OVER, mouseOver);
35 mesh.model.addEventListener(MouseEvent3D.MOUSE_OUT, mouseOut);
36 mesh.model.addEventListener(MouseEvent3D.MOUSE_DOWN, mouseDown);
37
38 return this;
39 }
40
41 public function mouseOver(event:MouseEvent3D):void
42 {
43 if (meshScaleTween != null) TweenMax.removeTween(meshScaleTween);
44 meshScaleTween = new TweenMax(mesh.model, 1, {scaleX:2, scaleY:2, scaleZ:2, yoyo:0});
45 }
46
47 public function mouseOut(event:MouseEvent3D):void
48 {
49 if (meshScaleTween != null) TweenMax.removeTween(meshScaleTween);
50 meshScaleTween = new TweenMax(mesh.model, 1, {scaleX:1, scaleY:1, scaleZ:1});
51 }
52
53 public function mouseDown(event:MouseEvent3D):void
54 {
55 if (meshRotateTween != null) TweenMax.removeTween(meshRotateTween);
56 rotation += 90;
57 meshRotateTween = new TweenMax(mesh.model, 1, {rotationX:rotation, rotationY:rotation, rotationZ:rotation});
58 }
59
60 public override function shutdown():void
61 {
62 super.shutdown();
63
64 mesh.shutdown();
65 mesh = null;
66 }
67
68 public override function enterFrame(dt:Number):void
69 {
70
71 }
72
73 }
74 }