Files
burrow-server/tools/decompiled/old-builds/b1188/com/sbi/popup/SBWizard.as
T

273 lines
7.7 KiB
ActionScript

package com.sbi.popup
{
import flash.display.DisplayObject;
import flash.display.MovieClip;
public class SBWizard
{
public var screens:Array;
private var _step:int;
private var _useSeparateScreens:Boolean;
public var wizClip:MovieClip;
public var creationAssets:Object;
public function SBWizard()
{
super();
}
public function init(param1:MovieClip, param2:Object, param3:Boolean = true, param4:int = 1, param5:Array = null, param6:Boolean = true, param7:Boolean = false, param8:Boolean = false, param9:Boolean = false) : void
{
var _loc11_:int = 0;
var _loc12_:DisplayObject = null;
var _loc13_:SBScreen = null;
var _loc14_:int = 0;
if(param1 == null)
{
throw new Error("invalid null initWizClip!");
}
this.wizClip = param1;
this.creationAssets = param2;
this._useSeparateScreens = param7;
if(!param3 && param7)
{
this.wizClip.visible = false;
}
var _loc10_:int = param7 == false ? int(param5.length) : this.wizClip.totalFrames;
if(param5)
{
this.screens = param5;
}
else
{
this.screens = [];
if(_loc10_ > 0)
{
_loc11_ = 0;
while(_loc11_ < _loc10_)
{
this.wizClip.gotoAndStop(_loc11_ + 1);
_loc12_ = this.wizClip.getChildAt(0);
_loc13_ = new SBScreen(_loc12_ as MovieClip,this);
_loc13_.screenClip.visible = false;
this.screens.push(_loc13_);
_loc11_++;
}
if(this.screens.length != uint(_loc10_))
{
throw new Error("SBWizard - Failed assertion: lengths must be equal- screens.length:" + this.screens.length + " uint(framesLength):" + uint(_loc10_));
}
}
}
this.wizClip.enabled = param6;
this.step = param4;
if(param7)
{
_loc14_ = 0;
while(_loc14_ < _loc10_)
{
this.wizClip.addChild(this.screens[_loc14_].screenClip);
_loc14_++;
}
if(param4 > 0 && param4 <= _loc10_)
{
this.screens[param4 - 1].screenClip.visible = true;
}
}
this.wizClip.stop();
}
public function destroy() : void
{
this.screens.splice(0,this.screens.length);
this.screens = null;
this.wizClip = null;
}
public function get step() : int
{
return this._step;
}
public function set step(param1:int) : void
{
if(param1 == this._step)
{
return;
}
this.jumpToStep(param1);
}
public function get currScreen() : SBScreen
{
if(Boolean(this.screens) && this._step - 1 <= this.screens.length - 1)
{
return this.screens[this._step - 1];
}
return null;
}
public function get nextScreen() : SBScreen
{
if(Boolean(this.screens) && this._step <= this.screens.length - 1)
{
return this.screens[int(this._step)];
}
return null;
}
public function get prevScreen() : SBScreen
{
if(Boolean(this._step > 0) && Boolean(this.screens) && this.screens.length >= this._step)
{
return this.screens[int(this._step - 2)];
}
return null;
}
public function jumpToStep(param1:int) : void
{
var _loc3_:SBScreen = null;
var _loc4_:Function = null;
var _loc5_:SBScreen = null;
var _loc6_:Function = null;
if(!this.screens || param1 < 0 || param1 > this.screens.length + 1)
{
throw new Error("illegal wizard step:" + param1 + " screens:" + (this.screens ? this.screens.length : this.screens));
}
if(!this.wizClip.enabled || param1 == this._step)
{
return;
}
var _loc2_:Boolean = Boolean(param1 > this._step);
if(this._step > 0 && this._step <= this.screens.length)
{
_loc3_ = this.screens[this._step - 1];
if(this._useSeparateScreens)
{
_loc3_.screenClip.visible = false;
}
_loc4_ = _loc2_ ? _loc3_.onLeaveToNext : _loc3_.onLeaveToPrev;
if(_loc4_ != null)
{
if(!_loc4_())
{
return;
}
}
}
this._step = param1;
if(param1 > 0 && param1 <= this.screens.length)
{
_loc5_ = this.screens[param1 - 1];
if(this._useSeparateScreens)
{
_loc5_.screenClip.visible = true;
}
_loc6_ = _loc2_ ? _loc5_.onEnterFromPrev : _loc5_.onEnterFromNext;
if(_loc6_ != null)
{
_loc6_();
}
}
}
public function jumpToScreen(param1:SBScreen) : void
{
var _loc2_:int = this.screens.indexOf(param1);
if(_loc2_ >= 0)
{
this.jumpToStep(_loc2_ + 1);
return;
}
throw new Error("SBWizard jumpToScreen - screen:" + param1 + " not found!");
}
public function next() : void
{
this.jumpToStep(this._step + 1);
}
public function prev() : void
{
this.jumpToStep(this._step - 1);
}
public function onPlay() : void
{
this.currScreen.onPlay();
}
public function onClose() : void
{
this.currScreen.onClose();
this._step = 1;
}
public function addScreen(param1:SBScreen, param2:int = 0) : void
{
if(!this.screens)
{
throw new Error("Tried to addScreen on an uninitialized wizard!");
}
if(param2 == 0)
{
this.screens.push(param1);
}
else
{
if(param2 < 0 || param2 > this.screens.length)
{
throw new Error("illegal step:" + param2 + " while trying to addScreen");
}
this.screens.splice(param2 - 1,0,param1);
}
}
public function removeScreen(param1:int = 0) : void
{
if(!this.screens || this.screens.length == 0)
{
throw new Error("Tried to removeScreen on an empty wizard!");
}
if(param1 == 0)
{
this.screens.pop();
}
else
{
if(param1 < 0 || param1 > this.screens.length)
{
throw new Error("illegal step:" + param1 + " while trying to removeScreen");
}
this.screens.splice(param1 - 1,1);
}
}
public function updateCurrScreen() : void
{
var _loc1_:SBScreen = this.currScreen;
if(_loc1_)
{
_loc1_.updateScreen(true);
}
var _loc2_:SBScreen = this.prevScreen;
if(_loc2_)
{
_loc2_.updateScreen();
}
var _loc3_:SBScreen = this.nextScreen;
if(_loc3_)
{
_loc3_.updateScreen();
}
}
}
}