PageRenderTime 87ms CodeModel.GetById 34ms RepoModel.GetById 1ms app.codeStats 0ms

/Flash/project-needs/src/away3d/containers/View3D.as

https://github.com/adamriggs/leapmotion
ActionScript | 799 lines | 538 code | 148 blank | 113 comment | 80 complexity | de22991adba8ba462462b5148c1f5c08 MD5 | raw file
Possible License(s): Apache-2.0
  1. package away3d.containers
  2. {
  3. import away3d.core.pick.IPicker;
  4. import away3d.Away3D;
  5. import away3d.arcane;
  6. import away3d.cameras.Camera3D;
  7. import away3d.core.managers.Mouse3DManager;
  8. import away3d.core.managers.RTTBufferManager;
  9. import away3d.core.managers.Stage3DManager;
  10. import away3d.core.managers.Stage3DProxy;
  11. import away3d.core.render.DefaultRenderer;
  12. import away3d.core.render.DepthRenderer;
  13. import away3d.core.render.Filter3DRenderer;
  14. import away3d.core.render.RendererBase;
  15. import away3d.core.traverse.EntityCollector;
  16. import away3d.textures.Texture2DBase;
  17. import flash.display.Sprite;
  18. import flash.display3D.Context3D;
  19. import flash.display3D.Context3DTextureFormat;
  20. import flash.display3D.textures.Texture;
  21. import flash.events.ContextMenuEvent;
  22. import flash.events.Event;
  23. import flash.geom.Point;
  24. import flash.geom.Rectangle;
  25. import flash.geom.Transform;
  26. import flash.geom.Vector3D;
  27. import flash.net.URLRequest;
  28. import flash.net.navigateToURL;
  29. import flash.ui.ContextMenu;
  30. import flash.ui.ContextMenuItem;
  31. import flash.utils.getTimer;
  32. use namespace arcane;
  33. public class View3D extends Sprite
  34. {
  35. private var _width : Number = 0;
  36. private var _height : Number = 0;
  37. private var _localPos : Point = new Point();
  38. private var _globalPos : Point = new Point();
  39. protected var _scene : Scene3D;
  40. protected var _camera : Camera3D;
  41. protected var _entityCollector : EntityCollector;
  42. protected var _aspectRatio : Number;
  43. private var _time : Number = 0;
  44. private var _deltaTime : uint;
  45. private var _backgroundColor : uint = 0x000000;
  46. private var _backgroundAlpha : Number = 1;
  47. private var _mouse3DManager : Mouse3DManager;
  48. private var _stage3DManager : Stage3DManager;
  49. protected var _renderer : RendererBase;
  50. private var _depthRenderer : DepthRenderer;
  51. private var _addedToStage:Boolean;
  52. private var _forceSoftware : Boolean;
  53. protected var _filter3DRenderer : Filter3DRenderer;
  54. protected var _requireDepthRender : Boolean;
  55. protected var _depthRender : Texture;
  56. private var _depthTextureInvalid : Boolean = true;
  57. private var _hitField : Sprite;
  58. protected var _parentIsStage : Boolean;
  59. private var _background : Texture2DBase;
  60. protected var _stage3DProxy : Stage3DProxy;
  61. protected var _backBufferInvalid : Boolean = true;
  62. private var _antiAlias : uint;
  63. protected var _rttBufferManager : RTTBufferManager;
  64. private var _rightClickMenuEnabled:Boolean = true;
  65. private var _sourceURL:String;
  66. private var _menu0:ContextMenuItem;
  67. private var _menu1:ContextMenuItem;
  68. private var _ViewContextMenu:ContextMenu;
  69. private var _shareContext:Boolean = false;
  70. private var _viewScissoRect:Rectangle;
  71. private function viewSource(e:ContextMenuEvent):void
  72. {
  73. var request:URLRequest = new URLRequest(_sourceURL);
  74. try {
  75. navigateToURL(request, "_blank");
  76. } catch (error:Error) {
  77. }
  78. }
  79. private function visitWebsite(e:ContextMenuEvent):void
  80. {
  81. var url:String = Away3D.WEBSITE_URL;
  82. var request:URLRequest = new URLRequest(url);
  83. try {
  84. navigateToURL(request);
  85. } catch (error:Error) {
  86. }
  87. }
  88. private function initRightClickMenu():void
  89. {
  90. _menu0 = new ContextMenuItem("Away3D.com\tv" + Away3D.MAJOR_VERSION +"." + Away3D.MINOR_VERSION +"."+ Away3D.REVISION, true, true, true);
  91. _menu1 = new ContextMenuItem("View Source", true, true, true);
  92. _menu0.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, visitWebsite);
  93. _menu1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, viewSource);
  94. _ViewContextMenu = new ContextMenu();
  95. updateRightClickMenu();
  96. }
  97. private function updateRightClickMenu():void
  98. {
  99. if (_rightClickMenuEnabled)
  100. _ViewContextMenu.customItems = _sourceURL? [_menu0, _menu1] : [_menu0];
  101. else
  102. _ViewContextMenu.customItems = [];
  103. contextMenu = _ViewContextMenu;
  104. }
  105. public function View3D(scene : Scene3D = null, camera : Camera3D = null, renderer : RendererBase = null, forceSoftware:Boolean = false)
  106. {
  107. super();
  108. _scene = scene || new Scene3D();
  109. _camera = camera || new Camera3D();
  110. _renderer = renderer || new DefaultRenderer();
  111. _depthRenderer = new DepthRenderer();
  112. _forceSoftware = forceSoftware;
  113. // todo: entity collector should be defined by renderer
  114. _entityCollector = _renderer.createEntityCollector();
  115. _viewScissoRect = new Rectangle();
  116. initHitField();
  117. _mouse3DManager = new Mouse3DManager();
  118. _mouse3DManager.enableMouseListeners(this);
  119. addEventListener(Event.ADDED_TO_STAGE, onAddedToStage, false, 0, true);
  120. addEventListener(Event.ADDED, onAdded, false, 0, true);
  121. _camera.partition = _scene.partition;
  122. initRightClickMenu();
  123. }
  124. public function get rightClickMenuEnabled() : Boolean
  125. {
  126. return _rightClickMenuEnabled;
  127. }
  128. public function set rightClickMenuEnabled(val:Boolean) : void
  129. {
  130. _rightClickMenuEnabled = val;
  131. updateRightClickMenu();
  132. }
  133. public function get stage3DProxy() : Stage3DProxy
  134. {
  135. return _stage3DProxy;
  136. }
  137. public function set stage3DProxy(stage3DProxy:Stage3DProxy) : void
  138. {
  139. _stage3DProxy = stage3DProxy;
  140. _renderer.stage3DProxy = _depthRenderer.stage3DProxy = _stage3DProxy;
  141. super.x = _stage3DProxy.x;
  142. _localPos.x = _stage3DProxy.x;
  143. _globalPos.x = parent? parent.localToGlobal(_localPos).x : _stage3DProxy.x;
  144. super.y = _stage3DProxy.y;
  145. _localPos.y = _stage3DProxy.y;
  146. _globalPos.y = parent? parent.localToGlobal(_localPos).y : _stage3DProxy.y;
  147. _viewScissoRect = new Rectangle(_stage3DProxy.x, _stage3DProxy.y, _stage3DProxy.width, _stage3DProxy.height);
  148. }
  149. /**
  150. * Forces mouse-move related events even when the mouse hasn't moved. This allows mouseOver and mouseOut events
  151. * etc to be triggered due to changes in the scene graph. Defaults to false.
  152. */
  153. public function get forceMouseMove() : Boolean
  154. {
  155. return _mouse3DManager.forceMouseMove;
  156. }
  157. public function set forceMouseMove(value : Boolean) : void
  158. {
  159. _mouse3DManager.forceMouseMove = value;
  160. }
  161. public function get background() : Texture2DBase
  162. {
  163. return _background;
  164. }
  165. public function set background(value : Texture2DBase) : void
  166. {
  167. _background = value;
  168. _renderer.background = _background;
  169. }
  170. private function initHitField() : void
  171. {
  172. _hitField = new Sprite();
  173. _hitField.alpha = 0;
  174. _hitField.doubleClickEnabled = true;
  175. _hitField.graphics.beginFill(0x000000);
  176. _hitField.graphics.drawRect(0, 0, 100, 100);
  177. addChild(_hitField);
  178. }
  179. /**
  180. * Not supported. Use filters3d instead.
  181. */
  182. override public function get filters() : Array
  183. {
  184. throw new Error("filters is not supported in View3D. Use filters3d instead.");
  185. return super.filters;
  186. }
  187. /**
  188. * Not supported. Use filters3d instead.
  189. */
  190. override public function set filters(value : Array) : void
  191. {
  192. throw new Error("filters is not supported in View3D. Use filters3d instead.");
  193. }
  194. public function get filters3d() : Array
  195. {
  196. return _filter3DRenderer? _filter3DRenderer.filters : null;
  197. }
  198. public function set filters3d(value : Array) : void
  199. {
  200. if (value && value.length == 0)
  201. value = null;
  202. if (_filter3DRenderer && !value) {
  203. _filter3DRenderer.dispose();
  204. _filter3DRenderer = null;
  205. } else if (!_filter3DRenderer && value) {
  206. _filter3DRenderer = new Filter3DRenderer(stage3DProxy);
  207. _filter3DRenderer.filters = value;
  208. }
  209. if (_filter3DRenderer) {
  210. _filter3DRenderer.filters = value;
  211. _requireDepthRender = _filter3DRenderer.requireDepthRender;
  212. } else {
  213. _requireDepthRender = false;
  214. if (_depthRender) {
  215. _depthRender.dispose();
  216. _depthRender = null;
  217. }
  218. }
  219. }
  220. /**
  221. * The renderer used to draw the scene.
  222. */
  223. public function get renderer() : RendererBase
  224. {
  225. return _renderer;
  226. }
  227. public function set renderer(value : RendererBase) : void
  228. {
  229. _renderer.dispose();
  230. _renderer = value;
  231. _entityCollector = _renderer.createEntityCollector();
  232. _renderer.stage3DProxy = _stage3DProxy;
  233. _renderer.antiAlias = _antiAlias;
  234. _renderer.backgroundR = ((_backgroundColor >> 16) & 0xff) / 0xff;
  235. _renderer.backgroundG = ((_backgroundColor >> 8) & 0xff) / 0xff;
  236. _renderer.backgroundB = (_backgroundColor & 0xff) / 0xff;
  237. _renderer.backgroundAlpha = _backgroundAlpha;
  238. _renderer.viewWidth = _width;
  239. _renderer.viewHeight = _height;
  240. invalidateBackBuffer();
  241. }
  242. private function invalidateBackBuffer() : void
  243. {
  244. _backBufferInvalid = true;
  245. }
  246. /**
  247. * The background color of the screen. This value is only used when clearAll is set to true.
  248. */
  249. public function get backgroundColor() : uint
  250. {
  251. return _backgroundColor;
  252. }
  253. public function set backgroundColor(value : uint) : void
  254. {
  255. _backgroundColor = value;
  256. _renderer.backgroundR = ((value >> 16) & 0xff) / 0xff;
  257. _renderer.backgroundG = ((value >> 8) & 0xff) / 0xff;
  258. _renderer.backgroundB = (value & 0xff) / 0xff;
  259. }
  260. public function get backgroundAlpha() : Number
  261. {
  262. return _backgroundAlpha;
  263. }
  264. public function set backgroundAlpha(value : Number) : void
  265. {
  266. if (value > 1)
  267. value = 1;
  268. else if (value < 0)
  269. value = 0;
  270. _renderer.backgroundAlpha = value;
  271. _backgroundAlpha = value;
  272. }
  273. /**
  274. * The camera that's used to render the scene for this viewport
  275. */
  276. public function get camera() : Camera3D
  277. {
  278. return _camera;
  279. }
  280. /**
  281. * Set camera that's used to render the scene for this viewport
  282. */
  283. public function set camera(camera:Camera3D) : void
  284. {
  285. _camera = camera;
  286. if (_scene)
  287. _camera.partition = _scene.partition;
  288. }
  289. /**
  290. * The scene that's used to render for this viewport
  291. */
  292. public function get scene() : Scene3D
  293. {
  294. return _scene;
  295. }
  296. /**
  297. * Set the scene that's used to render for this viewport
  298. */
  299. public function set scene(scene:Scene3D) : void
  300. {
  301. _scene = scene;
  302. if (_camera)
  303. _camera.partition = _scene.partition;
  304. }
  305. // todo: probably temporary:
  306. /**
  307. * The amount of milliseconds the last render call took
  308. */
  309. public function get deltaTime() : uint
  310. {
  311. return _deltaTime;
  312. }
  313. /**
  314. * The width of the viewport. When software rendering is used, this is limited by the
  315. * platform to 2048 pixels.
  316. */
  317. override public function get width() : Number
  318. {
  319. return _width;
  320. }
  321. override public function set width(value : Number) : void
  322. {
  323. // Backbuffer limitation in software mode. See comment in updateBackBuffer()
  324. if (_stage3DProxy && _stage3DProxy.usesSoftwareRendering && value > 2048)
  325. value = 2048;
  326. if (_width == value)
  327. return;
  328. if (_rttBufferManager)
  329. _rttBufferManager.viewWidth = value;
  330. _hitField.width = value;
  331. _width = value;
  332. _aspectRatio = _width/_height;
  333. _depthTextureInvalid = true;
  334. _renderer.viewWidth = value;
  335. _viewScissoRect.width = value;
  336. invalidateBackBuffer();
  337. }
  338. /**
  339. * The height of the viewport. When software rendering is used, this is limited by the
  340. * platform to 2048 pixels.
  341. */
  342. override public function get height() : Number
  343. {
  344. return _height;
  345. }
  346. override public function set height(value : Number) : void
  347. {
  348. // Backbuffer limitation in software mode. See comment in updateBackBuffer()
  349. if (_stage3DProxy && _stage3DProxy.usesSoftwareRendering && value > 2048)
  350. value = 2048;
  351. if (_height == value)
  352. return;
  353. if (_rttBufferManager)
  354. _rttBufferManager.viewHeight = value;
  355. _hitField.height = value;
  356. _height = value;
  357. _aspectRatio = _width/_height;
  358. _depthTextureInvalid = true;
  359. _renderer.viewHeight = value;
  360. _viewScissoRect.height = value;
  361. invalidateBackBuffer();
  362. }
  363. override public function set x(value : Number) : void
  364. {
  365. super.x = value;
  366. _localPos.x = value;
  367. _globalPos.x = parent? parent.localToGlobal(_localPos).x : value;
  368. _viewScissoRect.x = value;
  369. if (_stage3DProxy && !_shareContext)
  370. _stage3DProxy.x = _globalPos.x;
  371. }
  372. override public function set y(value : Number) : void
  373. {
  374. super.y = value;
  375. _localPos.y = value;
  376. _globalPos.y = parent? parent.localToGlobal(_localPos).y : value;
  377. _viewScissoRect.y = value;
  378. if (_stage3DProxy && !_shareContext)
  379. _stage3DProxy.y = _globalPos.y;
  380. }
  381. override public function set visible(value : Boolean) : void
  382. {
  383. super.visible = value;
  384. if (_stage3DProxy && !_shareContext)
  385. _stage3DProxy.visible = value;
  386. }
  387. /**
  388. * The amount of anti-aliasing to be used.
  389. */
  390. public function get antiAlias() : uint
  391. {
  392. return _antiAlias;
  393. }
  394. public function set antiAlias(value : uint) : void
  395. {
  396. _antiAlias = value;
  397. _renderer.antiAlias = value;
  398. invalidateBackBuffer();
  399. }
  400. /**
  401. * The amount of faces that were pushed through the render pipeline on the last frame render.
  402. */
  403. public function get renderedFacesCount() : uint
  404. {
  405. return _entityCollector.numTriangles;
  406. }
  407. /**
  408. * Defers control of Context3D clear() and present() calls to Stage3DProxy, enabling multiple Stage3D frameworks
  409. * to share the same Context3D object.
  410. */
  411. public function get shareContext() : Boolean
  412. {
  413. return _shareContext;
  414. }
  415. public function set shareContext(value : Boolean) : void
  416. {
  417. _shareContext = value;
  418. }
  419. /**
  420. * Updates the backbuffer dimensions.
  421. */
  422. protected function updateBackBuffer() : void
  423. {
  424. // No reason trying to configure back buffer if there is no context available.
  425. // Doing this anyway (and relying on _stage3DProxy to cache width/height for
  426. // context does get available) means usesSoftwareRendering won't be reliable.
  427. if (_stage3DProxy.context3D && !_shareContext) {
  428. if( _width && _height ){
  429. // Backbuffers are limited to 2048x2048 in software mode and
  430. // trying to configure the backbuffer to be bigger than that
  431. // will throw an error. Capping the value is a graceful way of
  432. // avoiding runtime exceptions for developers who are unable
  433. // to test their Away3D implementation on screens that are
  434. // large enough for this error to ever occur.
  435. if (_stage3DProxy.usesSoftwareRendering) {
  436. // Even though these checks where already made in the width
  437. // and height setters, at that point we couldn't be sure that
  438. // the context had even been retrieved and the software flag
  439. // thus be reliable. Make checks again.
  440. if (_width > 2048) _width = 2048;
  441. if (_height > 2048) _height = 2048;
  442. }
  443. _stage3DProxy.configureBackBuffer(_width, _height, _antiAlias, true);
  444. _backBufferInvalid = false;
  445. } else {
  446. width = stage.stageWidth;
  447. height = stage.stageHeight;
  448. }
  449. }
  450. }
  451. /**
  452. * Defines a source url string that can be accessed though a View Source option in the right-click menu.
  453. *
  454. * Requires the stats panel to be enabled.
  455. *
  456. * @param url The url to the source files.
  457. */
  458. public function addSourceURL(url:String):void
  459. {
  460. _sourceURL = url;
  461. updateRightClickMenu();
  462. }
  463. /**
  464. * Renders the view.
  465. */
  466. public function render() : void
  467. {
  468. //if context3D has Disposed by the OS,don't render at this frame
  469. if (!stage3DProxy.recoverFromDisposal()) {
  470. _backBufferInvalid = true;
  471. return;
  472. }
  473. // reset or update render settings
  474. if (_backBufferInvalid)
  475. updateBackBuffer();
  476. if (!_parentIsStage)
  477. updateGlobalPos();
  478. updateTime();
  479. _entityCollector.clear();
  480. updateViewSizeData();
  481. // collect stuff to render
  482. _scene.traversePartitions(_entityCollector);
  483. // update picking
  484. _mouse3DManager.updateCollider(this);
  485. // updateLights(_entityCollector);
  486. if (_requireDepthRender)
  487. renderSceneDepth(_entityCollector);
  488. if (_filter3DRenderer && _stage3DProxy._context3D) {
  489. _renderer.render(_entityCollector, _filter3DRenderer.getMainInputTexture(_stage3DProxy), _rttBufferManager.renderToTextureRect);
  490. _filter3DRenderer.render(_stage3DProxy, camera, _depthRender);
  491. if (!_shareContext) _stage3DProxy._context3D.present();
  492. } else {
  493. _renderer.shareContext = _shareContext;
  494. if (_shareContext) {
  495. _renderer.render(_entityCollector, null, _viewScissoRect);
  496. } else {
  497. _renderer.render(_entityCollector);
  498. }
  499. }
  500. // clean up data for this render
  501. _entityCollector.cleanUp();
  502. // fire collected mouse events
  503. _mouse3DManager.fireMouseEvents();
  504. }
  505. protected function updateGlobalPos() : void
  506. {
  507. var globalPos : Point = parent.localToGlobal(_localPos);
  508. if (_globalPos.x != globalPos.x) _stage3DProxy.x = globalPos.x;
  509. if (_globalPos.y != globalPos.y) _stage3DProxy.y = globalPos.y;
  510. _globalPos = globalPos;
  511. }
  512. protected function updateTime() : void
  513. {
  514. var time : Number = getTimer();
  515. if (_time == 0) _time = time;
  516. _deltaTime = time - _time;
  517. _time = time;
  518. }
  519. private function updateViewSizeData() : void
  520. {
  521. _camera.lens.aspectRatio = _aspectRatio;
  522. _entityCollector.camera = _camera;
  523. if (_filter3DRenderer || _renderer.renderToTexture) {
  524. _renderer.textureRatioX = _rttBufferManager.textureRatioX;
  525. _renderer.textureRatioY = _rttBufferManager.textureRatioY;
  526. }
  527. else {
  528. _renderer.textureRatioX = 1;
  529. _renderer.textureRatioY = 1;
  530. }
  531. }
  532. protected function renderSceneDepth(entityCollector : EntityCollector) : void
  533. {
  534. if (_depthTextureInvalid || !_depthRender) initDepthTexture(_stage3DProxy._context3D);
  535. _depthRenderer.textureRatioX = _rttBufferManager.textureRatioX;
  536. _depthRenderer.textureRatioY = _rttBufferManager.textureRatioY;
  537. _depthRenderer.render(entityCollector, _depthRender);
  538. }
  539. private function initDepthTexture(context : Context3D) : void
  540. {
  541. _depthTextureInvalid = false;
  542. if (_depthRender) _depthRender.dispose();
  543. _depthRender = context.createTexture(_rttBufferManager.textureWidth, _rttBufferManager.textureHeight, Context3DTextureFormat.BGRA, true);
  544. }
  545. /**
  546. * Disposes all memory occupied by the view. This will also dispose the renderer.
  547. */
  548. public function dispose() : void
  549. {
  550. _stage3DProxy.dispose();
  551. _renderer.dispose();
  552. if (_depthRender)
  553. _depthRender.dispose();
  554. if (_rttBufferManager)
  555. _rttBufferManager.dispose();
  556. _mouse3DManager.disableMouseListeners(this);
  557. _rttBufferManager = null;
  558. _depthRender = null;
  559. _mouse3DManager = null;
  560. _depthRenderer = null;
  561. _stage3DProxy = null;
  562. _renderer = null;
  563. _entityCollector = null;
  564. }
  565. public function project(point3d : Vector3D) : Vector3D
  566. {
  567. var v : Vector3D = _camera.project(point3d);
  568. v.x = (v.x + 1.0)*_width/2.0;
  569. v.y = (v.y + 1.0)*_height/2.0;
  570. return v;
  571. }
  572. /**
  573. * Calculates the scene position of the given screen coordinates.
  574. * @param mX The x coordinate relative to the View3D.
  575. * @param mY The y coordinate relative to the View3D.
  576. * @param mZ The z coordinate relative to the View3D.
  577. * @return The scene position of the given screen coordinates. The returned point corresponds to a point on the projection plane.
  578. */
  579. public function unproject(mX : Number, mY : Number, mZ : Number = 0) : Vector3D
  580. {
  581. return _camera.unproject((mX * 2 - _width)/_width, (mY * 2 - _height)/_height, mZ);
  582. }
  583. /**
  584. * Returns the ray in scene space from the camera to the point on the screen.
  585. * @param mX The x coordinate relative to the View3D.
  586. * @param mY The y coordinate relative to the View3D.
  587. * @param mZ The z coordinate relative to the View3D.
  588. * @return The ray from the camera to the scene space position of a point on the projection plane.
  589. */
  590. public function getRay(mX : Number, mY : Number, mZ : Number = 0) : Vector3D
  591. {
  592. return _camera.getRay((mX * 2 - _width)/_width, (mY * 2 - _height)/_height, mZ);
  593. }
  594. public function get mousePicker() : IPicker
  595. {
  596. return _mouse3DManager.mousePicker;
  597. }
  598. public function set mousePicker(value : IPicker) : void
  599. {
  600. _mouse3DManager.mousePicker = value;
  601. }
  602. /**
  603. * The EntityCollector object that will collect all potentially visible entities in the partition tree.
  604. *
  605. * @see away3d.core.traverse.EntityCollector
  606. * @private
  607. */
  608. arcane function get entityCollector() : EntityCollector
  609. {
  610. return _entityCollector;
  611. }
  612. /**
  613. * When added to the stage, retrieve a Stage3D instance
  614. */
  615. private function onAddedToStage(event : Event) : void
  616. {
  617. if (_addedToStage)
  618. return;
  619. _addedToStage = true;
  620. _stage3DManager = Stage3DManager.getInstance(stage);
  621. if (!_stage3DProxy) _stage3DProxy = _stage3DManager.getFreeStage3DProxy(_forceSoftware);
  622. _stage3DProxy.x = _globalPos.x;
  623. _rttBufferManager = RTTBufferManager.getInstance(_stage3DProxy);
  624. _stage3DProxy.y = _globalPos.y;
  625. if (_width == 0) width = stage.stageWidth;
  626. else _rttBufferManager.viewWidth = _width;
  627. if (_height == 0) height = stage.stageHeight;
  628. else _rttBufferManager.viewHeight = _height;
  629. _renderer.stage3DProxy = _depthRenderer.stage3DProxy = _stage3DProxy;
  630. }
  631. private function onAdded(event : Event) : void
  632. {
  633. _parentIsStage = (parent == stage);
  634. _globalPos = parent.localToGlobal(new Point(x, y));
  635. if (_stage3DProxy) {
  636. _stage3DProxy.x = _globalPos.x;
  637. _stage3DProxy.y = _globalPos.y;
  638. }
  639. }
  640. // dead ends:
  641. override public function set z(value : Number) : void {}
  642. override public function set scaleZ(value : Number) : void {}
  643. override public function set rotation(value : Number) : void {}
  644. override public function set rotationX(value : Number) : void {}
  645. override public function set rotationY(value : Number) : void {}
  646. override public function set rotationZ(value : Number) : void {}
  647. override public function set transform(value : Transform) : void {}
  648. override public function set scaleX(value : Number) : void {}
  649. override public function set scaleY(value : Number) : void {}
  650. }
  651. }