Brought up to date with the private repository (feea4c7)

This commit is contained in:
S committed 2026-10-14 20:57:33 +03:00
1 parent 1aa738d692
commit 1b1df1ae48
7925 files changed
+2617237 -20

No files matched your search

@@ -0,0 +1,293 @@
package createAccountGui
{
import avatar.Avatar;
import createAccountFlow.CreateAccountGui;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.text.TextField;
import gui.DarkenManager;
import loader.MediaHelper;
public class GuiAvatarCreationAssets extends Sprite
{
public var creationWiz:GuiCreateWizard;
public var notifyPopup:MovieClip;
public var tipsPopup:MovieClip;
private var nextBtn:MovieClip;
private var backBtn:MovieClip;
private var playBtn:MovieClip;
private var buyBtnRed:MovieClip;
private var buyBtnGreen:MovieClip;
private var buyBtnDiamondRed:MovieClip;
private var buyBtnDiamondGreen:MovieClip;
private var closeBtn:MovieClip;
private var _avatarAssets:MovieClip;
private var _mediaHelper:MediaHelper;
private var _createAccountIlAvatar:Object;
public function GuiAvatarCreationAssets()
{
super();
}
public function initFromWorld(param1:Boolean, param2:Boolean, param3:int = -1, param4:Boolean = false, param5:Boolean = false) : void
{
DarkenManager.showLoadingSpiral(true);
this._createAccountIlAvatar = null;
this._mediaHelper = new MediaHelper();
this._mediaHelper.init(1892,this.onAvatarCarouselLoaded,{
"isChoosingOceanAvatars":param1,
"isChoosing":param2,
"avatarTypeToShow":param3,
"skipToNameScreen":param4,
"isFastPass":param5
});
}
public function initFromAccountCreation(param1:MovieClip, param2:Object) : void
{
this._avatarAssets = param1;
this._createAccountIlAvatar = param2;
this.init(false,null);
}
public function destroy() : void
{
this.creationWiz.destroy();
this.creationWiz = null;
removeChild(this._avatarAssets);
this._avatarAssets = null;
}
public function get currAvatarImage() : MovieClip
{
return this.creationWiz.chooseAnimalScreen.currAvatarImage;
}
public function get currAvatar() : Avatar
{
return this.creationWiz.chooseAnimalScreen.currAvatar;
}
public function get currBG() : String
{
return this.creationWiz.chooseAnimalScreen.currBG;
}
public function get currType() : int
{
return this.creationWiz.chooseAnimalScreen.currType;
}
public function get currCustomAvId() : int
{
return this.creationWiz.chooseAnimalScreen.currCustomAvId;
}
public function get hasEnoughGems() : Boolean
{
return this.creationWiz.chooseAnimalScreen.hasEnoughGems;
}
public function get currAvatarCost() : int
{
return this.creationWiz.chooseAnimalScreen.currAvatarCost;
}
public function get currAvatarName() : String
{
return this.creationWiz.chooseAnimalScreen.currAvatarName;
}
public function get isCreatingWithoutChoosing() : Boolean
{
return this.creationWiz.chooseAnimalScreen.isCreatingWithoutChoosing;
}
public function get isDiamondAvatar() : Boolean
{
return this.creationWiz.chooseAnimalScreen.isDiamondAvatar;
}
public function get avatarDiamondDefId() : int
{
return this.creationWiz.chooseAnimalScreen.avatarDiamondDefId;
}
public function get currencyType() : int
{
return this.creationWiz.chooseAnimalScreen.currencyType;
}
public function get currEmailAddress() : String
{
return this.creationWiz.emailScreen.currEmail;
}
public function get emailValidationCallback() : Function
{
return this.creationWiz.emailScreen.emailValidCallback;
}
public function get currEmailSoFar() : String
{
return this.creationWiz.emailScreen.currEmail;
}
public function destroyReloadedItems() : void
{
this.creationWiz.chooseAnimalScreen.destroyReloadedItems();
}
public function loadNameLists() : void
{
this.creationWiz.createANameScreen.loadNameLists();
}
private function onAvatarCarouselLoaded(param1:MovieClip) : void
{
this._avatarAssets = MovieClip(param1.getChildAt(0));
if(param1.passback.isFastPass)
{
LoadProgress.show(false);
if(CreateAccountGui.vo1Sound == null)
{
CreateAccountGui.loadCreationVoSounds(this.init,{
"isInWorld":true,
"requiredParams":param1.passback
});
}
}
else
{
this.init(true,param1.passback);
}
}
private function init(param1:Boolean, param2:Object) : void
{
var _loc3_:TextField = null;
addChild(this._avatarAssets);
this.creationWiz = new GuiCreateWizard(this._avatarAssets,this._createAccountIlAvatar);
this.creationWiz.init(this._avatarAssets,this,false,1,null,true,false,param1,param2 ? Boolean(param2.isFastPass) : Boolean(null));
this._avatarAssets.addEventListener("Localization",this.onFrameCompleteEvent,false,0,true);
this.notifyPopup = this._avatarAssets.oopsPopup;
this.notifyPopup.notifyTxt = this._avatarAssets.oopsPopup.bodyTxtOops.oops_txt;
this.notifyPopup.titleTxt = this._avatarAssets.oopsPopup.oops_title_txt;
this.notifyPopup.bx.addEventListener(MouseEvent.MOUSE_DOWN,this.notifyPopupBxHandler,false,0,true);
this.notifyPopup.visible = false;
if(!param1)
{
this.tipsPopup = this._avatarAssets.tipsPopup;
this.tipsPopup.bx.addEventListener(MouseEvent.MOUSE_DOWN,this.tipsPopupBxHandler,false,0,true);
_loc3_ = this.tipsPopup.tips_pp_txt;
_loc3_.htmlText = _loc3_.text.replace("Privacy Policy","<a href=\'http://www.animaljam.com/privacy\' target=\'_blank\'><u>Privacy Policy</u></a>");
this.playBtn = this._avatarAssets.play_btn;
this.playBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onPlayBtn,false,0,true);
}
else
{
this.buyBtnRed = this._avatarAssets.buy_btn_red;
this.buyBtnRed.addEventListener(MouseEvent.MOUSE_DOWN,this.onBuyBtn,false,0,true);
this.buyBtnGreen = this._avatarAssets.buy_btn_green;
this.buyBtnGreen.addEventListener(MouseEvent.MOUSE_DOWN,this.onBuyBtn,false,0,true);
this.buyBtnDiamondRed = this._avatarAssets.diamond_buy_btn_red;
this.buyBtnDiamondRed.addEventListener(MouseEvent.MOUSE_DOWN,this.onBuyBtn,false,0,true);
this.buyBtnDiamondGreen = this._avatarAssets.diamond_buy_btn_green;
this.buyBtnDiamondGreen.addEventListener(MouseEvent.MOUSE_DOWN,this.onBuyBtn,false,0,true);
this.closeBtn = this._avatarAssets.bx;
this.playBtn = this._avatarAssets.play_btn;
if(param2.isFastPass)
{
this.playBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onPlayBtn,false,0,true);
this.closeBtn.visible = false;
}
else
{
this.closeBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onClose,false,0,true);
this.playBtn.visible = false;
}
}
this.nextBtn = this._avatarAssets.next_btn;
this.nextBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onNextBtn,false,0,true);
this.backBtn = this._avatarAssets.back_btn;
this.backBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onBackBtn,false,0,true);
this._avatarAssets.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopupDown,false,0,true);
if(param1)
{
this.creationWiz.step = 1;
this.creationWiz.chooseAnimalScreen.setup(param2.isChoosingOceanAvatars,param2.isChoosing,param2.avatarTypeToShow,param2.skipToNameScreen,param2.isFastPass);
}
}
private function onFrameCompleteEvent(param1:Event = null) : void
{
if(this.creationWiz)
{
this.creationWiz.updateCurrScreen();
}
}
private function notifyPopupBxHandler(param1:MouseEvent) : void
{
this.notifyPopup.visible = false;
}
private function tipsPopupBxHandler(param1:MouseEvent) : void
{
this.tipsPopup.visible = false;
}
private function onNextBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
this.creationWiz.next();
}
private function onBackBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
this.creationWiz.prev();
}
private function onPlayBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
this.creationWiz.onPlay();
}
private function onBuyBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
this.creationWiz.onPlay();
}
private function onClose(param1:MouseEvent) : void
{
param1.stopPropagation();
this.creationWiz.onClose();
}
private function onPopupDown(param1:MouseEvent) : void
{
param1.stopPropagation();
}
}
}
@@ -0,0 +1,912 @@
package createAccountGui
{
import avatar.Avatar;
import avatar.AvatarUtility;
import avatar.NewWorldAvatar;
import com.sbi.analytics.SBTracker;
import com.sbi.popup.SBOkPopup;
import com.sbi.popup.SBScreen;
import com.sbi.popup.SBWizard;
import createAccountFlow.CreateAccountGui;
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.text.TextField;
import gui.ItemWindowAvatarOrPetSelect;
import gui.LoadingSpiral;
import gui.SBScrollbar;
import gui.UpsellManager;
import gui.WindowGenerator;
import item.Item;
import localization.LocalizationManager;
public class GuiChooseAnimal extends SBScreen
{
private var _chooseScreen:MovieClip;
private var _voBtn:MovieClip;
private var _backBtn:MovieClip;
private var _nextBtn:MovieClip;
private var _playBtn:MovieClip;
private var _itemWindow:MovieClip;
private var _avatarHolder:MovieClip;
private var _currAvatarImage:MovieClip;
private var _currAvt:Avatar;
private var _buyBtnGreen:MovieClip;
private var _buyBtnRed:MovieClip;
private var _buyBtnDiamondGreen:MovieClip;
private var _buyBtnDiamondRed:MovieClip;
private var _tag:MovieClip;
private var _amlNameTxt:TextField;
private var _titleText:TextField;
private var _avatarWindows:WindowGenerator;
private var _scrollBar:SBScrollbar;
private var _itemsLoadingSpiral:LoadingSpiral;
private var _currAvatarIconIds:Array;
private var _currAvatarTypes:Array;
private var _currCreationAvatars:Array;
private var _oceanOnlyIconIds:Array;
private var _oceanOnlyTypes:Array;
private var _usableAvatarIconIds:Array;
private var _usableAvatarTypes:Array;
private var _usableCreationAvatars:Array;
private var _currBG:String;
private var _avatarNamesByType:Object;
private var _newAvatarFacilitator:NewWorldAvatar;
private var _currType:int;
private var _myCurrencyCount:int;
private var _currCost:int;
private var _currIndex:int;
private var _isChoosingOceanAvatars:Boolean;
private var _isChoosingFirstNonMember:Boolean;
private var _isFromWorld:Boolean;
private var _hasEnoughGems:Boolean;
private var _wizard:SBWizard;
private var _isCreatingWithoutChoosing:Boolean;
private var _diamondCost:int;
private var _currencyType:int;
private var _scrollYValue:int;
private var _originalWindowsHeight:int;
private var _originalWindowsWidth:int;
private var _isMovingScreens:Boolean;
private var _registrationPanel:MovieClip;
private var _avatarSelect:MovieClip;
private var _isFastPass:Boolean;
public function GuiChooseAnimal(param1:Object, param2:SBWizard, param3:Boolean, param4:Boolean = false)
{
this._chooseScreen = param3 ? param1.registrationPanel.chooseAnimal : param1.registrationPanel.chooseAnimal;
super(this._chooseScreen,param2);
this._registrationPanel = MovieClip(this._chooseScreen.parent);
this._avatarSelect = MovieClip(this._chooseScreen.parent.parent);
this._amlNameTxt = this._chooseScreen.animalNameText;
this._itemWindow = this._chooseScreen.itemWindow;
this._titleText = this._chooseScreen.titleText;
this._isFromWorld = param3;
this._wizard = param2;
this._isFastPass = param4;
this._voBtn = this._chooseScreen.vo_btn;
this._playBtn = param1.play_btn;
this._backBtn = param1.back_btn;
this._nextBtn = param1.next_btn;
this._avatarHolder = param1.allAvatars;
if(param3)
{
this._buyBtnGreen = param1.buy_btn_green;
this._buyBtnRed = param1.buy_btn_red;
this._buyBtnDiamondGreen = param1.diamond_buy_btn_green;
this._buyBtnDiamondRed = param1.diamond_buy_btn_red;
this._tag = this._chooseScreen.tag;
}
}
public function init() : void
{
onEnterFromNext = this.enterFromNext;
onEnterFromPrev = this.enterFromPrev;
onLeaveToPrev = this.leaveToPrev;
onLeaveToNext = this.leaveToNext;
onClose = this.leaveToPrev;
updateScreen = this.updateScreenAssets;
if(!this._isFromWorld || this._isFastPass)
{
this._voBtn.stop();
this._voBtn.gotoAndStop(1);
this._voBtn.addEventListener(MouseEvent.CLICK,this.voBtnClickHandler,false,0,true);
}
if(this._isFromWorld)
{
this._buyBtnGreen.visible = false;
this._buyBtnRed.visible = false;
this._buyBtnDiamondGreen.visible = false;
this._buyBtnDiamondRed.visible = false;
this._tag.visible = false;
this._voBtn.visible = this._isFastPass;
this._chooseScreen.reg.visible = !this._isFastPass;
this._chooseScreen.fastTrack.visible = this._isFastPass;
}
this._backBtn.visible = false;
this._playBtn.visible = false;
this._amlNameTxt.text = "";
this._myCurrencyCount = gMainFrame.clientInfo.gemCount;
this._newAvatarFacilitator = new NewWorldAvatar();
this._usableAvatarIconIds = [];
this._usableAvatarTypes = [];
this._usableCreationAvatars = [];
this._currAvatarIconIds = [];
this._currAvatarTypes = [];
this._currCreationAvatars = [];
this._avatarNamesByType = [];
this._oceanOnlyIconIds = [];
this._itemsLoadingSpiral = new LoadingSpiral(this._itemWindow,this._itemWindow.width * 0.5,this._itemWindow.height * 0.5);
this._itemsLoadingSpiral.visible = true;
this.setupIcons();
if((!this._isFromWorld || this._isFastPass) && Boolean(CreateAccountGui.vo1Sound))
{
CreateAccountGui.vo1Sound.play();
if(CreateAccountGui.vo1Sound.sc)
{
CreateAccountGui.vo1Sound.sc.addEventListener(Event.SOUND_COMPLETE,this.stopVOButton,false,0,true);
this._voBtn.play();
}
}
}
override public function destroy() : void
{
if(this._avatarWindows)
{
this._avatarWindows.destroy();
this._avatarWindows = null;
}
if(this._scrollBar)
{
this._scrollBar.destroy();
this._scrollBar = null;
}
super.destroy();
}
public function destroyReloadedItems() : void
{
if(this._avatarWindows)
{
this._avatarWindows.destroy();
this._avatarWindows = null;
}
if(this._scrollBar)
{
this._scrollBar.destroy();
this._scrollBar = null;
}
}
public function setup(param1:Boolean, param2:Boolean, param3:int = -1, param4:Boolean = false, param5:Boolean = false) : void
{
this._isMovingScreens = false;
this._currencyType = this.currencyType;
this._isFastPass = param5;
this.setupIcons(true);
if(this.currencyType == Item.GEM_CURRENCY)
{
this._myCurrencyCount = gMainFrame.clientInfo.gemCount;
}
else if(this.currencyType == Item.DIAMOND_CURRENCY)
{
this._myCurrencyCount = gMainFrame.clientInfo.diamondCount;
}
this._isChoosingOceanAvatars = param1;
this._isChoosingFirstNonMember = param2;
this._nextBtn.visible = true;
this._buyBtnGreen.visible = false;
this._buyBtnRed.visible = false;
this._buyBtnDiamondGreen.visible = false;
this._buyBtnDiamondRed.visible = false;
this._backBtn.visible = false;
this._isCreatingWithoutChoosing = param4;
if(this._isChoosingOceanAvatars)
{
this._currAvatarIconIds = this._oceanOnlyIconIds;
this._currAvatarTypes = this._oceanOnlyTypes;
}
else
{
this._currAvatarIconIds = this._usableAvatarIconIds;
this._currAvatarTypes = this._usableAvatarTypes;
this._currCreationAvatars = this._usableCreationAvatars;
}
this.pickRandomAvatar(param3);
this._wizard.creationAssets.creationWiz.step = param4 ? 2 : 1;
if(Boolean(this._currAvatarImage) && Boolean(this._currBG))
{
if(!param4)
{
this.enterFromPrev();
this._nextBtn.visible = true;
this._tag.visible = true;
}
else
{
this._nextBtn.visible = false;
this._tag.visible = false;
}
}
if(!param4)
{
this.createAvatarWindows();
}
}
public function enterFromNext() : void
{
this._registrationPanel.gotoAndPlay("backChooseAnAnimal");
this._currAvatarImage.gotoAndPlay("backChooseAnAnimal");
this._avatarSelect.bg[this._currBG + "Bg"].gotoAndPlay("backChooseAnAnimal");
if(this._isFromWorld)
{
this._buyBtnGreen.visible = false;
this._buyBtnRed.visible = false;
this._buyBtnDiamondGreen.visible = false;
this._buyBtnDiamondRed.visible = false;
this._nextBtn.visible = true;
}
this.enterFromBoth();
}
public function enterFromPrev() : void
{
this._registrationPanel.gotoAndStop("intro");
if(this._currAvatarImage)
{
this._currAvatarImage.gotoAndStop("chooseAnAnimal");
}
if(this._currBG)
{
this._avatarSelect.bg[this._currBG + "Bg"].gotoAndPlay("intro");
}
this.enterFromBoth();
}
public function enterFromBoth() : void
{
if((!this._isFromWorld || this._isFastPass) && Boolean(CreateAccountGui.vo1Sound))
{
if(!CreateAccountGui.vo1Sound.isPlaying)
{
CreateAccountGui.vo1Sound.play();
if(CreateAccountGui.vo1Sound.sc)
{
CreateAccountGui.vo1Sound.sc.addEventListener(Event.SOUND_COMPLETE,this.stopVOButton,false,0,true);
this._voBtn.play();
}
}
}
this._isMovingScreens = false;
if(this._isFromWorld)
{
SBTracker.trackPageview("/game/play/popup/avatarCreation/ChooseAnimal");
}
else
{
CreateAccountGui.trackUserCreateAccountPageChange("ChooseAnimal");
}
}
public function leaveToNext() : Boolean
{
var _loc1_:Object = null;
if(this._nextBtn.isGray)
{
return false;
}
if(!this._isFromWorld || this._isFastPass)
{
if(CreateAccountGui.vo1Sound)
{
CreateAccountGui.vo1Sound.stop();
}
this._voBtn.stop();
this._voBtn.gotoAndStop(1);
}
if(!gMainFrame.userInfo.isMember)
{
_loc1_ = AvatarUtility.findAvDefByType(this._currType,this.currCustomAvId);
if(_loc1_.isMemberOnly)
{
if(this._isCreatingWithoutChoosing)
{
if(this._registrationPanel.currentFrameLabel != "chooseAName")
{
this._registrationPanel.gotoAndStop("chooseAName");
}
if(this._currAvatarImage.currentFrameLabel != "chooseAName")
{
this._currAvatarImage.gotoAndStop("chooseAName");
}
if(this._avatarSelect.bg[this._currBG + "Bg"].currentFrameLabel != "chooseAName")
{
this._avatarSelect.bg[this._currBG + "Bg"].gotoAndStop("chooseAName");
}
return true;
}
UpsellManager.displayPopup(UpsellManager.ANIMALS,"createMembersOnlyAvatar");
}
else if(AvatarUtility.numNonMemberAvatars() >= 2 && !this._isChoosingFirstNonMember)
{
UpsellManager.displayPopup(UpsellManager.ANIMAL_SLOTS,"buyThirdAvatar");
}
else
{
if(!(this._isChoosingFirstNonMember && _loc1_.enviroFlag == 2))
{
if(this._isCreatingWithoutChoosing)
{
this._registrationPanel.gotoAndStop("chooseAName");
this._currAvatarImage.gotoAndStop("chooseAName");
this._avatarSelect.bg[this._currBG + "Bg"].gotoAndStop("chooseAName");
}
else
{
this._registrationPanel.gotoAndPlay("playChooseAName");
this._currAvatarImage.gotoAndPlay("playChooseAName");
this._avatarSelect.bg[this._currBG + "Bg"].gotoAndPlay("playChooseAName");
}
this._isMovingScreens = true;
return true;
}
new SBOkPopup(this._avatarSelect.parent.parent,LocalizationManager.translateIdOnly(14689));
}
return false;
}
if(this._isCreatingWithoutChoosing)
{
this._registrationPanel.gotoAndStop("chooseAName");
this._currAvatarImage.gotoAndStop("chooseAName");
this._avatarSelect.bg[this._currBG + "Bg"].gotoAndStop("chooseAName");
}
else
{
this._registrationPanel.gotoAndPlay("playChooseAName");
this._currAvatarImage.gotoAndPlay("playChooseAName");
this._avatarSelect.bg[this._currBG + "Bg"].gotoAndPlay("playChooseAName");
}
this._isMovingScreens = true;
return true;
}
public function leaveToPrev() : Boolean
{
if(!this._isFromWorld || this._isFastPass)
{
if(CreateAccountGui.vo1Sound)
{
CreateAccountGui.vo1Sound.stop();
}
this._voBtn.stop();
this._voBtn.gotoAndStop(1);
}
this._newAvatarFacilitator.nameTypeScreenDone();
this._isMovingScreens = true;
return true;
}
public function leaveToBoth() : Boolean
{
return true;
}
public function updateScreenAssets(param1:Boolean = false) : void
{
this._chooseScreen = this._registrationPanel.chooseAnimal;
this._amlNameTxt = this._chooseScreen.animalNameText;
this._itemWindow = this._chooseScreen.itemWindow;
this._titleText = this._chooseScreen.titleText;
this._voBtn = this._chooseScreen.vo_btn;
if(this._isFromWorld)
{
this._tag = this._chooseScreen.tag;
this._buyBtnGreen = this._avatarSelect.buy_btn_green;
this._buyBtnRed = this._avatarSelect.buy_btn_red;
this._buyBtnDiamondGreen = this._avatarSelect.diamond_buy_btn_green;
this._buyBtnDiamondRed = this._avatarSelect.diamond_buy_btn_red;
}
if(param1)
{
this.setupAvatarTextItems();
this.createAvatarWindows();
if(this._isFromWorld)
{
this._buyBtnGreen.visible = false;
this._buyBtnRed.visible = false;
this._buyBtnDiamondGreen.visible = false;
this._buyBtnDiamondRed.visible = false;
this._tag.visible = true;
}
if(!this._isFromWorld || this._isFastPass)
{
this._playBtn.visible = false;
this._voBtn.stop();
this._voBtn.gotoAndStop(1);
this._voBtn.addEventListener(MouseEvent.CLICK,this.voBtnClickHandler,false,0,true);
this._voBtn = this._chooseScreen.vo_btn;
}
if((!this._isFromWorld || this._isFastPass) && Boolean(CreateAccountGui.vo1Sound))
{
if(CreateAccountGui.vo1Sound.sc)
{
this._voBtn.play();
}
}
}
}
public function get currencyType() : int
{
return this._currencyType;
}
public function get isCreatingWithoutChoosing() : Boolean
{
return this._isCreatingWithoutChoosing;
}
public function get currAvatarImage() : MovieClip
{
return this._currAvatarImage;
}
public function get currAvatar() : Avatar
{
return this._currAvt;
}
public function get currBG() : String
{
return this._currBG;
}
public function get currType() : int
{
return this._currType;
}
public function get currCustomAvId() : int
{
if(this._currAvt)
{
return this._currAvt.customAvId;
}
return -1;
}
public function get hasEnoughGems() : Boolean
{
return this._hasEnoughGems;
}
public function get currAvatarCost() : int
{
return this._diamondCost == -1 ? this._currCost : this._diamondCost;
}
public function get currAvatarName() : String
{
return LocalizationManager.translateIdOnly(this._avatarNamesByType[this._currType + (this.currCustomAvId == -1 ? "0" : "1")]);
}
public function get isDiamondAvatar() : Boolean
{
return AvatarUtility.findAvDefByType(this._currType,this.currCustomAvId).isDiamond;
}
public function get avatarDiamondDefId() : int
{
return AvatarUtility.findAvDefByType(this._currType,this.currCustomAvId).diamondDefId;
}
private function setCurrAvatarNameText() : void
{
var _loc1_:int = parseInt(this._currType + (this.currCustomAvId == -1 ? "0" : "1"));
if(this._avatarNamesByType[_loc1_])
{
LocalizationManager.translateId(this._amlNameTxt,this._avatarNamesByType[_loc1_]);
}
}
private function setupIcons(param1:Boolean = false) : void
{
var _loc3_:int = 0;
var _loc4_:Object = null;
var _loc5_:Avatar = null;
var _loc2_:Array = AvatarUtility.creationAvatarsList;
this._usableAvatarIconIds = [];
this._usableAvatarTypes = [];
this._oceanOnlyIconIds = [];
this._oceanOnlyTypes = [];
var _loc6_:int = 0;
for(; _loc6_ < _loc2_.length; _loc6_++)
{
try
{
_loc4_ = AvatarUtility.getAvatarDefByIndex(_loc6_);
if(_loc4_)
{
_loc5_ = _loc2_[_loc6_];
_loc3_ = int(gMainFrame.userInfo.getAvatarDefByAvatar(_loc5_).iconMediaId);
if(this._isFastPass && (Boolean(_loc4_.isDiamond || _loc4_.isMemberOnly) || Boolean(!Utility.isLand(_loc4_.enviroFlag))))
{
continue;
}
if((!this._isFromWorld || this._isFastPass) && (AvatarUtility.isEndangered(_loc4_.availability) || AvatarUtility.isExtinct(_loc4_.availability)))
{
continue;
}
if(Boolean(_loc4_.isDiamond) || AvatarUtility.getAvatarDefIsViewable(_loc5_,_loc5_.customAvId != -1))
{
this._usableAvatarIconIds.push(_loc3_);
this._usableAvatarTypes.push(_loc5_.avTypeId);
this._usableCreationAvatars.push(_loc5_);
if(Utility.isOcean(_loc4_.enviroFlag) && !this._isFastPass)
{
this._oceanOnlyIconIds.push(_loc3_);
this._oceanOnlyTypes.push(_loc5_.avTypeId);
}
}
this._avatarNamesByType[_loc5_.avTypeId + (_loc5_.customAvId != -1 ? "1" : "0")] = gMainFrame.userInfo.getAvatarDefByAvatar(_loc5_).titleStrRef;
if(Boolean(this._currType) && _loc5_.avTypeId == this._currType)
{
this.setCurrAvatarNameText();
}
}
}
catch(e:Error)
{
}
}
this._currAvatarIconIds = this._usableAvatarIconIds;
this._currAvatarTypes = this._usableAvatarTypes;
this._currCreationAvatars = this._usableCreationAvatars;
if((!this._isFromWorld || this._isFastPass) && !param1)
{
this.pickRandomAvatar();
this.createAvatarWindows();
}
}
private function pickRandomAvatar(param1:int = -1) : void
{
var _loc2_:int = 0;
if(param1 == -1)
{
this._currIndex = Math.floor(Math.random() * (this._currAvatarTypes.length - 1 - 0 + 1)) + 0;
param1 = int(this._currAvatarTypes[this._currIndex]);
}
else
{
_loc2_ = 0;
while(_loc2_ < this._currAvatarTypes.length)
{
if(this._currAvatarTypes[_loc2_] == param1)
{
this._currIndex = _loc2_;
break;
}
_loc2_++;
}
}
this._currType = param1;
this._currAvt = this._currCreationAvatars[this._currIndex];
this.setupCurrAvatar();
}
private function createAvatarWindows() : void
{
if(Boolean(this._avatarWindows) && this._avatarWindows.numWindowsCreated > 0)
{
this._itemWindow.addChild(this._avatarWindows);
if(this._isFromWorld && !this._isFastPass)
{
if(this._scrollBar)
{
this._scrollYValue = this._scrollBar.scrollYValue;
this._scrollBar.destroy();
this._scrollBar = null;
}
this._scrollBar = new SBScrollbar();
this._scrollBar.init(this._avatarWindows,this._originalWindowsWidth,this._avatarWindows.boxHeight * 3 + 2 * 3,12,"scrollbar2",this._avatarWindows.boxHeight + 2,this._scrollYValue,this._originalWindowsHeight);
}
return;
}
this._itemsLoadingSpiral.visible = true;
if(this._scrollBar)
{
this._scrollYValue = this._scrollBar.scrollYValue;
this._scrollBar.destroy();
this._scrollBar = null;
}
if(this._avatarWindows)
{
this._avatarWindows.destroy();
this._avatarWindows = null;
}
this._avatarWindows = new WindowGenerator();
this._avatarWindows.init(3,3,this._currAvatarIconIds.length,2,2,2,ItemWindowAvatarOrPetSelect,this._currAvatarIconIds,"",{
"mouseDown":this.winMouseDown,
"mouseOver":this.winMouseOver,
"mouseOut":this.winMouseOut
},{
"forCreation":!this._isFromWorld || this._isFastPass,
"avTypes":this._currAvatarTypes,
"creationAvatars":this._currCreationAvatars,
"selectedIndex":this._currIndex
},this.onAvatarIconWindowsLoaded,false,false);
this._itemWindow.addChild(this._avatarWindows);
}
private function onAvatarIconWindowsLoaded() : void
{
if(this._isFromWorld && !this._isFastPass && this._scrollBar == null)
{
this._originalWindowsHeight = this._avatarWindows.height;
this._originalWindowsWidth = this._avatarWindows.width;
this._scrollBar = new SBScrollbar();
this._scrollBar.init(this._avatarWindows,this._originalWindowsWidth,this._avatarWindows.boxHeight * 3 + 2 * 3,12,"scrollbar2",this._avatarWindows.boxHeight + 2,this._scrollYValue,this._originalWindowsHeight);
this._scrollBar.scrollToElement(this._currIndex / 3,true);
}
this._itemsLoadingSpiral.visible = false;
}
private function winMouseDown(param1:MouseEvent) : void
{
param1.stopPropagation();
if(!this._isMovingScreens && this._currIndex != param1.currentTarget.index)
{
MovieClip(this._avatarWindows.bg.getChildAt(this._currIndex)).deselect();
this._currIndex = param1.currentTarget.index;
this._currType = this._currAvatarTypes[param1.currentTarget.index];
this._currAvt = this._currCreationAvatars[this._currIndex];
if(param1.currentTarget.currWindow.currentFrameLabel != (param1.currentTarget.isDiamond ? "diamond_down" : "down"))
{
param1.currentTarget.currWindow.gotoAndStop(param1.currentTarget.isDiamond ? "diamond_down" : "down");
}
param1.currentTarget.setupLayers();
this.setupCurrAvatar();
}
}
private function setupCurrAvatar() : void
{
var _loc2_:Array = null;
var _loc1_:Array = this._avatarHolder.currentLabels;
var _loc3_:String = this.currCustomAvId != -1 ? "special_" : "";
var _loc4_:int = this.currCustomAvId != -1 ? this.currCustomAvId : this._currType;
var _loc5_:int = 0;
while(_loc5_ < _loc1_.length)
{
_loc2_ = _loc1_[_loc5_].name.split("_");
if(_loc3_ == "" && _loc2_[1] == _loc4_ || _loc3_.indexOf(_loc2_[0]) >= 0 && _loc2_[2] == _loc4_)
{
this._currBG = _loc3_ == "" ? _loc2_[0] : _loc2_[1];
this._avatarHolder.gotoAndStop(_loc3_ + this._currBG + "_" + _loc4_);
this._currAvatarImage = this._avatarHolder[_loc3_ + "avatar" + _loc4_];
break;
}
_loc5_++;
}
if(this._currAvatarImage)
{
this._currAvatarImage.gotoAndPlay("intro");
this.setupAvatarTextItems();
}
if(this._currBG)
{
if(this._avatarSelect.bg.currentFrameLabel != this._currBG)
{
this._avatarSelect.bg.gotoAndStop(this._currBG);
this._avatarSelect.bg[this._currBG + "Bg"].gotoAndPlay("intro");
}
}
}
private function setupAvatarTextItems() : void
{
var _loc1_:Object = null;
var _loc2_:Boolean = false;
if(this._currAvatarImage)
{
this.setCurrAvatarNameText();
_loc1_ = AvatarUtility.findAvDefByType(this._currType,this.currCustomAvId);
if(this._isFromWorld)
{
_loc2_ = Boolean(_loc1_.isDiamond) && !AvatarUtility.getAvatarDefIsViewableWithAvId(this._currType,this.currCustomAvId != -1);
if(_loc2_)
{
this._myCurrencyCount = gMainFrame.clientInfo.diamondCount;
this._diamondCost = _loc1_.diamondCost;
}
else
{
this._myCurrencyCount = gMainFrame.clientInfo.gemCount;
this._diamondCost = -1;
}
this._currCost = this._diamondCost == -1 ? int(_loc1_.cost) : this._diamondCost;
if(!this._isChoosingFirstNonMember)
{
this._tag.txt.text = Utility.convertNumberToString(this._currCost);
if(this._myCurrencyCount < this._currCost)
{
this._hasEnoughGems = false;
this._tag.gotoAndStop(_loc2_ ? "diamondRed" : "red");
this._tag.txt.textColor = "0x800000";
}
else
{
this._hasEnoughGems = true;
this._tag.gotoAndStop(_loc2_ ? "diamondGreen" : "green");
this._tag.textColor = "0xFFFFFFFF";
}
}
else
{
this._hasEnoughGems = true;
LocalizationManager.translateId(this._tag.txt,11176);
}
}
if(AvatarUtility.isEndangered(_loc1_.availability))
{
if(this._currType == 13 || this._currType == 16 || this._currType == 26)
{
LocalizationManager.translateId(this._avatarSelect.endangeredSign.txt,11177);
}
else if(this._currType == 6)
{
LocalizationManager.translateId(this._avatarSelect.endangeredSign.txt,14226);
}
else
{
LocalizationManager.translateId(this._avatarSelect.endangeredSign.txt,11178);
}
this._avatarSelect.endangeredSign.visible = true;
}
else
{
this._avatarSelect.endangeredSign.visible = false;
}
if(AvatarUtility.isEndangered(_loc1_.availability) || AvatarUtility.isExtinct(_loc1_.availability))
{
this._nextBtn.activateGrayState(true);
if(this._isFromWorld)
{
this._tag.visible = false;
this._nextBtn.sparkle.visible = false;
}
}
else
{
this._nextBtn.activateGrayState(false);
if(this._isFromWorld)
{
this._nextBtn.sparkle.visible = _loc1_.isDiamond;
this._tag.visible = true;
}
}
}
}
private function winMouseOver(param1:MouseEvent) : void
{
if(param1)
{
param1.stopPropagation();
}
var _loc2_:String = param1.currentTarget.isDiamond ? "diamond_" : "";
if(param1.currentTarget.currWindow.currentFrameLabel == _loc2_ + "down")
{
param1.currentTarget.currWindow.gotoAndStop(_loc2_ + "downMouse");
}
else if(param1.currentTarget.currWindow.currentFrameLabel != _loc2_ + "downMouse")
{
param1.currentTarget.currWindow.gotoAndStop(_loc2_ + "over");
}
param1.currentTarget.setupLayers();
AJAudio.playSubMenuBtnRollover();
}
private function winMouseOut(param1:MouseEvent) : void
{
if(param1)
{
param1.stopPropagation();
}
var _loc2_:String = param1.currentTarget.isDiamond ? "diamond_" : "";
if(param1.currentTarget.currWindow.currentFrameLabel == _loc2_ + "downMouse")
{
param1.currentTarget.currWindow.gotoAndStop(_loc2_ + "down");
}
else if(param1.currentTarget.currWindow.currentFrameLabel != _loc2_ + "down")
{
param1.currentTarget.currWindow.gotoAndStop(_loc2_ + "up");
}
param1.currentTarget.setupLayers();
}
private function stopVOButton(param1:Event) : void
{
if(CreateAccountGui)
{
CreateAccountGui.vo1Sound.stop();
}
this._voBtn.stop();
this._voBtn.gotoAndStop(1);
}
private function voBtnClickHandler(param1:MouseEvent) : void
{
param1.stopPropagation();
if(CreateAccountGui.vo1Sound.isPlaying)
{
CreateAccountGui.vo1Sound.stop();
this._voBtn.stop();
this._voBtn.gotoAndStop(1);
}
else
{
CreateAccountGui.vo1Sound.play();
if(CreateAccountGui.vo1Sound.sc)
{
CreateAccountGui.vo1Sound.sc.addEventListener(Event.SOUND_COMPLETE,this.stopVOButton,false,0,true);
this._voBtn.play();
}
}
}
}
}
@@ -0,0 +1,753 @@
package createAccountGui
{
import avatar.Avatar;
import avatar.AvatarSwitch;
import avatar.AvatarUtility;
import avatar.INewAvatar;
import avatar.NewWorldAvatar;
import com.sbi.analytics.SBTracker;
import com.sbi.debug.DebugUtility;
import com.sbi.popup.SBOkPopup;
import com.sbi.popup.SBScreen;
import com.sbi.popup.SBWizard;
import com.sbi.popup.SBYesNoPopup;
import createAccountFlow.CreateAccountGui;
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.text.TextField;
import gui.DarkenManager;
import gui.GuiCarousel;
import gui.GuiManager;
import gui.PartyManager;
import gui.SwitchManager;
import gui.UpsellManager;
import item.Item;
import localization.LocalizationManager;
public class GuiCreateAName extends SBScreen
{
private static const AVT_NAMES_1:int = 200;
private static const AVT_NAMES_2:int = 202;
private static const AVT_NAMES_3:int = 203;
private var _createANameScreen:MovieClip;
private var _backBtn:MovieClip;
private var _playBtn:MovieClip;
private var _voBtn:MovieClip;
private var _name1Carousel:GuiCarousel;
private var _name2Carousel:GuiCarousel;
private var _name3Carousel:GuiCarousel;
private var _randomNameLever:MovieClip;
private var _avatarNameTxt:TextField;
private var _titleTxt:TextField;
private var _avatarNameIndexes:Array;
private var _avatarNameChosenIds:Array;
private var _avtNames:Array;
private var _newAvatarFacilitator:INewAvatar;
private var _isFromWorld:Boolean;
private var _isChoosingFirstNonMember:Boolean;
private var _isValid:Boolean;
private var _buyBtnGreen:MovieClip;
private var _buyBtnRed:MovieClip;
private var _buyBtnDiamondGreen:MovieClip;
private var _buyBtnDiamondRed:MovieClip;
private var _nextBtn:MovieClip;
private var _registrationPanel:MovieClip;
private var _isRandomSpin:Boolean;
private var _creationAssets:GuiAvatarCreationAssets;
private var _isFastPass:Boolean;
public function GuiCreateAName(param1:Object, param2:SBWizard, param3:Boolean, param4:Boolean = false)
{
this._createANameScreen = param1.registrationPanel.createAName;
this._backBtn = param1.back_btn;
this._playBtn = param1.play_btn;
this._voBtn = this._createANameScreen.vo_btn;
super(this._createANameScreen,param2);
this._creationAssets = GuiAvatarCreationAssets(param2.creationAssets);
this._registrationPanel = MovieClip(this._createANameScreen.parent);
this._name1Carousel = new GuiCarousel(this._createANameScreen.nameScroller1);
this._name2Carousel = new GuiCarousel(this._createANameScreen.nameScroller2);
this._name3Carousel = new GuiCarousel(this._createANameScreen.nameScroller3);
this._randomNameLever = this._createANameScreen.nameLever;
this._randomNameLever.addEventListener(MouseEvent.MOUSE_DOWN,this.randomLeverMouseDownHandler,false,0,true);
this._avatarNameTxt = this._createANameScreen.aml_name_txt;
this._titleTxt = this._createANameScreen.choose_name_title_txt;
this._isFastPass = param4;
if(param3)
{
this._nextBtn = param1.next_btn;
this._buyBtnGreen = param1.buy_btn_green;
this._buyBtnRed = param1.buy_btn_red;
this._buyBtnDiamondGreen = param1.diamond_buy_btn_green;
this._buyBtnDiamondRed = param1.diamond_buy_btn_red;
}
}
public function init(param1:Object, param2:Boolean = false, param3:Boolean = false) : void
{
onEnterFromPrev = this.enterFromPrev;
onEnterFromNext = this.enterFromNext;
onLeaveToPrev = this.leaveToPrev;
onLeaveToNext = this.leaveToNext;
onPlay = param2 ? this.leaveToNext : null;
onClose = this.close;
updateScreen = this.updateScreenAssets;
this._newAvatarFacilitator = param2 ? new NewWorldAvatar() : INewAvatar(param1);
this._avatarNameTxt.restrict = "A-Za-z0-9 ";
this._avatarNameTxt.maxChars = 23;
this._isFromWorld = param2;
this._isFastPass = param3;
if(!this._isFromWorld || this._isFastPass)
{
this._voBtn.stop();
this._voBtn.addEventListener(MouseEvent.CLICK,this.voBtnClickHandler,false,0,true);
}
this._backBtn.visible = false;
this._avatarNameIndexes = [-1,-1,-1];
this._avatarNameChosenIds = [0,0,0];
if(this._avtNames == null)
{
this._avtNames = [-1,-1,-1];
}
if(param2)
{
GenericListXtCommManager.requestGenericList(AVT_NAMES_1,this.onNamesLoaded);
GenericListXtCommManager.requestGenericList(AVT_NAMES_2,this.onNamesLoaded);
GenericListXtCommManager.requestGenericList(AVT_NAMES_3,this.onNamesLoaded);
}
}
override public function destroy() : void
{
this._createANameScreen = null;
this._name1Carousel.destroy();
this._name1Carousel = null;
this._name2Carousel.destroy();
this._name2Carousel = null;
this._name3Carousel.destroy();
this._name3Carousel = null;
this._newAvatarFacilitator = null;
super.destroy();
}
public function enterFromNext(param1:Boolean = false) : void
{
this._isChoosingFirstNonMember = param1;
this._isValid = false;
this._registrationPanel.gotoAndPlay("backChooseAName");
CreateAccountGui.currAvatar().gotoAndPlay("backChooseAName");
MovieClip(this._registrationPanel.parent).bg[CreateAccountGui.currBG() + "Bg"].gotoAndPlay("backChooseAName");
this.enterFromBoth();
}
public function enterFromPrev() : void
{
this._newAvatarFacilitator.hideConnectingMsg();
if(this._isFromWorld)
{
this._nextBtn.visible = false;
if(this._creationAssets.isDiamondAvatar && !AvatarUtility.getAvatarDefIsViewable(this._creationAssets.currAvatar,this._creationAssets.currCustomAvId != -1))
{
this._buyBtnDiamondGreen.visible = this._creationAssets.hasEnoughGems;
this._buyBtnDiamondRed.visible = !this._buyBtnDiamondGreen.visible;
this._buyBtnGreen.visible = this._buyBtnRed.visible = false;
}
else if(this._isFastPass)
{
this._playBtn.visible = true;
this._buyBtnGreen.visible = this._buyBtnRed.visible = this._buyBtnDiamondGreen.visible = this._buyBtnDiamondRed.visible = false;
}
else
{
this._buyBtnGreen.visible = this._creationAssets.hasEnoughGems;
this._buyBtnRed.visible = !this._buyBtnGreen.visible;
this._buyBtnDiamondGreen.visible = this._buyBtnDiamondRed.visible = false;
}
this._backBtn.sparkle.visible = this._creationAssets.isDiamondAvatar;
}
this._backBtn.visible = this._isFromWorld ? !this._creationAssets.isCreatingWithoutChoosing : true;
this._isValid = false;
this.enterFromBoth();
}
public function enterFromBoth() : void
{
if(this._newAvatarFacilitator.playSound || this._isFastPass)
{
if(CreateAccountGui.vo2Sound)
{
CreateAccountGui.vo2Sound.play();
if(CreateAccountGui.vo2Sound.sc)
{
CreateAccountGui.vo2Sound.sc.addEventListener(Event.SOUND_COMPLETE,this.stopVOButton,false,0,true);
this._voBtn.play();
}
}
}
if(this._isFromWorld)
{
SBTracker.trackPageview("/game/play/popup/avatarCreation/CreateAName");
}
else
{
CreateAccountGui.trackUserCreateAccountPageChange("CreateAName");
}
}
public function leaveToNext() : Boolean
{
var _loc1_:int = 0;
var _loc2_:Avatar = null;
var _loc3_:Object = null;
var _loc4_:Object = null;
AJAudio.stopRandomLever();
AJAudio.stopNameGenRotationSound();
if(this._isFastPass)
{
AvatarSwitch.addFastPassAvatarCallback = this.onFastPassComplete;
}
if(!this._isValid)
{
if(this._isFromWorld)
{
if(gMainFrame.clientInfo.roomType == SbiConstants.ROOMTYPE_PARTY)
{
_loc2_ = new Avatar();
_loc2_.init(0,"",this._creationAssets.currType,[]);
if(!PartyManager.canSwitchToAvatar(_loc2_,true))
{
_loc2_.destroy();
_loc2_ = null;
return false;
}
}
if(AvatarSwitch.numTotalAvatars >= SwitchManager.NUM_AVATAR_SLOTS)
{
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14690),true,this.onSlotsFullOk);
return true;
}
if(this._creationAssets.isCreatingWithoutChoosing || this._creationAssets.isDiamondAvatar)
{
if(!gMainFrame.userInfo.isMember)
{
_loc3_ = AvatarUtility.findAvDefByType(this._creationAssets.currType,this._creationAssets.currCustomAvId);
if(_loc3_.isMemberOnly)
{
UpsellManager.displayPopup(UpsellManager.ANIMALS,"createMembersOnlyAvatar");
return false;
}
}
}
if(this._creationAssets.isCreatingWithoutChoosing || this._creationAssets.isDiamondAvatar)
{
if(AvatarUtility.getAvatarDefIsViewable(this._creationAssets.currAvatar,this._creationAssets.currCustomAvId != -1))
{
_loc4_ = AvatarUtility.findAvDefByType(this._creationAssets.currType,this._creationAssets.currCustomAvId);
new SBYesNoPopup(this._registrationPanel.parent.parent.parent,LocalizationManager.translateIdAndInsertOnly(14782,this._creationAssets.currAvatarName,_loc4_.cost),true,this.onDiamondShopConfirmBuy,this._creationAssets.avatarDiamondDefId);
return false;
}
}
if(!this._isChoosingFirstNonMember && !this._creationAssets.hasEnoughGems)
{
DarkenManager.showLoadingSpiral(true);
if(this._creationAssets.isCreatingWithoutChoosing || this._creationAssets.isDiamondAvatar)
{
this.onCloseNotEnoughGems();
}
else
{
Utility.setupNotEnoughGemsPopup(this._creationAssets.parent,this._creationAssets.currAvatarCost,this._creationAssets.currencyType);
}
return false;
}
if(this._creationAssets.isCreatingWithoutChoosing || this._creationAssets.isDiamondAvatar)
{
GuiManager.showDiamondConfirmation(this._creationAssets.currAvatarCost,this.onDiamondApprovePurchase);
return false;
}
}
_loc1_ = this._isFromWorld ? this._creationAssets.currType : CreateAccountGui.currType();
this._newAvatarFacilitator.newAvatarData(_loc1_,this._avatarNameTxt.text,this._avatarNameChosenIds,this.avNameValidCallback,this._creationAssets.avatarDiamondDefId,this._creationAssets.currCustomAvId,this._isFastPass);
}
if(this._isValid)
{
if(CreateAccountGui.vo2Sound)
{
CreateAccountGui.vo2Sound.stop();
}
this._voBtn.stop();
this._voBtn.gotoAndStop(1);
if(!this._isFromWorld)
{
this._registrationPanel.gotoAndPlay("playPlayerAccountOne");
CreateAccountGui.currAvatar().gotoAndPlay("playPlayerAccountOne");
MovieClip(this._registrationPanel.parent).bg[CreateAccountGui.currBG() + "Bg"].gotoAndPlay("playPlayerAccountOne");
}
return true;
}
return false;
}
public function leaveToBoth() : Boolean
{
return true;
}
public function leaveToPrev() : Boolean
{
this._backBtn.visible = false;
if(!this._isFromWorld || this._isFastPass)
{
if(CreateAccountGui.vo2Sound)
{
CreateAccountGui.vo2Sound.stop();
}
this._voBtn.stop();
this._voBtn.gotoAndStop(1);
}
return true;
}
public function loadNameLists() : void
{
GenericListXtCommManager.requestGenericList(AVT_NAMES_1,this.onNamesLoaded,null,this._isFromWorld);
GenericListXtCommManager.requestGenericList(AVT_NAMES_2,this.onNamesLoaded,null,this._isFromWorld);
GenericListXtCommManager.requestGenericList(AVT_NAMES_3,this.onNamesLoaded,null,this._isFromWorld);
}
public function close() : void
{
AvatarSwitch.addAvatarCallback = null;
AvatarSwitch.addFastPassAvatarCallback = null;
this._newAvatarFacilitator.nameTypeScreenDone();
}
public function updateScreenAssets(param1:Boolean = false) : void
{
this._createANameScreen = this._registrationPanel.createAName;
this._avatarNameTxt = this._createANameScreen.aml_name_txt;
if(Boolean(this._name1Carousel) && this._name1Carousel.hasLoaded)
{
this._name1Carousel.destroy();
this._name1Carousel = null;
}
this._name1Carousel = new GuiCarousel(this._createANameScreen.nameScroller1);
if(Boolean(this._name2Carousel) && this._name1Carousel.hasLoaded)
{
this._name2Carousel.destroy();
this._name2Carousel = null;
}
this._name2Carousel = new GuiCarousel(this._createANameScreen.nameScroller2);
if(Boolean(this._name3Carousel) && this._name1Carousel.hasLoaded)
{
this._name3Carousel.destroy();
this._name3Carousel = null;
}
this._name3Carousel = new GuiCarousel(this._createANameScreen.nameScroller3);
if(this._avtNames[0] != -1)
{
this.setupNameLists(this._avtNames[0].names,this._avtNames[1].names,this._avtNames[2].names);
}
if(param1 || (this._isFromWorld ? Boolean(this._creationAssets.isCreatingWithoutChoosing) : Boolean(false)))
{
this._backBtn = MovieClip(this._registrationPanel.parent).back_btn;
this._playBtn = MovieClip(this._registrationPanel.parent).play_btn;
this._randomNameLever = this._createANameScreen.nameLever;
this._randomNameLever.addEventListener(MouseEvent.MOUSE_DOWN,this.randomLeverMouseDownHandler,false,0,true);
this._titleTxt = this._createANameScreen.choose_name_title_txt;
this._voBtn = this._createANameScreen.vo_btn;
if(this._isFromWorld)
{
this._nextBtn = MovieClip(this._registrationPanel.parent).next_btn;
this._buyBtnGreen = MovieClip(this._registrationPanel.parent).buy_btn_green;
this._buyBtnRed = MovieClip(this._registrationPanel.parent).buy_btn_red;
this._buyBtnDiamondGreen = MovieClip(this._registrationPanel.parent).diamond_buy_btn_green;
this._buyBtnDiamondRed = MovieClip(this._registrationPanel.parent).diamond_buy_btn_red;
if(!this._isFastPass)
{
this._voBtn.visible = false;
}
if(this._creationAssets.isDiamondAvatar && !AvatarUtility.getAvatarDefIsViewable(this._creationAssets.currAvatar,this._creationAssets.currCustomAvId != -1))
{
this._buyBtnDiamondGreen.visible = this._creationAssets.hasEnoughGems;
this._buyBtnDiamondRed.visible = !this._buyBtnDiamondGreen.visible;
this._buyBtnGreen.visible = this._buyBtnRed.visible = false;
}
else if(this._isFastPass)
{
this._playBtn.visible = true;
this._buyBtnGreen.visible = this._buyBtnRed.visible = this._buyBtnDiamondGreen.visible = this._buyBtnDiamondRed.visible = false;
}
else
{
this._buyBtnGreen.visible = this._creationAssets.hasEnoughGems;
this._buyBtnRed.visible = !this._buyBtnGreen.visible;
this._buyBtnDiamondGreen.visible = this._buyBtnDiamondRed.visible = false;
}
this._backBtn.sparkle.visible = this._creationAssets.isDiamondAvatar;
}
if(!this._isFromWorld || this._isFastPass)
{
this._voBtn.addEventListener(MouseEvent.CLICK,this.voBtnClickHandler,false,0,true);
if(CreateAccountGui.vo2Sound.sc)
{
this._voBtn.play();
}
}
this._backBtn.visible = this._isFromWorld ? !this._creationAssets.isCreatingWithoutChoosing : true;
}
}
private function onNamesLoaded(param1:int, param2:Array) : void
{
var _loc5_:Array = null;
var _loc6_:String = null;
var _loc7_:int = 0;
var _loc8_:int = 0;
var _loc3_:Object = [];
var _loc4_:int = -1;
switch(param1)
{
case AVT_NAMES_1:
_loc4_ = 0;
_loc3_ = {
"names":[],
"locIds":[]
};
break;
case AVT_NAMES_2:
if(LocalizationManager.isCurrLanguageReversed())
{
_loc3_ = {
"names":[],
"femNames":[],
"locIds":[]
};
_loc4_ = 2;
}
else
{
_loc3_ = {
"names":[],
"types":[],
"locIds":[]
};
_loc4_ = 1;
}
break;
case AVT_NAMES_3:
if(LocalizationManager.isCurrLanguageReversed())
{
_loc3_ = {
"names":[],
"types":[],
"locIds":[]
};
_loc4_ = 1;
}
else
{
_loc3_ = {
"names":[],
"femNames":[],
"locIds":[]
};
_loc4_ = 2;
}
}
if(_loc4_ != -1)
{
_loc8_ = 0;
while(_loc8_ < param2.length)
{
if(_loc4_ == 1)
{
_loc5_ = LocalizationManager.translateIdOnly(param2[_loc8_]).split("$");
_loc6_ = _loc5_[0];
_loc7_ = Utility.findIndexToInsert(_loc3_.names,_loc6_);
_loc3_.names.splice(_loc7_,0,_loc6_);
if(_loc5_[1])
{
_loc3_.types.splice(_loc7_,0,_loc5_[1]);
}
else
{
_loc3_.types.splice(_loc7_,0,"m");
}
}
else if(_loc4_ == 2)
{
_loc5_ = LocalizationManager.translateIdOnly(param2[_loc8_]).split("$");
_loc6_ = _loc5_[0].toLowerCase();
_loc7_ = Utility.findIndexToInsert(_loc3_.names,_loc6_);
_loc3_.names.splice(_loc7_,0,_loc6_);
if(_loc5_[1])
{
_loc3_.femNames.splice(_loc7_,0,_loc5_[1].toLowerCase());
}
else
{
_loc3_.femNames.splice(_loc7_,0,_loc6_);
}
}
else
{
_loc6_ = LocalizationManager.translateIdOnly(param2[_loc8_]);
_loc7_ = Utility.findIndexToInsert(_loc3_.names,_loc6_);
_loc3_.names.splice(_loc7_,0,_loc6_);
}
_loc3_.locIds.splice(_loc7_,0,param2[_loc8_]);
_loc8_++;
}
this._avtNames[_loc4_] = _loc3_;
}
if(this._avtNames[0] != -1 && this._avtNames[1] != -1 && this._avtNames[2] != -1)
{
this.setupNameLists(this._avtNames[0].names,this._avtNames[1].names,this._avtNames[2].names);
}
}
private function onCloseNotEnoughGems() : void
{
UpsellManager.displayPopup(UpsellManager.EXTRA_DIAMONDS_AS_MEMBER,"extraDiamonds");
}
private function onDiamondApprovePurchase() : void
{
var _loc1_:int = this._isFromWorld ? this._creationAssets.currType : CreateAccountGui.currType();
this._newAvatarFacilitator.newAvatarData(_loc1_,this._avatarNameTxt.text,this._avatarNameChosenIds,this.avNameValidCallback,this._creationAssets.avatarDiamondDefId);
}
private function onSlotsFullOk(param1:MouseEvent) : void
{
param1.stopPropagation();
SBOkPopup.destroyInParentChain(param1.target.parent);
this.close();
}
private function onDiamondShopConfirmBuy(param1:Object) : void
{
var _loc2_:Object = null;
var _loc3_:int = 0;
var _loc4_:int = 0;
if(param1.status)
{
_loc2_ = AvatarUtility.findAvDefByType(this._creationAssets.currType,this._creationAssets.currCustomAvId);
_loc3_ = int(gMainFrame.clientInfo.gemCount);
if(_loc3_ < _loc2_.diamondCost)
{
DarkenManager.showLoadingSpiral(true);
Utility.setupNotEnoughGemsPopup(this._creationAssets.parent,_loc2_.diamondCost,Item.GEM_CURRENCY);
}
else
{
_loc4_ = this._creationAssets.currType;
this._newAvatarFacilitator.newAvatarData(_loc4_,this._avatarNameTxt.text,this._avatarNameChosenIds,this.avNameValidCallback,param1.passback);
}
}
else
{
this.close();
}
}
private function avNameValidCallback(param1:Boolean) : void
{
if(param1)
{
this._isValid = true;
if(super.parentWizard != null)
{
super.parentWizard.next();
}
this._newAvatarFacilitator.nameTypeScreenDone();
}
else
{
DebugUtility.debugTrace("ERROR: Invalid avname?!");
}
}
private function onFastPassComplete(param1:Boolean) : void
{
if(param1)
{
this.avNameValidCallback(true);
}
else
{
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(11233));
}
}
private function setupNameLists(param1:Array, param2:Array, param3:Array) : void
{
this._name1Carousel.init(param1,this.names1Changed,false,false,null,false,this._avatarNameIndexes[0]);
this._name2Carousel.init(param2,this.names2Changed,false,false,null,false,this._avatarNameIndexes[1]);
this._name3Carousel.init(param3,this.names3Changed,false,false,null,false,this._avatarNameIndexes[2]);
if(this._avatarNameIndexes[0] == -1)
{
this.randomizeNames();
}
}
private function randomizeNames() : void
{
this._name1Carousel.soundsEnabled = false;
this._name2Carousel.soundsEnabled = false;
this._name3Carousel.soundsEnabled = false;
this._name1Carousel.pickRandomItem(true);
this._name2Carousel.pickRandomItem(true);
this._name3Carousel.pickRandomItem(true);
this._name1Carousel.soundsEnabled = true;
this._name2Carousel.soundsEnabled = true;
this._name3Carousel.soundsEnabled = true;
}
private function names1Changed() : void
{
if(Boolean(this._name1Carousel.selectedContentItem) && Boolean(this._name2Carousel.selectedContentItem) && Boolean(this._name3Carousel.selectedContentItem))
{
LocalizationManager.updateToFit(this._avatarNameTxt,this._name1Carousel.selectedContentItem + " " + this._name2Carousel.selectedContentItem + this._name3Carousel.selectedContentItem);
this._avatarNameChosenIds[0] = this._avtNames[0].locIds[this._name1Carousel.contentItemIndex];
this._avatarNameIndexes[0] = this._name1Carousel.contentItemIndex;
}
}
private function names2Changed() : void
{
if(Boolean(this._name1Carousel.selectedContentItem) && Boolean(this._name2Carousel.selectedContentItem) && Boolean(this._name3Carousel.selectedContentItem))
{
LocalizationManager.updateToFit(this._avatarNameTxt,this._name1Carousel.selectedContentItem + " " + this._name2Carousel.selectedContentItem + this._name3Carousel.selectedContentItem);
this._avatarNameChosenIds[1] = this._avtNames[1].locIds[this._name2Carousel.contentItemIndex];
this._avatarNameIndexes[1] = this._name2Carousel.contentItemIndex;
}
if(!this._name2Carousel.soundsEnabled && this._isRandomSpin)
{
this._name2Carousel.soundsEnabled = true;
this._name3Carousel.soundsEnabled = true;
this._isRandomSpin = false;
}
if(Boolean(this._avtNames[2]) && this._name3Carousel.hasLoaded)
{
if(this._avtNames[1].types[this._name2Carousel.contentItemIndex] != "f")
{
if(this._name3Carousel.contentItems != this._avtNames[2].names)
{
this._name3Carousel.contentItems = this._avtNames[2].names;
}
}
else if(Boolean(this._avtNames[2].femNames) && Boolean(this._avtNames[2].femNames[0]) && this._name3Carousel.contentItems != this._avtNames[2].femNames)
{
this._name3Carousel.contentItems = this._avtNames[2].femNames;
}
if(this._name3Carousel.soundsEnabled)
{
this._name3Carousel.soundsEnabled = false;
this._name3Carousel.spinToIndex(this._name3Carousel.contentItemIndex,true);
this._name3Carousel.soundsEnabled = true;
}
else
{
this._name3Carousel.spinToIndex(this._name3Carousel.contentItemIndex,true);
}
}
}
private function names3Changed() : void
{
if(Boolean(this._name1Carousel.selectedContentItem) && Boolean(this._name2Carousel.selectedContentItem) && Boolean(this._name3Carousel.selectedContentItem))
{
LocalizationManager.updateToFit(this._avatarNameTxt,this._name1Carousel.selectedContentItem + " " + this._name2Carousel.selectedContentItem + this._name3Carousel.selectedContentItem);
this._avatarNameChosenIds[2] = this._avtNames[2].locIds[this._name3Carousel.contentItemIndex];
this._avatarNameIndexes[2] = this._name3Carousel.contentItemIndex;
}
if(!this._name3Carousel.soundsEnabled && this._isRandomSpin)
{
this._name3Carousel.soundsEnabled = true;
this._name2Carousel.soundsEnabled = true;
this._isRandomSpin = false;
}
}
private function randomLeverMouseDownHandler(param1:MouseEvent) : void
{
if(this._randomNameLever.currentFrameLabel == "_up")
{
this._isRandomSpin = true;
this._name2Carousel.soundsEnabled = false;
this._name3Carousel.soundsEnabled = false;
AJAudio.playRandomLever();
this._randomNameLever.gotoAndPlay("_play");
this._name1Carousel.pickRandomItem();
this._name2Carousel.pickRandomItem();
this._name3Carousel.pickRandomItem();
}
}
private function stopVOButton(param1:Event) : void
{
CreateAccountGui.vo2Sound.stop();
this._voBtn.stop();
this._voBtn.gotoAndStop(1);
}
private function enableNext() : void
{
}
private function tipsNeedTxtClickHandler(param1:MouseEvent) : void
{
}
private function voBtnClickHandler(param1:MouseEvent) : void
{
if(CreateAccountGui.vo2Sound.isPlaying)
{
CreateAccountGui.vo2Sound.stop();
this._voBtn.stop();
this._voBtn.gotoAndStop(1);
}
else
{
CreateAccountGui.vo2Sound.play();
if(CreateAccountGui.vo2Sound.sc)
{
CreateAccountGui.vo2Sound.sc.addEventListener(Event.SOUND_COMPLETE,this.stopVOButton,false,0,true);
this._voBtn.play();
}
}
}
}
}
@@ -0,0 +1,76 @@
package createAccountGui
{
import com.sbi.popup.SBWizard;
import flash.display.MovieClip;
public class GuiCreateWizard extends SBWizard
{
public const SCREENS_LENGTH:int = 2;
public var playerTagScreen:GuiPlayerTagScreen;
public var emailScreen:GuiEmailScreen;
public var viewAssets:Object;
public var chooseAnimalScreen:GuiChooseAnimal;
public var createANameScreen:GuiCreateAName;
public var createAccountIlAvatar:Object;
public function GuiCreateWizard(param1:Object, param2:Object)
{
super();
this.viewAssets = param1;
this.createAccountIlAvatar = param2;
}
override public function init(param1:MovieClip, param2:Object, param3:Boolean = true, param4:int = 1, param5:Array = null, param6:Boolean = true, param7:Boolean = false, param8:Boolean = true, param9:Boolean = false) : void
{
var _loc10_:Array = null;
creationAssets = param2;
this.chooseAnimalScreen = new GuiChooseAnimal(this.viewAssets,this,param8,param9);
if(param8)
{
this.chooseAnimalScreen.init();
}
this.createANameScreen = new GuiCreateAName(this.viewAssets,this,param8,param9);
this.createANameScreen.init(param8 ? this.viewAssets : this.createAccountIlAvatar,param8,param9);
if(param8)
{
_loc10_ = new Array(this.chooseAnimalScreen,this.createANameScreen);
}
else
{
this.playerTagScreen = new GuiPlayerTagScreen(param8 ? this.viewAssets : this.createAccountIlAvatar,this);
this.playerTagScreen.init();
this.emailScreen = new GuiEmailScreen(param8 ? this.viewAssets : this.createAccountIlAvatar,this);
this.emailScreen.init();
_loc10_ = new Array(this.chooseAnimalScreen,this.createANameScreen,this.playerTagScreen,this.emailScreen);
}
super.init(param1,param2,param3,param4,_loc10_,param6,param7,param8);
}
override public function destroy() : void
{
this.chooseAnimalScreen.destroy();
this.chooseAnimalScreen = null;
this.createANameScreen.destroy();
this.createANameScreen = null;
if(this.playerTagScreen)
{
this.playerTagScreen.destroy();
this.playerTagScreen = null;
}
if(this.emailScreen)
{
this.emailScreen.destroy();
this.emailScreen = null;
}
super.destroy();
}
}
}
@@ -0,0 +1,663 @@
package createAccountGui
{
import com.sbi.corelib.Utils;
import com.sbi.corelib.audio.SBSound;
import com.sbi.popup.SBScreen;
import com.sbi.popup.SBWizard;
import createAccountFlow.CreateAccountGui;
import createAccountFlow.CreateAccountXtCommManager;
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.FocusEvent;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.events.TimerEvent;
import flash.text.TextField;
import flash.utils.Timer;
import gui.DarkenManager;
import gui.GuiCheckBox;
import gui.GuiStatusIcon;
import gui.PollManager;
public class GuiEmailScreen extends SBScreen
{
public static const MAX_EMAIL_LENGTH:int = 50;
private static const SURVEY_POLL_DEF_ID:int = 30;
private var _emailTxt:TextField;
private var _confirmTxt:TextField;
private var _emailBar:MovieClip;
private var _confirmBar:MovieClip;
private var _emailSts:MovieClip;
private var _confirmSts:MovieClip;
private var _voBtn:MovieClip;
private var _login:Object;
private const _commonDomains:Array = ["yahoo.com","hotmail.com","gmail.com","comcast.net","sbcglobal.net","att.net","msn.com","microsoft.com","aim.com","charter.net","aol.com","cox.net","live.com","live.ca","verizon.net","xtra.co.nz","shaw.ca","bellsouth.net","roadrunner.com","hotmail.co.uk","yahoo.co.uk","optonline.net","centurylink.net","centurytel.net","mail.com","mac.com","google.com","googlemail.com","compuserve.com","myspace.com","facebook.com","youtube.com","netscape.net","emailaccount.com","earthlink.net","rocketmail.com","broadband.com","ymail.com","supermail.com","junkmail.com","mindspring.com","juno.com","prodigy.net","excite.com","frontiernet.net","frontier.com","frontiernet.net","epix.net","love.com","hellokitty.com","sky.com","pacbell.net","champmail.com","heartmail.com","dragon.com","computer.org","digis.net","yahoo.ca","hotmail.ca","googlemail.co.uk","msn.ca","msn.co.uk","microsoft.co.uk","microsoft.ca","aol.co.uk","live.co.uk","compuserve.co.uk","netscape.ca"];
private const _emailRegExOLD:RegExp = new RegExp(/\A([^;:,\(\)\[\]@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i);
private const _emailRegEx:RegExp = new RegExp(/^[\w\-\.]+@([a-zA-Z0-9]+[\.{1}])+[a-zA-Z]{2,}$/i);
private var _validationPending:Boolean;
private var _continueClicked:Boolean;
private var _validatedEmail:String;
private var _lastCheckedEmail:String;
private var _validatedConfirmEmail:String;
private var _prevConfirmTxt:String;
private var _emailScreen:MovieClip;
private var _playBtn:MovieClip;
private var _nextBtn:MovieClip;
private var _registrationPanel:MovieClip;
private var _emailText:String;
private var _confirmText:String;
private var _emailStsTracking:Object;
private var _confirmStsTracking:Object;
private var _emailKeyUpDelayTimer:Timer;
private var _domainConfirmed:Boolean;
private var _checkBox:GuiCheckBox;
private var _isCheckBoxChecked:Boolean;
private var _isLeavingToPrev:Boolean;
private var _currVo:SBSound;
public function GuiEmailScreen(param1:Object, param2:SBWizard)
{
this._login = param1;
this._emailScreen = this._login.accountCreation.registrationPanel.email_popup;
this._registrationPanel = MovieClip(this._emailScreen.parent);
super(this._emailScreen,param2);
this._emailTxt = this._emailScreen.emailTxtCont.email_txt;
this._emailTxt.maxChars = MAX_EMAIL_LENGTH;
this._confirmTxt = this._emailScreen.confirmTxtCont.confirm_txt;
this._confirmTxt.maxChars = MAX_EMAIL_LENGTH;
this._emailBar = this._emailScreen.textBarNew;
this._confirmBar = this._emailScreen.confirmTextBar;
this._emailSts = this._emailScreen.emailTxtCont.email_status;
this._confirmSts = this._emailScreen.confirmTxtCont.confirm_status;
this._emailStsTracking = {
"xTracking":false,
"waitTracking":false,
"checkTracking":false
};
this._confirmStsTracking = {
"xTracking":false,
"waitTracking":false,
"checkTracking":false
};
this._checkBox = new GuiCheckBox(this._emailScreen.rulesFrame.agree_box,this.onAgreeChecked);
GuiStatusIcon.initClipOff(this._emailSts,this._emailStsTracking);
GuiStatusIcon.initClipOff(this._confirmSts,this._confirmStsTracking);
this._voBtn = this._emailScreen.vo_btn;
this._playBtn = this._login.accountCreation.play_btn;
this._nextBtn = this._login.accountCreation.next_btn;
this._nextBtn.gotoAndStop(1);
this._isLeavingToPrev = false;
}
public function init() : void
{
onEnterFromPrev = this.enterFromPrev;
onEnterFromNext = this.enterFromNext;
onLeaveToPrev = this.leaveToPrev;
onLeaveToNext = this.leaveToNext;
onPlay = this.onPlayBtn;
updateScreen = this.updateScreenAssets;
this._validationPending = false;
this._continueClicked = false;
this._prevConfirmTxt = "";
this._emailText = "";
this._confirmText = "";
this._emailTxt.addEventListener(KeyboardEvent.KEY_UP,this.emailKeyUpHandler,false,0,true);
this._emailTxt.addEventListener(FocusEvent.FOCUS_OUT,this.onEmailTxtLoseFocus,false,0,true);
this._confirmTxt.addEventListener(KeyboardEvent.KEY_UP,this.confirmKeyUpHandler,false,0,true);
this._emailKeyUpDelayTimer = new Timer(1222);
this._emailKeyUpDelayTimer.addEventListener(TimerEvent.TIMER,this.emailTxtChangeDelayTimerHandler,false,0,true);
this._voBtn.stop();
this._voBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.voBtnClickHandler,false,0,true);
}
override public function destroy() : void
{
this._voBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.voBtnClickHandler);
this._emailKeyUpDelayTimer.stop();
this._emailKeyUpDelayTimer = null;
super.destroy();
}
public function onPlayBtn() : void
{
DarkenManager.showLoadingSpiral(true);
CreateAccountGui.vo5Sound.stop();
this._voBtn.stop();
this._voBtn.gotoAndStop(1);
this._login.createNewAccountSetup(CreateAccountGui.currEmailAddress(),CreateAccountGui.emailValidationCallback());
}
public function enterFromNext() : void
{
this._isLeavingToPrev = false;
if(Boolean(this._emailSts["_check"].visible) && Boolean(this._confirmSts["_check"].visible) && this._isCheckBoxChecked)
{
this._playBtn.visible = true;
}
else
{
this._playBtn.visible = false;
}
CreateAccountGui.trackUserCreateAccountPageChange("ParentEmail");
this._currVo = CreateAccountGui.vo4Sound;
this._currVo.play();
if(this._currVo.sc)
{
this._currVo.sc.addEventListener(Event.SOUND_COMPLETE,this.stopVO,false,0,true);
this._voBtn.play();
}
this._nextBtn.visible = false;
CreateAccountGui.hideNotifyPopup();
this._emailKeyUpDelayTimer.reset();
this._emailKeyUpDelayTimer.start();
}
public function enterFromPrev() : void
{
this.enterFromNext();
MovieClip(this._emailScreen.parent).gotoAndPlay("playPlayerAccountTwo");
CreateAccountGui.currAvatar().gotoAndPlay("playPlayerAccountTwo");
MovieClip(this._emailScreen.parent.parent).bg[CreateAccountGui.currBG() + "Bg"].gotoAndPlay("playPlayerAccountTwo");
}
public function enterFromBoth() : void
{
}
public function leaveToPrev() : Boolean
{
this._isLeavingToPrev = true;
this._nextBtn.visible = true;
this._playBtn.visible = false;
this._currVo.stop();
this._voBtn.stop();
MovieClip(this._emailScreen.parent).gotoAndPlay("backAccountOne");
CreateAccountGui.currAvatar().gotoAndPlay("backAccountOne");
MovieClip(this._emailScreen.parent.parent).bg[CreateAccountGui.currBG() + "Bg"].gotoAndPlay("backAccountOne");
return true;
}
public function leaveToNext() : Boolean
{
this._currVo.stop();
this._voBtn.stop();
this._voBtn.gotoAndStop(1);
CreateAccountGui.hideNotifyPopup();
return this.nextBtnHandler();
}
public function updateScreenAssets(param1:Boolean = false) : void
{
this._emailScreen = this._registrationPanel.email_popup;
this._emailTxt = this._emailScreen.emailTxtCont.email_txt;
this._emailTxt.maxChars = MAX_EMAIL_LENGTH;
this._emailTxt.text = this._emailText;
this._confirmTxt = this._emailScreen.confirmTxtCont.confirm_txt;
this._confirmTxt.maxChars = MAX_EMAIL_LENGTH;
this._confirmTxt.text = this._confirmText;
this._emailBar = this._emailScreen.textBarNew;
this._confirmBar = this._emailScreen.confirmTextBar;
this._emailSts = this._emailScreen.emailTxtCont.email_status;
this._confirmSts = this._emailScreen.confirmTxtCont.confirm_status;
this._checkBox = new GuiCheckBox(this._emailScreen.rulesFrame.agree_box,this.onAgreeChecked);
this._checkBox.init(this._emailScreen.rulesFrame.agree_txt);
this._checkBox.checked = this._isCheckBoxChecked;
GuiStatusIcon.setVisBasedOnTrackers(this._emailSts,this._emailStsTracking);
GuiStatusIcon.setVisBasedOnTrackers(this._confirmSts,this._confirmStsTracking);
this._voBtn = this._emailScreen.vo_btn;
this._playBtn = this._login.accountCreation.play_btn;
this._nextBtn = this._login.accountCreation.next_btn;
this._nextBtn.gotoAndStop(1);
if(param1)
{
this._emailTxt.addEventListener(KeyboardEvent.KEY_UP,this.emailKeyUpHandler,false,0,true);
this._emailTxt.addEventListener(FocusEvent.FOCUS_OUT,this.onEmailTxtLoseFocus,false,0,true);
this._confirmTxt.addEventListener(KeyboardEvent.KEY_UP,this.confirmKeyUpHandler,false,0,true);
if(this._currVo.sc)
{
this._voBtn.play();
}
else
{
this._voBtn.stop();
}
this._voBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.voBtnClickHandler,false,0,true);
if(!this._isLeavingToPrev)
{
if(Boolean(this._emailSts["_check"].visible) && Boolean(this._confirmSts["_check"].visible) && this._isCheckBoxChecked)
{
this._playBtn.visible = true;
}
else
{
this._playBtn.visible = false;
}
}
}
else
{
this._playBtn.visible = false;
}
}
public function get currEmail() : String
{
return this._emailTxt.text;
}
public function stopVO(param1:Event) : void
{
if(this._currVo)
{
this._currVo.stop();
}
this._voBtn.stop();
this._voBtn.gotoAndStop(1);
}
public function emailValidCallback(param1:Boolean, param2:Boolean, param3:Boolean = false) : void
{
DarkenManager.showLoadingSpiral(false);
this._validationPending = false;
this._emailSts.visible = true;
this._domainConfirmed = false;
if(param2)
{
this._validatedEmail = null;
GuiStatusIcon.showX(this._emailSts,this._emailStsTracking);
this.resetVoBackToSound4();
this._playBtn.visible = false;
if(this._emailTxt.text == "")
{
GuiStatusIcon.initClipOff(this._emailSts,this._emailStsTracking);
this._emailBar.visible = true;
}
else
{
this._emailBar.visible = false;
}
if(!param3)
{
this._emailKeyUpDelayTimer.reset();
this._emailKeyUpDelayTimer.start();
}
else
{
this._emailKeyUpDelayTimer.reset();
}
}
else if(!param1)
{
if(param3)
{
GuiStatusIcon.showCheck(this._emailSts,this._emailStsTracking);
if(this._emailTxt.text == this._confirmTxt.text)
{
this.confirmValidCallback(false);
}
if(Boolean(this._confirmSts["_check"].visible) && this._isCheckBoxChecked)
{
this._playBtn.visible = true;
}
this._validatedEmail = this._emailTxt.text;
this._emailKeyUpDelayTimer.reset();
this._domainConfirmed = true;
}
else
{
this._emailKeyUpDelayTimer.reset();
this._emailKeyUpDelayTimer.start();
GuiStatusIcon.showWait(this._emailSts,this._emailStsTracking);
}
this._emailBar.visible = true;
if(!param1 && this._emailScreen.currentFrameLabel == "default")
{
this._emailScreen.gotoAndStop("confirm");
}
}
this._continueClicked = false;
}
public function confirmValidCallback(param1:Boolean) : void
{
this._confirmSts.visible = true;
if(param1)
{
this._validatedConfirmEmail = null;
GuiStatusIcon.showX(this._confirmSts,this._confirmStsTracking);
this.resetVoBackToSound4();
this._playBtn.visible = false;
if(this._confirmTxt.text == "")
{
GuiStatusIcon.initClipOff(this._confirmSts,this._confirmStsTracking);
this._confirmBar.visible = true;
}
else
{
this._confirmBar.visible = false;
}
}
else if(this._emailSts["_check"].visible)
{
GuiStatusIcon.showCheck(this._confirmSts,this._confirmStsTracking);
if(this._isCheckBoxChecked)
{
this._playBtn.visible = true;
}
this._confirmBar.visible = true;
this._validatedConfirmEmail = this._confirmTxt.text;
if(this._emailScreen.currentFrameLabel != "rules")
{
if(gMainFrame.clientInfo.sessionId % gMainFrame.clientInfo.sbTrackerModulator == 0)
{
this.showSurveyPopup();
return;
}
this._emailScreen.gotoAndPlay("playRules");
}
if(this._continueClicked && this._isCheckBoxChecked)
{
this.nextBtnHandler();
}
else if(!this._isCheckBoxChecked)
{
this.setupRulesVo();
}
}
this._continueClicked = false;
}
private function setupRulesVo() : void
{
if(this._currVo)
{
this._currVo.stop();
}
this._voBtn.stop();
this._voBtn.gotoAndStop(1);
if(CreateAccountGui)
{
this._currVo = CreateAccountGui.vo5Sound;
this._currVo.play();
if(this._currVo.sc)
{
this._currVo.sc.addEventListener(Event.SOUND_COMPLETE,this.stopVO,false,0,true);
this._voBtn.play();
}
}
}
private function showSurveyPopup() : void
{
PollManager.setupNonTabPoll(SURVEY_POLL_DEF_ID,this.onSurveyClose);
}
private function onSurveyClose() : void
{
if(this._emailScreen.currentFrameLabel != "rules")
{
this._emailScreen.gotoAndPlay("playRules");
}
this.setupRulesVo();
}
private function onAgreeChecked() : void
{
this._isCheckBoxChecked = this._checkBox.checked;
if(Boolean(this._isCheckBoxChecked) && Boolean(this._emailSts["_check"].visible) && Boolean(this._confirmSts["_check"].visible))
{
this._playBtn.visible = true;
}
else
{
this._playBtn.visible = false;
}
}
private function emailMarkEmptyAsError() : void
{
if(this._emailTxt.text == "")
{
GuiStatusIcon.showX(this._emailSts,this._emailStsTracking);
this.resetVoBackToSound4();
this._emailSts.visible = true;
this._emailBar.visible = false;
}
}
private function confirmMarkEmptyAsError() : void
{
if(this._confirmTxt.text == "")
{
GuiStatusIcon.showX(this._confirmSts,this._confirmStsTracking);
this.resetVoBackToSound4();
this._confirmSts.visible = true;
this._confirmBar.visible = false;
}
}
private function resetVoBackToSound4() : void
{
if(this._currVo)
{
if(this._currVo != CreateAccountGui.vo4Sound)
{
this._currVo.stop();
this._voBtn.stop();
this._voBtn.gotoAndStop(1);
this._currVo = CreateAccountGui.vo4Sound;
}
}
}
private function emailKeyUpHandler(param1:KeyboardEvent) : void
{
var _loc2_:Array = null;
var _loc3_:Boolean = false;
this._emailText = this._emailTxt.text;
if(this._emailTxt.text == "")
{
GuiStatusIcon.initClipOff(this._emailSts,this._emailStsTracking);
this._emailBar.visible = true;
this._lastCheckedEmail = this._emailTxt.text;
this._validatedEmail = null;
return;
}
if(this._emailTxt.text != this._lastCheckedEmail)
{
this._validationPending = true;
this._lastCheckedEmail = this._emailTxt.text;
_loc2_ = this._emailTxt.text.split("@");
if(_loc2_.length > 1 && _loc2_[0].toLowerCase() == this._login.validatedUserName.toLowerCase())
{
parentWizard.prev();
return;
}
_loc3_ = Boolean(!this._emailRegEx["exec"](this._emailTxt.text) || this._emailTxt.text.length > MAX_EMAIL_LENGTH);
this.emailValidCallback(_loc3_,_loc3_);
if(this._confirmTxt.text != "")
{
this.confirmKeyUpHandler(null);
}
}
}
private function emailTxtChangeDelayTimerHandler(param1:TimerEvent) : void
{
this.onEmailTxtLoseFocus(null);
this._emailKeyUpDelayTimer.reset();
}
private function onEmailTxtLoseFocus(param1:FocusEvent) : void
{
var _loc3_:Boolean = false;
var _loc4_:int = 0;
var _loc5_:int = 0;
var _loc6_:String = null;
var _loc7_:Array = null;
var _loc8_:Array = null;
var _loc9_:int = 0;
var _loc2_:Boolean = Boolean(!this._emailRegEx["exec"](this._emailTxt.text) || this._emailTxt.text.length > MAX_EMAIL_LENGTH);
if(!_loc2_)
{
_loc3_ = false;
_loc4_ = 0;
_loc5_ = int(this._commonDomains.length);
_loc6_ = this._emailTxt.text.substr(this._emailTxt.text.indexOf("@") + 1).toLowerCase();
while(_loc4_ < _loc5_)
{
if(_loc6_ == this._commonDomains[_loc4_])
{
_loc3_ = true;
CreateAccountGui.hideNotifyPopup();
this.emailValidCallback(false,false,true);
break;
}
_loc4_++;
}
if(!_loc3_)
{
_loc7_ = new Array();
_loc8_ = _loc6_.split("");
_loc4_ = 0;
while(_loc4_ < _loc5_)
{
_loc9_ = Utils.damerauLevenshteinDistance(_loc8_,this._commonDomains[_loc4_].split(""),64);
if(_loc9_ == 1)
{
_loc7_.push(this._commonDomains[_loc4_]);
}
_loc4_++;
}
if(_loc7_.length > 0)
{
CreateAccountGui.showEmailDomainMisspelledWarning(_loc7_);
}
else
{
CreateAccountGui.hideNotifyPopup();
}
if(!this._domainConfirmed && !this._validationPending)
{
this._validationPending = true;
GuiStatusIcon.showWait(this._emailSts,this._emailStsTracking);
CreateAccountXtCommManager.sendLoginMXLookup(_loc6_);
}
}
}
}
private function confirmKeyUpHandler(param1:KeyboardEvent) : void
{
this._confirmText = this._confirmTxt.text;
if(this._confirmTxt.text == "")
{
GuiStatusIcon.initClipOff(this._confirmSts,this._confirmStsTracking);
this._validatedConfirmEmail = null;
return;
}
if(param1 != null)
{
CreateAccountGui.hideNotifyPopup();
}
if(this._emailTxt.text == this._confirmTxt.text)
{
this.confirmValidCallback(false);
}
else
{
this.confirmValidCallback(true);
}
}
private function voBtnClickHandler(param1:MouseEvent) : void
{
if(this._currVo.isPlaying)
{
this._currVo.stop();
this._voBtn.stop();
this._voBtn.gotoAndStop(1);
}
else
{
if(this._currVo == null)
{
this._currVo = CreateAccountGui.vo4Sound;
}
this._currVo.play();
if(this._currVo.sc)
{
this._currVo.sc.addEventListener(Event.SOUND_COMPLETE,this.stopVO,false,0,true);
this._voBtn.play();
}
}
}
private function nextBtnHandler() : Boolean
{
if(this._validationPending || !this._domainConfirmed || !this._isCheckBoxChecked)
{
this._continueClicked = true;
return false;
}
if(this._validatedEmail != null)
{
if(this._validatedConfirmEmail != null)
{
this.stopVO(null);
this._continueClicked = true;
this._validationPending = false;
this._emailKeyUpDelayTimer.reset();
return true;
}
if(this._confirmTxt.text == "")
{
this.confirmMarkEmptyAsError();
}
CreateAccountGui.showMustConfirmMsg();
return false;
}
CreateAccountGui.showUsernameExistsMsg(CreateAccountGui.MSG_ID_EMAIL_INVALID,false);
if(this._emailTxt.text == "")
{
this.emailMarkEmptyAsError();
}
return false;
}
}
}
@@ -0,0 +1,814 @@
package createAccountGui
{
import com.sbi.analytics.SBTracker;
import com.sbi.popup.SBScreen;
import com.sbi.popup.SBWizard;
import createAccountFlow.CreateAccountGui;
import createAccountFlow.CreateAccountXtCommManager;
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.FocusEvent;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.events.TextEvent;
import flash.events.TimerEvent;
import flash.text.TextField;
import flash.utils.Timer;
import gui.GuiDropdown;
import gui.GuiDropdownDay;
import gui.GuiRadioButtonGroup;
import gui.GuiSoundBtnSubMenu;
import gui.GuiStatusIcon;
public class GuiPlayerTagScreen extends SBScreen
{
public static const NUM_SUGGESTED_NAMES:int = 4;
private var _newBdayMonthDpn:GuiDropdown;
private var _newBdayDayDpn:GuiDropdownDay;
private var _newGenderRbg:GuiRadioButtonGroup;
private var _newPlayerAgeDpn:GuiDropdown;
private var _nameSuggestionsFrame:MovieClip;
private var _nameSugTxts:Array;
private var _userNameKeyUpDelayTimer:Timer;
private var _newUsernameTxt:TextField;
private var _newUsernameBar:MovieClip;
private var _newPasswordTxt:TextField;
private var _newPasswordBar:MovieClip;
private var _animalFrame:MovieClip;
private var _animalFrameAnimalHolder:MovieClip;
private var _activeSelBar1:MovieClip;
private var _activeSelBar2:MovieClip;
private var _activeSelBar3:MovieClip;
private var _activeSelBar4:MovieClip;
private var _backBtn:MovieClip;
private var _nextBtn:MovieClip;
private var _genderAgeSts:MovieClip;
private var _userNameSts:MovieClip;
private var _passWordSts:MovieClip;
private var _tipsNeedTxt:TextField;
private var _privacyPolicyTxt:TextField;
private var _voBtn:MovieClip;
private var _nameTipPopup:MovieClip;
private var _passwordTipPopup:MovieClip;
private var _creation:Object;
private var _playerTagScreen:MovieClip;
private var _validationPending:Boolean;
private var _lastCheckedPlayerTag:String;
private var _continueClicked:Boolean;
private var _numTimesBadUsername:int;
private var _isEmailSameAsUserName:Boolean;
private var _registrationPanel:MovieClip;
private var _selectedBdayMonthIndex:int;
private var _selectedBdayDayIndex:int;
private var _selectedGender:int;
private var _selectedBdayAgeIndex:int;
private var _hasSelectedBdayAge:Boolean;
private var _passwordText:String;
private var _genderAgeTracking:Object;
private var _userNameTracking:Object;
private var _passWordTracking:Object;
public function GuiPlayerTagScreen(param1:Object, param2:SBWizard)
{
this._creation = param1;
this._creation.accountCreation.registrationPanel.gotoAndStop("intro");
this._playerTagScreen = this._creation.accountCreation.registrationPanel.userNamePanel.userNameContainer.signup_wizard.act_popup;
super(this._playerTagScreen,param2);
this._registrationPanel = MovieClip(this._creation.accountCreation.registrationPanel);
this._newBdayMonthDpn = new GuiDropdown(this._playerTagScreen.birthday.dropdown_month);
this._newBdayDayDpn = new GuiDropdownDay(this._playerTagScreen.birthday.dropdown_day);
this._newGenderRbg = new GuiRadioButtonGroup(this._playerTagScreen.ageGender.radioGenderBtn);
this._newPlayerAgeDpn = new GuiDropdown(this._playerTagScreen.ageGender.dropdown_age);
this._nameSuggestionsFrame = this._playerTagScreen.NamePopup;
this._newUsernameTxt = this._playerTagScreen.username.pTag_txt;
this._newUsernameBar = this._playerTagScreen.username.textBar1;
this._newPasswordTxt = this._playerTagScreen.password.pswd_txt;
this._newPasswordBar = this._playerTagScreen.password.textBar2;
this._activeSelBar1 = this._playerTagScreen.act_bar_sel1;
this._activeSelBar2 = this._playerTagScreen.act_bar_sel2;
this._activeSelBar3 = this._playerTagScreen.username.act_bar_sel3;
this._activeSelBar4 = this._playerTagScreen.password.act_bar_sel4;
this._tipsNeedTxt = this._playerTagScreen.tips_help_txt;
this._privacyPolicyTxt = this._playerTagScreen.pp_txt;
this._voBtn = this._playerTagScreen.vo_Btn;
this._backBtn = this._creation.accountCreation.back_btn;
this._backBtn.gotoAndStop(1);
this._nextBtn = this._creation.accountCreation.next_btn;
this._nextBtn.gotoAndStop(1);
this._genderAgeSts = this._playerTagScreen.ageGender.genderAge_status;
this._userNameSts = this._playerTagScreen.username.username_status;
this._passWordSts = this._playerTagScreen.password.pswd_status;
this._nameTipPopup = this._playerTagScreen.nameTipPopup;
this._passwordTipPopup = this._playerTagScreen.passwordTipPopup;
}
public function init() : void
{
var _loc2_:GuiSoundBtnSubMenu = null;
onEnterFromPrev = this.enterFromPrev;
onEnterFromNext = this.enterFromNext;
onLeaveToPrev = this.leaveToPrev;
onLeaveToNext = this.leaveToNext;
updateScreen = this.updateScreenAssets;
this._playerTagScreen.ageGender.visible = false;
this._playerTagScreen.username.visible = false;
this._playerTagScreen.password.visible = false;
this._genderAgeTracking = {
"xTracking":false,
"waitTracking":false,
"checkTracking":false
};
this._userNameTracking = {
"xTracking":false,
"waitTracking":false,
"checkTracking":false
};
this._passWordTracking = {
"xTracking":false,
"waitTracking":false,
"checkTracking":false
};
GuiStatusIcon.initClipOff(this._genderAgeSts,this._genderAgeTracking);
GuiStatusIcon.initClipOff(this._userNameSts,this._userNameTracking);
GuiStatusIcon.initClipOff(this._passWordSts,this._passWordTracking);
this._nameTipPopup.visible = false;
this._passwordTipPopup.visible = false;
this._validationPending = false;
this._continueClicked = false;
this._lastCheckedPlayerTag = "";
this._passwordText = "";
this._selectedBdayMonthIndex = -1;
this._selectedBdayAgeIndex = 7;
this._selectedBdayDayIndex = -1;
this._selectedGender = -1;
this._newBdayMonthDpn.init(-1.05,0,"-");
this._newBdayDayDpn.init(0.55,0,"-");
this._newPlayerAgeDpn.init(0.55,this._selectedBdayAgeIndex,"-");
this._nameSuggestionsFrame.visible = false;
this._nameSuggestionsFrame["bx"].addEventListener(MouseEvent.MOUSE_DOWN,this.nameSugCloseBtnMouseDownHandler,false,0,true);
this._nameSugTxts = [];
var _loc1_:int = 0;
while(_loc1_ < NUM_SUGGESTED_NAMES)
{
_loc2_ = this._nameSuggestionsFrame["name" + (_loc1_ + 1)];
this._nameSugTxts[_loc1_] = _loc2_["pTag_txt"];
TextField(this._nameSugTxts[_loc1_]).text = "ysername" + _loc1_;
_loc2_.addEventListener(MouseEvent.CLICK,this.nameSugClickHandler,false,0,true);
_loc1_++;
}
this._userNameKeyUpDelayTimer = new Timer(1222);
this._userNameKeyUpDelayTimer.addEventListener(TimerEvent.TIMER,this.userNameTxtChangeDelayTimerHandler,false,0,true);
this._newUsernameTxt.restrict = "A-Za-z0-9";
this._newUsernameTxt.maxChars = 20;
this._newPasswordTxt.restrict = "^ ";
this._newPasswordTxt.maxChars = 32;
this._activeSelBar1.visible = false;
this._activeSelBar2.visible = false;
this._activeSelBar3.visible = false;
this._activeSelBar4.visible = false;
this._newBdayMonthDpn.currDropDown.addEventListener(MouseEvent.MOUSE_DOWN,this.selBar1FocusHandler,false,0,true);
this._newBdayDayDpn.currDropDown.addEventListener(MouseEvent.MOUSE_DOWN,this.selBar1FocusHandler,false,0,true);
this._newBdayMonthDpn.currDropDown.addEventListener(FocusEvent.FOCUS_IN,this.selBar1FocusHandler,false,0,true);
this._newBdayDayDpn.currDropDown.addEventListener(FocusEvent.FOCUS_IN,this.selBar1FocusHandler,false,0,true);
this._newGenderRbg.currRadioButton.addEventListener(MouseEvent.MOUSE_DOWN,this.selBar2FocusHandler,false,0,true);
this._newPlayerAgeDpn.currDropDown.addEventListener(MouseEvent.MOUSE_DOWN,this.selBar2FocusHandler,false,0,true);
this._newPlayerAgeDpn.currDropDown.addEventListener(FocusEvent.FOCUS_IN,this.selBar2FocusHandler,false,0,true);
this._newUsernameTxt.addEventListener(Event.CHANGE,this.userNameTxtChangeHandler,false,0,true);
this._newUsernameTxt.addEventListener(MouseEvent.MOUSE_DOWN,this.selBar3FocusHandler,false,0,true);
this._newUsernameTxt.addEventListener(KeyboardEvent.KEY_DOWN,this.selBar3FocusHandler,false,0,true);
this._newUsernameTxt.addEventListener(FocusEvent.FOCUS_IN,this.selBar3FocusHandler,false,0,true);
this._newPasswordTxt.addEventListener(Event.CHANGE,this.passWordTxtChangeHandler,false,0,true);
this._newPasswordTxt.addEventListener(FocusEvent.FOCUS_IN,this.selBar4FocusHandler,false,0,true);
this._tipsNeedTxt.htmlText = "<a href=\'event:\'><u>" + this._tipsNeedTxt.text + "</u></a>";
this._tipsNeedTxt.addEventListener(TextEvent.LINK,this.tipsNeedTxtClickHandler,false,0,true);
this._privacyPolicyTxt.htmlText = "<a href=\'http://www.animaljam.com/privacy\' target=\'_blank\'><u>" + this._privacyPolicyTxt.text + "</u></a>";
this._voBtn.stop();
this._voBtn.addEventListener(MouseEvent.CLICK,this.voBtnClickHandler,false,0,true);
}
override public function destroy() : void
{
this._newBdayMonthDpn.currDropDown.removeEventListener(MouseEvent.MOUSE_DOWN,this.selBar1FocusHandler);
this._newBdayDayDpn.currDropDown.removeEventListener(MouseEvent.MOUSE_DOWN,this.selBar1FocusHandler);
this._newBdayMonthDpn.currDropDown.removeEventListener(FocusEvent.FOCUS_IN,this.selBar1FocusHandler);
this._newBdayDayDpn.currDropDown.removeEventListener(FocusEvent.FOCUS_IN,this.selBar1FocusHandler);
this._newGenderRbg.currRadioButton.removeEventListener(MouseEvent.MOUSE_DOWN,this.selBar2FocusHandler);
this._newPlayerAgeDpn.currDropDown.removeEventListener(MouseEvent.MOUSE_DOWN,this.selBar2FocusHandler);
this._newPlayerAgeDpn.currDropDown.removeEventListener(FocusEvent.FOCUS_IN,this.selBar2FocusHandler);
this._newUsernameTxt.removeEventListener(Event.CHANGE,this.userNameTxtChangeHandler);
this._newUsernameTxt.removeEventListener(MouseEvent.MOUSE_DOWN,this.selBar3FocusHandler);
this._newUsernameTxt.removeEventListener(KeyboardEvent.KEY_DOWN,this.selBar3FocusHandler);
this._newUsernameTxt.removeEventListener(FocusEvent.FOCUS_IN,this.selBar3FocusHandler);
this._newPasswordTxt.removeEventListener(Event.CHANGE,this.passWordTxtChangeHandler);
this._newPasswordTxt.removeEventListener(FocusEvent.FOCUS_IN,this.selBar4FocusHandler);
this._tipsNeedTxt.removeEventListener(TextEvent.LINK,this.tipsNeedTxtClickHandler);
this._voBtn.removeEventListener(MouseEvent.CLICK,this.voBtnClickHandler);
this._newBdayMonthDpn.destroy();
this._newBdayMonthDpn = null;
this._newBdayDayDpn.destroy();
this._newBdayDayDpn = null;
this._newPlayerAgeDpn.destroy();
this._newPlayerAgeDpn = null;
this._newGenderRbg.destroy();
this._newGenderRbg = null;
this._nameSuggestionsFrame["bx"].removeEventListener(MouseEvent.MOUSE_DOWN,this.nameSugCloseBtnMouseDownHandler);
this._userNameKeyUpDelayTimer.stop();
this._userNameKeyUpDelayTimer = null;
super.destroy();
}
public function enterFromPrev() : void
{
this._playerTagScreen.ageGender.visible = true;
this._playerTagScreen.username.visible = true;
this._playerTagScreen.password.visible = true;
this._numTimesBadUsername = 0;
CreateAccountGui.vo3Sound.play();
if(CreateAccountGui.vo3Sound.sc)
{
CreateAccountGui.vo3Sound.sc.addEventListener(Event.SOUND_COMPLETE,this.stopVOButton,false,0,true);
this._voBtn.play();
}
CreateAccountGui.trackUserCreateAccountPageChange("CreatePlayerAccount");
this.selBar1FocusHandler(null);
this._nextBtn.enabled = false;
CreateAccountGui.hideNotifyPopup();
if(Boolean(this._userNameSts["_check"].visible) && Boolean(this._passWordSts["_check"].visible))
{
this._nextBtn.visible = true;
}
else
{
this._nextBtn.visible = false;
}
}
public function enterFromNext() : Boolean
{
this.enterFromPrev();
if(CreateAccountGui.currEmailAddress().split("@")[0].toLowerCase() == this._newUsernameTxt.text.toLowerCase())
{
this._isEmailSameAsUserName = true;
gMainFrame.stage.focus = this._newUsernameTxt;
CreateAccountGui.showEmailCannotMatchUserName();
this._nextBtn.visible = false;
this._newUsernameBar.visible = false;
GuiStatusIcon.showX(this._userNameSts,this._userNameTracking);
}
return true;
}
public function leaveToNext() : Boolean
{
CreateAccountGui.vo3Sound.stop();
this._voBtn.stop();
this._voBtn.gotoAndStop(1);
CreateAccountGui.showTipsPopup(false);
var _loc1_:Boolean = this._isEmailSameAsUserName;
var _loc2_:Boolean = this.nextBtnHandler();
if(_loc1_)
{
super.parentWizard.next();
}
return _loc2_;
}
public function leaveToBoth() : void
{
}
public function leaveToPrev() : Boolean
{
CreateAccountGui.vo3Sound.stop();
this._voBtn.stop();
this._voBtn.gotoAndStop(1);
this._numTimesBadUsername = 0;
CreateAccountGui.showNewChrPopup();
CreateAccountGui.showTipsPopup(false);
this._nextBtn.visible = true;
return true;
}
public function updateScreenAssets(param1:Boolean = false) : void
{
var _loc2_:int = 0;
var _loc3_:GuiSoundBtnSubMenu = null;
this._playerTagScreen = this._registrationPanel.userNamePanel.userNameContainer.signup_wizard.act_popup;
this._newBdayMonthDpn = new GuiDropdown(this._playerTagScreen.birthday.dropdown_month);
this._newBdayMonthDpn.init(-1.05,this._selectedBdayMonthIndex,this._selectedBdayMonthIndex == -1 ? "-" : null);
this._newBdayDayDpn = new GuiDropdownDay(this._playerTagScreen.birthday.dropdown_day);
this._newBdayDayDpn.init(0.55,this._selectedBdayDayIndex,this._selectedBdayDayIndex == -1 ? "-" : null);
this._newGenderRbg = new GuiRadioButtonGroup(this._playerTagScreen.ageGender.radioGenderBtn);
this._newGenderRbg.selected = this._selectedGender;
this._newPlayerAgeDpn = new GuiDropdown(this._playerTagScreen.ageGender.dropdown_age);
this._newPlayerAgeDpn.init(0.55,this._selectedBdayAgeIndex,this._hasSelectedBdayAge ? null : "-");
this._nameSuggestionsFrame = this._playerTagScreen.NamePopup;
this._newUsernameTxt = this._playerTagScreen.username.pTag_txt;
this._newUsernameTxt.text = this._lastCheckedPlayerTag ? this._lastCheckedPlayerTag : "";
this._newUsernameBar = this._playerTagScreen.username.textBar1;
this._newPasswordTxt = this._playerTagScreen.password.pswd_txt;
this._newPasswordTxt.text = this._passwordText;
this._newPasswordBar = this._playerTagScreen.password.textBar2;
this._activeSelBar1 = this._playerTagScreen.act_bar_sel1;
this._activeSelBar2 = this._playerTagScreen.act_bar_sel2;
this._activeSelBar3 = this._playerTagScreen.username.act_bar_sel3;
this._activeSelBar4 = this._playerTagScreen.password.act_bar_sel4;
this._tipsNeedTxt = this._playerTagScreen.tips_help_txt;
this._privacyPolicyTxt = this._playerTagScreen.pp_txt;
this._voBtn = this._playerTagScreen.vo_Btn;
this._backBtn = this._creation.accountCreation.back_btn;
this._backBtn.gotoAndStop(1);
this._nextBtn = this._creation.accountCreation.next_btn;
this._nextBtn.gotoAndStop(1);
this._genderAgeSts = this._playerTagScreen.ageGender.genderAge_status;
this._userNameSts = this._playerTagScreen.username.username_status;
this._passWordSts = this._playerTagScreen.password.pswd_status;
this._nameTipPopup = this._playerTagScreen.nameTipPopup;
this._passwordTipPopup = this._playerTagScreen.passwordTipPopup;
this._playerTagScreen.username.changeBtn.visible = false;
this._playerTagScreen.ageGender.visible = true;
this._playerTagScreen.username.visible = true;
this._playerTagScreen.password.visible = true;
GuiStatusIcon.setVisBasedOnTrackers(this._genderAgeSts,this._genderAgeTracking);
GuiStatusIcon.setVisBasedOnTrackers(this._userNameSts,this._userNameTracking);
GuiStatusIcon.setVisBasedOnTrackers(this._passWordSts,this._passWordTracking);
this._nameTipPopup.visible = false;
this._passwordTipPopup.visible = false;
this._validationPending = false;
this._continueClicked = false;
this._nameSuggestionsFrame.visible = false;
this._activeSelBar1.visible = false;
this._activeSelBar2.visible = false;
this._activeSelBar3.visible = false;
this._activeSelBar4.visible = false;
if(param1)
{
this._newUsernameTxt.restrict = "A-Za-z0-9";
this._newUsernameTxt.maxChars = 20;
this._newPasswordTxt.restrict = "^ ";
this._newPasswordTxt.maxChars = 32;
this._nameSuggestionsFrame["bx"].addEventListener(MouseEvent.MOUSE_DOWN,this.nameSugCloseBtnMouseDownHandler,false,0,true);
this._nameSugTxts = [];
_loc2_ = 0;
while(_loc2_ < NUM_SUGGESTED_NAMES)
{
_loc3_ = this._nameSuggestionsFrame["name" + (_loc2_ + 1)];
this._nameSugTxts[_loc2_] = _loc3_["pTag_txt"];
TextField(this._nameSugTxts[_loc2_]).text = "ysername" + _loc2_;
_loc3_.addEventListener(MouseEvent.CLICK,this.nameSugClickHandler,false,0,true);
_loc2_++;
}
this._newBdayMonthDpn.currDropDown.addEventListener(MouseEvent.MOUSE_DOWN,this.selBar1FocusHandler,false,0,true);
this._newBdayDayDpn.currDropDown.addEventListener(MouseEvent.MOUSE_DOWN,this.selBar1FocusHandler,false,0,true);
this._newBdayMonthDpn.currDropDown.addEventListener(FocusEvent.FOCUS_IN,this.selBar1FocusHandler,false,0,true);
this._newBdayDayDpn.currDropDown.addEventListener(FocusEvent.FOCUS_IN,this.selBar1FocusHandler,false,0,true);
this._newGenderRbg.currRadioButton.addEventListener(MouseEvent.MOUSE_DOWN,this.selBar2FocusHandler,false,0,true);
this._newPlayerAgeDpn.currDropDown.addEventListener(MouseEvent.MOUSE_DOWN,this.selBar2FocusHandler,false,0,true);
this._newPlayerAgeDpn.currDropDown.addEventListener(FocusEvent.FOCUS_IN,this.selBar2FocusHandler,false,0,true);
this._newUsernameTxt.addEventListener(Event.CHANGE,this.userNameTxtChangeHandler,false,0,true);
this._newUsernameTxt.addEventListener(MouseEvent.MOUSE_DOWN,this.selBar3FocusHandler,false,0,true);
this._newUsernameTxt.addEventListener(KeyboardEvent.KEY_DOWN,this.selBar3FocusHandler,false,0,true);
this._newUsernameTxt.addEventListener(FocusEvent.FOCUS_IN,this.selBar3FocusHandler,false,0,true);
this._newPasswordTxt.addEventListener(Event.CHANGE,this.passWordTxtChangeHandler,false,0,true);
this._newPasswordTxt.addEventListener(FocusEvent.FOCUS_IN,this.selBar4FocusHandler,false,0,true);
this._tipsNeedTxt.addEventListener(TextEvent.LINK,this.tipsNeedTxtClickHandler,false,0,true);
this._voBtn.addEventListener(MouseEvent.CLICK,this.voBtnClickHandler,false,0,true);
if(CreateAccountGui.vo3Sound.sc)
{
this._voBtn.play();
}
else
{
this._voBtn.stop();
}
this.selBar1FocusHandler(null);
this._nextBtn.enabled = false;
if(Boolean(this._userNameSts["_check"].visible) && Boolean(this._passWordSts["_check"].visible))
{
this._nextBtn.visible = true;
}
else
{
this._nextBtn.visible = false;
}
}
}
public function stopVOButton(param1:Event) : void
{
this._voBtn.stop();
this._voBtn.gotoAndStop(1);
}
public function enableNext() : void
{
this._nextBtn.enabled = true;
}
public function userNameValidCallback(param1:int, param2:Array, param3:int) : void
{
var _loc4_:int = 0;
var _loc5_:Array = null;
this._validationPending = false;
this._userNameSts.visible = true;
if(param1 == 1)
{
GuiStatusIcon.showCheck(this._userNameSts,this._userNameTracking);
if(this._passWordSts["_check"].visible)
{
this._nextBtn.visible = true;
}
this._newUsernameBar.visible = true;
this._nameSuggestionsFrame.visible = false;
if(this._continueClicked || this._isEmailSameAsUserName)
{
if(this.nextBtnHandler())
{
if(super.parentWizard != null)
{
super.parentWizard.next();
}
}
}
}
else
{
if(param1 == CreateAccountGui.MSG_ID_USERNAME_UNAVAILABLE)
{
if(param3 != CreateAccountXtCommManager.LOGINAVAILABLE_TYPE_SUGGESTIONS)
{
SBTracker.trackPageview("/login/usernameUnavailable/#" + this._numTimesBadUsername,0,SBTracker.TYPE_EVENT);
++this._numTimesBadUsername;
}
_loc5_ = [];
_loc4_ = 3;
while(_loc4_ < param2.length)
{
if(param2[_loc4_] != null && param2[_loc4_] != "")
{
_loc5_.push(param2[_loc4_]);
}
_loc4_++;
}
if(_loc5_.length != 0)
{
this._nameSuggestionsFrame.gotoAndStop(_loc5_.length);
_loc4_ = 0;
while(_loc4_ < _loc5_.length)
{
TextField(this._nameSugTxts[_loc4_]).text = _loc5_[_loc4_];
_loc4_++;
}
this._nameSuggestionsFrame.visible = true;
}
else
{
this._nameSuggestionsFrame.visible = false;
}
this._newBdayMonthDpn.closeDropdownSilent();
this._newBdayDayDpn.closeDropdownSilent();
this._newPlayerAgeDpn.closeDropdownSilent();
}
GuiStatusIcon.showX(this._userNameSts,this._userNameTracking);
this._nextBtn.visible = false;
if(this._newUsernameTxt.text == "")
{
this._userNameSts.visible = this._userNameTracking.xTracking = this._userNameTracking.waitTracking = this._userNameTracking.checkTracking = false;
this._newUsernameBar.visible = true;
}
else
{
this._newUsernameBar.visible = false;
}
}
this._continueClicked = false;
}
public function passWordValidCallback(param1:Boolean) : void
{
if(param1)
{
this._passWordSts.visible = true;
this._passwordText = this._newPasswordTxt.text;
GuiStatusIcon.showCheck(this._passWordSts,this._passWordTracking);
this._newPasswordBar.visible = true;
if(this._userNameSts["_check"].visible)
{
this._nextBtn.visible = true;
}
}
else
{
GuiStatusIcon.showX(this._passWordSts,this._passWordTracking);
if(this._newPasswordTxt.text.length == 0)
{
this._passWordSts.visible = this._passWordTracking.xTracking = this._passWordTracking.waitTracking = this._passWordTracking.checkTracking = false;
}
else
{
this._newPasswordBar.visible = false;
}
this._passwordText = "";
this._nextBtn.visible = false;
this._creation.invalidatePassWord();
}
}
private function markEmptyAsError() : void
{
if(this._newUsernameTxt.text == "")
{
GuiStatusIcon.showX(this._userNameSts,this._userNameTracking);
this._userNameSts.visible = true;
this._newUsernameBar.visible = false;
}
this.checkPassWord();
}
private function checkUserName() : void
{
if(this._creation.validatedUserName != this._newUsernameTxt.text)
{
if(this._creation.validatedUserName)
{
this._creation.invalidateUserName();
}
if(this._newUsernameTxt.text == "")
{
this._userNameSts.visible = this._userNameTracking.xTracking = this._userNameTracking.waitTracking = this._userNameTracking.checkTracking = false;
CreateAccountGui.hideNotifyPopup();
}
else if(this._newUsernameTxt.text != this._lastCheckedPlayerTag)
{
if(this._validationPending)
{
if(!this._userNameKeyUpDelayTimer.running)
{
this._creation.invalidatePending();
}
this._userNameKeyUpDelayTimer.reset();
}
this._validationPending = true;
this._lastCheckedPlayerTag = this._newUsernameTxt.text;
this._userNameSts.visible = true;
GuiStatusIcon.showWait(this._userNameSts,this._userNameTracking);
this._userNameKeyUpDelayTimer.start();
}
}
}
private function checkPassWord() : void
{
this._creation.validatePassWord(this._newPasswordTxt.text,this._newUsernameTxt.text,this.passWordValidCallback);
}
private function userNameTxtChangeHandler(param1:Event) : void
{
this.checkUserName();
this.checkPassWord();
CreateAccountGui.hideNotifyPopup();
}
private function userNameTxtChangeDelayTimerHandler(param1:TimerEvent) : void
{
var _loc2_:String = this._newUsernameTxt.text;
this._newUsernameTxt.text = _loc2_.substr(0,1) + _loc2_.substr(1).toLowerCase();
var _loc3_:Array = CreateAccountGui.currEmailAddress().split("@");
if(_loc3_.length > 1)
{
if(_loc3_[0].toLowerCase() != this._newUsernameTxt.text.toLowerCase())
{
this._creation.validateUserName(this._newUsernameTxt.text,this._newPasswordTxt.text,0,0,0,this.userNameValidCallback);
}
else
{
CreateAccountGui.showEmailCannotMatchUserName();
this._validationPending = false;
GuiStatusIcon.showX(this._userNameSts,this._userNameTracking);
}
}
else
{
this._creation.validateUserName(this._newUsernameTxt.text,this._newPasswordTxt.text,0,0,0,this.userNameValidCallback);
}
this._userNameKeyUpDelayTimer.reset();
}
private function nameSugClickHandler(param1:MouseEvent) : void
{
this._newUsernameTxt.text = param1.currentTarget["pTag_txt"].text;
this.userNameTxtChangeHandler(null);
this._nameSuggestionsFrame.visible = false;
}
private function nameSugCloseBtnMouseDownHandler(param1:MouseEvent) : void
{
this._nameSuggestionsFrame.visible = false;
}
private function passWordTxtChangeHandler(param1:Event) : void
{
this.checkPassWord();
this.checkUserName();
}
private function selBar1FocusHandler(param1:Event) : void
{
var _loc2_:Date = null;
if(!this._activeSelBar1.visible)
{
this._activeSelBar1.visible = true;
this._activeSelBar2.visible = false;
this._activeSelBar3.visible = false;
this._activeSelBar4.visible = false;
this._nameSuggestionsFrame.visible = false;
this._nameTipPopup.visible = false;
this._passwordTipPopup.visible = false;
this._newPlayerAgeDpn.closeDropdownSilent();
}
if(param1)
{
this._selectedBdayMonthIndex = this._newBdayMonthDpn.selectedIdx;
this._selectedBdayDayIndex = this._newBdayDayDpn.selectedIdx;
if(this._selectedBdayMonthIndex != -1 && param1.currentTarget == this._playerTagScreen.birthday.dropdown_month)
{
_loc2_ = new Date(2013,this._selectedBdayMonthIndex + 1,0);
this._newBdayDayDpn.updateDaysShown(_loc2_.getDate());
}
}
}
private function selBar2FocusHandler(param1:Event) : void
{
if(!this._activeSelBar2.visible)
{
this._activeSelBar1.visible = false;
this._activeSelBar2.visible = true;
this._activeSelBar3.visible = false;
this._activeSelBar4.visible = false;
this._nameSuggestionsFrame.visible = false;
this._nameTipPopup.visible = false;
this._passwordTipPopup.visible = false;
this._newBdayMonthDpn.closeDropdownSilent();
this._newBdayDayDpn.closeDropdownSilent();
}
if(param1)
{
this._selectedGender = this._newGenderRbg.selected;
if(!this._hasSelectedBdayAge)
{
this._hasSelectedBdayAge = this._newPlayerAgeDpn.dropdownTxt.text != "-";
}
this._selectedBdayAgeIndex = this._newPlayerAgeDpn.selectedIdx;
}
}
private function selBar3FocusHandler(param1:Event) : void
{
if(!this._activeSelBar3.visible)
{
this._activeSelBar1.visible = false;
this._activeSelBar2.visible = false;
this._activeSelBar3.visible = true;
this._activeSelBar4.visible = false;
this._nameTipPopup.visible = true;
this._passwordTipPopup.visible = false;
this._nameSuggestionsFrame.visible = false;
this._newPlayerAgeDpn.closeDropdownSilent();
this._newBdayMonthDpn.closeDropdownSilent();
this._newBdayDayDpn.closeDropdownSilent();
}
CreateAccountGui.hideNotifyPopup();
}
private function selBar4FocusHandler(param1:FocusEvent) : void
{
if(!this._activeSelBar4.visible)
{
this._activeSelBar1.visible = false;
this._activeSelBar2.visible = false;
this._activeSelBar3.visible = false;
this._activeSelBar4.visible = true;
this._nameSuggestionsFrame.visible = false;
this._nameTipPopup.visible = false;
this._passwordTipPopup.visible = true;
this._newPlayerAgeDpn.closeDropdownSilent();
this._newBdayMonthDpn.closeDropdownSilent();
this._newBdayDayDpn.closeDropdownSilent();
}
}
private function tipsNeedTxtClickHandler(param1:TextEvent) : void
{
param1.preventDefault();
CreateAccountGui.showTipsPopup(true);
}
private function voBtnClickHandler(param1:MouseEvent) : void
{
if(CreateAccountGui.vo3Sound.isPlaying)
{
CreateAccountGui.vo3Sound.stop();
this._voBtn.stop();
this._voBtn.gotoAndStop(1);
}
else
{
CreateAccountGui.vo3Sound.play();
if(CreateAccountGui.vo3Sound.sc)
{
CreateAccountGui.vo3Sound.sc.addEventListener(Event.SOUND_COMPLETE,this.stopVOButton,false,0,true);
this._voBtn.play();
}
}
}
private function nextBtnHandler() : Boolean
{
if(this._validationPending)
{
this._continueClicked = true;
return false;
}
if(this._creation.validatedUserName)
{
if(this._creation.validatedPassWord)
{
if(this._newPlayerAgeDpn.selectedIdx < 0)
{
CreateAccountGui.showLoginCreateResultMsg(CreateAccountGui.MSG_ID_AGE_BLANK);
return false;
}
if(this._newGenderRbg.selected < 0)
{
CreateAccountGui.showLoginCreateResultMsg(CreateAccountGui.MSG_ID_SEX_BLANK);
return false;
}
if(this._newBdayDayDpn.selectedIdx < 0 || this._newBdayMonthDpn.selectedIdx < 0)
{
CreateAccountGui.showLoginCreateResultMsg(CreateAccountGui.MSG_ID_MONTH_OR_DAY_BLANK);
return false;
}
this._creation.setBirthday(String(this._newBdayMonthDpn.selectedIdx + 1),this._newBdayDayDpn.selectedTxt.text,String(this._newPlayerAgeDpn.selectedIdx));
this._creation.setGender(this._newGenderRbg.selected);
this._numTimesBadUsername = 0;
this._isEmailSameAsUserName = false;
return true;
}
this.passWordTxtChangeHandler(null);
this.markEmptyAsError();
return false;
}
this._continueClicked = true;
this._creation.validateUserName(this._newUsernameTxt.text,this._newPasswordTxt.text,0,0,0,this.userNameValidCallback);
this.markEmptyAsError();
return false;
}
}
}