mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-21 17:37:50 -05:00
Brought up to date with the private repository (feea4c7)
This commit is contained in:
1 parent
1aa738d692
commit
1b1df1ae48
7925 files changed
+2617237
-20
No files matched your search
@@ -0,0 +1,781 @@
|
||||
package movie
|
||||
{
|
||||
import com.sbi.client.KeepAlive;
|
||||
import com.sbi.popup.SBYesNoPopup;
|
||||
import flash.display.Bitmap;
|
||||
import flash.display.BitmapData;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.geom.Rectangle;
|
||||
import flash.printing.PrintJob;
|
||||
import flash.printing.PrintJobOrientation;
|
||||
import gui.DarkenManager;
|
||||
import gui.FeedbackManager;
|
||||
import gui.LoadingSpiral;
|
||||
import loader.MediaHelper;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class MovieManager
|
||||
{
|
||||
|
||||
public static const NORMAL_SKIN:int = 1;
|
||||
|
||||
public static const BRADY_BARR_SKIN:int = 2;
|
||||
|
||||
public static const TIERNEY_THYS_SKIN:int = 3;
|
||||
|
||||
public static const BIGGER_FRAME:int = 5;
|
||||
|
||||
public static const VID_PLAYER_MEDIA_ID:int = 39;
|
||||
|
||||
public static const VID_SELECTOR_MEDIA_ID:int = 202;
|
||||
|
||||
private const MOVIES_PER_SCREEN:int = 4;
|
||||
|
||||
private var _popupLayer:DisplayLayer;
|
||||
|
||||
private var _movieSelector:MovieClip;
|
||||
|
||||
private var _movieSelectorPopup:MovieClip;
|
||||
|
||||
private var _closeCallback:Function;
|
||||
|
||||
private var _pageNumber:int;
|
||||
|
||||
private var _mediaItems:Array;
|
||||
|
||||
private var _previewImages:Array;
|
||||
|
||||
private var _videoArray:Array;
|
||||
|
||||
private var _videoPlayer:VideoPlayerOSMF;
|
||||
|
||||
private var _spirals:Array;
|
||||
|
||||
private var _movieMediaHelper:MediaHelper;
|
||||
|
||||
private var _printMediaHelper:MediaHelper;
|
||||
|
||||
private var _previewArray:Array;
|
||||
|
||||
private var _baseTitles:Array;
|
||||
|
||||
private var _indivTitles:Array;
|
||||
|
||||
private var _videoPlayerId:int;
|
||||
|
||||
private var _theaterScreen:Object;
|
||||
|
||||
private var _isFromTheater:Boolean;
|
||||
|
||||
private var _isAsking:Boolean;
|
||||
|
||||
private var _titleTxt:String;
|
||||
|
||||
private var _statusIds:Array;
|
||||
|
||||
private var _subtitleIds:Array;
|
||||
|
||||
private var _chooseRandom:Boolean;
|
||||
|
||||
private var _printMediaHolder:Array;
|
||||
|
||||
private var _numPrintItemsToLoad:int;
|
||||
|
||||
private var _numPrintItemsLoaded:int;
|
||||
|
||||
private var _loadedImages:Array;
|
||||
|
||||
private var _randomPlayerSkinId:int;
|
||||
|
||||
private var _shouldRepeat:Boolean;
|
||||
|
||||
private var _defaultWidth:int = 512;
|
||||
|
||||
private var _defaultHeight:int = 288;
|
||||
|
||||
private var _skinFrameId:int = 1;
|
||||
|
||||
private var _closeBtn:MovieClip;
|
||||
|
||||
private var _leftArrow:MovieClip;
|
||||
|
||||
private var _rightArrow:MovieClip;
|
||||
|
||||
private var _mw0:MovieClip;
|
||||
|
||||
private var _mw1:MovieClip;
|
||||
|
||||
private var _mw2:MovieClip;
|
||||
|
||||
private var _mw3:MovieClip;
|
||||
|
||||
private var _playMovBtn0:MovieClip;
|
||||
|
||||
private var _playMovBtn1:MovieClip;
|
||||
|
||||
private var _playMovBtn2:MovieClip;
|
||||
|
||||
private var _playMovBtn3:MovieClip;
|
||||
|
||||
public function MovieManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:DisplayLayer, param2:Object, param3:Array, param4:Array, param5:Array, param6:Array, param7:Array, param8:Array, param9:int = 202, param10:int = 39, param11:Function = null) : void
|
||||
{
|
||||
this._popupLayer = param1;
|
||||
if(param9 > 0)
|
||||
{
|
||||
this._movieMediaHelper = new MediaHelper();
|
||||
this._movieMediaHelper.init(param9,this.movieHelperCallback);
|
||||
}
|
||||
this._closeCallback = param11;
|
||||
if(param2)
|
||||
{
|
||||
if(param2 is MovieClip)
|
||||
{
|
||||
this._theaterScreen = param2;
|
||||
}
|
||||
else if(param2.hasOwnProperty("loader"))
|
||||
{
|
||||
this._theaterScreen = param2.loader.content;
|
||||
}
|
||||
}
|
||||
this._videoPlayer = new VideoPlayerOSMF();
|
||||
if(this._theaterScreen)
|
||||
{
|
||||
MovieClip(this._theaterScreen).addChild(this._videoPlayer);
|
||||
this._isFromTheater = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
param1.addChild(this._videoPlayer);
|
||||
this._isFromTheater = false;
|
||||
}
|
||||
this._pageNumber = 0;
|
||||
this._videoPlayerId = param10;
|
||||
this._spirals = new Array();
|
||||
this._previewImages = new Array();
|
||||
this._mediaItems = new Array();
|
||||
this._videoArray = param4;
|
||||
this._previewArray = param3;
|
||||
this._baseTitles = param5;
|
||||
this._indivTitles = param6;
|
||||
this._statusIds = param7;
|
||||
this._subtitleIds = param8;
|
||||
}
|
||||
|
||||
public function get videoPlayer() : VideoPlayerOSMF
|
||||
{
|
||||
return this._videoPlayer;
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
this.removeListeners();
|
||||
KeepAlive.stopKATimer(this._movieSelectorPopup);
|
||||
this._popupLayer.removeChild(this._movieSelectorPopup);
|
||||
DarkenManager.unDarken(this._movieSelectorPopup);
|
||||
this._movieSelectorPopup = null;
|
||||
this._movieSelector = null;
|
||||
this._isFromTheater = false;
|
||||
this._isAsking = false;
|
||||
this._theaterScreen = null;
|
||||
this._titleTxt = null;
|
||||
this._movieMediaHelper.destroy();
|
||||
this._movieMediaHelper = null;
|
||||
if(this._printMediaHelper)
|
||||
{
|
||||
this._printMediaHelper.destroy();
|
||||
this._printMediaHelper = null;
|
||||
}
|
||||
if(this._mediaItems)
|
||||
{
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < this._mediaItems.length)
|
||||
{
|
||||
this._mediaItems[0].destroy();
|
||||
_loc2_++;
|
||||
}
|
||||
this._mediaItems.splice(0,this._mediaItems.length);
|
||||
this._mediaItems = null;
|
||||
}
|
||||
var _loc1_:int = 0;
|
||||
while(_loc1_ < this._spirals.length)
|
||||
{
|
||||
this._spirals[_loc1_].destroy();
|
||||
_loc1_++;
|
||||
}
|
||||
if(this._videoPlayer)
|
||||
{
|
||||
this._videoPlayer.destroy();
|
||||
}
|
||||
this._spirals = null;
|
||||
this._previewImages = null;
|
||||
this._mediaItems = null;
|
||||
this._videoArray = null;
|
||||
this._previewArray = null;
|
||||
this._baseTitles = null;
|
||||
this._indivTitles = null;
|
||||
this._statusIds = null;
|
||||
this._closeBtn = null;
|
||||
this._leftArrow = null;
|
||||
this._rightArrow = null;
|
||||
this._mw0 = null;
|
||||
this._mw1 = null;
|
||||
this._mw2 = null;
|
||||
this._mw3 = null;
|
||||
this._playMovBtn0 = null;
|
||||
this._playMovBtn1 = null;
|
||||
this._playMovBtn2 = null;
|
||||
this._playMovBtn3 = null;
|
||||
this._closeCallback = null;
|
||||
}
|
||||
|
||||
public function toggleVisibility() : void
|
||||
{
|
||||
if(this._movieSelectorPopup)
|
||||
{
|
||||
if(this._movieSelectorPopup.visible)
|
||||
{
|
||||
DarkenManager.unDarken(this._movieSelectorPopup);
|
||||
}
|
||||
else
|
||||
{
|
||||
DarkenManager.darken(this._movieSelectorPopup);
|
||||
}
|
||||
this._movieSelectorPopup.visible = !this._movieSelectorPopup.visible;
|
||||
}
|
||||
}
|
||||
|
||||
public function setSkinFrame(param1:int) : void
|
||||
{
|
||||
this._skinFrameId = param1;
|
||||
if(Boolean(this._movieSelector) && this._movieSelector.currentFrame != param1)
|
||||
{
|
||||
this._movieSelector.gotoAndPlay(param1);
|
||||
}
|
||||
}
|
||||
|
||||
public function setQuestionBtn() : void
|
||||
{
|
||||
if(Boolean(this._movieSelector) && Boolean(this._movieSelector.askTab))
|
||||
{
|
||||
if(this._movieSelector.askTab.hasOwnProperty("askBradyBtn"))
|
||||
{
|
||||
this._movieSelector.askTab.askBradyBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onAskBtn,false,0,true);
|
||||
}
|
||||
else
|
||||
{
|
||||
this._movieSelector.askTab.askTierneyBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onAskBtn,false,0,true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this._isAsking = true;
|
||||
}
|
||||
}
|
||||
|
||||
public function setTitleTxt(param1:String) : void
|
||||
{
|
||||
if(this._movieSelector)
|
||||
{
|
||||
LocalizationManager.translateId(this._movieSelector.titleTxt,int(param1));
|
||||
}
|
||||
else
|
||||
{
|
||||
this._titleTxt = param1;
|
||||
}
|
||||
}
|
||||
|
||||
public function chooseRandom(param1:Boolean, param2:int = 1, param3:Boolean = false, param4:int = 530, param5:int = 298) : void
|
||||
{
|
||||
this._chooseRandom = param1;
|
||||
this._randomPlayerSkinId = param2;
|
||||
if(Boolean(this._movieSelector) && this._chooseRandom)
|
||||
{
|
||||
this._videoPlayer.init(this._videoArray,this._subtitleIds,this._indivTitles,this._videoPlayerId,-1,param3,param4,param5,this.onVideoPlayerClose);
|
||||
this._videoPlayer.setSkinFrame(param2);
|
||||
this.toggleVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
public function setShouldRepeat(param1:Boolean) : void
|
||||
{
|
||||
this._shouldRepeat = param1;
|
||||
}
|
||||
|
||||
public function setDefaultWidthHeight(param1:int, param2:int) : void
|
||||
{
|
||||
this._defaultWidth = param1;
|
||||
this._defaultHeight = param2;
|
||||
}
|
||||
|
||||
private function movieHelperCallback(param1:MovieClip) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:MediaHelper = null;
|
||||
if(param1)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
this._movieSelectorPopup = param1;
|
||||
KeepAlive.startKATimer(this._movieSelectorPopup);
|
||||
this._movieSelectorPopup.visible = false;
|
||||
this._popupLayer.addChild(this._movieSelectorPopup);
|
||||
this._movieSelector = MovieClip(this._movieSelectorPopup.getChildAt(0));
|
||||
if(this._movieSelector.currentFrame != this._skinFrameId)
|
||||
{
|
||||
this._movieSelector.gotoAndPlay(this._skinFrameId);
|
||||
}
|
||||
_loc2_ = 1;
|
||||
while(_loc2_ < Math.min(5,this._previewArray.length + 1))
|
||||
{
|
||||
this._spirals[_loc2_ - 1] = new LoadingSpiral(this._movieSelector["mw" + _loc2_].itemLayer);
|
||||
_loc2_++;
|
||||
}
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < this._previewArray.length)
|
||||
{
|
||||
_loc4_ = new MediaHelper();
|
||||
_loc4_.init(this._previewArray[_loc3_],this.previewHelperCallback,true);
|
||||
this._mediaItems[_loc3_] = _loc4_;
|
||||
_loc3_++;
|
||||
}
|
||||
this._movieSelectorPopup.x = MainFrame.VIEW_WIDTH * 0.5;
|
||||
this._movieSelectorPopup.y = MainFrame.VIEW_HEIGHT * 0.5;
|
||||
this._closeBtn = MovieClip(this._movieSelectorPopup.getChildAt(0)["bx"]);
|
||||
this._leftArrow = this._movieSelector["arrowLBtn"];
|
||||
this._rightArrow = this._movieSelector["arrowRBtn"];
|
||||
this._mw0 = this._movieSelector["mw1"];
|
||||
this._mw1 = this._movieSelector["mw2"];
|
||||
this._mw2 = this._movieSelector["mw3"];
|
||||
this._mw3 = this._movieSelector["mw4"];
|
||||
this._playMovBtn0 = this._mw0["playMovBtn"];
|
||||
this._playMovBtn1 = this._mw1["playMovBtn"];
|
||||
this._playMovBtn2 = this._mw2["playMovBtn"];
|
||||
this._playMovBtn3 = this._mw3["playMovBtn"];
|
||||
this._playMovBtn0.visible = false;
|
||||
this._playMovBtn1.visible = false;
|
||||
this._playMovBtn2.visible = false;
|
||||
this._playMovBtn3.visible = false;
|
||||
this._mw0.movieDescTxt.visible = false;
|
||||
this._mw1.movieDescTxt.visible = false;
|
||||
this._mw2.movieDescTxt.visible = false;
|
||||
this._mw3.movieDescTxt.visible = false;
|
||||
this._mw0.newTag.visible = false;
|
||||
this._mw1.newTag.visible = false;
|
||||
this._mw2.newTag.visible = false;
|
||||
this._mw3.newTag.visible = false;
|
||||
if(this._videoArray.length <= 4)
|
||||
{
|
||||
this._leftArrow.activateGrayState(true);
|
||||
this._rightArrow.activateGrayState(true);
|
||||
}
|
||||
if(!this._isAsking)
|
||||
{
|
||||
if(this._movieSelector.askTab)
|
||||
{
|
||||
this._movieSelector.askTab.visible = false;
|
||||
}
|
||||
}
|
||||
if(this._titleTxt)
|
||||
{
|
||||
LocalizationManager.translateId(this._movieSelector.titleTxt,int(this._titleTxt));
|
||||
}
|
||||
this.addListeners();
|
||||
if(!this._theaterScreen)
|
||||
{
|
||||
this.toggleVisibility();
|
||||
}
|
||||
if(this._theaterScreen)
|
||||
{
|
||||
this._videoPlayer.init(this._videoArray,this._subtitleIds,this._indivTitles,-1,-1);
|
||||
}
|
||||
if(this._chooseRandom)
|
||||
{
|
||||
this._videoPlayer.init(this._videoArray,this._subtitleIds,this._indivTitles,this._videoPlayerId,-1,this._shouldRepeat,512,288,this.onVideoPlayerClose);
|
||||
this._videoPlayer.setSkinFrame(this._randomPlayerSkinId);
|
||||
this.toggleVisibility();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onVideoPlayerClose() : void
|
||||
{
|
||||
this.onClose(null);
|
||||
}
|
||||
|
||||
private function addListeners() : void
|
||||
{
|
||||
this._closeBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onClose,false,0,true);
|
||||
this._playMovBtn0.addEventListener(MouseEvent.MOUSE_DOWN,this.onPlay,false,0,true);
|
||||
this._playMovBtn1.addEventListener(MouseEvent.MOUSE_DOWN,this.onPlay,false,0,true);
|
||||
this._playMovBtn2.addEventListener(MouseEvent.MOUSE_DOWN,this.onPlay,false,0,true);
|
||||
this._playMovBtn3.addEventListener(MouseEvent.MOUSE_DOWN,this.onPlay,false,0,true);
|
||||
this._leftArrow.addEventListener(MouseEvent.MOUSE_DOWN,this.onSideBtn,false,0,true);
|
||||
this._rightArrow.addEventListener(MouseEvent.MOUSE_DOWN,this.onSideBtn,false,0,true);
|
||||
this._movieSelectorPopup.addEventListener(MouseEvent.MOUSE_DOWN,this.onMoviePopup,false,0,true);
|
||||
if(this._isAsking)
|
||||
{
|
||||
if(this._movieSelector.askTab)
|
||||
{
|
||||
if(this._movieSelector.askTab.hasOwnProperty("askBradyBtn"))
|
||||
{
|
||||
this._movieSelector.askTab.askBradyBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onAskBtn,false,0,true);
|
||||
}
|
||||
else
|
||||
{
|
||||
this._movieSelector.askTab.askTierneyBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onAskBtn,false,0,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function removeListeners() : void
|
||||
{
|
||||
this._closeBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onClose);
|
||||
this._playMovBtn0.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPlay);
|
||||
this._playMovBtn1.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPlay);
|
||||
this._playMovBtn2.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPlay);
|
||||
this._playMovBtn3.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPlay);
|
||||
this._leftArrow.removeEventListener(MouseEvent.MOUSE_DOWN,this.onSideBtn);
|
||||
this._rightArrow.removeEventListener(MouseEvent.MOUSE_DOWN,this.onSideBtn);
|
||||
this._movieSelectorPopup.removeEventListener(MouseEvent.MOUSE_DOWN,this.onMoviePopup);
|
||||
if(this._isAsking)
|
||||
{
|
||||
if(this._movieSelector.askTab)
|
||||
{
|
||||
if(this._movieSelector.askTab.hasOwnProperty("askBradyBtn"))
|
||||
{
|
||||
this._movieSelector.askTab.askBradyBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onAskBtn);
|
||||
}
|
||||
else
|
||||
{
|
||||
this._movieSelector.askTab.askTierneyBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onAskBtn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onMoviePopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function onClose(param1:MouseEvent) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
if(this._closeCallback != null)
|
||||
{
|
||||
if(!this._chooseRandom)
|
||||
{
|
||||
this._closeCallback();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private function onAskBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
if(param1.currentTarget.name == "askBradyBtn")
|
||||
{
|
||||
FeedbackManager.openFeedbackPopup(FeedbackManager.TYPE_ASK_BRADY);
|
||||
}
|
||||
else
|
||||
{
|
||||
FeedbackManager.openFeedbackPopup(FeedbackManager.TYPE_ASK_TIERNEY);
|
||||
}
|
||||
}
|
||||
|
||||
private function previewHelperCallback(param1:MovieClip) : void
|
||||
{
|
||||
var _loc2_:MovieClip = null;
|
||||
var _loc3_:int = 0;
|
||||
var _loc5_:Object = null;
|
||||
var _loc4_:int = 0;
|
||||
while(_loc4_ < this._mediaItems.length)
|
||||
{
|
||||
if(this._mediaItems[_loc4_] == param1.mediaHelper)
|
||||
{
|
||||
this._previewImages[_loc4_] = param1;
|
||||
if(_loc4_ < 4)
|
||||
{
|
||||
_loc2_ = this["_mw" + _loc4_];
|
||||
this._spirals[_loc4_].destroy();
|
||||
_loc2_.movieDescTxt.visible = true;
|
||||
_loc2_.playMovBtn.visible = true;
|
||||
_loc2_.itemLayer.addChild(param1);
|
||||
LocalizationManager.translateId(_loc2_.movieDescTxt,this._baseTitles[_loc4_]);
|
||||
_loc2_.newTag.visible = this._statusIds[_loc4_] == 1;
|
||||
_loc5_ = param1.getChildAt(0);
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _loc5_.numChildren)
|
||||
{
|
||||
if(_loc5_.getChildAt(_loc3_).name.indexOf("beakerBtn") >= 0)
|
||||
{
|
||||
_loc5_.getChildAt(_loc3_).addEventListener(MouseEvent.MOUSE_DOWN,this.onBeakerDown,false,0,true);
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
if(this._mediaItems.length < 4)
|
||||
{
|
||||
_loc3_ = int(this._mediaItems.length);
|
||||
while(_loc3_ < 4)
|
||||
{
|
||||
this["_mw" + _loc3_].visible = false;
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function reloadPreviews() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
var _loc2_:MovieClip = null;
|
||||
var _loc4_:Object = null;
|
||||
_loc1_ = 1;
|
||||
while(_loc1_ < 5)
|
||||
{
|
||||
while(this._movieSelector["mw" + _loc1_].itemLayer.numChildren > 0)
|
||||
{
|
||||
this._movieSelector["mw" + _loc1_].itemLayer.removeChildAt(0);
|
||||
}
|
||||
_loc1_++;
|
||||
}
|
||||
var _loc3_:int = this._pageNumber;
|
||||
while(_loc3_ < this._pageNumber + 4)
|
||||
{
|
||||
_loc2_ = this["_mw" + (_loc3_ - this._pageNumber)];
|
||||
if(_loc3_ < this._previewImages.length)
|
||||
{
|
||||
_loc2_.visible = true;
|
||||
_loc2_.itemLayer.addChild(this._previewImages[_loc3_]);
|
||||
_loc2_.playMovBtn.visible = true;
|
||||
LocalizationManager.translateId(_loc2_.movieDescTxt,this._baseTitles[_loc3_]);
|
||||
_loc2_.newTag.visible = this._statusIds[_loc3_] == 1;
|
||||
_loc4_ = this._previewImages[_loc3_].getChildAt(0);
|
||||
_loc1_ = 0;
|
||||
while(_loc1_ < _loc4_.numChildren)
|
||||
{
|
||||
if(_loc4_.getChildAt(_loc1_).name.indexOf("beakerBtn") > 0)
|
||||
{
|
||||
_loc4_.getChildAt(_loc1_).addEventListener(MouseEvent.MOUSE_DOWN,this.onBeakerDown,false,0,true);
|
||||
}
|
||||
_loc1_++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_.visible = false;
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
|
||||
private function onPlay(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
param1.stopPropagation();
|
||||
switch(param1.currentTarget.parent.name)
|
||||
{
|
||||
case "mw1":
|
||||
break;
|
||||
case "mw2":
|
||||
_loc2_ = 1;
|
||||
break;
|
||||
case "mw3":
|
||||
_loc2_ = 2;
|
||||
break;
|
||||
case "mw4":
|
||||
_loc2_ = 3;
|
||||
}
|
||||
if(this._videoArray.length > _loc2_ + this._pageNumber)
|
||||
{
|
||||
if(this._chooseRandom || this._isFromTheater)
|
||||
{
|
||||
this._videoPlayer.playVideoIdx(this._pageNumber + _loc2_);
|
||||
this.onClose(param1);
|
||||
}
|
||||
else
|
||||
{
|
||||
this._videoPlayer.init(this._videoArray,this._subtitleIds,this._indivTitles,this._videoPlayerId,this._pageNumber + _loc2_,this._shouldRepeat,this._defaultWidth,this._defaultHeight);
|
||||
this._videoPlayer.setSkinFrame(this._skinFrameId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onSideBtn(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
param1.stopPropagation();
|
||||
switch(param1.currentTarget.name)
|
||||
{
|
||||
case "arrowLBtn":
|
||||
if(this._pageNumber - 4 >= 0)
|
||||
{
|
||||
this._pageNumber -= 4;
|
||||
this.reloadPreviews();
|
||||
}
|
||||
else if(this._videoArray.length > 4)
|
||||
{
|
||||
_loc2_ = this._videoArray.length % 4;
|
||||
this._pageNumber = this._videoArray.length;
|
||||
this._pageNumber -= _loc2_ == 0 ? 4 : _loc2_;
|
||||
this.reloadPreviews();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if(this._pageNumber + 4 < this._videoArray.length)
|
||||
{
|
||||
this._pageNumber += 4;
|
||||
this.reloadPreviews();
|
||||
}
|
||||
else
|
||||
{
|
||||
this._pageNumber = 0;
|
||||
this.reloadPreviews();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onBeakerDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
new SBYesNoPopup(this._popupLayer,LocalizationManager.translateIdOnly(14808),true,this.onConfirmPrint,param1.currentTarget.name.split("_"));
|
||||
}
|
||||
|
||||
private function onConfirmPrint(param1:Object) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
if(param1.status)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
this._numPrintItemsToLoad = param1.passback.length - 1;
|
||||
this._numPrintItemsLoaded = 0;
|
||||
this._printMediaHolder = [];
|
||||
this._loadedImages = [];
|
||||
_loc2_ = 1;
|
||||
while(_loc2_ < param1.passback.length)
|
||||
{
|
||||
this._printMediaHelper = new MediaHelper();
|
||||
this._printMediaHelper.init(param1.passback[_loc2_],this.onPrintMediaLoaded,_loc2_);
|
||||
this._printMediaHolder.push(this._printMediaHelper);
|
||||
_loc2_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onPrintMediaLoaded(param1:MovieClip) : void
|
||||
{
|
||||
var _loc2_:PrintJob = null;
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:Array = null;
|
||||
var _loc5_:Object = null;
|
||||
this._loadedImages[param1.passback - 1] = param1;
|
||||
++this._numPrintItemsLoaded;
|
||||
if(this._numPrintItemsLoaded == this._numPrintItemsToLoad)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_loc2_ = new PrintJob();
|
||||
if(_loc2_.start())
|
||||
{
|
||||
_loc4_ = [];
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < this._loadedImages.length)
|
||||
{
|
||||
_loc5_ = this.setupPrintSprite(this._loadedImages[_loc3_],_loc2_);
|
||||
_loc4_.push(_loc5_.spriteToPrint);
|
||||
this._printMediaHolder[_loc3_].destroy();
|
||||
try
|
||||
{
|
||||
_loc2_.addPage(_loc5_.spriteToPrint,new Rectangle(0,0,_loc5_.realW + 2,_loc5_.realH + 2));
|
||||
}
|
||||
catch(e:Error)
|
||||
{
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
_loc5_ = null;
|
||||
}
|
||||
this._loadedImages = null;
|
||||
this._printMediaHolder = null;
|
||||
_loc2_.send();
|
||||
if(_loc4_)
|
||||
{
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _loc4_.length)
|
||||
{
|
||||
if(_loc4_[_loc3_].parent)
|
||||
{
|
||||
gMainFrame.stage.removeChild(_loc4_[_loc3_]);
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
_loc4_ = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function setupPrintSprite(param1:MovieClip, param2:PrintJob) : Object
|
||||
{
|
||||
var _loc9_:Number = NaN;
|
||||
var _loc10_:Number = NaN;
|
||||
var _loc3_:Sprite = new Sprite();
|
||||
param1.scaleX = param1.scaleY = 4;
|
||||
_loc3_.addChild(param1);
|
||||
param1.x = param1.y = 1;
|
||||
var _loc4_:Number = _loc3_.width;
|
||||
var _loc5_:Number = _loc3_.height;
|
||||
var _loc6_:BitmapData = new BitmapData(_loc3_.width,_loc3_.height,false,4294967295);
|
||||
_loc6_.draw(_loc3_);
|
||||
var _loc7_:Bitmap = new Bitmap(_loc6_);
|
||||
var _loc8_:Sprite = new Sprite();
|
||||
_loc8_.addChild(_loc7_);
|
||||
_loc7_.x = 0;
|
||||
_loc7_.y = 0;
|
||||
_loc7_.scaleX = 0.999;
|
||||
_loc7_.scaleY = 0.999;
|
||||
_loc8_.x = 0;
|
||||
_loc8_.y = 0;
|
||||
gMainFrame.stage.addChild(_loc8_);
|
||||
_loc8_.visible = false;
|
||||
if(param2.orientation != PrintJobOrientation.PORTRAIT)
|
||||
{
|
||||
_loc8_.rotation = 90;
|
||||
_loc8_.x = _loc8_.width;
|
||||
_loc9_ = param2.pageWidth / _loc5_;
|
||||
_loc10_ = param2.pageHeight / _loc4_;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc9_ = param2.pageWidth / _loc4_;
|
||||
_loc10_ = param2.pageHeight / _loc5_;
|
||||
}
|
||||
_loc8_.scaleX = _loc8_.scaleY = Math.min(_loc9_,_loc10_);
|
||||
return {
|
||||
"spriteToPrint":_loc8_,
|
||||
"realW":_loc4_,
|
||||
"realH":_loc5_
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
package movie
|
||||
{
|
||||
public class MovieNode
|
||||
{
|
||||
|
||||
private var _titleId:int;
|
||||
|
||||
private var _streamId:int;
|
||||
|
||||
private var _streamTitleId:int;
|
||||
|
||||
private var _mediaId:int;
|
||||
|
||||
private var _iconMediaId:int;
|
||||
|
||||
private var _thumbMediaId:int;
|
||||
|
||||
private var _choices:Object;
|
||||
|
||||
private var _denRewardId:int;
|
||||
|
||||
private var _userVarId:int;
|
||||
|
||||
private var _bitIndex:int;
|
||||
|
||||
private var _defId:int;
|
||||
|
||||
private var _numChoices:int;
|
||||
|
||||
private var _hasChosenThisChoice:Boolean;
|
||||
|
||||
private var _subtitleId:int;
|
||||
|
||||
protected var _thisChapterHasGift:Boolean;
|
||||
|
||||
protected var _isChapter:Boolean;
|
||||
|
||||
public function MovieNode(param1:Object)
|
||||
{
|
||||
super();
|
||||
this._defId = param1.defId;
|
||||
this._titleId = param1.titleStrRef;
|
||||
this._streamId = param1.streamRefId;
|
||||
this._streamTitleId = param1.streamTitleStrRef;
|
||||
this._mediaId = param1.mediaRefId;
|
||||
this._iconMediaId = param1.iconMediaRefId;
|
||||
this._thumbMediaId = param1.thumbMediaRefId;
|
||||
this._choices = {
|
||||
"choice1Id":param1.choice1MovieNodeRefId,
|
||||
"choice2Id":param1.choice2MovieNodeRefId,
|
||||
"choice3Id":param1.choice3MovieNodeRefId
|
||||
};
|
||||
this._denRewardId = param1.denItemRefId;
|
||||
this._userVarId = param1.userVarRefId;
|
||||
this._bitIndex = param1.userVarBit;
|
||||
this._numChoices = param1.numChoices;
|
||||
this._subtitleId = param1.subtitleId;
|
||||
param1 = null;
|
||||
}
|
||||
|
||||
public function get defId() : int
|
||||
{
|
||||
return this._defId;
|
||||
}
|
||||
|
||||
public function get titleId() : int
|
||||
{
|
||||
return this._titleId;
|
||||
}
|
||||
|
||||
public function get streamId() : int
|
||||
{
|
||||
return this._streamId;
|
||||
}
|
||||
|
||||
public function get streamTitleId() : int
|
||||
{
|
||||
return this._streamTitleId;
|
||||
}
|
||||
|
||||
public function get mediaId() : int
|
||||
{
|
||||
return this._mediaId;
|
||||
}
|
||||
|
||||
public function get iconMediaId() : int
|
||||
{
|
||||
return this._iconMediaId;
|
||||
}
|
||||
|
||||
public function get thumbMediaId() : int
|
||||
{
|
||||
return this._thumbMediaId;
|
||||
}
|
||||
|
||||
public function getChoiceById(param1:int) : int
|
||||
{
|
||||
return this._choices["choice" + param1 + "Id"];
|
||||
}
|
||||
|
||||
public function get choice1Id() : int
|
||||
{
|
||||
return this._choices.choice1Id;
|
||||
}
|
||||
|
||||
public function get choice2Id() : int
|
||||
{
|
||||
return this._choices.choice2Id;
|
||||
}
|
||||
|
||||
public function get choice3Id() : int
|
||||
{
|
||||
return this._choices.choice3Id;
|
||||
}
|
||||
|
||||
public function get denRewardId() : int
|
||||
{
|
||||
return this._denRewardId;
|
||||
}
|
||||
|
||||
public function get userVarId() : int
|
||||
{
|
||||
return this._userVarId;
|
||||
}
|
||||
|
||||
public function get bitIndex() : int
|
||||
{
|
||||
return this._bitIndex;
|
||||
}
|
||||
|
||||
public function get numChoices() : int
|
||||
{
|
||||
return this._numChoices;
|
||||
}
|
||||
|
||||
public function set thisChapterHasGift(param1:Boolean) : void
|
||||
{
|
||||
this._thisChapterHasGift = param1;
|
||||
}
|
||||
|
||||
public function get thisChapterHasGift() : Boolean
|
||||
{
|
||||
return this._thisChapterHasGift;
|
||||
}
|
||||
|
||||
public function get isChapter() : Boolean
|
||||
{
|
||||
return this._isChapter;
|
||||
}
|
||||
|
||||
public function set isChapter(param1:Boolean) : void
|
||||
{
|
||||
this._isChapter = param1;
|
||||
}
|
||||
|
||||
public function get hasChosenThisChoice() : Boolean
|
||||
{
|
||||
return this._hasChosenThisChoice;
|
||||
}
|
||||
|
||||
public function set hasChosenThisChoice(param1:Boolean) : void
|
||||
{
|
||||
this._hasChosenThisChoice = param1;
|
||||
}
|
||||
|
||||
public function get subtitleId() : int
|
||||
{
|
||||
return this._subtitleId;
|
||||
}
|
||||
|
||||
public function set subtitleId(param1:int) : void
|
||||
{
|
||||
this._subtitleId = param1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package movie
|
||||
{
|
||||
public class MovieTreeNode extends MovieNode
|
||||
{
|
||||
|
||||
private var _isCorrectChoice:Boolean;
|
||||
|
||||
private var _nodeIndex:int;
|
||||
|
||||
private var _parentDefId:int;
|
||||
|
||||
public function MovieTreeNode(param1:Object)
|
||||
{
|
||||
super(param1);
|
||||
this.nodeIndex = 1;
|
||||
}
|
||||
|
||||
public function get isCorrectChoice() : Boolean
|
||||
{
|
||||
return this._isCorrectChoice;
|
||||
}
|
||||
|
||||
public function set isCorrectChoice(param1:Boolean) : void
|
||||
{
|
||||
this._isCorrectChoice = param1;
|
||||
}
|
||||
|
||||
public function get nodeIndex() : int
|
||||
{
|
||||
return this._nodeIndex;
|
||||
}
|
||||
|
||||
public function set nodeIndex(param1:int) : void
|
||||
{
|
||||
this._nodeIndex = param1;
|
||||
}
|
||||
|
||||
public function get parentDefId() : int
|
||||
{
|
||||
return this._parentDefId;
|
||||
}
|
||||
|
||||
public function set parentDefId(param1:int) : void
|
||||
{
|
||||
this._parentDefId = param1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,231 @@
|
||||
package movie
|
||||
{
|
||||
import loader.DefPacksDefHelper;
|
||||
|
||||
public class MovieXtCommManager
|
||||
{
|
||||
|
||||
private static var _movieNodeDefs:Object;
|
||||
|
||||
private static var _movieTrees:Object = {};
|
||||
|
||||
public function MovieXtCommManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function movieNodeResponse(param1:DefPacksDefHelper) : void
|
||||
{
|
||||
var _loc4_:Object = null;
|
||||
var _loc5_:Object = null;
|
||||
var _loc2_:Object = param1.def;
|
||||
DefPacksDefHelper.mediaArray[DefPacksDefHelper.DEF_MOVIE_NODE] = null;
|
||||
var _loc3_:Object = new Object();
|
||||
for each(_loc5_ in param1.def)
|
||||
{
|
||||
_loc4_ = {
|
||||
"choice1MovieNodeRefId":int(_loc5_.choice1MovieNodeRefId),
|
||||
"choice2MovieNodeRefId":int(_loc5_.choice2MovieNodeRefId),
|
||||
"choice3MovieNodeRefId":int(_loc5_.choice3MovieNodeRefId),
|
||||
"mediaRefId":int(_loc5_.mediaRefId),
|
||||
"iconMediaRefId":int(_loc5_.iconMediaRefId),
|
||||
"thumbMediaRefId":int(_loc5_.thumbMediaRefId),
|
||||
"denItemRefId":int(_loc5_.denItemRefId),
|
||||
"titleStrRef":int(_loc5_.titleStrRef),
|
||||
"streamRefId":int(_loc5_.streamRefId),
|
||||
"streamTitleStrRef":int(_loc5_.streamTitleStrRef),
|
||||
"userVarRefId":int(_loc5_.userVarRefId),
|
||||
"userVarBit":int(_loc5_.userVarBit),
|
||||
"subtitleId":int(_loc5_.subtitleRefId),
|
||||
"defId":int(_loc5_.id),
|
||||
"numChoices":0
|
||||
};
|
||||
_loc4_.numChoices = _loc4_.choice3MovieNodeRefId > 0 ? 3 : (_loc4_.choice2MovieNodeRefId > 0 ? 2 : (_loc4_.choice1MovieNodeRefId > 0 ? 1 : 0));
|
||||
_loc3_[_loc4_.defId] = _loc4_;
|
||||
}
|
||||
_movieNodeDefs = _loc3_;
|
||||
getAllContinuingNodes(1);
|
||||
}
|
||||
|
||||
public static function get movieDefs() : Object
|
||||
{
|
||||
return _movieNodeDefs;
|
||||
}
|
||||
|
||||
public static function getMovieDef(param1:int) : MovieNode
|
||||
{
|
||||
return new MovieNode(_movieNodeDefs[param1]);
|
||||
}
|
||||
|
||||
public static function getMovieNodeFromTree(param1:int, param2:int) : MovieNode
|
||||
{
|
||||
if(_movieTrees[param1] != null)
|
||||
{
|
||||
return _movieTrees[param1][param2];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function getAllContinuingNodes(param1:int) : Array
|
||||
{
|
||||
var _loc3_:MovieTreeNode = null;
|
||||
if(_movieTrees[param1] == null)
|
||||
{
|
||||
_movieTrees[param1] = new Object();
|
||||
_movieTrees[param1][param1] = getTreeMovieDef(param1);
|
||||
buildNodeTree(_movieTrees[param1][param1],param1);
|
||||
}
|
||||
var _loc2_:Array = [];
|
||||
for each(_loc3_ in _movieTrees[param1])
|
||||
{
|
||||
if(_loc3_.isCorrectChoice)
|
||||
{
|
||||
_loc2_.push(_loc3_);
|
||||
}
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
public static function getAllChapters(param1:int) : Array
|
||||
{
|
||||
var _loc3_:MovieTreeNode = null;
|
||||
if(_movieTrees[param1] == null)
|
||||
{
|
||||
_movieTrees[param1] = new Object();
|
||||
_movieTrees[param1][param1] = getTreeMovieDef(param1);
|
||||
buildNodeTree(_movieTrees[param1][param1],param1);
|
||||
}
|
||||
var _loc2_:Array = [];
|
||||
for each(_loc3_ in _movieTrees[param1])
|
||||
{
|
||||
if(_loc3_.isChapter)
|
||||
{
|
||||
_loc2_.push(_loc3_);
|
||||
}
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
public static function resetAllChosenChapters(param1:int) : void
|
||||
{
|
||||
var _loc2_:MovieTreeNode = null;
|
||||
for each(_loc2_ in _movieTrees[param1])
|
||||
{
|
||||
if(_loc2_.hasChosenThisChoice)
|
||||
{
|
||||
_loc2_.hasChosenThisChoice = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function getTreeMovieDef(param1:int) : MovieTreeNode
|
||||
{
|
||||
return new MovieTreeNode(_movieNodeDefs[param1]);
|
||||
}
|
||||
|
||||
private static function contains(param1:int, param2:int) : int
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:int = 0;
|
||||
if(_movieTrees[param1] != null)
|
||||
{
|
||||
_loc3_ = int(_movieTrees[param1].length);
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < _loc3_)
|
||||
{
|
||||
if(_movieTrees[param1][_loc4_].defId == param2)
|
||||
{
|
||||
return _loc4_;
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private static function buildNodeTree(param1:MovieTreeNode, param2:int) : void
|
||||
{
|
||||
var _loc3_:MovieTreeNode = null;
|
||||
if(param1.nodeIndex > 3)
|
||||
{
|
||||
if(param1.defId != param2)
|
||||
{
|
||||
_loc3_ = _movieTrees[param2][param1.parentDefId];
|
||||
++_loc3_.nodeIndex;
|
||||
buildNodeTree(_loc3_,param2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(param1.getChoiceById(param1.nodeIndex) == 0)
|
||||
{
|
||||
if(param1.defId == param2)
|
||||
{
|
||||
++param1.nodeIndex;
|
||||
buildNodeTree(param1,param2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(param1.userVarId != 0)
|
||||
{
|
||||
param1.isChapter = true;
|
||||
}
|
||||
if(param1.denRewardId > 0)
|
||||
{
|
||||
if(param1.isChapter)
|
||||
{
|
||||
param1.thisChapterHasGift = true;
|
||||
}
|
||||
else if(param1.parentDefId != 0)
|
||||
{
|
||||
_movieTrees[param2][param1.parentDefId].thisChapterHasGift = true;
|
||||
}
|
||||
}
|
||||
param1.isCorrectChoice = true;
|
||||
_loc3_ = _movieTrees[param2][param1.parentDefId];
|
||||
++_loc3_.nodeIndex;
|
||||
buildNodeTree(_loc3_,param2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
var _loc4_:MovieTreeNode = getTreeMovieDef(param1.getChoiceById(param1.nodeIndex));
|
||||
if(_loc4_ == null || _loc4_.nodeIndex > 3)
|
||||
{
|
||||
throw new Error("CurrChoiceNode was null or we are past 3rd index");
|
||||
}
|
||||
if(_loc4_.defId == param1.parentDefId)
|
||||
{
|
||||
param1.isChapter = false;
|
||||
_loc3_ = _movieTrees[param2][_loc4_.defId];
|
||||
if(_loc3_.defId != _loc4_.defId)
|
||||
{
|
||||
throw new Error("Parent def id did not match current choices def id");
|
||||
}
|
||||
++_loc3_.nodeIndex;
|
||||
buildNodeTree(_loc3_,param2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(param1.userVarId != 0)
|
||||
{
|
||||
param1.isChapter = true;
|
||||
}
|
||||
if(param1.denRewardId > 0)
|
||||
{
|
||||
if(param1.isChapter)
|
||||
{
|
||||
param1.thisChapterHasGift = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_movieTrees[param2][param1.parentDefId].thisChapterHasGift = true;
|
||||
}
|
||||
}
|
||||
param1.isCorrectChoice = true;
|
||||
_movieTrees[param2][_loc4_.defId] = _loc4_;
|
||||
_loc4_.parentDefId = param1.defId;
|
||||
buildNodeTree(_loc4_,param2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,783 @@
|
||||
package movie
|
||||
{
|
||||
import avatar.UserCommXtCommManager;
|
||||
import com.sbi.analytics.SBTracker;
|
||||
import com.sbi.corelib.audio.SBAudio;
|
||||
import com.sbi.loader.LoaderCache;
|
||||
import com.sbi.popup.SBOkPopup;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.text.TextField;
|
||||
import flash.text.TextFormat;
|
||||
import flash.utils.Timer;
|
||||
import flash.utils.getDefinitionByName;
|
||||
import game.MinigameManager;
|
||||
import gui.DarkenManager;
|
||||
import gui.GuiManager;
|
||||
import gui.LoadingSpiral;
|
||||
import loader.MediaHelper;
|
||||
import localization.LocalizationManager;
|
||||
import org.osmf.captioning.CaptioningPluginInfo;
|
||||
import org.osmf.captioning.model.Caption;
|
||||
import org.osmf.captioning.model.CaptionFormat;
|
||||
import org.osmf.captioning.model.CaptionStyle;
|
||||
import org.osmf.containers.MediaContainer;
|
||||
import org.osmf.elements.VideoElement;
|
||||
import org.osmf.events.BufferEvent;
|
||||
import org.osmf.events.DisplayObjectEvent;
|
||||
import org.osmf.events.LoadEvent;
|
||||
import org.osmf.events.MediaElementEvent;
|
||||
import org.osmf.events.MediaErrorEvent;
|
||||
import org.osmf.events.MediaFactoryEvent;
|
||||
import org.osmf.events.MediaPlayerCapabilityChangeEvent;
|
||||
import org.osmf.events.MediaPlayerStateChangeEvent;
|
||||
import org.osmf.events.PlayEvent;
|
||||
import org.osmf.events.TimeEvent;
|
||||
import org.osmf.events.TimelineMetadataEvent;
|
||||
import org.osmf.media.DefaultMediaFactory;
|
||||
import org.osmf.media.MediaElement;
|
||||
import org.osmf.media.MediaFactoryItem;
|
||||
import org.osmf.media.MediaPlayer;
|
||||
import org.osmf.media.MediaResourceBase;
|
||||
import org.osmf.media.PluginInfoResource;
|
||||
import org.osmf.media.URLResource;
|
||||
import org.osmf.metadata.Metadata;
|
||||
import org.osmf.metadata.TimelineMetadata;
|
||||
import org.osmf.net.DynamicStreamingResource;
|
||||
import org.osmf.net.NetLoader;
|
||||
import org.osmf.net.StreamType;
|
||||
import org.osmf.net.StreamingURLResource;
|
||||
import org.osmf.traits.MediaTraitType;
|
||||
import org.osmf.utils.FCSubscribeHandler;
|
||||
|
||||
public class VideoPlayerOSMF extends Sprite
|
||||
{
|
||||
|
||||
private var _videoMediaHelper:MediaHelper;
|
||||
|
||||
private var _playerPopup:MovieClip;
|
||||
|
||||
private var _videoLayer:Sprite;
|
||||
|
||||
private var _videoPlayer:MediaPlayer;
|
||||
|
||||
private var _loadingSpiral:LoadingSpiral;
|
||||
|
||||
private var _currVideoIdx:int;
|
||||
|
||||
private var _videos:Array;
|
||||
|
||||
private var _videoDesc:Array;
|
||||
|
||||
private var _subtitleIds:Array;
|
||||
|
||||
private var _loadText:TextField;
|
||||
|
||||
private var _hasMediaId:Boolean;
|
||||
|
||||
private var _skinFrameId:int = 1;
|
||||
|
||||
private var _subTitleTextField:TextField;
|
||||
|
||||
private var _graySubtitleBox:MovieClip;
|
||||
|
||||
private var _musicMutedByPlayer:Boolean;
|
||||
|
||||
private var _isReady:Boolean;
|
||||
|
||||
private var _isPaused:Boolean;
|
||||
|
||||
private var _readyToStart:Boolean;
|
||||
|
||||
private var _popupLoaded:Boolean;
|
||||
|
||||
private var _netConnected:Boolean;
|
||||
|
||||
private var _playerWidth:int;
|
||||
|
||||
private var _playerHeight:int;
|
||||
|
||||
private var _info:Object;
|
||||
|
||||
private var _shouldRepeatSingleMovie:Boolean;
|
||||
|
||||
private var _container:MediaContainer;
|
||||
|
||||
private var _videoElement:MediaElement;
|
||||
|
||||
private var _mediaFactory:DefaultMediaFactory;
|
||||
|
||||
private var _FCS:FCSubscribeHandler;
|
||||
|
||||
private var _isLive:Boolean;
|
||||
|
||||
private var _bufferTimer:Timer;
|
||||
|
||||
private var _startUpTimer:Timer;
|
||||
|
||||
private var _captionMetadata:TimelineMetadata;
|
||||
|
||||
private var _theaterWindow:MovieClip;
|
||||
|
||||
private var _mouseOverTimer:Timer;
|
||||
|
||||
private var _closeCallback:Function;
|
||||
|
||||
public function VideoPlayerOSMF()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:Array, param2:Array, param3:Array = null, param4:int = -1, param5:int = -1, param6:Boolean = true, param7:Number = 512, param8:Number = 288, param9:Function = null) : void
|
||||
{
|
||||
this._videos = param1;
|
||||
this._videoDesc = param3;
|
||||
this._subtitleIds = param2;
|
||||
this._playerWidth = param7;
|
||||
this._playerHeight = param8;
|
||||
this._shouldRepeatSingleMovie = param6;
|
||||
this._currVideoIdx = param5;
|
||||
this._closeCallback = param9;
|
||||
this._mouseOverTimer = new Timer(10,300);
|
||||
this._mouseOverTimer.addEventListener(TimerEvent.TIMER,this.onMouseOverTimer,false,0,true);
|
||||
if(this._currVideoIdx >= this._videos.length || this._currVideoIdx < 0)
|
||||
{
|
||||
this._currVideoIdx = Math.round(Math.random() * (this._videos.length - 1));
|
||||
}
|
||||
if(param4 >= 0)
|
||||
{
|
||||
this._videoMediaHelper = new MediaHelper();
|
||||
this._videoMediaHelper.init(param4,this.mediaHelperCallback);
|
||||
this._hasMediaId = true;
|
||||
}
|
||||
this._startUpTimer = new Timer(5000);
|
||||
this._videoPlayer = new MediaPlayer();
|
||||
this._container = new MediaContainer();
|
||||
this._mediaFactory = new DefaultMediaFactory();
|
||||
if(LocalizationManager.currentLanguage != LocalizationManager.LANG_ENG)
|
||||
{
|
||||
this.loadPlugin("org.osmf.captioning.CaptioningPluginInfo");
|
||||
}
|
||||
this._container.width = this._playerWidth;
|
||||
this._container.height = this._playerHeight;
|
||||
this._videoPlayer.autoPlay = true;
|
||||
this._videoPlayer.autoRewind = param6;
|
||||
this._videoPlayer.addEventListener(MediaPlayerCapabilityChangeEvent.CAN_PLAY_CHANGE,this.canPlay,false,0,true);
|
||||
this._videoPlayer.addEventListener(PlayEvent.PLAY_STATE_CHANGE,this.onStateChange,false,0,true);
|
||||
this._videoPlayer.addEventListener(BufferEvent.BUFFERING_CHANGE,this.onBufferChange,false,0,true);
|
||||
this._videoPlayer.addEventListener(MediaPlayerStateChangeEvent.MEDIA_PLAYER_STATE_CHANGE,this.onMediaPlayerStateChange,false,0,true);
|
||||
this._videoPlayer.addEventListener(DisplayObjectEvent.MEDIA_SIZE_CHANGE,this.onMediaSizeChange,false,0,true);
|
||||
this._videoPlayer.addEventListener(TimeEvent.COMPLETE,this.completeHandler,false,0,true);
|
||||
if(this._hasMediaId)
|
||||
{
|
||||
this._videoPlayer.addEventListener(LoadEvent.BYTES_LOADED_CHANGE,this.onBytesLoadedChange,false,0,true);
|
||||
}
|
||||
if(this._isLive)
|
||||
{
|
||||
this._videoPlayer.addEventListener(BufferEvent.BUFFER_LENGTH_CHANGE,this.onBufferLengthChange,false,0,true);
|
||||
}
|
||||
this._videoPlayer.currentTimeUpdateInterval = 100;
|
||||
if(this._hasMediaId)
|
||||
{
|
||||
this._container.x -= this._playerWidth * 0.5;
|
||||
this._container.y -= this._playerHeight * 0.5;
|
||||
UserCommXtCommManager.sendPermEmote(542,false);
|
||||
SBTracker.push();
|
||||
}
|
||||
else
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
this._theaterWindow = MovieClip(this.parent);
|
||||
this._theaterWindow.parent.mouseEnabled = true;
|
||||
this._theaterWindow.parent.mouseChildren = true;
|
||||
this._loadingSpiral = new LoadingSpiral(this._theaterWindow,this._theaterWindow.width * 0.5,this._theaterWindow.height * 0.5);
|
||||
this._theaterWindow.hoverState.addEventListener(MouseEvent.MOUSE_DOWN,this.onPlayPauseBtn,false,0,true);
|
||||
this._theaterWindow.hoverState.addEventListener(MouseEvent.ROLL_OUT,this.onRollOut,false,0,true);
|
||||
this._theaterWindow.hoverState.addEventListener(MouseEvent.ROLL_OVER,this.onRollOver,false,0,true);
|
||||
this._theaterWindow.playPauseBtn.visible = false;
|
||||
this._theaterWindow.playPauseBtn.gotoAndStop("pause");
|
||||
this._theaterWindow.videoLayer.addChild(this._container);
|
||||
this._subTitleTextField = this._theaterWindow.subtitle;
|
||||
this._subTitleTextField.htmlText = "";
|
||||
this._graySubtitleBox = this._theaterWindow.grayBox;
|
||||
this._graySubtitleBox.visible = false;
|
||||
this._popupLoaded = true;
|
||||
this.playVideoIdx(this._currVideoIdx);
|
||||
}
|
||||
}
|
||||
|
||||
private function loadPlugin(param1:String) : void
|
||||
{
|
||||
var _loc2_:MediaResourceBase = null;
|
||||
var _loc3_:Class = null;
|
||||
if(param1.substr(0,4) == "http" || param1.substr(0,4) == "file")
|
||||
{
|
||||
_loc2_ = new URLResource(param1);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_ = getDefinitionByName(param1) as Class;
|
||||
_loc2_ = new PluginInfoResource(new _loc3_());
|
||||
}
|
||||
this.loadPluginFromResource(_loc2_);
|
||||
}
|
||||
|
||||
private function loadPluginFromResource(param1:MediaResourceBase) : void
|
||||
{
|
||||
this._mediaFactory.addEventListener(MediaFactoryEvent.PLUGIN_LOAD,this.onPluginLoaded);
|
||||
this._mediaFactory.addEventListener(MediaFactoryEvent.PLUGIN_LOAD_ERROR,this.onPluginLoadFailed);
|
||||
this._mediaFactory.loadPlugin(param1);
|
||||
}
|
||||
|
||||
private function onPluginLoaded(param1:MediaFactoryEvent) : void
|
||||
{
|
||||
}
|
||||
|
||||
private function onPluginLoadFailed(param1:MediaFactoryEvent) : void
|
||||
{
|
||||
}
|
||||
|
||||
private function onPlayPauseBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(param1.currentTarget.parent.playPauseBtn.currentFrameLabel != "play")
|
||||
{
|
||||
this._videoPlayer.pause();
|
||||
this._mouseOverTimer.reset();
|
||||
param1.currentTarget.parent.playPauseBtn.gotoAndStop("play");
|
||||
}
|
||||
else if(param1.currentTarget.parent.playPauseBtn.currentFrameLabel != "pause")
|
||||
{
|
||||
param1.currentTarget.parent.playPauseBtn.gotoAndStop("pause");
|
||||
this._videoPlayer.play();
|
||||
this._mouseOverTimer.start();
|
||||
param1.currentTarget.parent.playPauseBtn.alpha = 1;
|
||||
}
|
||||
}
|
||||
|
||||
private function onRollOut(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(param1.currentTarget.parent.playPauseBtn.currentFrameLabel != "play")
|
||||
{
|
||||
this._mouseOverTimer.reset();
|
||||
param1.currentTarget.parent.playPauseBtn.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private function onRollOver(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(param1.currentTarget.parent.playPauseBtn.currentFrameLabel != "play")
|
||||
{
|
||||
this._mouseOverTimer.start();
|
||||
param1.currentTarget.parent.playPauseBtn.alpha = 1;
|
||||
param1.currentTarget.parent.playPauseBtn.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
private function onMouseOverTimer(param1:TimerEvent) : void
|
||||
{
|
||||
if(param1.currentTarget.currentCount > 200)
|
||||
{
|
||||
if(this._theaterWindow)
|
||||
{
|
||||
this._theaterWindow.playPauseBtn.alpha -= 0.01;
|
||||
}
|
||||
else if(this._playerPopup)
|
||||
{
|
||||
this._playerPopup.playPauseBtn.alpha -= 0.01;
|
||||
}
|
||||
if(param1.currentTarget.currentCount == this._mouseOverTimer.repeatCount)
|
||||
{
|
||||
this._mouseOverTimer.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onBytesLoadedChange(param1:LoadEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(this._playerPopup.loadTxt)
|
||||
{
|
||||
this._playerPopup.loadTxt.text = int(param1.bytes / param1.currentTarget.bytesTotal * 100) + "%";
|
||||
}
|
||||
}
|
||||
|
||||
private function onBufferLengthChange(param1:BufferEvent) : void
|
||||
{
|
||||
if(param1.bufferLength <= 0.01)
|
||||
{
|
||||
this._bufferTimer = new Timer(10000);
|
||||
this._bufferTimer.addEventListener(TimerEvent.TIMER,this.onCheckBufferLength);
|
||||
this._bufferTimer.start();
|
||||
}
|
||||
else if(this._bufferTimer)
|
||||
{
|
||||
this._bufferTimer.stop();
|
||||
this._bufferTimer.removeEventListener(TimerEvent.TIMER,this.onCheckBufferLength);
|
||||
this._bufferTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function onMediaPlayerStateChange(param1:MediaPlayerStateChangeEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(param1.state == "buffering")
|
||||
{
|
||||
}
|
||||
if(param1.state == "playing")
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private function onCheckBufferLength(param1:TimerEvent) : void
|
||||
{
|
||||
new SBOkPopup(GuiManager.guiLayer,"This video is not available anymore.");
|
||||
}
|
||||
|
||||
private function onBufferChange(param1:BufferEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(param1.buffering)
|
||||
{
|
||||
this.addSpiral();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.removeSpiral();
|
||||
}
|
||||
}
|
||||
|
||||
private function onTimeEvent(param1:TimeEvent) : void
|
||||
{
|
||||
}
|
||||
|
||||
private function canPlay(param1:MediaPlayerCapabilityChangeEvent) : void
|
||||
{
|
||||
if(this._startUpTimer)
|
||||
{
|
||||
this._startUpTimer.addEventListener(TimerEvent.TIMER,this.onStartupCheck);
|
||||
this._startUpTimer.start();
|
||||
}
|
||||
}
|
||||
|
||||
private function onMediaSizeChange(param1:DisplayObjectEvent) : void
|
||||
{
|
||||
if(this._startUpTimer)
|
||||
{
|
||||
this._startUpTimer.stop();
|
||||
this._startUpTimer.removeEventListener(TimerEvent.TIMER,this.onStartupCheck);
|
||||
this._startUpTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function onStartupCheck(param1:TimerEvent) : void
|
||||
{
|
||||
this._startUpTimer.stop();
|
||||
this._startUpTimer.removeEventListener(TimerEvent.TIMER,this.onStartupCheck);
|
||||
this._startUpTimer = null;
|
||||
}
|
||||
|
||||
private function onStateChange(param1:PlayEvent) : void
|
||||
{
|
||||
if(param1.playState == "playing")
|
||||
{
|
||||
SBTracker.trackPageview("/game/play/video/#" + this._videos[this._currVideoIdx]);
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
this.destroyPlayerItems();
|
||||
if(this._videoMediaHelper)
|
||||
{
|
||||
this._videoMediaHelper.destroy();
|
||||
this._videoMediaHelper = null;
|
||||
}
|
||||
if(this._playerPopup)
|
||||
{
|
||||
this._playerPopup.removeEventListener(MouseEvent.MOUSE_DOWN,this.mouseDown);
|
||||
this._playerPopup.visible = false;
|
||||
this._playerPopup = null;
|
||||
}
|
||||
if(this._loadingSpiral)
|
||||
{
|
||||
this._loadingSpiral.destroy();
|
||||
this._loadingSpiral = null;
|
||||
}
|
||||
this._videos = null;
|
||||
this._videoDesc = null;
|
||||
if(this._musicMutedByPlayer)
|
||||
{
|
||||
this._musicMutedByPlayer = false;
|
||||
SBAudio.unmuteMusic(false);
|
||||
}
|
||||
if(!MinigameManager.inMinigame() && this._hasMediaId)
|
||||
{
|
||||
UserCommXtCommManager.sendPermEmote(-1,false);
|
||||
}
|
||||
}
|
||||
|
||||
public function toggleSound() : void
|
||||
{
|
||||
if(this._videoPlayer.volume == 0)
|
||||
{
|
||||
this._videoPlayer.volume = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._videoPlayer.volume = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public function setSkinFrame(param1:int) : void
|
||||
{
|
||||
this._skinFrameId = param1;
|
||||
if(Boolean(this._playerPopup) && this._playerPopup.currentFrame != this._skinFrameId)
|
||||
{
|
||||
this._playerPopup.gotoAndPlay(this._skinFrameId);
|
||||
}
|
||||
}
|
||||
|
||||
private function destroyPlayerItems() : void
|
||||
{
|
||||
if(this._startUpTimer)
|
||||
{
|
||||
this._startUpTimer.stop();
|
||||
this._startUpTimer.removeEventListener(TimerEvent.TIMER,this.onStartupCheck);
|
||||
this._startUpTimer = null;
|
||||
}
|
||||
if(this._bufferTimer)
|
||||
{
|
||||
this._bufferTimer.stop();
|
||||
this._bufferTimer.removeEventListener(TimerEvent.TIMER,this.onCheckBufferLength);
|
||||
this._bufferTimer = null;
|
||||
}
|
||||
if(this._videoPlayer)
|
||||
{
|
||||
this._videoPlayer.stop();
|
||||
this._videoPlayer.media = null;
|
||||
if(this._container.containsMediaElement(this._videoElement))
|
||||
{
|
||||
this._container.removeMediaElement(this._videoElement);
|
||||
}
|
||||
while(this._container.numChildren > 0)
|
||||
{
|
||||
this._container.removeChildAt(0);
|
||||
}
|
||||
this._videoPlayer.removeEventListener(MediaPlayerCapabilityChangeEvent.CAN_PLAY_CHANGE,this.canPlay);
|
||||
this._videoPlayer.removeEventListener(PlayEvent.PLAY_STATE_CHANGE,this.onStateChange);
|
||||
this._videoPlayer.removeEventListener(BufferEvent.BUFFERING_CHANGE,this.onBufferChange);
|
||||
this._videoPlayer.removeEventListener(MediaPlayerStateChangeEvent.MEDIA_PLAYER_STATE_CHANGE,this.onMediaPlayerStateChange);
|
||||
this._videoPlayer.removeEventListener(DisplayObjectEvent.MEDIA_SIZE_CHANGE,this.onMediaSizeChange);
|
||||
if(this._isLive)
|
||||
{
|
||||
this._videoPlayer.removeEventListener(BufferEvent.BUFFER_LENGTH_CHANGE,this.onBufferLengthChange);
|
||||
}
|
||||
this._videoElement = null;
|
||||
this._container = null;
|
||||
this._videoPlayer = null;
|
||||
this._mediaFactory = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function mediaHelperCallback(param1:MovieClip) : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
if(param1)
|
||||
{
|
||||
this._playerPopup = MovieClip(param1.getChildAt(0));
|
||||
if(this._playerPopup.currentFrame != this._skinFrameId)
|
||||
{
|
||||
this._playerPopup.gotoAndPlay(this._skinFrameId);
|
||||
}
|
||||
GuiManager.guiLayer.addChild(this._playerPopup);
|
||||
if(Boolean(this._videoDesc) && this._videoDesc.length > 0)
|
||||
{
|
||||
LocalizationManager.translateId(this._playerPopup.videoTitleTxt,this._videoDesc[this._currVideoIdx]);
|
||||
}
|
||||
else
|
||||
{
|
||||
LocalizationManager.translateId(this._playerPopup.videoTitleTxt,11392);
|
||||
}
|
||||
this._playerPopup.x = MainFrame.VIEW_WIDTH * 0.5;
|
||||
this._playerPopup.y = MainFrame.VIEW_HEIGHT * 0.5;
|
||||
this._playerPopup.itemLayer.addChild(this._container);
|
||||
this._playerPopup["bx"].addEventListener(MouseEvent.MOUSE_DOWN,this.onClose);
|
||||
this._playerPopup.hoverState.addEventListener(MouseEvent.MOUSE_DOWN,this.onPlayPauseBtn);
|
||||
this._playerPopup.hoverState.addEventListener(MouseEvent.ROLL_OUT,this.onRollOut,false,0,true);
|
||||
this._playerPopup.hoverState.addEventListener(MouseEvent.ROLL_OVER,this.onRollOver,false,0,true);
|
||||
this._playerPopup.playPauseBtn.visible = false;
|
||||
this._playerPopup.playPauseBtn.gotoAndStop("pause");
|
||||
this._playerPopup.loadTxt.text = "0%";
|
||||
this._subTitleTextField = this._playerPopup.subtitle;
|
||||
this._subTitleTextField.htmlText = "";
|
||||
this._graySubtitleBox = this._playerPopup.grayBox;
|
||||
this._graySubtitleBox.visible = false;
|
||||
this._playerPopup.addEventListener(MouseEvent.MOUSE_DOWN,this.mouseDown);
|
||||
DarkenManager.darken(this._playerPopup);
|
||||
this._loadingSpiral = new LoadingSpiral(this._playerPopup.itemLayer);
|
||||
this._popupLoaded = true;
|
||||
this.playVideoIdx(this._currVideoIdx);
|
||||
}
|
||||
}
|
||||
|
||||
public function playVideoIdx(param1:int) : void
|
||||
{
|
||||
this._currVideoIdx = param1;
|
||||
this.playNonStreaming();
|
||||
}
|
||||
|
||||
private function playNonStreaming() : void
|
||||
{
|
||||
var _loc3_:Metadata = null;
|
||||
var _loc1_:URLResource = new URLResource(LoaderCache.fetchCDNURL("streams/" + this._videos[this._currVideoIdx] + ".flv"));
|
||||
this.onHideCaption(null);
|
||||
if(LocalizationManager.currentLanguage != LocalizationManager.LANG_ENG && this._subtitleIds[this._currVideoIdx] != 0)
|
||||
{
|
||||
_loc3_ = new Metadata();
|
||||
_loc3_.addValue(CaptioningPluginInfo.CAPTIONING_METADATA_KEY_URI,LoaderCache.fetchCDNURL("subtitle/" + this._subtitleIds[this._currVideoIdx] + "/" + LocalizationManager.currentLanguage));
|
||||
MediaResourceBase(_loc1_).addMetadataValue(CaptioningPluginInfo.CAPTIONING_METADATA_NAMESPACE,_loc3_);
|
||||
}
|
||||
var _loc2_:NetLoader = new NetLoader();
|
||||
this._mediaFactory.addItem(new MediaFactoryItem("org.osmf.elements.video",_loc2_.canHandleResource,this.createVideoElement));
|
||||
this._videoElement = this._mediaFactory.createMediaElement(_loc1_);
|
||||
this._videoElement.addEventListener(MediaElementEvent.TRAIT_ADD,this.onTraitAdd);
|
||||
this._captionMetadata = this._videoElement.getMetadata(CaptioningPluginInfo.CAPTIONING_TEMPORAL_METADATA_NAMESPACE) as TimelineMetadata;
|
||||
if(this._captionMetadata == null)
|
||||
{
|
||||
this._captionMetadata = new TimelineMetadata(this._videoElement);
|
||||
this._videoElement.addMetadata(CaptioningPluginInfo.CAPTIONING_TEMPORAL_METADATA_NAMESPACE,this._captionMetadata);
|
||||
}
|
||||
this._captionMetadata.addEventListener(TimelineMetadataEvent.MARKER_TIME_REACHED,this.onShowCaption);
|
||||
this._captionMetadata.addEventListener(TimelineMetadataEvent.MARKER_ADD,this.onHideCaption);
|
||||
this._videoElement.addEventListener(MediaErrorEvent.MEDIA_ERROR,this.onMediaError,false,0,true);
|
||||
this.setMediaElement(this._videoElement);
|
||||
this.enablePlayerControls(true);
|
||||
if(!SBAudio.isMusicMuted)
|
||||
{
|
||||
SBAudio.muteMusic(false);
|
||||
this._musicMutedByPlayer = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._videoPlayer.volume = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private function setMediaElement(param1:MediaElement) : void
|
||||
{
|
||||
if(this._videoPlayer.media != null && this._container.containsMediaElement(this._videoPlayer.media))
|
||||
{
|
||||
this._container.removeMediaElement(this._videoPlayer.media);
|
||||
}
|
||||
if(param1 != null)
|
||||
{
|
||||
this._container.addMediaElement(param1);
|
||||
}
|
||||
this._videoPlayer.media = param1;
|
||||
}
|
||||
|
||||
private function enablePlayerControls(param1:Boolean = true) : void
|
||||
{
|
||||
}
|
||||
|
||||
private function createVideoElement() : MediaElement
|
||||
{
|
||||
return new VideoElement();
|
||||
}
|
||||
|
||||
private function onTraitAdd(param1:MediaElementEvent) : void
|
||||
{
|
||||
switch(param1.traitType)
|
||||
{
|
||||
case MediaTraitType.SEEK:
|
||||
}
|
||||
}
|
||||
|
||||
private function onShowCaption(param1:TimelineMetadataEvent) : void
|
||||
{
|
||||
var _loc2_:Caption = param1.marker as Caption;
|
||||
if(_loc2_ != null)
|
||||
{
|
||||
this._subTitleTextField.htmlText = _loc2_.text;
|
||||
if(!this._graySubtitleBox.visible)
|
||||
{
|
||||
this._graySubtitleBox.visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onHideCaption(param1:TimelineMetadataEvent) : void
|
||||
{
|
||||
this._subTitleTextField.htmlText = "";
|
||||
this._graySubtitleBox.visible = false;
|
||||
}
|
||||
|
||||
private function onMediaError(param1:MediaErrorEvent) : void
|
||||
{
|
||||
}
|
||||
|
||||
private function formatCaption(param1:Caption) : void
|
||||
{
|
||||
var _loc3_:CaptionFormat = null;
|
||||
var _loc4_:TextFormat = null;
|
||||
var _loc5_:CaptionStyle = null;
|
||||
var _loc2_:uint = 0;
|
||||
while(_loc2_ < param1.numCaptionFormats)
|
||||
{
|
||||
_loc3_ = param1.getCaptionFormatAt(_loc2_);
|
||||
_loc4_ = new TextFormat();
|
||||
_loc5_ = _loc3_.style;
|
||||
if(_loc5_.textColor != null)
|
||||
{
|
||||
_loc4_.color = _loc5_.textColor;
|
||||
}
|
||||
if(_loc5_.fontFamily != "")
|
||||
{
|
||||
_loc4_.font = _loc5_.fontFamily;
|
||||
}
|
||||
if(_loc5_.fontSize > 0)
|
||||
{
|
||||
_loc4_.size = _loc5_.fontSize;
|
||||
}
|
||||
if(_loc5_.fontStyle != "")
|
||||
{
|
||||
_loc4_.italic = _loc5_.fontStyle == "italic" ? true : false;
|
||||
}
|
||||
if(_loc5_.fontWeight != "")
|
||||
{
|
||||
_loc4_.bold = _loc5_.fontWeight == "bold" ? true : false;
|
||||
}
|
||||
if(_loc5_.textAlign != "")
|
||||
{
|
||||
_loc4_.align = _loc5_.textAlign;
|
||||
}
|
||||
this._playerPopup.subtitle.setTextFormat(_loc4_,_loc3_.startIndex,_loc3_.endIndex);
|
||||
if(this._playerPopup.subtitle.wordWrap != _loc5_.wrapOption)
|
||||
{
|
||||
this._playerPopup.subtitle.wordWrap = _loc5_.wrapOption;
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
}
|
||||
|
||||
private function onSMILPluginLoaded(param1:MediaFactoryEvent) : void
|
||||
{
|
||||
var _loc2_:DynamicStreamingResource = new DynamicStreamingResource("http://wac.6A16.edgecastcdn.net/006A16/IntroVideo/manifest.smil",StreamType.RECORDED);
|
||||
_loc2_.urlIncludesFMSApplicationInstance = true;
|
||||
this._videoElement = this._mediaFactory.createMediaElement(_loc2_);
|
||||
this._videoPlayer.media = this._videoElement;
|
||||
this._videoPlayer.bufferTime = 6;
|
||||
this._container.addMediaElement(this._videoElement);
|
||||
if(SBAudio.isMusicMuted)
|
||||
{
|
||||
this._videoPlayer.volume = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private function playLiveStream(param1:int) : void
|
||||
{
|
||||
this._FCS = new FCSubscribeHandler();
|
||||
this._FCS.run("mba_opensea","rtmp://fml.6A16.edgecastcdn.net/206A16",this);
|
||||
}
|
||||
|
||||
public function fcSubscribeDone() : void
|
||||
{
|
||||
var _loc1_:StreamingURLResource = new StreamingURLResource("rtmp://fml.6A16.edgecastcdn.net/206A16/mba_opensea",StreamType.LIVE);
|
||||
this._videoElement = this._mediaFactory.createMediaElement(_loc1_);
|
||||
this._videoPlayer.media = this._videoElement;
|
||||
this._videoPlayer.bufferTime = 6;
|
||||
this._container.addMediaElement(this._videoElement);
|
||||
if(SBAudio.isMusicMuted)
|
||||
{
|
||||
this._videoPlayer.volume = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private function onPluginLoadError(param1:MediaFactoryEvent) : void
|
||||
{
|
||||
}
|
||||
|
||||
private function completeHandler(param1:TimeEvent) : void
|
||||
{
|
||||
this.addSpiral();
|
||||
this._videoPlayer.stop();
|
||||
this._container.removeMediaElement(this._videoElement);
|
||||
if(this._currVideoIdx < this._videos.length - 1)
|
||||
{
|
||||
++this._currVideoIdx;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._currVideoIdx = 0;
|
||||
}
|
||||
if(this._shouldRepeatSingleMovie)
|
||||
{
|
||||
this.playVideoIdx(this._currVideoIdx);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.onClose(null);
|
||||
}
|
||||
}
|
||||
|
||||
private function onClose(param1:MouseEvent) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
DarkenManager.unDarken(this._playerPopup);
|
||||
if(this._hasMediaId)
|
||||
{
|
||||
SBTracker.pop();
|
||||
}
|
||||
this.destroy();
|
||||
if(this._closeCallback != null)
|
||||
{
|
||||
this._closeCallback();
|
||||
this._closeCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function removeSpiral() : void
|
||||
{
|
||||
if(this._hasMediaId)
|
||||
{
|
||||
if(this._playerPopup.itemLayer.contains(this._loadingSpiral))
|
||||
{
|
||||
this._playerPopup.itemLayer.removeChild(this._loadingSpiral);
|
||||
}
|
||||
}
|
||||
else if(this._theaterWindow.contains(this._loadingSpiral))
|
||||
{
|
||||
this._theaterWindow.removeChild(this._loadingSpiral);
|
||||
}
|
||||
}
|
||||
|
||||
private function addSpiral() : void
|
||||
{
|
||||
if(this._hasMediaId)
|
||||
{
|
||||
if(Boolean(this._loadingSpiral) && !this._playerPopup.itemLayer.contains(this._loadingSpiral))
|
||||
{
|
||||
this._playerPopup.itemLayer.addChild(this._loadingSpiral);
|
||||
}
|
||||
}
|
||||
else if(Boolean(this._loadingSpiral) && !this._theaterWindow.contains(this._loadingSpiral))
|
||||
{
|
||||
this._theaterWindow.addChild(this._loadingSpiral);
|
||||
}
|
||||
}
|
||||
|
||||
private function mouseDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user