Jump to content
Search Community

Alky

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by Alky

  1. Thanks for that guys - I've been pulling my hair out for days trying to solve a dynamically changing perspectiveProjection center - one that responded to a users mouse move. Here was my solution, thanks! (the Box3d is a separate class that builds a box) package com { import flash.events.*; import flash.display.*; import flash.geom.*; import com.greensock.*; import com.common.Box3d; public class DynamicProjectionCenter extends Sprite { private var _box:Box3d; private var _perspectivePoint:*; private var _currentX:Number; private var _currentY:Number; public function Hotdraw() { _box = new Box3d(); addChild(_box); _currentX = this.stage.stageWidth /2; _currentY = this.stage.stageHeight /2; _box.x = _currentX - (_box.width/2); _box.y = _currentY - (_box.height/2);; _box.z = -1; _perspectivePoint = root.transform.perspectiveProjection.projectionCenter = new Point(_currentX,_currentY); stage.addEventListener(MouseEvent.MOUSE_MOVE, updatePerspective); }//end constructor private function updatePerspective(evt:MouseEvent):void{ TweenLite.to(_perspectivePoint, 1, {x:evt.stageX, y:evt.stageY, onUpdate:applyPoint}); } private function applyPoint():void { root.transform.perspectiveProjection.projectionCenter = _perspectivePoint; } }// end class }//end package
×
×
  • Create New...