Advertisement
Scriv07

Untitled

Sep 16th, 2017
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.06 KB | None | 0 0
  1. package
  2. {
  3. import flash.display.MovieClip;
  4. import flash.events.Event;
  5. import flash.events.IOErrorEvent;
  6. import Shared.AS3.BSButtonHintBar;
  7. import Shared.AS3.BSButtonHintData;
  8. import Shared.IMenu;
  9.  
  10. public class ScopeMenu extends IMenu implements IScopeMenu
  11. {
  12. public var OverlayLoader_mc:OverlayLoader;
  13. public var ButtonHintInstance:BSButtonHintBar;
  14.  
  15. private var HoldBreathButton:BSButtonHintData;
  16. private var HoldBreathButtonForVita:BSButtonHintData;
  17.  
  18. public var OverlayFrame:int = 0;
  19.  
  20.  
  21.  
  22. // Initialize
  23. //---------------------------------------------
  24.  
  25. public function ScopeMenu()
  26. {
  27. trace("[ScopeMenu.as]: "+Utility.WalkMovie(this));
  28. HoldBreathButton = new BSButtonHintData("$Hold Breath", "Alt", "PSN_L3", "Xenon_L3", 1, null);
  29. HoldBreathButtonForVita = new BSButtonHintData("$Hold Breath", "Alt", "_DPad_Down", "Xenon_L3", 1, null);
  30. super();
  31.  
  32. HoldBreathButtonForVita.ButtonVisible = false;
  33.  
  34. var hints:Vector.<BSButtonHintData> = new Vector.<BSButtonHintData>();
  35. hints.push(HoldBreathButton);
  36. hints.push(HoldBreathButtonForVita);
  37. ButtonHintInstance.SetButtonHintData(hints);
  38.  
  39. if (stage) {trace("[ScopeMenu] already in stage")};
  40.  
  41. addEventListener(Event.ENTER_FRAME, enterFrameHandler);
  42. }
  43.  
  44.  
  45. private function enterFrameHandler(e:Event):void
  46. {
  47.  
  48. if (stage)
  49. {
  50. removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
  51. trace("bingo");
  52. }
  53. }
  54.  
  55.  
  56. // Events
  57. //---------------------------------------------
  58.  
  59. private function OnLoadComplete(e:Event) : void // WORKING!
  60. {
  61. // remove listeners
  62. gotoAndStop(18);
  63. trace("[ScopeMenu] LOADED");
  64. }
  65.  
  66.  
  67. private function OnLoadError(e:IOErrorEvent) : void // WORKING!
  68. {
  69. gotoAndStop(OverlayFrame);
  70. trace("[ScopeMenu] ERROR");
  71. }
  72.  
  73.  
  74. // Methods
  75. //---------------------------------------------
  76.  
  77. public function SetIsVita(isVita:Boolean) : *
  78. {
  79. if (isVita)
  80. {
  81. HoldBreathButton.ButtonVisible = false;
  82. HoldBreathButtonForVita.ButtonVisible = true;
  83. }
  84. else
  85. {
  86. HoldBreathButton.ButtonVisible = true;
  87. HoldBreathButtonForVita.ButtonVisible = false;
  88. }
  89. }
  90.  
  91.  
  92. public function SetOverlay(identifier:uint) : *
  93. {
  94. OverlayFrame = identifier + 1;
  95. gotoAndStop(OverlayFrame);
  96. trace("[ScopeMenu] SetOverlay(identifier="+identifier+")");
  97. }
  98.  
  99.  
  100. public function SetCustom(filePath:String) : *
  101. {
  102. OverlayLoader_mc.Info.addEventListener(Event.COMPLETE, this.OnLoadComplete);
  103. OverlayLoader_mc.Info.addEventListener(IOErrorEvent.IO_ERROR, this.OnLoadError);
  104. OverlayLoader_mc.Load(filePath);
  105. trace("[ScopeMenu] SetCustom(filePath="+filePath+")");
  106. }
  107.  
  108.  
  109. public function GetCustom() : String
  110. {
  111. return OverlayLoader_mc.Instance;
  112. }
  113.  
  114.  
  115. public function PathConvert(filepath:String, toExtension:String) : String
  116. {
  117. trace("[ScopeMenu] PathConvert(filepath="+filepath+", toExtension="+toExtension+")");
  118. return Path.ConvertFileExtension(filepath, toExtension);
  119. }
  120.  
  121.  
  122. }
  123. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement