mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-21 09: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,112 @@
|
||||
package com.sbi.popup
|
||||
{
|
||||
import flash.display.*;
|
||||
import flash.events.*;
|
||||
import flash.text.TextField;
|
||||
import flash.text.TextFieldAutoSize;
|
||||
|
||||
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)
|
||||
{
|
||||
this._okBtnCallback = param4;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._okBtnCallback = this.onOkBtn;
|
||||
}
|
||||
this._skin = GETDEFINITIONBYNAME("BroadcastPopupSkin");
|
||||
this._content = GETDEFINITIONBYNAME("BroadcastPopupContent");
|
||||
this._top = this._skin.ba.t;
|
||||
this._mid = this._skin.ba.m;
|
||||
this._bot = this._skin.ba.b;
|
||||
this._okBtn = this._content.okBtn;
|
||||
this._okBtn.addEventListener(MouseEvent.MOUSE_DOWN,this._okBtnCallback,false,0,true);
|
||||
this._messageText = this._content.text;
|
||||
this._titleText = this._content.titleTxt;
|
||||
this._messageText.autoSize = TextFieldAutoSize.CENTER;
|
||||
this._titleText.autoSize = TextFieldAutoSize.CENTER;
|
||||
this.setMessageText(param2);
|
||||
if(param3)
|
||||
{
|
||||
this._titleText.text = param3;
|
||||
}
|
||||
super(param1,this._skin,this._content,param8,param9,param10,param11,param5,param3,param12,param13,param14,param15,param16);
|
||||
}
|
||||
|
||||
public static function destroyInParentChain(param1:DisplayObject) : void
|
||||
{
|
||||
while(Boolean(param1) && Boolean(param1 != gMainFrame.stage) && !(param1 is SBOkPopup))
|
||||
{
|
||||
param1 = param1.parent;
|
||||
}
|
||||
if(param1 is SBOkPopup)
|
||||
{
|
||||
SBOkPopup(param1).destroy();
|
||||
}
|
||||
}
|
||||
|
||||
override public function destroy() : void
|
||||
{
|
||||
this._okBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this._okBtnCallback);
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
public function setMessageText(param1:String) : void
|
||||
{
|
||||
this._messageText.text = param1;
|
||||
this.resize();
|
||||
}
|
||||
|
||||
private function resize() : void
|
||||
{
|
||||
this._mid.height = Math.floor(this._messageText.height);
|
||||
this._mid.y = Math.floor(-(this._mid.height * 0.5));
|
||||
this._top.y = this._mid.y - this._top.height;
|
||||
this._bot.y = this._mid.y + this._mid.height;
|
||||
this._titleText.y = 0;
|
||||
this._messageText.y = this._titleText.height + this._titleToMessageDifference;
|
||||
this._okBtn.y = this._messageText.y + this._messageText.height + this._btnTxtGap + this._okBtn.height * 0.5;
|
||||
this._skin.c.height = this._titleText.height + this._titleToMessageDifference + this._messageText.height + this._btnTxtGap + this._okBtn.height;
|
||||
this._skin.c.y = -(this._skin.ba.height * 0.5) + this._verticalOffset;
|
||||
this._content.x = this._skin.c.x;
|
||||
this._content.y = this._skin.c.y;
|
||||
this._content.width = this._skin.c.width;
|
||||
this._content.height = this._skin.c.height;
|
||||
}
|
||||
|
||||
private function onOkBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
this.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
this.messageTxt.text = param3;
|
||||
super(param1,param2,this.messageTxt,param4,param5,param6,param7,param8,param9,param10,param11,param12,param13,param14);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.sbi.popup
|
||||
{
|
||||
import flash.display.*;
|
||||
import flash.events.*;
|
||||
|
||||
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)
|
||||
{
|
||||
this._okBtnCallback = param4;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._okBtnCallback = this.onOkBtn;
|
||||
}
|
||||
var _loc15_:MovieClip = GETDEFINITIONBYNAME("OkPopupSkin");
|
||||
var _loc16_:MovieClip = GETDEFINITIONBYNAME("OkPopupContent");
|
||||
this._okBtn = _loc16_.okBtn;
|
||||
this._okBtn.addEventListener(MouseEvent.MOUSE_DOWN,this._okBtnCallback,false,0,true);
|
||||
_resizeCallback = this.onResize;
|
||||
super(param1,param2,param3,_loc16_,_loc15_,param5,param6,param7,param8,param9,param10,param11,param12,param13,param14);
|
||||
}
|
||||
|
||||
public static function destroyInParentChain(param1:DisplayObject) : void
|
||||
{
|
||||
while(Boolean(param1) && Boolean(param1 != gMainFrame.stage) && !(param1 is SBOkPopup))
|
||||
{
|
||||
param1 = param1.parent;
|
||||
}
|
||||
if(param1 is SBOkPopup)
|
||||
{
|
||||
SBOkPopup(param1).destroy();
|
||||
}
|
||||
}
|
||||
|
||||
override public function destroy() : void
|
||||
{
|
||||
this._okBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this._okBtnCallback);
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
private function onResize() : void
|
||||
{
|
||||
this._okBtn.y = _text.height + _btnTxtGap + 0.5 * _btnHeight;
|
||||
}
|
||||
|
||||
private function onOkBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
this.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
package com.sbi.popup
|
||||
{
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.text.TextFieldAutoSize;
|
||||
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);
|
||||
this._parent = param1;
|
||||
this._type = param2;
|
||||
this._message = param3;
|
||||
this._darken = param4;
|
||||
this._confirmCallback = param5;
|
||||
this._passback = param6;
|
||||
this._mediaHelper = new MediaHelper();
|
||||
this._mediaHelper.init(2106,this.onMediaLoaded);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
if(this._popup)
|
||||
{
|
||||
DarkenManager.unDarken(this._popup);
|
||||
if(Boolean(this._parent) && Boolean(this._popup.parent) && this._popup.parent == this._parent)
|
||||
{
|
||||
this._parent.removeChild(this._popup);
|
||||
}
|
||||
this._popup.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPopup);
|
||||
switch(this._type)
|
||||
{
|
||||
case TYPE_CONTINUE_EXIT:
|
||||
this._popup.contBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onBtnDown);
|
||||
this._popup.exitBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onBtnDown);
|
||||
break;
|
||||
case TYPE_CONTINUE_ONLY:
|
||||
this._popup.contOnlyBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onBtnDown);
|
||||
break;
|
||||
case TYPE_OK:
|
||||
this._popup.okBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onBtnDown);
|
||||
break;
|
||||
case TYPE_YES_NO:
|
||||
this._popup.yesBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onBtnDown);
|
||||
this._popup.noBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onBtnDown);
|
||||
}
|
||||
_loc1_ = SBPopupManager.nonSBPopups.indexOf(this);
|
||||
if(_loc1_ >= 0)
|
||||
{
|
||||
SBPopupManager.nonSBPopups.splice(_loc1_,1);
|
||||
}
|
||||
this._popup = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function onMediaLoaded(param1:MovieClip) : void
|
||||
{
|
||||
var img:MovieClip = param1;
|
||||
if(img)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
this._popup = MovieClip(img.getChildAt(0));
|
||||
this._mediaHelper.destroy();
|
||||
this._mediaHelper = null;
|
||||
switch(this._type)
|
||||
{
|
||||
case TYPE_CONTINUE_EXIT:
|
||||
this._popup.okBtn.visible = false;
|
||||
this._popup.yesBtn.visible = false;
|
||||
this._popup.noBtn.visible = false;
|
||||
this._popup.contOnlyBtn.visible = false;
|
||||
this._popup.contBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onBtnDown,false,0,true);
|
||||
this._popup.exitBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onBtnDown,false,0,true);
|
||||
break;
|
||||
case TYPE_CONTINUE_ONLY:
|
||||
this._popup.okBtn.visible = false;
|
||||
this._popup.yesBtn.visible = false;
|
||||
this._popup.noBtn.visible = false;
|
||||
this._popup.exitBtn.visible = false;
|
||||
this._popup.contBtn.visible = false;
|
||||
this._popup.contOnlyBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onBtnDown,false,0,true);
|
||||
break;
|
||||
case TYPE_OK:
|
||||
this._popup.yesBtn.visible = false;
|
||||
this._popup.noBtn.visible = false;
|
||||
this._popup.contBtn.visible = false;
|
||||
this._popup.exitBtn.visible = false;
|
||||
this._popup.contOnlyBtn.visible = false;
|
||||
this._popup.okBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onBtnDown,false,0,true);
|
||||
break;
|
||||
case TYPE_YES_NO:
|
||||
this._popup.okBtn.visible = false;
|
||||
this._popup.contBtn.visible = false;
|
||||
this._popup.exitBtn.visible = false;
|
||||
this._popup.contOnlyBtn.visible = false;
|
||||
this._popup.yesBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onBtnDown,false,0,true);
|
||||
this._popup.noBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onBtnDown,false,0,true);
|
||||
}
|
||||
this._popup.txt.autoSize = TextFieldAutoSize.CENTER;
|
||||
this._popup.txt.text = this._message;
|
||||
with(this._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;
|
||||
}
|
||||
this._popup.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopup,false,0,true);
|
||||
this._popup.x = MainFrame.VIEW_WIDTH * 0.5;
|
||||
this._popup.y = MainFrame.VIEW_HEIGHT * 0.5;
|
||||
this._parent.addChild(this._popup);
|
||||
if(this._darken)
|
||||
{
|
||||
DarkenManager.darken(this._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(this._confirmCallback != null)
|
||||
{
|
||||
_loc2_ = {
|
||||
"status":param1.currentTarget == this._popup.contBtn || param1.currentTarget == this._popup.contOnlyBtn || param1.currentTarget == this._popup.yesBtn || param1.currentTarget == this._popup.okBtn,
|
||||
"passback":this._passback
|
||||
};
|
||||
this.destroy();
|
||||
this._confirmCallback(_loc2_);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,230 @@
|
||||
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
|
||||
{
|
||||
|
||||
private static const POLL_POPUP_MEDIA_ID:int = 369;
|
||||
|
||||
private static const POLL_TY_POPUP_MEDIA_ID:int = 370;
|
||||
|
||||
private var _popupLayer:DisplayObjectContainer;
|
||||
|
||||
private var _tab:MovieClip;
|
||||
|
||||
private var _pollDef:Object;
|
||||
|
||||
private var _onVoteCallback:Function;
|
||||
|
||||
private var _onDoneCallback:Function;
|
||||
|
||||
private var _pollPopup:MovieClip;
|
||||
|
||||
private var _pollMediaHelper:MediaHelper;
|
||||
|
||||
private var _thankYouPopup:SBStandardTitlePopup;
|
||||
|
||||
private var _numOptions:int;
|
||||
|
||||
private var _randomizeOrder:Boolean;
|
||||
|
||||
private var _randOptionLookup:Array;
|
||||
|
||||
private var _answerSection:MovieClip;
|
||||
|
||||
private var _optionsGroup:GuiRadioButtonGroup;
|
||||
|
||||
public function SBPollPopup()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:DisplayObjectContainer, param2:MovieClip, param3:Function, param4:Function, param5:Boolean) : void
|
||||
{
|
||||
this._popupLayer = param1;
|
||||
this._tab = param2;
|
||||
this._onVoteCallback = param3;
|
||||
this._onDoneCallback = param4;
|
||||
this._randomizeOrder = param5;
|
||||
this._pollDef = this._tab.def;
|
||||
this._randOptionLookup = [0,1,2,3,4];
|
||||
this._thankYouPopup = new SBStandardTitlePopup(this._popupLayer,LocalizationManager.translateIdOnly(14680),null,370,this._onDoneCallback,false);
|
||||
this._pollMediaHelper = new MediaHelper();
|
||||
this._pollMediaHelper.init(POLL_POPUP_MEDIA_ID,this.onMediaLoaded,true);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
this._pollPopup.bx.removeEventListener(MouseEvent.MOUSE_DOWN,this.onCloseBtnDown);
|
||||
this._pollPopup.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPopupDown);
|
||||
this._pollPopup = null;
|
||||
this._thankYouPopup.destroy();
|
||||
this._thankYouPopup = null;
|
||||
}
|
||||
|
||||
private function onMediaLoaded(param1:MovieClip) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
if(param1.mediaHelper.id == POLL_POPUP_MEDIA_ID)
|
||||
{
|
||||
this._pollMediaHelper.destroy();
|
||||
this._pollMediaHelper = null;
|
||||
this._pollPopup = MovieClip(param1.getChildAt(0));
|
||||
this.setUpPollPopup();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function setUpPollPopup() : void
|
||||
{
|
||||
this._pollPopup.bx.addEventListener(MouseEvent.MOUSE_DOWN,this.onCloseBtnDown,false,0,true);
|
||||
this._pollPopup.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopupDown,false,0,true);
|
||||
var _loc1_:String = this._pollDef.poll;
|
||||
var _loc2_:int = _loc1_.indexOf("|");
|
||||
this._pollPopup.bodyTxt.text = _loc1_.substring(0,_loc2_);
|
||||
var _loc3_:Array = _loc1_.substring(_loc2_ + 1,_loc1_.length).split("|");
|
||||
if(this._randomizeOrder)
|
||||
{
|
||||
_loc3_ = this.shuffleArray(_loc3_);
|
||||
}
|
||||
this._numOptions = _loc3_.length;
|
||||
this._pollPopup.titleTxt.text = this._pollDef.title;
|
||||
if(this._numOptions == 2)
|
||||
{
|
||||
this._answerSection = this._pollPopup.answer2;
|
||||
this._pollPopup.answer2.visible = true;
|
||||
this._pollPopup.answer3.visible = false;
|
||||
this._pollPopup.answer4.visible = false;
|
||||
this._pollPopup.answer5.visible = false;
|
||||
}
|
||||
else if(this._numOptions == 3)
|
||||
{
|
||||
this._answerSection = this._pollPopup.answer3;
|
||||
this._pollPopup.answer2.visible = false;
|
||||
this._pollPopup.answer3.visible = true;
|
||||
this._pollPopup.answer4.visible = false;
|
||||
this._pollPopup.answer5.visible = false;
|
||||
}
|
||||
else if(this._numOptions == 4)
|
||||
{
|
||||
this._answerSection = this._pollPopup.answer4;
|
||||
this._pollPopup.answer2.visible = false;
|
||||
this._pollPopup.answer3.visible = false;
|
||||
this._pollPopup.answer4.visible = true;
|
||||
this._pollPopup.answer5.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._answerSection = this._pollPopup.answer5;
|
||||
this._pollPopup.answer2.visible = false;
|
||||
this._pollPopup.answer3.visible = false;
|
||||
this._pollPopup.answer4.visible = false;
|
||||
this._pollPopup.answer5.visible = true;
|
||||
}
|
||||
this._optionsGroup = new GuiRadioButtonGroup(this._answerSection.options);
|
||||
this._answerSection.voteBtn.activateGrayState(true);
|
||||
this._answerSection.voteBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onVoteBtnDown,false,0,true);
|
||||
var _loc4_:int = 1;
|
||||
while(_loc4_ < this._numOptions + 1)
|
||||
{
|
||||
this._answerSection["answer" + _loc4_ + "Txt"].text = _loc3_[_loc4_ - 1];
|
||||
this._answerSection.options["option" + _loc4_].addEventListener(MouseEvent.MOUSE_DOWN,this.onOptionSelected,false,0,true);
|
||||
_loc4_++;
|
||||
}
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
this.open(this._pollPopup);
|
||||
}
|
||||
|
||||
private function shuffleArray(param1:Array) : Array
|
||||
{
|
||||
var _loc4_:String = null;
|
||||
var _loc5_:int = 0;
|
||||
var _loc6_:int = 0;
|
||||
var _loc7_:int = 0;
|
||||
var _loc2_:int = int(param1.length);
|
||||
var _loc3_:Array = param1.slice();
|
||||
while(_loc5_ < _loc2_)
|
||||
{
|
||||
_loc4_ = _loc3_[_loc5_];
|
||||
_loc6_ = Math.floor(Math.random() * _loc2_);
|
||||
if(_loc5_ != _loc6_)
|
||||
{
|
||||
_loc3_[_loc5_] = _loc3_[_loc6_];
|
||||
_loc3_[_loc6_] = _loc4_;
|
||||
_loc7_ = int(this._randOptionLookup[_loc5_]);
|
||||
this._randOptionLookup[_loc5_] = this._randOptionLookup[_loc6_];
|
||||
this._randOptionLookup[_loc6_] = _loc7_;
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
return _loc3_;
|
||||
}
|
||||
|
||||
private function open(param1:MovieClip) : void
|
||||
{
|
||||
this._popupLayer.addChild(param1);
|
||||
param1.x = MainFrame.VIEW_WIDTH * 0.5;
|
||||
param1.y = MainFrame.VIEW_HEIGHT * 0.5;
|
||||
DarkenManager.darken(param1);
|
||||
param1.visible = true;
|
||||
}
|
||||
|
||||
private function close(param1:MovieClip) : void
|
||||
{
|
||||
param1.visible = false;
|
||||
DarkenManager.unDarken(param1);
|
||||
this._popupLayer.removeChild(param1);
|
||||
}
|
||||
|
||||
private function onVoteBtnDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(!param1.currentTarget.isGray)
|
||||
{
|
||||
if(this._onVoteCallback != null)
|
||||
{
|
||||
this._onVoteCallback(this._tab,this._randOptionLookup[this._optionsGroup.selected] + 1);
|
||||
}
|
||||
this.close(this._pollPopup);
|
||||
this._thankYouPopup.open();
|
||||
}
|
||||
}
|
||||
|
||||
private function onCloseBtnDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
this.close(param1.currentTarget.parent);
|
||||
this._onDoneCallback();
|
||||
}
|
||||
|
||||
private function onOptionSelected(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(param1.currentTarget == this._answerSection.options.option1)
|
||||
{
|
||||
this._answerSection.options.option1._circle.visible = true;
|
||||
}
|
||||
var _loc2_:int = 1;
|
||||
while(_loc2_ < this._numOptions + 1)
|
||||
{
|
||||
this._answerSection.options["option" + _loc2_].removeEventListener(MouseEvent.MOUSE_DOWN,this.onOptionSelected);
|
||||
_loc2_++;
|
||||
}
|
||||
this._answerSection.voteBtn.activateGrayState(false);
|
||||
}
|
||||
|
||||
private function onPopupDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,353 @@
|
||||
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();
|
||||
this.skin = new SBPopupSkin(param2);
|
||||
this.addChild(this.skin.s);
|
||||
if(param3)
|
||||
{
|
||||
this.content = param3;
|
||||
this.content.name = "content";
|
||||
this.content.x = this.skin.s["c"].x;
|
||||
this.content.y = this.skin.s["c"].y;
|
||||
this.content.width = this.skin.s["c"].width;
|
||||
this.content.height = this.skin.s["c"].height;
|
||||
this.skin.s.addChildAt(this.content,this.skin.s.getChildIndex(this.skin.s["c"]));
|
||||
}
|
||||
this.skin.s["c"].visible = false;
|
||||
if(this.skin.s.getChildByName("bx"))
|
||||
{
|
||||
this.skin.s["bx"].addEventListener(MouseEvent.MOUSE_DOWN,this.bxHandler,false,0,true);
|
||||
}
|
||||
param1.addChild(this);
|
||||
this.visible = false;
|
||||
width = param12 ? param12 : this.skin.s.width;
|
||||
height = param13 ? param13 : this.skin.s.height;
|
||||
if(parent.stage)
|
||||
{
|
||||
x = param10 ? param10 : MainFrame.VIEW_WIDTH * 0.5;
|
||||
y = param11 ? param11 : MainFrame.VIEW_HEIGHT * 0.5;
|
||||
}
|
||||
this.lastPosX = x;
|
||||
this.lastPosY = y;
|
||||
this.modal = param6;
|
||||
this.draggable = param7;
|
||||
this.enabled = param5;
|
||||
this.suppressMouseDown = false;
|
||||
this.popupFilters = param14;
|
||||
SBPopupManager.popups.push(this);
|
||||
if(param8)
|
||||
{
|
||||
this._darken = true;
|
||||
}
|
||||
if(param4)
|
||||
{
|
||||
this.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 this._darken;
|
||||
}
|
||||
|
||||
public function get selected() : Boolean
|
||||
{
|
||||
return this._selected;
|
||||
}
|
||||
|
||||
public function set selected(param1:Boolean) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
}
|
||||
this._selected = param1;
|
||||
}
|
||||
|
||||
public function get enabled() : Boolean
|
||||
{
|
||||
return this._enabled;
|
||||
}
|
||||
|
||||
public function set enabled(param1:Boolean) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
mouseChildren = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
mouseChildren = false;
|
||||
}
|
||||
this._enabled = param1;
|
||||
}
|
||||
|
||||
override public function set visible(param1:Boolean) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
if(this._modal)
|
||||
{
|
||||
SBPopupManager.modalSBPopup = this;
|
||||
}
|
||||
if(this._darken && SBPopupManager.darken != null)
|
||||
{
|
||||
SBPopupManager.darken(this);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(this._modal && SBPopupManager.modalSBPopup == this)
|
||||
{
|
||||
SBPopupManager.modalSBPopup = null;
|
||||
}
|
||||
if(!this._darken && SBPopupManager.lighten != null)
|
||||
{
|
||||
SBPopupManager.lighten(this);
|
||||
}
|
||||
}
|
||||
super.visible = param1;
|
||||
}
|
||||
|
||||
public function get modal() : Boolean
|
||||
{
|
||||
return Boolean(this._modal && visible);
|
||||
}
|
||||
|
||||
public function set modal(param1:Boolean) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
if(visible)
|
||||
{
|
||||
if(Boolean(SBPopupManager.modalSBPopup) && Boolean(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;
|
||||
}
|
||||
this._modal = param1;
|
||||
}
|
||||
|
||||
public function addListeners() : void
|
||||
{
|
||||
addEventListener(MouseEvent.MOUSE_DOWN,this.mouseDownHandler,false,0,true);
|
||||
addEventListener(MouseEvent.MOUSE_UP,this.mouseUpHandler,false,0,true);
|
||||
}
|
||||
|
||||
public function removeListeners() : void
|
||||
{
|
||||
removeEventListener(MouseEvent.MOUSE_DOWN,this.mouseDownHandler);
|
||||
removeEventListener(MouseEvent.MOUSE_UP,this.mouseUpHandler);
|
||||
}
|
||||
|
||||
public function open() : void
|
||||
{
|
||||
if(visible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(this._darken)
|
||||
{
|
||||
if(Boolean(SBPopupManager) && SBPopupManager.darken != null)
|
||||
{
|
||||
SBPopupManager.darken(this);
|
||||
}
|
||||
}
|
||||
this.addListeners();
|
||||
this.setFilters(this.popupFilters);
|
||||
if(0)
|
||||
{
|
||||
x = this.lastPosX;
|
||||
y = this.lastPosY;
|
||||
}
|
||||
this.visible = true;
|
||||
if(parent)
|
||||
{
|
||||
this.bringToFront();
|
||||
}
|
||||
if(this._modal)
|
||||
{
|
||||
SBPopupManager.modalSBPopup = this;
|
||||
}
|
||||
}
|
||||
|
||||
public function close() : void
|
||||
{
|
||||
if(!visible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(this._darken)
|
||||
{
|
||||
if(Boolean(SBPopupManager) && SBPopupManager.lighten != null)
|
||||
{
|
||||
SBPopupManager.lighten(this);
|
||||
}
|
||||
}
|
||||
this.removeListeners();
|
||||
this.setFilters([]);
|
||||
this.lastPosX = x;
|
||||
this.lastPosY = y;
|
||||
this.visible = false;
|
||||
if(this._modal)
|
||||
{
|
||||
if(SBPopupManager.modalSBPopup == this)
|
||||
{
|
||||
SBPopupManager.modalSBPopup = null;
|
||||
}
|
||||
}
|
||||
if(this.closeCallback != null)
|
||||
{
|
||||
this.closeCallback();
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
if(visible)
|
||||
{
|
||||
this.close();
|
||||
}
|
||||
if(Boolean(this.skin) && Boolean(this.skin.s))
|
||||
{
|
||||
removeChild(this.skin.s);
|
||||
if(this.content)
|
||||
{
|
||||
this.skin.s.removeChild(this.content);
|
||||
this.content = null;
|
||||
}
|
||||
this.skin.s = null;
|
||||
}
|
||||
this.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 && this.bxClosesPopup)
|
||||
{
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
|
||||
public function bringContentToFront() : void
|
||||
{
|
||||
this.skin.s.setChildIndex(this.content,this.skin.s.getChildIndex(this.skin.s["c"]));
|
||||
}
|
||||
|
||||
public function mouseDownHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(this.suppressMouseDown)
|
||||
{
|
||||
this.suppressMouseDown = false;
|
||||
return;
|
||||
}
|
||||
if(!(param1.target is DisplayObject))
|
||||
{
|
||||
throw new Error("mouseDownHandler mouse event got a non-DisplayObject object!");
|
||||
}
|
||||
if(this.draggable && SBPopupManager.checkModalSBPopup(this,true) && (Boolean(SBPopup.isChildOf(this.skin.s["ba"],this,DisplayObject(param1.target)) || param1.target == this.content) || Boolean(this.content is DisplayObjectContainer && DisplayObjectContainer(this.content).getChildByName("titleDragBar") && param1.target == this.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(this.draggable && SBPopupManager.checkModalSBPopup(this,false) && (Boolean(SBPopup.isChildOf(this.skin.s["ba"],this,DisplayObject(param1.target)) || param1.target == this.content) || Boolean(this.content is DisplayObjectContainer && DisplayObjectContainer(this.content).getChildByName("titleDragBar") && param1.target == this.content["titleDragBar"])))
|
||||
{
|
||||
stopDrag();
|
||||
}
|
||||
}
|
||||
|
||||
public function get closeBtn() : MovieClip
|
||||
{
|
||||
return this.skin.s["bx"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
package com.sbi.popup
|
||||
{
|
||||
import flash.filters.*;
|
||||
|
||||
public class SBPopupManager
|
||||
{
|
||||
|
||||
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 static var enabled:Boolean = true;
|
||||
|
||||
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
|
||||
{
|
||||
var _loc2_:SBPopup = null;
|
||||
var _loc3_:SBPopup = null;
|
||||
for each(_loc2_ in popups)
|
||||
{
|
||||
if(_loc2_ != param1)
|
||||
{
|
||||
_loc2_.enabled = param1 == null;
|
||||
}
|
||||
}
|
||||
_loc3_ = _prevModalSBPopup;
|
||||
if(Boolean(param1) && Boolean(_modalSBPopup) && param1 != _modalSBPopup)
|
||||
{
|
||||
_prevModalSBPopup = _modalSBPopup;
|
||||
}
|
||||
_modalSBPopup = param1;
|
||||
if(_modalSBPopup == null && Boolean(_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 = new 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
|
||||
{
|
||||
var _loc2_:SBPopup = null;
|
||||
for each(_loc2_ in popups)
|
||||
{
|
||||
_loc2_.setFilters(param1);
|
||||
}
|
||||
}
|
||||
|
||||
public static function setAllModalPopupEffects(param1:Array = null) : void
|
||||
{
|
||||
var _loc2_:SBPopup = null;
|
||||
for each(_loc2_ in popups)
|
||||
{
|
||||
if(_loc2_.modal)
|
||||
{
|
||||
_loc2_.setFilters(param1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function closeAll() : void
|
||||
{
|
||||
var _loc1_:SBPopup = null;
|
||||
modalSBPopup = null;
|
||||
for each(_loc1_ in popups)
|
||||
{
|
||||
if(_loc1_.visible)
|
||||
{
|
||||
_loc1_.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function destroyAll() : void
|
||||
{
|
||||
var _loc1_:SBPopup = null;
|
||||
modalSBPopup = null;
|
||||
for each(_loc1_ in popups)
|
||||
{
|
||||
_loc1_.destroy();
|
||||
}
|
||||
while(popups.length > 0)
|
||||
{
|
||||
popups.pop();
|
||||
}
|
||||
}
|
||||
|
||||
public static function destroyNonSBPopups() : void
|
||||
{
|
||||
var _loc1_:Object = null;
|
||||
for each(_loc1_ in nonSBPopups)
|
||||
{
|
||||
_loc1_.destroy();
|
||||
}
|
||||
while(nonSBPopups.length > 0)
|
||||
{
|
||||
nonSBPopups.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
this.s = param1;
|
||||
if(!(Boolean(this.s["c"]) && Boolean(this.s["ba"])))
|
||||
{
|
||||
throw new Error("skin " + this.s.name + " is missing parts!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.sbi.popup
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
|
||||
public class SBScreen
|
||||
{
|
||||
|
||||
public var screenClip:MovieClip;
|
||||
|
||||
public var parentWizard:SBWizard;
|
||||
|
||||
public var onEnterFromPrev:Function;
|
||||
|
||||
public var onEnterFromNext:Function;
|
||||
|
||||
public var onLeaveToPrev:Function;
|
||||
|
||||
public var onLeaveToNext:Function;
|
||||
|
||||
public var onPlay:Function;
|
||||
|
||||
public var onClose:Function;
|
||||
|
||||
public var updateScreen:Function;
|
||||
|
||||
public function SBScreen(param1:MovieClip, param2:SBWizard)
|
||||
{
|
||||
super();
|
||||
this.screenClip = param1;
|
||||
this.parentWizard = param2;
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
this.screenClip = null;
|
||||
this.parentWizard = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.sbi.popup
|
||||
{
|
||||
import flash.display.*;
|
||||
import flash.events.*;
|
||||
import flash.text.TextField;
|
||||
import flash.text.TextFieldAutoSize;
|
||||
|
||||
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)
|
||||
{
|
||||
this._skin = param5;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._skin = GETDEFINITIONBYNAME("PopupSkin");
|
||||
}
|
||||
if(param4)
|
||||
{
|
||||
this._content = param4;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._content = GETDEFINITIONBYNAME("PopupContent");
|
||||
}
|
||||
this._top = this._skin.ba.t;
|
||||
this._mid = this._skin.ba.m;
|
||||
this._bot = this._skin.ba.b;
|
||||
this._text = this._content.text;
|
||||
this._text.autoSize = TextFieldAutoSize.CENTER;
|
||||
if(param2)
|
||||
{
|
||||
this.setText(param2);
|
||||
}
|
||||
super(param1,this._skin,this._content,param6,param7,param8,param9,param3,param10,param11,param12,param13,param14,param15);
|
||||
}
|
||||
|
||||
public function setText(param1:String) : void
|
||||
{
|
||||
this._text.text = param1;
|
||||
this.resize();
|
||||
}
|
||||
|
||||
public function setHtmlText(param1:String) : void
|
||||
{
|
||||
this._text.htmlText = param1;
|
||||
this.resize();
|
||||
}
|
||||
|
||||
private function resize() : void
|
||||
{
|
||||
this._mid.height = Math.floor(this._text.height);
|
||||
this._mid.y = Math.floor(-(this._mid.height * 0.5) + this._verticalOffset);
|
||||
this._top.y = this._mid.y - this._top.height;
|
||||
this._bot.y = this._mid.y + this._mid.height;
|
||||
this._text.y = 0;
|
||||
this._skin.c.height = this._text.height + this._btnTxtGap + this._btnHeight;
|
||||
this._skin.c.y = this._mid.y;
|
||||
if(this._resizeCallback != null)
|
||||
{
|
||||
this._resizeCallback();
|
||||
}
|
||||
this._content.x = this._skin["c"].x;
|
||||
this._content.y = this._skin["c"].y;
|
||||
this._content.width = this._skin["c"].width;
|
||||
this._content.height = this._skin["c"].height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
package com.sbi.popup
|
||||
{
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.text.TextFieldAutoSize;
|
||||
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);
|
||||
this._popupMediaHelper = new MediaHelper();
|
||||
this._popupMediaHelper.init(param4,this.onMediaLoaded,{
|
||||
"parent":param1,
|
||||
"message":param2,
|
||||
"title":param3,
|
||||
"closeCallback":param5,
|
||||
"autoOpen":param6,
|
||||
"darken":param7
|
||||
});
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
DarkenManager.unDarken(this._loadedMC);
|
||||
this._loadedMC.passback.parent.removeChild(this._loadedMC);
|
||||
this._loadedMC.bx.removeEventListener(MouseEvent.MOUSE_DOWN,this.onClose);
|
||||
this._loadedMC.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPopup);
|
||||
this._loadedMC = null;
|
||||
this._top = null;
|
||||
this._mid = null;
|
||||
this._bot = null;
|
||||
this._openWasCalled = false;
|
||||
}
|
||||
|
||||
public function open() : void
|
||||
{
|
||||
if(this._loadedMC)
|
||||
{
|
||||
this._loadedMC.visible = true;
|
||||
}
|
||||
if(this._loadedMC.passback.darken)
|
||||
{
|
||||
DarkenManager.darken(this._loadedMC);
|
||||
}
|
||||
this._openWasCalled = true;
|
||||
}
|
||||
|
||||
public function close() : void
|
||||
{
|
||||
if(this._loadedMC)
|
||||
{
|
||||
this._loadedMC.visible = false;
|
||||
}
|
||||
if(this._loadedMC.passback.darken)
|
||||
{
|
||||
DarkenManager.unDarken(this._loadedMC);
|
||||
}
|
||||
}
|
||||
|
||||
private function onMediaLoaded(param1:MovieClip) : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
if(param1)
|
||||
{
|
||||
this._loadedMC = param1.getChildAt(0) as MovieClip;
|
||||
this._popupMediaHelper.destroy();
|
||||
this._popupMediaHelper = null;
|
||||
this._loadedMC.x = MainFrame.VIEW_WIDTH * 0.5;
|
||||
this._loadedMC.y = MainFrame.VIEW_HEIGHT * 0.5;
|
||||
this._loadedMC.parent.parent.x = this._loadedMC.x;
|
||||
this._loadedMC.parent.parent.y = this._loadedMC.y;
|
||||
this._loadedMC.bx.addEventListener(MouseEvent.MOUSE_DOWN,this.onClose);
|
||||
this._loadedMC.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopup);
|
||||
this._loadedMC.passback = this._loadedMC.parent["passback"];
|
||||
if(this._loadedMC.passback.title)
|
||||
{
|
||||
this._loadedMC.titleTxt.text = this._loadedMC.passback.title;
|
||||
}
|
||||
if(this._loadedMC.passback.message)
|
||||
{
|
||||
this._loadedMC.txt.bodyTxt.autoSize = TextFieldAutoSize.CENTER;
|
||||
this._loadedMC.txt.bodyTxt.text = this._loadedMC.passback.message;
|
||||
}
|
||||
this._top = this._loadedMC.ba.t;
|
||||
this._mid = this._loadedMC.ba.m;
|
||||
this._bot = this._loadedMC.ba.b;
|
||||
this.resize();
|
||||
if(!this._loadedMC.passback.autoOpen && !this._openWasCalled)
|
||||
{
|
||||
this._loadedMC.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.open();
|
||||
}
|
||||
this._loadedMC.passback.parent.addChild(this._loadedMC);
|
||||
}
|
||||
}
|
||||
|
||||
private function onClose(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(this._loadedMC.passback.closeCallback)
|
||||
{
|
||||
this._loadedMC.passback.closeCallback();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private function onPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function resize() : void
|
||||
{
|
||||
this._mid.height = Math.floor(this._loadedMC.txt.height);
|
||||
this._top.y = this._mid.y - this._mid.height * 0.5 - this._top.height * 0.5;
|
||||
this._bot.y = this._mid.y + this._mid.height * 0.5 + this._bot.height * 0.5;
|
||||
this._loadedMC.titleTxt.y = this._top.y - 23;
|
||||
this._loadedMC.bx.y = this._loadedMC.titleTxt.y;
|
||||
this._loadedMC.txt.y -= this._mid.height * 0.5 - 29;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.sbi.popup
|
||||
{
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
|
||||
public dynamic class SBStayLeavePopup extends SBStandardPopup
|
||||
{
|
||||
|
||||
private var _stayBtn:MovieClip;
|
||||
|
||||
private var _leaveBtn:MovieClip;
|
||||
|
||||
private var _confirmCallback:Function;
|
||||
|
||||
private var _passbackObject:Object;
|
||||
|
||||
public function SBStayLeavePopup(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)
|
||||
{
|
||||
this._confirmCallback = param4;
|
||||
this._passbackObject = param5;
|
||||
_verticalOffset = -20;
|
||||
_btnTxtGap = 6;
|
||||
_btnHeight = 44;
|
||||
var _loc16_:MovieClip = GETDEFINITIONBYNAME("YesNoPopupSkin");
|
||||
var _loc17_:MovieClip = GETDEFINITIONBYNAME("LeaveStayPopupContent");
|
||||
this._stayBtn = _loc17_.stayBtn;
|
||||
this._leaveBtn = _loc17_.leaveBtn;
|
||||
this._stayBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onStayLeaveBtn,false,0,true);
|
||||
this._leaveBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onStayLeaveBtn,false,0,true);
|
||||
_resizeCallback = this.onResize;
|
||||
super(param1,param2,param3,_loc17_,_loc16_,param6,param7,param8,param9,param10,param11,param12,param13,param14,param15);
|
||||
}
|
||||
|
||||
override public function destroy() : void
|
||||
{
|
||||
this._stayBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onStayLeaveBtn);
|
||||
this._leaveBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onStayLeaveBtn);
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
private function onResize() : void
|
||||
{
|
||||
this._stayBtn.y = _text.height + _btnTxtGap + 0.5 * _btnHeight;
|
||||
this._leaveBtn.y = this._stayBtn.y;
|
||||
}
|
||||
|
||||
private function onStayLeaveBtn(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc2_:Object = null;
|
||||
param1.stopPropagation();
|
||||
this.destroy();
|
||||
if(this._confirmCallback != null)
|
||||
{
|
||||
_loc2_ = {
|
||||
"status":param1.currentTarget == this._leaveBtn,
|
||||
"passback":this._passbackObject
|
||||
};
|
||||
this._confirmCallback(_loc2_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,265 @@
|
||||
package com.sbi.popup
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
|
||||
public class SBWizard
|
||||
{
|
||||
|
||||
public var screens:Array;
|
||||
|
||||
private var _step:int;
|
||||
|
||||
private var _useSeparateScreens:Boolean;
|
||||
|
||||
public var wizClip:MovieClip;
|
||||
|
||||
public function SBWizard()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:MovieClip, param2:Boolean = true, param3:int = 1, param4:Array = null, param5:Boolean = true, param6:Boolean = false, param7:Boolean = false) : void
|
||||
{
|
||||
var _loc9_:int = 0;
|
||||
var _loc10_:DisplayObject = null;
|
||||
var _loc11_:SBScreen = null;
|
||||
var _loc12_:int = 0;
|
||||
if(param1 == null)
|
||||
{
|
||||
throw new Error("invalid null initWizClip!");
|
||||
}
|
||||
this.wizClip = param1;
|
||||
this._useSeparateScreens = param6;
|
||||
if(!param2 && param6)
|
||||
{
|
||||
this.wizClip.visible = false;
|
||||
}
|
||||
var _loc8_:int = param6 == false ? int(param4.length) : this.wizClip.totalFrames;
|
||||
if(param4)
|
||||
{
|
||||
this.screens = param4;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.screens = [];
|
||||
if(_loc8_ > 0)
|
||||
{
|
||||
_loc9_ = 0;
|
||||
while(_loc9_ < _loc8_)
|
||||
{
|
||||
this.wizClip.gotoAndStop(_loc9_ + 1);
|
||||
_loc10_ = this.wizClip.getChildAt(0);
|
||||
_loc11_ = new SBScreen(_loc10_ as MovieClip,this);
|
||||
_loc11_.screenClip.visible = false;
|
||||
this.screens.push(_loc11_);
|
||||
_loc9_++;
|
||||
}
|
||||
if(this.screens.length != uint(_loc8_))
|
||||
{
|
||||
throw new Error("SBWizard - Failed assertion: lengths must be equal- screens.length:" + this.screens.length + " uint(framesLength):" + uint(_loc8_));
|
||||
}
|
||||
}
|
||||
}
|
||||
this.wizClip.enabled = param5;
|
||||
this.step = param3;
|
||||
if(param6)
|
||||
{
|
||||
_loc12_ = 0;
|
||||
while(_loc12_ < _loc8_)
|
||||
{
|
||||
this.wizClip.addChild(this.screens[_loc12_].screenClip);
|
||||
_loc12_++;
|
||||
}
|
||||
if(param3 > 0 && param3 <= _loc8_)
|
||||
{
|
||||
this.screens[param3 - 1].screenClip.visible = true;
|
||||
}
|
||||
}
|
||||
this.wizClip.stop();
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
this.screens.splice(0,this.screens.length);
|
||||
this.screens = null;
|
||||
this.wizClip = null;
|
||||
}
|
||||
|
||||
public function get step() : int
|
||||
{
|
||||
return this._step;
|
||||
}
|
||||
|
||||
public function set step(param1:int) : void
|
||||
{
|
||||
if(param1 == this._step)
|
||||
{
|
||||
return;
|
||||
}
|
||||
this.jumpToStep(param1);
|
||||
}
|
||||
|
||||
public function get currScreen() : SBScreen
|
||||
{
|
||||
return this.screens[this._step - 1];
|
||||
}
|
||||
|
||||
public function get nextScreen() : SBScreen
|
||||
{
|
||||
if(Boolean(this.screens) && this._step <= this.screens.length - 1)
|
||||
{
|
||||
return this.screens[int(this._step)];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get prevScreen() : SBScreen
|
||||
{
|
||||
if(Boolean(this._step > 0) && Boolean(this.screens) && this.screens.length >= this._step)
|
||||
{
|
||||
return this.screens[int(this._step - 2)];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function jumpToStep(param1:int) : void
|
||||
{
|
||||
var _loc3_:SBScreen = null;
|
||||
var _loc4_:Function = null;
|
||||
var _loc5_:SBScreen = null;
|
||||
var _loc6_:Function = null;
|
||||
if(!this.screens || param1 < 0 || param1 > this.screens.length + 1)
|
||||
{
|
||||
throw new Error("illegal wizard step:" + param1 + " screens:" + (this.screens ? this.screens.length : this.screens));
|
||||
}
|
||||
if(!this.wizClip.enabled || param1 == this._step)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var _loc2_:Boolean = Boolean(param1 > this._step);
|
||||
if(this._step > 0 && this._step <= this.screens.length)
|
||||
{
|
||||
_loc3_ = this.screens[this._step - 1];
|
||||
if(this._useSeparateScreens)
|
||||
{
|
||||
_loc3_.screenClip.visible = false;
|
||||
}
|
||||
_loc4_ = _loc2_ ? _loc3_.onLeaveToNext : _loc3_.onLeaveToPrev;
|
||||
if(_loc4_ != null)
|
||||
{
|
||||
if(!_loc4_())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
this._step = param1;
|
||||
if(param1 > 0 && param1 <= this.screens.length)
|
||||
{
|
||||
_loc5_ = this.screens[param1 - 1];
|
||||
if(this._useSeparateScreens)
|
||||
{
|
||||
_loc5_.screenClip.visible = true;
|
||||
}
|
||||
_loc6_ = _loc2_ ? _loc5_.onEnterFromPrev : _loc5_.onEnterFromNext;
|
||||
if(_loc6_ != null)
|
||||
{
|
||||
_loc6_();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function jumpToScreen(param1:SBScreen) : void
|
||||
{
|
||||
var _loc2_:int = this.screens.indexOf(param1);
|
||||
if(_loc2_ >= 0)
|
||||
{
|
||||
this.jumpToStep(_loc2_ + 1);
|
||||
return;
|
||||
}
|
||||
throw new Error("SBWizard jumpToScreen - screen:" + param1 + " not found!");
|
||||
}
|
||||
|
||||
public function next() : void
|
||||
{
|
||||
this.jumpToStep(this._step + 1);
|
||||
}
|
||||
|
||||
public function prev() : void
|
||||
{
|
||||
this.jumpToStep(this._step - 1);
|
||||
}
|
||||
|
||||
public function onPlay() : void
|
||||
{
|
||||
this.currScreen.onPlay();
|
||||
}
|
||||
|
||||
public function onClose() : void
|
||||
{
|
||||
this.currScreen.onClose();
|
||||
this._step = 1;
|
||||
}
|
||||
|
||||
public function addScreen(param1:SBScreen, param2:int = 0) : void
|
||||
{
|
||||
if(!this.screens)
|
||||
{
|
||||
throw new Error("Tried to addScreen on an uninitialized wizard!");
|
||||
}
|
||||
if(param2 == 0)
|
||||
{
|
||||
this.screens.push(param1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(param2 < 0 || param2 > this.screens.length)
|
||||
{
|
||||
throw new Error("illegal step:" + param2 + " while trying to addScreen");
|
||||
}
|
||||
this.screens.splice(param2 - 1,0,param1);
|
||||
}
|
||||
}
|
||||
|
||||
public function removeScreen(param1:int = 0) : void
|
||||
{
|
||||
if(!this.screens || this.screens.length == 0)
|
||||
{
|
||||
throw new Error("Tried to removeScreen on an empty wizard!");
|
||||
}
|
||||
if(param1 == 0)
|
||||
{
|
||||
this.screens.pop();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(param1 < 0 || param1 > this.screens.length)
|
||||
{
|
||||
throw new Error("illegal step:" + param1 + " while trying to removeScreen");
|
||||
}
|
||||
this.screens.splice(param1 - 1,1);
|
||||
}
|
||||
}
|
||||
|
||||
public function updateCurrScreen() : void
|
||||
{
|
||||
var _loc1_:SBScreen = this.currScreen;
|
||||
if(_loc1_)
|
||||
{
|
||||
_loc1_.updateScreen(true);
|
||||
}
|
||||
var _loc2_:SBScreen = this.prevScreen;
|
||||
if(_loc2_)
|
||||
{
|
||||
_loc2_.updateScreen();
|
||||
}
|
||||
var _loc3_:SBScreen = this.nextScreen;
|
||||
if(_loc3_)
|
||||
{
|
||||
_loc3_.updateScreen();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.sbi.popup
|
||||
{
|
||||
import flash.display.*;
|
||||
import flash.events.*;
|
||||
import flash.net.FileReference;
|
||||
|
||||
public dynamic class SBYesNoPopup extends SBStandardPopup
|
||||
{
|
||||
|
||||
private var _yesBtn:MovieClip;
|
||||
|
||||
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)
|
||||
{
|
||||
this._confirmCallback = param4;
|
||||
this._passbackObject = param5;
|
||||
_verticalOffset = -20;
|
||||
_btnTxtGap = 6;
|
||||
_btnHeight = 44;
|
||||
var _loc16_:MovieClip = GETDEFINITIONBYNAME("YesNoPopupSkin");
|
||||
var _loc17_:MovieClip = GETDEFINITIONBYNAME("YesNoPopupContent");
|
||||
this._yesBtn = _loc17_.yesBtn;
|
||||
this._noBtn = _loc17_.noBtn;
|
||||
this._yesBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onYesNoBtn,false,0,true);
|
||||
this._noBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onYesNoBtn,false,0,true);
|
||||
_resizeCallback = this.onResize;
|
||||
super(param1,param2,param3,_loc17_,_loc16_,param6,param7,param8,param9,param10,param11,param12,param13,param14,param15);
|
||||
}
|
||||
|
||||
override public function destroy() : void
|
||||
{
|
||||
this._yesBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onYesNoBtn);
|
||||
this._noBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onYesNoBtn);
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
private function onResize() : void
|
||||
{
|
||||
this._yesBtn.y = _text.height + _btnTxtGap + 0.5 * _btnHeight;
|
||||
this._noBtn.y = this._yesBtn.y;
|
||||
}
|
||||
|
||||
private function onYesNoBtn(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc2_:FileReference = null;
|
||||
var _loc3_:Object = null;
|
||||
param1.stopPropagation();
|
||||
this.destroy();
|
||||
if(Boolean(param1.currentTarget == this._yesBtn) && Boolean(this._passbackObject) && this._passbackObject.hasOwnProperty("FileReference"))
|
||||
{
|
||||
_loc2_ = new FileReference();
|
||||
_loc2_.save(this._passbackObject.ImageData,this._passbackObject.SaveName);
|
||||
}
|
||||
if(this._confirmCallback != null)
|
||||
{
|
||||
_loc3_ = {
|
||||
"status":param1.currentTarget == this._yesBtn,
|
||||
"passback":this._passbackObject
|
||||
};
|
||||
this._confirmCallback(_loc3_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user