mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-20 01:37:50 -05:00
Brought up to date with the private repository (feea4c7)
This commit is contained in:
1 parent
1aa738d692
commit
1b1df1ae48
7925 files changed
+2617237
-20
No files matched your search
@@ -0,0 +1,111 @@
|
||||
package com.sbi.popup
|
||||
{
|
||||
import flash.display.*;
|
||||
import flash.events.*;
|
||||
import flash.text.TextField;
|
||||
|
||||
public dynamic class SBAJOkPopup extends SBPopup
|
||||
{
|
||||
|
||||
protected var _messageText:TextField;
|
||||
|
||||
protected var _titleText:TextField;
|
||||
|
||||
protected var _skin:MovieClip;
|
||||
|
||||
protected var _content:MovieClip;
|
||||
|
||||
protected var _top:MovieClip;
|
||||
|
||||
protected var _mid:MovieClip;
|
||||
|
||||
protected var _bot:MovieClip;
|
||||
|
||||
private var _titleToMessageDifference:int = 5;
|
||||
|
||||
private var _btnTxtGap:int = 10;
|
||||
|
||||
private var _verticalOffset:int = 13;
|
||||
|
||||
private var _okBtn:MovieClip;
|
||||
|
||||
private var _okBtnCallback:Function;
|
||||
|
||||
public function SBAJOkPopup(param1:DisplayObjectContainer, param2:String = null, param3:String = null, param4:Function = null, param5:Boolean = true, param6:MovieClip = null, param7:MovieClip = null, param8:Boolean = true, param9:Boolean = true, param10:Boolean = false, param11:Boolean = false, param12:Number = undefined, param13:Number = undefined, param14:Number = undefined, param15:Number = undefined, param16:Array = null)
|
||||
{
|
||||
if(param4 != null)
|
||||
{
|
||||
_okBtnCallback = param4;
|
||||
}
|
||||
else
|
||||
{
|
||||
_okBtnCallback = onOkBtn;
|
||||
}
|
||||
_skin = GETDEFINITIONBYNAME("BroadcastPopupSkin");
|
||||
_content = GETDEFINITIONBYNAME("BroadcastPopupContent");
|
||||
_top = _skin.ba.t;
|
||||
_mid = _skin.ba.m;
|
||||
_bot = _skin.ba.b;
|
||||
_okBtn = _content.okBtn;
|
||||
_okBtn.addEventListener("mouseDown",_okBtnCallback,false,0,true);
|
||||
_messageText = _content.text;
|
||||
_titleText = _content.titleTxt;
|
||||
_messageText.autoSize = "center";
|
||||
_titleText.autoSize = "center";
|
||||
setMessageText(param2);
|
||||
if(param3)
|
||||
{
|
||||
_titleText.text = param3;
|
||||
}
|
||||
super(param1,_skin,_content,param8,param9,param10,param11,param5,param3,param12,param13,param14,param15,param16);
|
||||
}
|
||||
|
||||
public static function destroyInParentChain(param1:DisplayObject) : void
|
||||
{
|
||||
while(param1 && param1 != gMainFrame.stage && !(param1 is SBOkPopup))
|
||||
{
|
||||
param1 = param1.parent;
|
||||
}
|
||||
if(param1 is SBOkPopup)
|
||||
{
|
||||
SBOkPopup(param1).destroy();
|
||||
}
|
||||
}
|
||||
|
||||
override public function destroy() : void
|
||||
{
|
||||
_okBtn.removeEventListener("mouseDown",_okBtnCallback);
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
public function setMessageText(param1:String) : void
|
||||
{
|
||||
_messageText.text = param1;
|
||||
resize();
|
||||
}
|
||||
|
||||
private function resize() : void
|
||||
{
|
||||
_mid.height = Math.floor(_messageText.height);
|
||||
_mid.y = Math.floor(-(_mid.height * 0.5));
|
||||
_top.y = _mid.y - _top.height;
|
||||
_bot.y = _mid.y + _mid.height;
|
||||
_titleText.y = 0;
|
||||
_messageText.y = _titleText.height + _titleToMessageDifference;
|
||||
_okBtn.y = _messageText.y + _messageText.height + _btnTxtGap + _okBtn.height * 0.5;
|
||||
_skin.c.height = _titleText.height + _titleToMessageDifference + _messageText.height + _btnTxtGap + _okBtn.height;
|
||||
_skin.c.y = -(_skin.ba.height * 0.5) + _verticalOffset;
|
||||
_content.x = _skin.c.x;
|
||||
_content.y = _skin.c.y;
|
||||
_content.width = _skin.c.width;
|
||||
_content.height = _skin.c.height;
|
||||
}
|
||||
|
||||
private function onOkBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.sbi.popup
|
||||
{
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.KeyboardEvent;
|
||||
import flash.events.MouseEvent;
|
||||
|
||||
public dynamic class SBBlockCancelPopup extends SBStandardPopup
|
||||
{
|
||||
|
||||
private var _blockUnblockBtn:MovieClip = _loc9_.blockUnblockBtn;
|
||||
|
||||
private var _cancelBtn:MovieClip;
|
||||
|
||||
private var _confirmCallback:Function;
|
||||
|
||||
private var _passbackObject:Object;
|
||||
|
||||
public function SBBlockCancelPopup(param1:DisplayObjectContainer, param2:String = null, param3:Boolean = true, param4:Function = null, param5:Object = null, param6:Number = undefined, param7:Number = undefined)
|
||||
{
|
||||
_confirmCallback = param4;
|
||||
_passbackObject = param5;
|
||||
_verticalOffset = -20;
|
||||
_btnTxtGap = 6;
|
||||
_btnHeight = 44;
|
||||
var _loc8_:MovieClip = GETDEFINITIONBYNAME("YesNoPopupSkin");
|
||||
var _loc9_:MovieClip = GETDEFINITIONBYNAME("blockCancelPopupContent");
|
||||
_cancelBtn = _loc9_.cancelBtn;
|
||||
_blockUnblockBtn.addEventListener("mouseDown",onBlockCancelBtn,false,0,true);
|
||||
_cancelBtn.addEventListener("mouseDown",onBlockCancelBtn,false,0,true);
|
||||
_resizeCallback = onResize;
|
||||
super(param1,param2,param3,_loc9_,_loc8_,true,true,false,false,"",param6,param7,NaN,NaN,null);
|
||||
stage.addEventListener("keyDown",handleBlockCancelKeyDown,false,0,true);
|
||||
}
|
||||
|
||||
override public function destroy() : void
|
||||
{
|
||||
if(stage)
|
||||
{
|
||||
stage.removeEventListener("keyDown",handleBlockCancelKeyDown);
|
||||
}
|
||||
_blockUnblockBtn.removeEventListener("mouseDown",onBlockCancelBtn);
|
||||
_cancelBtn.removeEventListener("mouseDown",onBlockCancelBtn);
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
private function onResize() : void
|
||||
{
|
||||
_blockUnblockBtn.y = _text.height + _btnTxtGap + 0.5 * _btnHeight;
|
||||
_cancelBtn.y = _blockUnblockBtn.y;
|
||||
}
|
||||
|
||||
private function handleBlockCancelKeyDown(param1:KeyboardEvent) : void
|
||||
{
|
||||
switch(param1.keyCode)
|
||||
{
|
||||
case 13:
|
||||
case 32:
|
||||
param1.stopPropagation();
|
||||
handleBlockCancel(true);
|
||||
break;
|
||||
case 8:
|
||||
case 46:
|
||||
case 27:
|
||||
param1.stopPropagation();
|
||||
handleBlockCancel(false);
|
||||
}
|
||||
}
|
||||
|
||||
private function onBlockCancelBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
handleBlockCancel(param1.currentTarget == _blockUnblockBtn);
|
||||
}
|
||||
|
||||
private function handleBlockCancel(param1:Boolean) : void
|
||||
{
|
||||
var _loc2_:Object = null;
|
||||
destroy();
|
||||
if(_confirmCallback != null)
|
||||
{
|
||||
_loc2_ = {
|
||||
"status":param1,
|
||||
"passback":_passbackObject
|
||||
};
|
||||
_confirmCallback(_loc2_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.sbi.popup
|
||||
{
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.KeyboardEvent;
|
||||
import flash.events.MouseEvent;
|
||||
|
||||
public class SBLeaveCancelPopup extends SBStandardPopup
|
||||
{
|
||||
|
||||
private var _confirmCallback:Function;
|
||||
|
||||
private var _passbackObject:Object;
|
||||
|
||||
private var _leaveBtn:Object;
|
||||
|
||||
private var _cancelBtn:Object;
|
||||
|
||||
public function SBLeaveCancelPopup(param1:DisplayObjectContainer, param2:String = null, param3:Boolean = true, param4:Function = null, param5:Object = null)
|
||||
{
|
||||
_confirmCallback = param4;
|
||||
_passbackObject = param5;
|
||||
_verticalOffset = -20;
|
||||
_btnTxtGap = 6;
|
||||
_btnHeight = 44;
|
||||
var _loc6_:MovieClip = GETDEFINITIONBYNAME("YesNoPopupSkin");
|
||||
var _loc7_:MovieClip = GETDEFINITIONBYNAME("LeaveCancelPopupContent");
|
||||
_resizeCallback = onResize;
|
||||
_leaveBtn = _loc7_.leaveBtn;
|
||||
_cancelBtn = _loc7_.cancelBtn;
|
||||
_leaveBtn.addEventListener("mouseDown",onLeaveCancelBtn,false,0,true);
|
||||
_cancelBtn.addEventListener("mouseDown",onLeaveCancelBtn,false,0,true);
|
||||
super(param1,param2,param3,_loc7_,_loc6_);
|
||||
stage.addEventListener("keyDown",handleLeaveCancelKeyDown,false,0,true);
|
||||
}
|
||||
|
||||
override public function destroy() : void
|
||||
{
|
||||
if(stage)
|
||||
{
|
||||
stage.removeEventListener("keyDown",handleLeaveCancelKeyDown);
|
||||
}
|
||||
_leaveBtn.removeEventListener("mouseDown",onLeaveCancelBtn);
|
||||
_cancelBtn.removeEventListener("mouseDown",onLeaveCancelBtn);
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
private function onResize() : void
|
||||
{
|
||||
_leaveBtn.y = _text.height + _btnTxtGap + 0.5 * _btnHeight;
|
||||
_cancelBtn.y = _leaveBtn.y;
|
||||
}
|
||||
|
||||
private function handleLeaveCancelKeyDown(param1:KeyboardEvent) : void
|
||||
{
|
||||
switch(param1.keyCode)
|
||||
{
|
||||
case 13:
|
||||
case 32:
|
||||
param1.stopPropagation();
|
||||
handleLeaveCancel(true);
|
||||
break;
|
||||
case 8:
|
||||
case 46:
|
||||
case 27:
|
||||
param1.stopPropagation();
|
||||
handleLeaveCancel(false);
|
||||
}
|
||||
}
|
||||
|
||||
private function onLeaveCancelBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
handleLeaveCancel(param1.currentTarget == _leaveBtn);
|
||||
}
|
||||
|
||||
private function handleLeaveCancel(param1:Boolean) : void
|
||||
{
|
||||
var _loc2_:Object = null;
|
||||
destroy();
|
||||
if(_confirmCallback != null)
|
||||
{
|
||||
_loc2_ = {
|
||||
"status":param1,
|
||||
"passback":_passbackObject
|
||||
};
|
||||
_confirmCallback(_loc2_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.sbi.popup
|
||||
{
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.MovieClip;
|
||||
import flash.text.TextField;
|
||||
|
||||
public dynamic class SBMessage extends SBPopup
|
||||
{
|
||||
|
||||
public var messageTxt:TextField = new TextField();
|
||||
|
||||
public function SBMessage(param1:DisplayObjectContainer, param2:MovieClip, param3:String, param4:Boolean = true, param5:Boolean = true, param6:Boolean = false, param7:Boolean = true, param8:Boolean = false, param9:String = null, param10:Number = undefined, param11:Number = undefined, param12:Number = undefined, param13:Number = undefined, param14:Array = null)
|
||||
{
|
||||
messageTxt.text = param3;
|
||||
super(param1,param2,messageTxt,param4,param5,param6,param7,param8,param9,param10,param11,param12,param13,param14);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
package com.sbi.popup
|
||||
{
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import gui.DarkenManager;
|
||||
import loader.MediaHelper;
|
||||
|
||||
public class SBMysteryMessagePopup
|
||||
{
|
||||
|
||||
private var _parent:DisplayObjectContainer;
|
||||
|
||||
private var _message:String;
|
||||
|
||||
private var _mediaHelper:MediaHelper;
|
||||
|
||||
private var _popup:MovieClip;
|
||||
|
||||
private var _giftCallback:Function;
|
||||
|
||||
private var _passback:Object;
|
||||
|
||||
private var _showGift:Boolean;
|
||||
|
||||
private var _type:int;
|
||||
|
||||
public function SBMysteryMessagePopup(param1:DisplayObjectContainer, param2:int, param3:String = null, param4:Boolean = true, param5:Function = null, param6:Object = null)
|
||||
{
|
||||
super();
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_parent = param1;
|
||||
_type = param2;
|
||||
_message = param3;
|
||||
_giftCallback = param5;
|
||||
_passback = param6;
|
||||
_showGift = param4;
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(5443,onMediaLoaded);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
if(_popup)
|
||||
{
|
||||
DarkenManager.unDarken(_popup);
|
||||
if(_parent && _popup.parent && _popup.parent == _parent)
|
||||
{
|
||||
_parent.removeChild(_popup);
|
||||
}
|
||||
_popup.removeEventListener("mouseDown",onPopup);
|
||||
_loc1_ = SBPopupManager.nonSBPopups.indexOf(this);
|
||||
if(_loc1_ >= 0)
|
||||
{
|
||||
SBPopupManager.nonSBPopups.splice(_loc1_,1);
|
||||
}
|
||||
_popup = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function onMediaLoaded(param1:MovieClip) : void
|
||||
{
|
||||
var topHeight:Number;
|
||||
var distanceFromMiddleToImage:Number;
|
||||
var distanceFromBottomToGift:Number;
|
||||
var img:MovieClip = param1;
|
||||
if(img)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_popup = MovieClip(img.getChildAt(0));
|
||||
_popup.gotoAndStop(_type + 1);
|
||||
_mediaHelper.destroy();
|
||||
_mediaHelper = null;
|
||||
_popup.txt.autoSize = "center";
|
||||
_popup.txt.text = _message;
|
||||
topHeight = Number(_popup.ba.t.hasOwnProperty("sizeCont") ? _popup.ba.t.sizeCont.height : _popup.ba.t.height);
|
||||
distanceFromMiddleToImage = _popup.ba.m.y - _popup.p.y;
|
||||
distanceFromBottomToGift = _popup.ba.b.y - _popup.gift.y;
|
||||
with(_popup.ba)
|
||||
{
|
||||
|
||||
m.height = Math.floor(_popup.txt.height) + 65;
|
||||
m.y = Math.floor(-(m.height * 0.5));
|
||||
t.y = m.y - topHeight + 1;
|
||||
b.y = m.y + m.height;
|
||||
_popup.txt.y = m.y + 30;
|
||||
}
|
||||
_popup.p.y = _popup.ba.m.y - distanceFromMiddleToImage;
|
||||
_popup.gift.y = _popup.ba.b.y - distanceFromBottomToGift;
|
||||
_popup.gift.visible = _showGift;
|
||||
_popup.addEventListener("mouseDown",onPopup,false,0,true);
|
||||
_popup.gift.addEventListener("mouseDown",onGiftDown,false,0,true);
|
||||
_popup.ba.t.bx.addEventListener("mouseDown",onCloseBtn,false,0,true);
|
||||
_popup.x = 900 * 0.5;
|
||||
_popup.y = 550 * 0.5;
|
||||
_parent.addChild(_popup);
|
||||
DarkenManager.darken(_popup);
|
||||
SBPopupManager.nonSBPopups.push(this);
|
||||
}
|
||||
}
|
||||
|
||||
private function onPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function onGiftDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
destroy();
|
||||
if(_giftCallback != null)
|
||||
{
|
||||
if(_passback != null)
|
||||
{
|
||||
_giftCallback(_passback);
|
||||
}
|
||||
else
|
||||
{
|
||||
_giftCallback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onCloseBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.sbi.popup
|
||||
{
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.KeyboardEvent;
|
||||
import flash.events.MouseEvent;
|
||||
|
||||
public class SBOkCancelPopup extends SBStandardPopup
|
||||
{
|
||||
|
||||
private var _okCancelBtn:MovieClip = _loc9_.okCancelBtn;
|
||||
|
||||
private var _cancelBtn:MovieClip;
|
||||
|
||||
private var _confirmCallback:Function;
|
||||
|
||||
private var _passbackObject:Object;
|
||||
|
||||
public function SBOkCancelPopup(param1:DisplayObjectContainer, param2:String = null, param3:Boolean = true, param4:Function = null, param5:Object = null, param6:Number = undefined, param7:Number = undefined)
|
||||
{
|
||||
_confirmCallback = param4;
|
||||
_passbackObject = param5;
|
||||
_verticalOffset = -20;
|
||||
_btnTxtGap = 6;
|
||||
_btnHeight = 44;
|
||||
var _loc8_:MovieClip = GETDEFINITIONBYNAME("YesNoPopupSkin");
|
||||
var _loc9_:MovieClip = GETDEFINITIONBYNAME("okCancelPopupContent");
|
||||
_cancelBtn = _loc9_.cancelBtn;
|
||||
_okCancelBtn.addEventListener("mouseDown",onOkCancelBtn,false,0,true);
|
||||
_cancelBtn.addEventListener("mouseDown",onOkCancelBtn,false,0,true);
|
||||
_resizeCallback = onResize;
|
||||
super(param1,param2,param3,_loc9_,_loc8_,true,true,false,false,"",param6,param7,NaN,NaN,null);
|
||||
stage.addEventListener("keyDown",handleBlockCancelKeyDown,false,0,true);
|
||||
}
|
||||
|
||||
override public function destroy() : void
|
||||
{
|
||||
if(stage)
|
||||
{
|
||||
stage.removeEventListener("keyDown",handleBlockCancelKeyDown);
|
||||
}
|
||||
_okCancelBtn.removeEventListener("mouseDown",onOkCancelBtn);
|
||||
_cancelBtn.removeEventListener("mouseDown",onOkCancelBtn);
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
private function onResize() : void
|
||||
{
|
||||
_okCancelBtn.y = _text.height + _btnTxtGap + 0.5 * _btnHeight;
|
||||
_cancelBtn.y = _okCancelBtn.y;
|
||||
}
|
||||
|
||||
private function handleBlockCancelKeyDown(param1:KeyboardEvent) : void
|
||||
{
|
||||
switch(param1.keyCode)
|
||||
{
|
||||
case 13:
|
||||
case 32:
|
||||
param1.stopPropagation();
|
||||
handleOkCancel(true);
|
||||
break;
|
||||
case 8:
|
||||
case 46:
|
||||
case 27:
|
||||
param1.stopPropagation();
|
||||
handleOkCancel(false);
|
||||
}
|
||||
}
|
||||
|
||||
private function onOkCancelBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
handleOkCancel(param1.currentTarget == _okCancelBtn);
|
||||
}
|
||||
|
||||
private function handleOkCancel(param1:Boolean) : void
|
||||
{
|
||||
var _loc2_:Object = null;
|
||||
destroy();
|
||||
if(_confirmCallback != null)
|
||||
{
|
||||
_loc2_ = {
|
||||
"status":param1,
|
||||
"passback":_passbackObject
|
||||
};
|
||||
_confirmCallback(_loc2_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.sbi.popup
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.Event;
|
||||
import flash.events.KeyboardEvent;
|
||||
|
||||
public dynamic class SBOkPopup extends SBStandardPopup
|
||||
{
|
||||
|
||||
private var _okBtn:MovieClip;
|
||||
|
||||
private var _okBtnCallback:Function;
|
||||
|
||||
public function SBOkPopup(param1:DisplayObjectContainer, param2:String = null, param3:Boolean = true, param4:Function = null, param5:Boolean = true, param6:Boolean = true, param7:Boolean = false, param8:Boolean = false, param9:String = null, param10:Number = undefined, param11:Number = undefined, param12:Number = undefined, param13:Number = undefined, param14:Array = null)
|
||||
{
|
||||
_verticalOffset = -20;
|
||||
_btnTxtGap = 6;
|
||||
_btnHeight = 44;
|
||||
if(param4 != null)
|
||||
{
|
||||
_okBtnCallback = param4;
|
||||
}
|
||||
else
|
||||
{
|
||||
_okBtnCallback = onOkBtn;
|
||||
}
|
||||
var _loc15_:MovieClip = GETDEFINITIONBYNAME("OkPopupSkin");
|
||||
var _loc16_:MovieClip = GETDEFINITIONBYNAME("OkPopupContent");
|
||||
_okBtn = _loc16_.okBtn;
|
||||
_okBtn.addEventListener("mouseDown",_okBtnCallback,false,0,true);
|
||||
_resizeCallback = onResize;
|
||||
super(param1,param2,param3,_loc16_,_loc15_,param5,param6,param7,param8,param9,param10,param11,param12,param13,param14);
|
||||
stage.addEventListener("keyDown",handleOkKeyDown,false,0,true);
|
||||
}
|
||||
|
||||
public static function destroyInParentChain(param1:DisplayObject) : void
|
||||
{
|
||||
while(param1 && param1 != gMainFrame.stage && !(param1 is SBOkPopup))
|
||||
{
|
||||
param1 = param1.parent;
|
||||
}
|
||||
if(param1 is SBOkPopup)
|
||||
{
|
||||
SBOkPopup(param1).destroy();
|
||||
}
|
||||
}
|
||||
|
||||
override public function destroy() : void
|
||||
{
|
||||
_okBtn.removeEventListener("mouseDown",_okBtnCallback);
|
||||
if(stage != null)
|
||||
{
|
||||
stage.removeEventListener("keyDown",handleOkKeyDown);
|
||||
}
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
private function onResize() : void
|
||||
{
|
||||
_okBtn.y = _text.height + _btnTxtGap + 0.5 * _btnHeight;
|
||||
}
|
||||
|
||||
private function handleOkKeyDown(param1:KeyboardEvent) : void
|
||||
{
|
||||
switch(param1.keyCode)
|
||||
{
|
||||
case 13:
|
||||
case 32:
|
||||
onOkBtn(param1);
|
||||
}
|
||||
}
|
||||
|
||||
private function onOkBtn(param1:Event) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,213 @@
|
||||
package com.sbi.popup
|
||||
{
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.KeyboardEvent;
|
||||
import flash.events.MouseEvent;
|
||||
import gui.DarkenManager;
|
||||
import loader.MediaHelper;
|
||||
|
||||
public dynamic class SBParchmentPopup
|
||||
{
|
||||
|
||||
public static const TYPE_OK:int = 0;
|
||||
|
||||
public static const TYPE_YES_NO:int = 1;
|
||||
|
||||
public static const TYPE_CONTINUE_EXIT:int = 2;
|
||||
|
||||
public static const TYPE_CONTINUE_ONLY:int = 3;
|
||||
|
||||
private var _parent:DisplayObjectContainer;
|
||||
|
||||
private var _type:int;
|
||||
|
||||
private var _message:String;
|
||||
|
||||
private var _darken:Boolean;
|
||||
|
||||
private var _confirmCallback:Function;
|
||||
|
||||
private var _passback:Object;
|
||||
|
||||
private var _mediaHelper:MediaHelper;
|
||||
|
||||
private var _popup:MovieClip;
|
||||
|
||||
public function SBParchmentPopup(param1:DisplayObjectContainer, param2:int = 0, param3:String = null, param4:Boolean = true, param5:Function = null, param6:Object = null)
|
||||
{
|
||||
super();
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_parent = param1;
|
||||
_type = param2;
|
||||
_message = param3;
|
||||
_darken = param4;
|
||||
_confirmCallback = param5;
|
||||
_passback = param6;
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(2106,onMediaLoaded);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
if(_popup)
|
||||
{
|
||||
DarkenManager.unDarken(_popup);
|
||||
if(_parent && _popup.parent && _popup.parent == _parent)
|
||||
{
|
||||
_parent.removeChild(_popup);
|
||||
}
|
||||
_popup.removeEventListener("mouseDown",onPopup);
|
||||
gMainFrame.stage.removeEventListener("keyDown",keyDownHandler);
|
||||
switch(_type)
|
||||
{
|
||||
case 0:
|
||||
_popup.okBtn.removeEventListener("mouseDown",onBtnDown);
|
||||
break;
|
||||
case 1:
|
||||
_popup.yesBtn.removeEventListener("mouseDown",onBtnDown);
|
||||
_popup.noBtn.removeEventListener("mouseDown",onBtnDown);
|
||||
break;
|
||||
case 2:
|
||||
_popup.contBtn.removeEventListener("mouseDown",onBtnDown);
|
||||
_popup.exitBtn.removeEventListener("mouseDown",onBtnDown);
|
||||
break;
|
||||
case 3:
|
||||
_popup.contOnlyBtn.removeEventListener("mouseDown",onBtnDown);
|
||||
}
|
||||
_loc1_ = SBPopupManager.nonSBPopups.indexOf(this);
|
||||
if(_loc1_ >= 0)
|
||||
{
|
||||
SBPopupManager.nonSBPopups.splice(_loc1_,1);
|
||||
}
|
||||
_popup = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function onMediaLoaded(param1:MovieClip) : void
|
||||
{
|
||||
var img:MovieClip = param1;
|
||||
if(img)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_popup = MovieClip(img.getChildAt(0));
|
||||
_mediaHelper.destroy();
|
||||
_mediaHelper = null;
|
||||
gMainFrame.stage.addEventListener("keyDown",keyDownHandler,false,0,true);
|
||||
switch(_type)
|
||||
{
|
||||
case 0:
|
||||
_popup.yesBtn.visible = false;
|
||||
_popup.noBtn.visible = false;
|
||||
_popup.contBtn.visible = false;
|
||||
_popup.exitBtn.visible = false;
|
||||
_popup.contOnlyBtn.visible = false;
|
||||
_popup.okBtn.addEventListener("mouseDown",onBtnDown,false,0,true);
|
||||
break;
|
||||
case 1:
|
||||
_popup.okBtn.visible = false;
|
||||
_popup.contBtn.visible = false;
|
||||
_popup.exitBtn.visible = false;
|
||||
_popup.contOnlyBtn.visible = false;
|
||||
_popup.yesBtn.addEventListener("mouseDown",onBtnDown,false,0,true);
|
||||
_popup.noBtn.addEventListener("mouseDown",onBtnDown,false,0,true);
|
||||
break;
|
||||
case 2:
|
||||
_popup.okBtn.visible = false;
|
||||
_popup.yesBtn.visible = false;
|
||||
_popup.noBtn.visible = false;
|
||||
_popup.contOnlyBtn.visible = false;
|
||||
_popup.contBtn.addEventListener("mouseDown",onBtnDown,false,0,true);
|
||||
_popup.exitBtn.addEventListener("mouseDown",onBtnDown,false,0,true);
|
||||
break;
|
||||
case 3:
|
||||
_popup.okBtn.visible = false;
|
||||
_popup.yesBtn.visible = false;
|
||||
_popup.noBtn.visible = false;
|
||||
_popup.exitBtn.visible = false;
|
||||
_popup.contBtn.visible = false;
|
||||
_popup.contOnlyBtn.addEventListener("mouseDown",onBtnDown,false,0,true);
|
||||
}
|
||||
_popup.txt.autoSize = "center";
|
||||
_popup.txt.text = _message;
|
||||
with(_popup.ba)
|
||||
{
|
||||
|
||||
m.height = Math.floor(_popup.txt.height) + 44 + 8;
|
||||
m.y = Math.floor(-(m.height * 0.5));
|
||||
t.y = m.y - t.height;
|
||||
b.y = m.y + m.height;
|
||||
_popup.txt.y = m.y + 4;
|
||||
_popup.yesBtn.y = m.y + _popup.txt.height + 13;
|
||||
_popup.noBtn.y = m.y + _popup.txt.height + 13;
|
||||
_popup.okBtn.y = m.y + _popup.txt.height + 9;
|
||||
_popup.contBtn.y = m.y + _popup.txt.height + 13;
|
||||
_popup.exitBtn.y = m.y + _popup.txt.height + 13;
|
||||
_popup.contOnlyBtn.y = m.y + _popup.txt.height + 13;
|
||||
}
|
||||
_popup.addEventListener("mouseDown",onPopup,false,0,true);
|
||||
_popup.x = 900 * 0.5;
|
||||
_popup.y = 550 * 0.5;
|
||||
_parent.addChild(_popup);
|
||||
if(_darken)
|
||||
{
|
||||
DarkenManager.darken(_popup);
|
||||
}
|
||||
SBPopupManager.nonSBPopups.push(this);
|
||||
}
|
||||
}
|
||||
|
||||
private function onPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function onBtnDown(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc2_:Object = null;
|
||||
param1.stopPropagation();
|
||||
if(_confirmCallback != null)
|
||||
{
|
||||
_loc2_ = {
|
||||
"status":param1.currentTarget == _popup.contBtn || param1.currentTarget == _popup.contOnlyBtn || param1.currentTarget == _popup.yesBtn || param1.currentTarget == _popup.okBtn,
|
||||
"passback":_passback
|
||||
};
|
||||
destroy();
|
||||
_confirmCallback(_loc2_);
|
||||
}
|
||||
else
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private function keyDownHandler(param1:KeyboardEvent) : void
|
||||
{
|
||||
var _loc2_:Object = null;
|
||||
switch(int(param1.keyCode) - 32)
|
||||
{
|
||||
case 0:
|
||||
switch(_type)
|
||||
{
|
||||
case 0:
|
||||
case 2:
|
||||
case 3:
|
||||
param1.stopPropagation();
|
||||
if(_confirmCallback != null)
|
||||
{
|
||||
_loc2_ = {
|
||||
"status":true,
|
||||
"passback":_passback
|
||||
};
|
||||
destroy();
|
||||
_confirmCallback(_loc2_);
|
||||
break;
|
||||
}
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,224 @@
|
||||
package com.sbi.popup
|
||||
{
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import gui.DarkenManager;
|
||||
import gui.GuiRadioButtonGroup;
|
||||
import loader.MediaHelper;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public dynamic class SBPollPopup
|
||||
{
|
||||
|
||||
public static const POLL_POPUP_MEDIA_ID:int = 369;
|
||||
|
||||
private static const POLL_TY_POPUP_MEDIA_ID:int = 370;
|
||||
|
||||
protected var _popupLayer:DisplayObjectContainer;
|
||||
|
||||
protected var _tab:MovieClip;
|
||||
|
||||
protected var _pollDef:Object;
|
||||
|
||||
protected var _onVoteCallback:Function;
|
||||
|
||||
protected var _onDoneCallback:Function;
|
||||
|
||||
protected var _pollPopup:MovieClip;
|
||||
|
||||
protected var _pollMediaHelper:MediaHelper;
|
||||
|
||||
protected var _thankYouPopup:SBStandardTitlePopup;
|
||||
|
||||
protected var _numOptions:int;
|
||||
|
||||
protected var _randomizeOrder:Boolean;
|
||||
|
||||
protected var _randOptionLookup:Array;
|
||||
|
||||
protected var _answerSection:MovieClip;
|
||||
|
||||
protected var _optionsGroup:GuiRadioButtonGroup;
|
||||
|
||||
protected var _pollMediaId:int;
|
||||
|
||||
public function SBPollPopup()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:DisplayObjectContainer, param2:MovieClip, param3:int, param4:Function, param5:Function, param6:Boolean) : void
|
||||
{
|
||||
_popupLayer = param1;
|
||||
_tab = param2;
|
||||
_onVoteCallback = param4;
|
||||
_onDoneCallback = param5;
|
||||
_randomizeOrder = param6;
|
||||
_pollMediaId = param3;
|
||||
_pollDef = _tab.def;
|
||||
_pollMediaHelper = new MediaHelper();
|
||||
_pollMediaHelper.init(param3,onMediaLoaded,true);
|
||||
_randOptionLookup = [0,1,2,3,4];
|
||||
_thankYouPopup = new SBStandardTitlePopup(_popupLayer,LocalizationManager.translateIdOnly(14680),null,370,_onDoneCallback,false);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
_pollPopup.bx.removeEventListener("mouseDown",onCloseBtnDown);
|
||||
_pollPopup.removeEventListener("mouseDown",onPopupDown);
|
||||
_pollPopup = null;
|
||||
_thankYouPopup.destroy();
|
||||
_thankYouPopup = null;
|
||||
}
|
||||
|
||||
private function onMediaLoaded(param1:MovieClip) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_pollMediaHelper.destroy();
|
||||
_pollMediaHelper = null;
|
||||
_pollPopup = MovieClip(param1.getChildAt(0));
|
||||
setUpPollPopup();
|
||||
}
|
||||
}
|
||||
|
||||
protected function setUpPollPopup() : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
_pollPopup.bx.addEventListener("mouseDown",onCloseBtnDown,false,0,true);
|
||||
_pollPopup.addEventListener("mouseDown",onPopupDown,false,0,true);
|
||||
var _loc3_:String = _pollDef.poll;
|
||||
var _loc1_:int = _loc3_.indexOf("|");
|
||||
LocalizationManager.updateToFit(_pollPopup.bodyTxt,_loc3_.substring(0,_loc1_));
|
||||
var _loc4_:Array = _loc3_.substring(_loc1_ + 1,_loc3_.length).split("|");
|
||||
if(_randomizeOrder)
|
||||
{
|
||||
_loc4_ = Utility.shuffleArray(_loc4_,_randOptionLookup);
|
||||
}
|
||||
_numOptions = _loc4_.length;
|
||||
LocalizationManager.updateToFit(_pollPopup.titleTxt,_pollDef.title);
|
||||
if(_numOptions == 2)
|
||||
{
|
||||
_answerSection = _pollPopup.answer2;
|
||||
_pollPopup.answer2.visible = true;
|
||||
_pollPopup.answer3.visible = false;
|
||||
_pollPopup.answer4.visible = false;
|
||||
_pollPopup.answer5.visible = false;
|
||||
}
|
||||
else if(_numOptions == 3)
|
||||
{
|
||||
_answerSection = _pollPopup.answer3;
|
||||
_pollPopup.answer2.visible = false;
|
||||
_pollPopup.answer3.visible = true;
|
||||
_pollPopup.answer4.visible = false;
|
||||
_pollPopup.answer5.visible = false;
|
||||
}
|
||||
else if(_numOptions == 4)
|
||||
{
|
||||
_answerSection = _pollPopup.answer4;
|
||||
_pollPopup.answer2.visible = false;
|
||||
_pollPopup.answer3.visible = false;
|
||||
_pollPopup.answer4.visible = true;
|
||||
_pollPopup.answer5.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_answerSection = _pollPopup.answer5;
|
||||
if(_pollPopup.answer2)
|
||||
{
|
||||
_pollPopup.answer2.visible = false;
|
||||
}
|
||||
if(_pollPopup.answer3)
|
||||
{
|
||||
_pollPopup.answer3.visible = false;
|
||||
}
|
||||
if(_pollPopup.answer4)
|
||||
{
|
||||
_pollPopup.answer4.visible = false;
|
||||
}
|
||||
_pollPopup.answer5.visible = true;
|
||||
}
|
||||
_optionsGroup = new GuiRadioButtonGroup(_answerSection.options);
|
||||
if(_answerSection.voteBtn)
|
||||
{
|
||||
_answerSection.voteBtn.activateGrayState(true);
|
||||
_answerSection.voteBtn.addEventListener("mouseDown",onVoteBtnDown,false,0,true);
|
||||
}
|
||||
_loc2_ = 1;
|
||||
while(_loc2_ < _numOptions + 1)
|
||||
{
|
||||
_answerSection["answer" + _loc2_ + "Txt"].text = _loc4_[_loc2_ - 1];
|
||||
_answerSection.options["option" + _loc2_].addEventListener("click",onOptionSelected,false,0,true);
|
||||
_loc2_++;
|
||||
}
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
open(_pollPopup);
|
||||
}
|
||||
|
||||
protected function open(param1:MovieClip) : void
|
||||
{
|
||||
_popupLayer.addChild(param1);
|
||||
param1.x = 900 * 0.5;
|
||||
param1.y = 550 * 0.5;
|
||||
DarkenManager.darken(param1);
|
||||
param1.visible = true;
|
||||
}
|
||||
|
||||
protected function close(param1:MovieClip) : void
|
||||
{
|
||||
param1.visible = false;
|
||||
DarkenManager.unDarken(param1);
|
||||
_popupLayer.removeChild(param1);
|
||||
}
|
||||
|
||||
private function onVoteBtnDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(!param1.currentTarget.isGray)
|
||||
{
|
||||
processVote();
|
||||
}
|
||||
}
|
||||
|
||||
protected function processVote() : void
|
||||
{
|
||||
if(_onVoteCallback != null)
|
||||
{
|
||||
_onVoteCallback(_tab,_randOptionLookup[_optionsGroup.selected] + 1);
|
||||
}
|
||||
close(_pollPopup);
|
||||
_thankYouPopup.open();
|
||||
}
|
||||
|
||||
protected function onCloseBtnDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
close(param1.currentTarget.parent);
|
||||
_onDoneCallback();
|
||||
}
|
||||
|
||||
protected function onOptionSelected(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
param1.stopPropagation();
|
||||
if(param1.currentTarget == _answerSection.options.option1)
|
||||
{
|
||||
_answerSection.options.option1._circle.visible = true;
|
||||
}
|
||||
_loc2_ = 1;
|
||||
while(_loc2_ < _numOptions + 1)
|
||||
{
|
||||
_answerSection.options["option" + _loc2_].removeEventListener("mouseDown",onOptionSelected);
|
||||
_loc2_++;
|
||||
}
|
||||
_answerSection.voteBtn.activateGrayState(false);
|
||||
}
|
||||
|
||||
protected function onPopupDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.sbi.popup
|
||||
{
|
||||
import flash.events.MouseEvent;
|
||||
import gui.DarkenManager;
|
||||
import gui.GuiRadioButtonGroup;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class SBPollPopupAdjustable extends SBPollPopup
|
||||
{
|
||||
|
||||
public static const POLL_POPUP_WOOD_MEDIA_ID:int = 3931;
|
||||
|
||||
private var _options:Array;
|
||||
|
||||
public function SBPollPopupAdjustable()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
override protected function setUpPollPopup() : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
_pollPopup.bx.addEventListener("mouseDown",onCloseBtnDown,false,0,true);
|
||||
_pollPopup.addEventListener("mouseDown",onPopupDown,false,0,true);
|
||||
var _loc3_:String = _pollDef.poll;
|
||||
var _loc1_:int = _loc3_.indexOf("|");
|
||||
LocalizationManager.updateToFit(_pollPopup.bodyTxt,_loc3_.substring(0,_loc1_));
|
||||
var _loc4_:Array = _loc3_.substring(_loc1_ + 1,_loc3_.length).split("|");
|
||||
if(_randomizeOrder)
|
||||
{
|
||||
_loc4_ = Utility.shuffleArray(_loc4_,_randOptionLookup);
|
||||
}
|
||||
_numOptions = _loc4_.length;
|
||||
LocalizationManager.updateToFit(_pollPopup.titleTxt,_pollDef.title);
|
||||
_options = [];
|
||||
_loc2_ = 1;
|
||||
while(_loc2_ < 6)
|
||||
{
|
||||
if(_loc2_ < _numOptions + 1)
|
||||
{
|
||||
_pollPopup["answer" + _loc2_ + "Txt"].text = _loc4_[_loc2_ - 1];
|
||||
_pollPopup["option" + _loc2_].addEventListener("click",onOptionSelected,false,0,true);
|
||||
_options.push(_pollPopup["option" + _loc2_]);
|
||||
}
|
||||
else
|
||||
{
|
||||
_pollPopup["answer" + _loc2_ + "Txt"].visible = false;
|
||||
_pollPopup["option" + _loc2_].visible = false;
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
_optionsGroup = new GuiRadioButtonGroup(_options);
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
open(_pollPopup);
|
||||
}
|
||||
|
||||
override protected function onOptionSelected(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
processVote();
|
||||
}
|
||||
|
||||
override public function destroy() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
if(_optionsGroup)
|
||||
{
|
||||
_optionsGroup.destroy();
|
||||
_optionsGroup = null;
|
||||
}
|
||||
_loc1_ = 1;
|
||||
while(_loc1_ < _numOptions + 1)
|
||||
{
|
||||
_pollPopup["option" + _loc1_].removeEventListener("click",onOptionSelected);
|
||||
_loc1_++;
|
||||
}
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
private function processVote(param1:String = null) : void
|
||||
{
|
||||
if(_onVoteCallback != null)
|
||||
{
|
||||
_onVoteCallback(_tab,_randOptionLookup[_optionsGroup.selected] + 1,param1);
|
||||
}
|
||||
close(_pollPopup);
|
||||
_onDoneCallback();
|
||||
}
|
||||
|
||||
private function setupNameInput() : void
|
||||
{
|
||||
_pollPopup.submitBtn.addEventListener("mouseDown",onSubmitNameBtn,false,0,true);
|
||||
_pollPopup.name_txt.addEventListener("mouseDown",onNameText,false,0,true);
|
||||
_pollPopup.name_txt.alpha = 0.5;
|
||||
}
|
||||
|
||||
private function onSubmitNameBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(_pollPopup.name_txt.alpha == 1 && _pollPopup.name_txt.length > 0)
|
||||
{
|
||||
processVote(_pollPopup.name_txt.text);
|
||||
}
|
||||
}
|
||||
|
||||
private function onNameText(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(param1.currentTarget.alpha == 0.5)
|
||||
{
|
||||
param1.currentTarget.text = "";
|
||||
param1.currentTarget.alpha = 1;
|
||||
param1.currentTarget.removeEventListener("mouseDown",onNameText);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,350 @@
|
||||
package com.sbi.popup
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.MouseEvent;
|
||||
|
||||
public dynamic class SBPopup extends Sprite
|
||||
{
|
||||
|
||||
public var skin:SBPopupSkin;
|
||||
|
||||
public var content:DisplayObject;
|
||||
|
||||
public var popupFilters:Array;
|
||||
|
||||
public var _enabled:Boolean = true;
|
||||
|
||||
public var _selected:Boolean = true;
|
||||
|
||||
public var _modal:Boolean = false;
|
||||
|
||||
public var _darken:Boolean = false;
|
||||
|
||||
public var suppressMouseDown:Boolean = false;
|
||||
|
||||
public var closeCallback:Function;
|
||||
|
||||
public var restoreLastPos:Boolean = true;
|
||||
|
||||
public var lastPosX:Number;
|
||||
|
||||
public var lastPosY:Number;
|
||||
|
||||
public var draggable:Boolean = true;
|
||||
|
||||
public var soundsEnabled:Boolean = true;
|
||||
|
||||
public var bxClosesPopup:Boolean = true;
|
||||
|
||||
public function SBPopup(param1:DisplayObjectContainer, param2:MovieClip, param3:DisplayObject, param4:Boolean = true, param5:Boolean = true, param6:Boolean = false, param7:Boolean = false, param8:Boolean = false, param9:String = null, param10:Number = undefined, param11:Number = undefined, param12:Number = undefined, param13:Number = undefined, param14:Array = null, param15:Array = null)
|
||||
{
|
||||
super();
|
||||
skin = new SBPopupSkin(param2);
|
||||
this.addChild(skin.s);
|
||||
if(param3)
|
||||
{
|
||||
content = param3;
|
||||
content.name = "content";
|
||||
content.x = skin.s["c"].x;
|
||||
content.y = skin.s["c"].y;
|
||||
content.width = skin.s["c"].width;
|
||||
content.height = skin.s["c"].height;
|
||||
skin.s.addChildAt(content,skin.s.getChildIndex(skin.s["c"]));
|
||||
}
|
||||
skin.s["c"].visible = false;
|
||||
if(skin.s.getChildByName("bx"))
|
||||
{
|
||||
skin.s["bx"].addEventListener("mouseDown",bxHandler,false,0,true);
|
||||
}
|
||||
param1.addChild(this);
|
||||
visible = false;
|
||||
width = param12 ? param12 : skin.s.width;
|
||||
height = param13 ? param13 : skin.s.height;
|
||||
if(parent.stage)
|
||||
{
|
||||
x = param10 ? param10 : 900 * 0.5;
|
||||
y = param11 ? param11 : 550 * 0.5;
|
||||
}
|
||||
lastPosX = x;
|
||||
lastPosY = y;
|
||||
modal = param6;
|
||||
draggable = param7;
|
||||
enabled = param5;
|
||||
suppressMouseDown = false;
|
||||
popupFilters = param14;
|
||||
SBPopupManager.popups.push(this);
|
||||
if(param8)
|
||||
{
|
||||
_darken = true;
|
||||
}
|
||||
if(param4)
|
||||
{
|
||||
open();
|
||||
}
|
||||
}
|
||||
|
||||
public static function isChildOf(param1:DisplayObjectContainer, param2:DisplayObjectContainer, param3:DisplayObject) : Boolean
|
||||
{
|
||||
var _loc4_:DisplayObject = param3;
|
||||
while(_loc4_ != param2)
|
||||
{
|
||||
if(_loc4_ == param1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
_loc4_ = _loc4_.parent;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function get darken() : Boolean
|
||||
{
|
||||
return _darken;
|
||||
}
|
||||
|
||||
public function get selected() : Boolean
|
||||
{
|
||||
return _selected;
|
||||
}
|
||||
|
||||
public function set selected(param1:Boolean) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
}
|
||||
_selected = param1;
|
||||
}
|
||||
|
||||
public function get enabled() : Boolean
|
||||
{
|
||||
return _enabled;
|
||||
}
|
||||
|
||||
public function set enabled(param1:Boolean) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
mouseChildren = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
mouseChildren = false;
|
||||
}
|
||||
_enabled = param1;
|
||||
}
|
||||
|
||||
override public function set visible(param1:Boolean) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
if(_modal)
|
||||
{
|
||||
SBPopupManager.modalSBPopup = this;
|
||||
}
|
||||
if(_darken && SBPopupManager.darken != null)
|
||||
{
|
||||
SBPopupManager.darken(this);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_modal && SBPopupManager.modalSBPopup == this)
|
||||
{
|
||||
SBPopupManager.modalSBPopup = null;
|
||||
}
|
||||
if(!_darken && SBPopupManager.lighten != null)
|
||||
{
|
||||
SBPopupManager.lighten(this);
|
||||
}
|
||||
}
|
||||
super.visible = param1;
|
||||
}
|
||||
|
||||
public function get modal() : Boolean
|
||||
{
|
||||
return _modal && visible;
|
||||
}
|
||||
|
||||
public function set modal(param1:Boolean) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
if(visible)
|
||||
{
|
||||
if(SBPopupManager.modalSBPopup && SBPopupManager.modalSBPopup != this && SBPopupManager.modalSBPopup.modal)
|
||||
{
|
||||
throw new Error("Attempted to make two or more modal dialogs active at once!");
|
||||
}
|
||||
SBPopupManager.modalSBPopup = this;
|
||||
}
|
||||
}
|
||||
else if(SBPopupManager.modalSBPopup == this)
|
||||
{
|
||||
SBPopupManager.modalSBPopup = null;
|
||||
}
|
||||
_modal = param1;
|
||||
}
|
||||
|
||||
public function addListeners() : void
|
||||
{
|
||||
addEventListener("mouseDown",mouseDownHandler,false,0,true);
|
||||
addEventListener("mouseUp",mouseUpHandler,false,0,true);
|
||||
}
|
||||
|
||||
public function removeListeners() : void
|
||||
{
|
||||
removeEventListener("mouseDown",mouseDownHandler);
|
||||
removeEventListener("mouseUp",mouseUpHandler);
|
||||
}
|
||||
|
||||
public function open() : void
|
||||
{
|
||||
if(visible)
|
||||
{
|
||||
trace("WARNING: Tried to open an already opened popup... ignored...");
|
||||
return;
|
||||
}
|
||||
if(_darken)
|
||||
{
|
||||
if(SBPopupManager && SBPopupManager.darken != null)
|
||||
{
|
||||
SBPopupManager.darken(this);
|
||||
}
|
||||
}
|
||||
addListeners();
|
||||
setFilters(popupFilters);
|
||||
visible = true;
|
||||
if(parent)
|
||||
{
|
||||
bringToFront();
|
||||
}
|
||||
if(_modal)
|
||||
{
|
||||
SBPopupManager.modalSBPopup = this;
|
||||
}
|
||||
}
|
||||
|
||||
public function close() : void
|
||||
{
|
||||
if(!visible)
|
||||
{
|
||||
trace("WARNING: Tried to close an already closed popup... ignored...");
|
||||
return;
|
||||
}
|
||||
if(_darken)
|
||||
{
|
||||
if(SBPopupManager && SBPopupManager.lighten != null)
|
||||
{
|
||||
SBPopupManager.lighten(this);
|
||||
}
|
||||
}
|
||||
removeListeners();
|
||||
setFilters([]);
|
||||
lastPosX = x;
|
||||
lastPosY = y;
|
||||
visible = false;
|
||||
if(_modal)
|
||||
{
|
||||
if(SBPopupManager.modalSBPopup == this)
|
||||
{
|
||||
SBPopupManager.modalSBPopup = null;
|
||||
}
|
||||
}
|
||||
if(closeCallback != null)
|
||||
{
|
||||
closeCallback();
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
if(visible)
|
||||
{
|
||||
close();
|
||||
}
|
||||
if(skin && skin.s)
|
||||
{
|
||||
removeChild(skin.s);
|
||||
if(content)
|
||||
{
|
||||
skin.s.removeChild(content);
|
||||
content = null;
|
||||
}
|
||||
skin.s = null;
|
||||
}
|
||||
closeCallback = null;
|
||||
if(parent)
|
||||
{
|
||||
parent.removeChild(this);
|
||||
}
|
||||
var _loc1_:int = SBPopupManager.popups.indexOf(this);
|
||||
if(_loc1_ > 0)
|
||||
{
|
||||
SBPopupManager.popups.splice(_loc1_,1);
|
||||
}
|
||||
}
|
||||
|
||||
public function setFilters(param1:Array = null) : void
|
||||
{
|
||||
}
|
||||
|
||||
public function bxHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(visible && bxClosesPopup)
|
||||
{
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
public function bringContentToFront() : void
|
||||
{
|
||||
skin.s.setChildIndex(content,skin.s.getChildIndex(skin.s["c"]));
|
||||
}
|
||||
|
||||
public function mouseDownHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(suppressMouseDown)
|
||||
{
|
||||
suppressMouseDown = false;
|
||||
return;
|
||||
}
|
||||
if(!(param1.target is DisplayObject))
|
||||
{
|
||||
throw new Error("mouseDownHandler mouse event got a non-DisplayObject object!");
|
||||
}
|
||||
if(draggable && SBPopupManager.checkModalSBPopup(this,true) && (SBPopup.isChildOf(skin.s["ba"],this,DisplayObject(param1.target)) || param1.target == content || content is DisplayObjectContainer && DisplayObjectContainer(content).getChildByName("titleDragBar") && param1.target == content["titleDragBar"]))
|
||||
{
|
||||
startDrag();
|
||||
}
|
||||
}
|
||||
|
||||
public function bringToFront() : void
|
||||
{
|
||||
parent.setChildIndex(this,parent.numChildren - 1);
|
||||
}
|
||||
|
||||
public function mouseUpHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(!(param1.target is DisplayObject))
|
||||
{
|
||||
throw new Error("mouseDownHandler mouse event got a non-DisplayObject object!");
|
||||
}
|
||||
if(draggable && SBPopupManager.checkModalSBPopup(this,false) && (SBPopup.isChildOf(skin.s["ba"],this,DisplayObject(param1.target)) || param1.target == content || content is DisplayObjectContainer && DisplayObjectContainer(content).getChildByName("titleDragBar") && param1.target == content["titleDragBar"]))
|
||||
{
|
||||
stopDrag();
|
||||
}
|
||||
}
|
||||
|
||||
public function get closeBtn() : MovieClip
|
||||
{
|
||||
return skin.s["bx"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
package com.sbi.popup
|
||||
{
|
||||
import flash.filters.*;
|
||||
|
||||
public class SBPopupManager
|
||||
{
|
||||
|
||||
public static var enabled:Boolean = true;
|
||||
|
||||
public static var _selected:SBPopup;
|
||||
|
||||
public static var _modalSBPopup:SBPopup;
|
||||
|
||||
public static var _prevModalSBPopup:SBPopup;
|
||||
|
||||
public static var darken:Function;
|
||||
|
||||
public static var lighten:Function;
|
||||
|
||||
public static var popups:Array = [];
|
||||
|
||||
public static var nonSBPopups:Array = [];
|
||||
|
||||
public function SBPopupManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function get selected() : SBPopup
|
||||
{
|
||||
return _selected;
|
||||
}
|
||||
|
||||
public static function set selected(param1:SBPopup) : void
|
||||
{
|
||||
if(param1.selected)
|
||||
{
|
||||
return;
|
||||
}
|
||||
param1.selected = true;
|
||||
_selected = param1;
|
||||
}
|
||||
|
||||
public static function get modalSBPopup() : SBPopup
|
||||
{
|
||||
return _modalSBPopup;
|
||||
}
|
||||
|
||||
public static function set modalSBPopup(param1:SBPopup) : void
|
||||
{
|
||||
for each(var _loc2_:SBPopup in popups)
|
||||
{
|
||||
if(_loc2_ != param1)
|
||||
{
|
||||
_loc2_.enabled = param1 == null;
|
||||
}
|
||||
}
|
||||
var _loc3_:SBPopup = _prevModalSBPopup;
|
||||
if(param1 && _modalSBPopup && param1 != _modalSBPopup)
|
||||
{
|
||||
_prevModalSBPopup = _modalSBPopup;
|
||||
}
|
||||
_modalSBPopup = param1;
|
||||
if(_modalSBPopup == null && _loc3_)
|
||||
{
|
||||
_modalSBPopup = _loc3_;
|
||||
_prevModalSBPopup = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static function checkModalSBPopup(param1:SBPopup, param2:Boolean) : Boolean
|
||||
{
|
||||
if(_modalSBPopup == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if(_modalSBPopup != param1)
|
||||
{
|
||||
if(param2)
|
||||
{
|
||||
_modalSBPopup.alpha = 0.5;
|
||||
}
|
||||
else
|
||||
{
|
||||
_modalSBPopup.alpha = 1;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function getBlurFilter(param1:Number = 2, param2:Number = 2, param3:int = 3) : BlurFilter
|
||||
{
|
||||
var _loc4_:BlurFilter = new BlurFilter();
|
||||
_loc4_.blurX = param1;
|
||||
_loc4_.blurY = param2;
|
||||
_loc4_.quality = param3;
|
||||
return _loc4_;
|
||||
}
|
||||
|
||||
public static function getColorFilter(param1:Number = 1, param2:Number = 1, param3:Number = 1, param4:Number = 1) : ColorMatrixFilter
|
||||
{
|
||||
var _loc5_:Array = [];
|
||||
_loc5_ = _loc5_.concat([param2,0,0,0,0]);
|
||||
_loc5_ = _loc5_.concat([0,param3,0,0,0]);
|
||||
_loc5_ = _loc5_.concat([0,0,param4,0,0]);
|
||||
_loc5_ = _loc5_.concat([0,0,0,param1,0]);
|
||||
return new ColorMatrixFilter(_loc5_);
|
||||
}
|
||||
|
||||
public static function setAllPopupEffects(param1:Array = null) : void
|
||||
{
|
||||
for each(var _loc2_:SBPopup in popups)
|
||||
{
|
||||
_loc2_.setFilters(param1);
|
||||
}
|
||||
}
|
||||
|
||||
public static function setAllModalPopupEffects(param1:Array = null) : void
|
||||
{
|
||||
for each(var _loc2_:SBPopup in popups)
|
||||
{
|
||||
if(_loc2_.modal)
|
||||
{
|
||||
_loc2_.setFilters(param1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function closeAll() : void
|
||||
{
|
||||
modalSBPopup = null;
|
||||
for each(var _loc1_:SBPopup in popups)
|
||||
{
|
||||
if(_loc1_.visible)
|
||||
{
|
||||
_loc1_.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function destroyAll() : void
|
||||
{
|
||||
modalSBPopup = null;
|
||||
for each(var _loc1_:SBPopup in popups)
|
||||
{
|
||||
_loc1_.destroy();
|
||||
}
|
||||
while(popups.length > 0)
|
||||
{
|
||||
popups.pop();
|
||||
}
|
||||
}
|
||||
|
||||
public static function destroyNonSBPopups() : void
|
||||
{
|
||||
for each(var _loc1_:Object in nonSBPopups)
|
||||
{
|
||||
_loc1_.destroy();
|
||||
}
|
||||
while(nonSBPopups.length > 0)
|
||||
{
|
||||
nonSBPopups.pop();
|
||||
}
|
||||
}
|
||||
|
||||
public static function destroySpecificNonSBPopup(param1:Object) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < nonSBPopups.length)
|
||||
{
|
||||
if(nonSBPopups[_loc2_] == param1)
|
||||
{
|
||||
nonSBPopups.splice(_loc2_,1);
|
||||
break;
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.sbi.popup
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
|
||||
public dynamic class SBPopupSkin
|
||||
{
|
||||
|
||||
public var s:MovieClip;
|
||||
|
||||
public function SBPopupSkin(param1:MovieClip)
|
||||
{
|
||||
super();
|
||||
s = param1;
|
||||
if(!(s["c"] && s["ba"]))
|
||||
{
|
||||
throw new Error("skin " + s.name + " is missing parts!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.sbi.popup
|
||||
{
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.MovieClip;
|
||||
import flash.text.TextField;
|
||||
|
||||
public dynamic class SBStandardPopup extends SBPopup
|
||||
{
|
||||
|
||||
protected var _text:TextField;
|
||||
|
||||
protected var _skin:MovieClip;
|
||||
|
||||
protected var _content:MovieClip;
|
||||
|
||||
protected var _top:MovieClip;
|
||||
|
||||
protected var _mid:MovieClip;
|
||||
|
||||
protected var _bot:MovieClip;
|
||||
|
||||
protected var _verticalOffset:Number = 0;
|
||||
|
||||
protected var _btnTxtGap:Number = 0;
|
||||
|
||||
protected var _btnHeight:Number = 0;
|
||||
|
||||
protected var _resizeCallback:Function;
|
||||
|
||||
public function SBStandardPopup(param1:DisplayObjectContainer, param2:String = null, param3:Boolean = true, param4:MovieClip = null, param5:MovieClip = null, param6:Boolean = true, param7:Boolean = true, param8:Boolean = false, param9:Boolean = false, param10:String = null, param11:Number = undefined, param12:Number = undefined, param13:Number = undefined, param14:Number = undefined, param15:Array = null)
|
||||
{
|
||||
if(param5)
|
||||
{
|
||||
_skin = param5;
|
||||
}
|
||||
else
|
||||
{
|
||||
_skin = GETDEFINITIONBYNAME("PopupSkin");
|
||||
}
|
||||
if(param4)
|
||||
{
|
||||
_content = param4;
|
||||
}
|
||||
else
|
||||
{
|
||||
_content = GETDEFINITIONBYNAME("PopupContent");
|
||||
}
|
||||
_top = _skin.ba.t;
|
||||
_mid = _skin.ba.m;
|
||||
_bot = _skin.ba.b;
|
||||
_text = _content.text;
|
||||
_text.autoSize = "center";
|
||||
if(param2)
|
||||
{
|
||||
setText(param2);
|
||||
}
|
||||
super(param1,_skin,_content,param6,param7,param8,param9,param3,param10,param11,param12,param13,param14,param15);
|
||||
}
|
||||
|
||||
public function setText(param1:String) : void
|
||||
{
|
||||
_text.text = param1;
|
||||
resize();
|
||||
}
|
||||
|
||||
public function setHtmlText(param1:String) : void
|
||||
{
|
||||
_text.htmlText = param1;
|
||||
resize();
|
||||
}
|
||||
|
||||
private function resize() : void
|
||||
{
|
||||
_mid.height = Math.round(_text.height);
|
||||
_mid.y = -(_mid.height * 0.5) + _verticalOffset;
|
||||
_top.y = _mid.y - _top.height;
|
||||
_bot.y = _mid.y + _mid.height - 1;
|
||||
_text.y = 0;
|
||||
_skin.c.height = _text.height + _btnTxtGap + _btnHeight;
|
||||
_skin.c.y = _mid.y;
|
||||
if(_resizeCallback != null)
|
||||
{
|
||||
_resizeCallback();
|
||||
}
|
||||
_content.x = _skin["c"].x;
|
||||
_content.y = _skin["c"].y;
|
||||
_content.width = _skin["c"].width;
|
||||
_content.height = _skin["c"].height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
package com.sbi.popup
|
||||
{
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import gui.DarkenManager;
|
||||
import loader.MediaHelper;
|
||||
|
||||
public dynamic class SBStandardTitlePopup
|
||||
{
|
||||
|
||||
public static const THANK_YOU_MEDIA_ID:int = 370;
|
||||
|
||||
private var _popupMediaHelper:MediaHelper;
|
||||
|
||||
private var _openWasCalled:Boolean;
|
||||
|
||||
protected var _loadedMC:MovieClip;
|
||||
|
||||
protected var _top:MovieClip;
|
||||
|
||||
protected var _mid:MovieClip;
|
||||
|
||||
protected var _bot:MovieClip;
|
||||
|
||||
public function SBStandardTitlePopup(param1:DisplayObjectContainer, param2:String, param3:String = null, param4:int = 370, param5:Function = null, param6:Boolean = true, param7:Boolean = true)
|
||||
{
|
||||
super();
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_popupMediaHelper = new MediaHelper();
|
||||
_popupMediaHelper.init(param4,onMediaLoaded,{
|
||||
"parent":param1,
|
||||
"message":param2,
|
||||
"title":param3,
|
||||
"closeCallback":param5,
|
||||
"autoOpen":param6,
|
||||
"darken":param7
|
||||
});
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
DarkenManager.unDarken(_loadedMC);
|
||||
_loadedMC.passback.parent.removeChild(_loadedMC);
|
||||
_loadedMC.bx.removeEventListener("mouseDown",onClose);
|
||||
_loadedMC.removeEventListener("mouseDown",onPopup);
|
||||
_loadedMC = null;
|
||||
_top = null;
|
||||
_mid = null;
|
||||
_bot = null;
|
||||
_openWasCalled = false;
|
||||
}
|
||||
|
||||
public function open() : void
|
||||
{
|
||||
if(_loadedMC)
|
||||
{
|
||||
_loadedMC.visible = true;
|
||||
}
|
||||
if(_loadedMC.passback.darken)
|
||||
{
|
||||
DarkenManager.darken(_loadedMC);
|
||||
}
|
||||
_openWasCalled = true;
|
||||
}
|
||||
|
||||
public function close() : void
|
||||
{
|
||||
if(_loadedMC)
|
||||
{
|
||||
_loadedMC.visible = false;
|
||||
}
|
||||
if(_loadedMC.passback.darken)
|
||||
{
|
||||
DarkenManager.unDarken(_loadedMC);
|
||||
}
|
||||
}
|
||||
|
||||
private function onMediaLoaded(param1:MovieClip) : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
if(param1)
|
||||
{
|
||||
_loadedMC = param1.getChildAt(0) as MovieClip;
|
||||
_popupMediaHelper.destroy();
|
||||
_popupMediaHelper = null;
|
||||
_loadedMC.x = 900 * 0.5;
|
||||
_loadedMC.y = 550 * 0.5;
|
||||
_loadedMC.parent.parent.x = _loadedMC.x;
|
||||
_loadedMC.parent.parent.y = _loadedMC.y;
|
||||
_loadedMC.bx.addEventListener("mouseDown",onClose);
|
||||
_loadedMC.addEventListener("mouseDown",onPopup);
|
||||
_loadedMC.passback = _loadedMC.parent["passback"];
|
||||
if(_loadedMC.passback.title)
|
||||
{
|
||||
_loadedMC.titleTxt.text = _loadedMC.passback.title;
|
||||
}
|
||||
if(_loadedMC.passback.message)
|
||||
{
|
||||
_loadedMC.txt.bodyTxt.autoSize = "center";
|
||||
_loadedMC.txt.bodyTxt.text = _loadedMC.passback.message;
|
||||
}
|
||||
_top = _loadedMC.ba.t;
|
||||
_mid = _loadedMC.ba.m;
|
||||
_bot = _loadedMC.ba.b;
|
||||
resize();
|
||||
if(!_loadedMC.passback.autoOpen && !_openWasCalled)
|
||||
{
|
||||
_loadedMC.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
open();
|
||||
}
|
||||
_loadedMC.passback.parent.addChild(_loadedMC);
|
||||
}
|
||||
}
|
||||
|
||||
private function onClose(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(_loadedMC.passback.closeCallback)
|
||||
{
|
||||
_loadedMC.passback.closeCallback();
|
||||
}
|
||||
else
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private function onPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function resize() : void
|
||||
{
|
||||
_mid.height = Math.floor(_loadedMC.txt.height);
|
||||
_top.y = _mid.y - _mid.height * 0.5 - _top.height * 0.5;
|
||||
_bot.y = _mid.y + _mid.height * 0.5 + _bot.height * 0.5;
|
||||
_loadedMC.titleTxt.y = _top.y - 23;
|
||||
_loadedMC.bx.y = _loadedMC.titleTxt.y;
|
||||
_loadedMC.txt.y -= _mid.height * 0.5 - 29;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.sbi.popup
|
||||
{
|
||||
import flash.display.*;
|
||||
import flash.events.*;
|
||||
import flash.net.FileReference;
|
||||
|
||||
public dynamic class SBYesNoPopup extends SBStandardPopup
|
||||
{
|
||||
|
||||
private var _yesBtn:MovieClip = _loc17_.yesBtn;
|
||||
|
||||
private var _noBtn:MovieClip;
|
||||
|
||||
private var _confirmCallback:Function;
|
||||
|
||||
private var _passbackObject:Object;
|
||||
|
||||
public function SBYesNoPopup(param1:DisplayObjectContainer, param2:String = null, param3:Boolean = true, param4:Function = null, param5:Object = null, param6:Boolean = true, param7:Boolean = true, param8:Boolean = false, param9:Boolean = false, param10:String = null, param11:Number = undefined, param12:Number = undefined, param13:Number = undefined, param14:Number = undefined, param15:Array = null)
|
||||
{
|
||||
_confirmCallback = param4;
|
||||
_passbackObject = param5;
|
||||
_verticalOffset = -20;
|
||||
_btnTxtGap = 6;
|
||||
_btnHeight = 44;
|
||||
var _loc16_:MovieClip = GETDEFINITIONBYNAME("YesNoPopupSkin");
|
||||
var _loc17_:MovieClip = GETDEFINITIONBYNAME("YesNoPopupContent");
|
||||
_noBtn = _loc17_.noBtn;
|
||||
_yesBtn.addEventListener("mouseDown",onYesNoBtn,false,0,true);
|
||||
_noBtn.addEventListener("mouseDown",onYesNoBtn,false,0,true);
|
||||
_resizeCallback = onResize;
|
||||
super(param1,param2,param3,_loc17_,_loc16_,param6,param7,param8,param9,param10,param11,param12,param13,param14,param15);
|
||||
stage.addEventListener("keyDown",handleYesNoKeyDown,false,0,true);
|
||||
}
|
||||
|
||||
override public function destroy() : void
|
||||
{
|
||||
if(stage)
|
||||
{
|
||||
stage.removeEventListener("keyDown",handleYesNoKeyDown);
|
||||
}
|
||||
_yesBtn.removeEventListener("mouseDown",onYesNoBtn);
|
||||
_noBtn.removeEventListener("mouseDown",onYesNoBtn);
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
private function onResize() : void
|
||||
{
|
||||
_yesBtn.y = _text.height + _btnTxtGap + 0.5 * _btnHeight;
|
||||
_noBtn.y = _yesBtn.y;
|
||||
}
|
||||
|
||||
private function handleYesNoKeyDown(param1:KeyboardEvent) : void
|
||||
{
|
||||
switch(param1.keyCode)
|
||||
{
|
||||
case 13:
|
||||
case 32:
|
||||
param1.stopPropagation();
|
||||
handleYesNo(true);
|
||||
break;
|
||||
case 8:
|
||||
case 46:
|
||||
case 27:
|
||||
param1.stopPropagation();
|
||||
handleYesNo(false);
|
||||
}
|
||||
}
|
||||
|
||||
private function onYesNoBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
handleYesNo(param1.currentTarget == _yesBtn);
|
||||
}
|
||||
|
||||
private function handleYesNo(param1:Boolean) : void
|
||||
{
|
||||
var _loc2_:FileReference = null;
|
||||
var _loc3_:Object = null;
|
||||
destroy();
|
||||
if(param1 && _passbackObject && _passbackObject.hasOwnProperty("FileReference"))
|
||||
{
|
||||
_loc2_ = new FileReference();
|
||||
_loc2_.save(_passbackObject.ImageData,_passbackObject.SaveName);
|
||||
}
|
||||
if(_confirmCallback != null)
|
||||
{
|
||||
_loc3_ = {
|
||||
"status":param1,
|
||||
"passback":_passbackObject
|
||||
};
|
||||
_confirmCallback(_loc3_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user