Posted By

gfazioli on 04/03/08


Tagged

actionscript window flash alert movieclip Sviluppo Tutorials DepthManager kTopmost modal modale onRelease setDepthBelow useHandCursor


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

gfazioli


MovieClip TopMost


 / Published in: ActionScript
 

URL: http://www.undolog.com/2007/11/12/creare-movieclip-modali-in-topmost/

An Actionscript Class for TopMost MovieClip

  1. /*
  2. **
  3. ** file : MovieClipModal.as
  4. ** Author : Giovambattista Fazioli ([email protected])
  5. ** Web : http://www.undolog.com
  6. ** Email : g (dot) fazioli (at) undolog (dot) (com)
  7. ** Created : 08/11/2007 23.57
  8. ** Modified : 08/11/2007 23.57
  9. **
  10. **
  11. */
  12. import mx.managers.DepthManager;
  13. //
  14. class MovieClipModal extends MovieClip {
  15. //
  16. private var __release:String = "1.0";
  17. //
  18. private var __modal_mc:MovieClip;
  19. //
  20. private var __movieWidth:Number = 0;
  21. private var __movieHeight:Number = 0;
  22. private var __left:Number = 0;
  23. private var __right:Number = 0;
  24. private var __top:Number = 0;
  25. private var __bottom:Number = 0;
  26. //
  27. function MovieClipModal() {
  28. Stage.scaleMode = "noscale";
  29. Stage.addListener(this);
  30. //
  31. onLoad = _onLoad;
  32. onUnload = _onUnload;
  33. //
  34. __movieWidth = Stage.width;
  35. __movieHeight = Stage.height;
  36. }
  37. /*
  38. ** _onLoad() - wrap onLoad MovieClip
  39. */
  40. private function _onLoad() {
  41. //Key.addListener(this);
  42. //
  43. __modal_mc = _root.createEmptyMovieClip("__modal_mc", DepthManager.kTopmost);
  44. __modal_mc.clear();
  45. __modal_mc.beginFill(0xff0000, 100);
  46. __modal_mc.moveTo(0, 0);
  47. __modal_mc.lineTo(100, 0);
  48. __modal_mc.lineTo(100, 100);
  49. __modal_mc.lineTo(0, 100);
  50. __modal_mc.endFill();
  51. //
  52. __modal_mc.setDepthBelow(this);
  53. __modal_mc._alpha = 10;
  54. //_global.style.modalTransparency;
  55. __modal_mc.tabEnabled = __modal_mc.useHandCursor = false;
  56. //
  57. __modal_mc.onRelease = function() {};
  58. //
  59. onResize();
  60. }
  61. /*
  62. ** _onUnload() - wrap onUnload MovieClip
  63. */
  64. private function _onUnload() {
  65. __modal_mc.removeMovieClip();
  66. }
  67. /*
  68. ** onKeyDown - wrap Key
  69. */
  70. private function onKeyDown() {
  71. if (Key.getCode() == Key.TAB) {
  72. //Selection.setFocus();
  73. }
  74. }
  75. /********************************************************************************************
  76. ** onResize() event
  77. ********************************************************************************************/
  78. private function onResize() {
  79. var sw:Number = Math.round(Stage.width);
  80. var sh:Number = Math.round(Stage.height);
  81. var ow:Number = Math.round(this.__movieWidth);
  82. var oh:Number = Math.round(this.__movieHeight);
  83. //
  84. __modal_mc._x = -Math.floor(((sw - ow) / 2));
  85. __modal_mc._y = -Math.floor(((sh - oh) / 2));
  86. __modal_mc._width = Stage.width;
  87. __modal_mc._height = Stage.height;
  88. }
  89. }

Report this snippet  

You need to login to post a comment.