Last active
August 17, 2021 03:36
-
-
Save caizixian/3f7aa7c84ea390ddf714 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package { | |
import flash.display.*; | |
import flash.text.*; | |
public dynamic class CaptionTip extends MovieClip { | |
public var captionTiptxt:TextField; | |
} | |
}//package | |
package { | |
import flash.display.*; | |
import flash.text.*; | |
public dynamic class copyBtn extends SimpleButton { | |
public var btnTxt:TextField; | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class SettingCtrlBtn extends SimpleButton { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class smallTipBg extends MovieClip { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class commonCheckBtn extends MovieClip { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class MenuPanelBg extends MovieClip { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class menuFullScreenBtn extends SimpleButton { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class CloseSoundBt extends SimpleButton { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class prePageBtn extends SimpleButton { | |
} | |
}//package | |
package { | |
import flash.events.*; | |
import flash.display.*; | |
import flash.text.*; | |
public dynamic class AutoSeekTips extends MovieClip { | |
public var txt:TextField; | |
public var bt:SimpleButton; | |
public var replayBt:SimpleButton; | |
public var line:MovieClip; | |
public function AutoSeekTips(){ | |
addFrameScript(0, this.frame1, 213, this.frame214); | |
} | |
function frame1(){ | |
visible = true; | |
this.bt.addEventListener(MouseEvent.CLICK, function (_arg1){ | |
gotoAndStop("end"); | |
}); | |
} | |
function frame214(){ | |
stop(); | |
visible = false; | |
} | |
} | |
}//package | |
package mx.core { | |
public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal"; | |
}//package mx.core | |
package mx.utils { | |
import mx.core.*; | |
public class StringUtil { | |
mx_internal static const VERSION:String = "4.6.0.23201"; | |
public static function trim(_arg1:String):String{ | |
if (_arg1 == null){ | |
return (""); | |
}; | |
var _local2:int; | |
while (isWhitespace(_arg1.charAt(_local2))) { | |
_local2++; | |
}; | |
var _local3:int = (_arg1.length - 1); | |
while (isWhitespace(_arg1.charAt(_local3))) { | |
_local3--; | |
}; | |
if (_local3 >= _local2){ | |
return (_arg1.slice(_local2, (_local3 + 1))); | |
}; | |
return (""); | |
} | |
public static function trimArrayElements(_arg1:String, _arg2:String):String{ | |
var _local3:Array; | |
var _local4:int; | |
var _local5:int; | |
if (((!((_arg1 == ""))) && (!((_arg1 == null))))){ | |
_local3 = _arg1.split(_arg2); | |
_local4 = _local3.length; | |
_local5 = 0; | |
while (_local5 < _local4) { | |
_local3[_local5] = StringUtil.trim(_local3[_local5]); | |
_local5++; | |
}; | |
if (_local4 > 0){ | |
_arg1 = _local3.join(_arg2); | |
}; | |
}; | |
return (_arg1); | |
} | |
public static function isWhitespace(_arg1:String):Boolean{ | |
switch (_arg1){ | |
case " ": | |
case "\t": | |
case "\r": | |
case "\n": | |
case "\f": | |
return (true); | |
default: | |
return (false); | |
}; | |
} | |
public static function substitute(_arg1:String, ... _args):String{ | |
var _local4:Array; | |
if (_arg1 == null){ | |
return (""); | |
}; | |
var _local3:uint = _args.length; | |
if ((((_local3 == 1)) && ((_args[0] is Array)))){ | |
_local4 = (_args[0] as Array); | |
_local3 = _local4.length; | |
} else { | |
_local4 = _args; | |
}; | |
var _local5:int; | |
while (_local5 < _local3) { | |
_arg1 = _arg1.replace(new RegExp((("\\{" + _local5) + "\\}"), "g"), _local4[_local5]); | |
_local5++; | |
}; | |
return (_arg1); | |
} | |
public static function repeat(_arg1:String, _arg2:int):String{ | |
if (_arg2 == 0){ | |
return (""); | |
}; | |
var _local3:String = _arg1; | |
var _local4 = 1; | |
while (_local4 < _arg2) { | |
_local3 = (_local3 + _arg1); | |
_local4++; | |
}; | |
return (_local3); | |
} | |
public static function restrict(_arg1:String, _arg2:String):String{ | |
var _local6:uint; | |
if (_arg2 == null){ | |
return (_arg1); | |
}; | |
if (_arg2 == ""){ | |
return (""); | |
}; | |
var _local3:Array = []; | |
var _local4:int = _arg1.length; | |
var _local5:int; | |
while (_local5 < _local4) { | |
_local6 = _arg1.charCodeAt(_local5); | |
if (testCharacter(_local6, _arg2)){ | |
_local3.push(_local6); | |
}; | |
_local5++; | |
}; | |
return (String.fromCharCode.apply(null, _local3)); | |
} | |
private static function testCharacter(_arg1:uint, _arg2:String):Boolean{ | |
var _local9:uint; | |
var _local11:Boolean; | |
var _local3:Boolean; | |
var _local4:Boolean; | |
var _local5:Boolean; | |
var _local6:Boolean; | |
var _local7:uint; | |
var _local8:int = _arg2.length; | |
if (_local8 > 0){ | |
_local9 = _arg2.charCodeAt(0); | |
if (_local9 == 94){ | |
_local3 = true; | |
}; | |
}; | |
var _local10:int; | |
while (_local10 < _local8) { | |
_local9 = _arg2.charCodeAt(_local10); | |
_local11 = false; | |
if (!_local4){ | |
if (_local9 == 45){ | |
_local5 = true; | |
} else { | |
if (_local9 == 94){ | |
_local6 = !(_local6); | |
} else { | |
if (_local9 == 92){ | |
_local4 = true; | |
} else { | |
_local11 = true; | |
}; | |
}; | |
}; | |
} else { | |
_local11 = true; | |
_local4 = false; | |
}; | |
if (_local11){ | |
if (_local5){ | |
if ((((_local7 <= _arg1)) && ((_arg1 <= _local9)))){ | |
_local3 = _local6; | |
}; | |
_local5 = false; | |
_local7 = 0; | |
} else { | |
if (_arg1 == _local9){ | |
_local3 = _local6; | |
}; | |
_local7 = _local9; | |
}; | |
}; | |
_local10++; | |
}; | |
return (_local3); | |
} | |
} | |
}//package mx.utils | |
package { | |
import flash.display.*; | |
public dynamic class closeBtn extends SimpleButton { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
import flash.text.*; | |
public dynamic class historyLine2 extends MovieClip { | |
public var poslook:TextField; | |
public var title:TextField; | |
public var continueTxt:TextField; | |
public var time:TextField; | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class shareNetease extends SimpleButton { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class shareSina extends SimpleButton { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class sharePanelBg extends MovieClip { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
import flash.text.*; | |
public dynamic class Warning extends MovieClip { | |
public var warningtip:TextField; | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class shareDouban extends SimpleButton { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class clearHistoryBtn extends SimpleButton { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class devLine extends MovieClip { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class PlayBt_Big extends SimpleButton { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class ExitFullScreenBt extends SimpleButton { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class MidAdCloseBtn extends SimpleButton { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
import flash.text.*; | |
public dynamic class shareBtnTip extends MovieClip { | |
public var shareTipTxt:TextField; | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class NextPageBtn extends SimpleButton { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class shareSouhu extends SimpleButton { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class SettingPanel extends MovieClip { | |
public var cancelbtn:cancelBtn; | |
public var settingCloseBtn:closeBtn; | |
public var lbCheckBtn:commonCheckBtn; | |
public var savebtn:okBtn; | |
} | |
}//package | |
package { | |
import flash.display.*; | |
import flash.text.*; | |
public dynamic class TimeTip extends MovieClip { | |
public var timetxt:TextField; | |
} | |
}//package | |
package { | |
import flash.display.*; | |
import flash.text.*; | |
public dynamic class sharePanel extends MovieClip { | |
public var copybtn1:copyBtn; | |
public var copybtn2:copyBtn; | |
public var copybtn3:copyBtn; | |
public var shareNeteaseBtn:shareNetease; | |
public var shareSouhuBtn:shareSouhu; | |
public var shareTencentBtn:shareTencent; | |
public var shareClose:closeBtn; | |
public var panelBg:sharePanelBg; | |
public var copyText1:TextField; | |
public var copyText2:TextField; | |
public var copyText3:TextField; | |
public var shareKaixinBtn:shareKaixin; | |
public var shareSinaBtn:shareSina; | |
public var shareDoubanBtn:shareDouban; | |
public var shareRenrenBtn:shareRenren; | |
public var shareQzoneBtn:shareQzone; | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class shareQzone extends SimpleButton { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class okBtn extends SimpleButton { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class cancelBtn extends SimpleButton { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class VolumeLine extends MovieClip { | |
public var volume:MovieClip; | |
public var volumebtn:MovieClip; | |
public var volumebg:MovieClip; | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class shareRenren extends SimpleButton { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class menuShareBtn extends SimpleButton { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class shareKaixin extends SimpleButton { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class menuHistoryBtn extends SimpleButton { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class menuFullScreenBtn2 extends SimpleButton { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class shareTencent extends SimpleButton { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class OpenSoundBt extends SimpleButton { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
import flash.text.*; | |
public dynamic class smallTip extends MovieClip { | |
public var txt:TextField; | |
public var bg:smallTipBg; | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class replayBtn extends SimpleButton { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class ProgressBar_Base extends MovieClip { | |
public var bottomBar:MovieClip; | |
public var timePointBt:MovieClip; | |
public var playTimeBar:MovieClip; | |
public var loadedBar:MovieClip; | |
} | |
}//package | |
package { | |
import flash.display.*; | |
import flash.text.*; | |
public dynamic class CtrlBar_Base extends MovieClip { | |
public var timeTxt:TextField; | |
public var playBt:SimpleButton; | |
public var captionDevline:devLine; | |
public var progressBar:ProgressBar_Base; | |
public var pauseBt:SimpleButton; | |
public var qualityDevline:devLine; | |
public var openlogo:MovieClip; | |
public var settingDevline:devLine; | |
public var settingBtn:SettingCtrlBtn; | |
public var logoDevline:devLine; | |
public var bgMc:MovieClip; | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class menuPanel extends MovieClip { | |
public var fullScreenBtn2:menuFullScreenBtn2; | |
public var fullScreenBtn:menuFullScreenBtn; | |
public var historyBtn:menuHistoryBtn; | |
public var menuPanelBg:MenuPanelBg; | |
public var shareBtn:menuShareBtn; | |
} | |
}//package | |
package com.netease.openplayer { | |
import com.netease.eduplayercore.interfaces.*; | |
import com.netease.openplayer.model.*; | |
import com.netease.eduplayercore.*; | |
import com.netease.eduplayercore.events.*; | |
import com.google.analytics.*; | |
import com.netease.openplayer.util.*; | |
import com.netease.eduplayercore.log.*; | |
public class OpenLog extends VideoLog { | |
private var _movieData:OpenMovieData; | |
private var _postutil:PostUtil; | |
private var _uuLog:UulogUtil; | |
private var _canRecord:Boolean = true; | |
public function OpenLog(_arg1:IMediaCore){ | |
super(_arg1); | |
this._postutil = new PostUtil(); | |
} | |
override protected function stateLoghandler(_arg1:PlayerStateEvent):void{ | |
super.stateLoghandler(_arg1); | |
if (!this._canRecord){ | |
return; | |
}; | |
switch (_arg1.newstate){ | |
case PlayerStates.PLAYING: | |
if (!this._movieData.hasSendVV){ | |
this._postutil.sendVV(); | |
this._movieData.hasSendVV = true; | |
}; | |
break; | |
case PlayerStates.PAUSE: | |
if (this._uuLog){ | |
this._uuLog.pauseRecord(); | |
}; | |
break; | |
case PlayerStates.COMPLETE: | |
GlobalData.recordObj.setLocalHistoryComplete(); | |
GlobalData.recordObj.sendRecordToRemote(NaN, true); | |
this._postutil.sendProgress(); | |
break; | |
}; | |
} | |
override protected function mediaLoghandler(_arg1:MediaEvent):void{ | |
super.mediaLoghandler(_arg1); | |
if (!this._canRecord){ | |
return; | |
}; | |
switch (_arg1.type){ | |
case MediaEvent.PLAYER_MEDIA_NEWMOVIE: | |
this._movieData = (_arg1.data as OpenMovieData); | |
break; | |
case MediaEvent.PLAYER_MEDIA_META: | |
if (!this._uuLog){ | |
this._uuLog = new UulogUtil(_arg1.metadata.duration); | |
}; | |
_currentLogData.loadMetaTime = new Date().time; | |
this._postutil.sendVideoLog(this.getOpenLogData()); | |
this.gganalyse(this._core); | |
break; | |
case MediaEvent.PLAYER_MEDIA_QUALITYCHANGED: | |
break; | |
case MediaEvent.PLAYER_MEDIA_VOLUME: | |
break; | |
case MediaEvent.PLAYER_MEDIA_MUTE: | |
break; | |
case MediaEvent.PLAYER_MEDIA_ERROR: | |
_currentLogData.addErrorLog(OpenVideoError[_arg1.errorMessage]); | |
this._postutil.sendVideoLog(this.getOpenLogData()); | |
break; | |
case MediaEvent.PLAYER_MEDIA_TIME: | |
GlobalData.recordObj.updateLocalHistory(_arg1.position); | |
GlobalData.recordObj.updateLocalAboutHistory(_arg1.position); | |
GlobalData.recordObj.sendRecordToRemote(_arg1.position, false); | |
if (this._uuLog){ | |
this._uuLog.record(); | |
}; | |
break; | |
}; | |
} | |
private function getOpenLogData():Object{ | |
var _local1:Object = _currentLogData.getLog(); | |
_local1.mid = this._movieData.mid; | |
_local1.pid = this._movieData.pid; | |
_local1.swfUrl = this._movieData.swfUrl; | |
_local1.videoXmlUrl = this._movieData.videoXmlUrl; | |
return (_local1); | |
} | |
public function gganalyse(_arg1:IMediaCore):void{ | |
var tracker:* = null; | |
var core:* = _arg1; | |
try { | |
tracker = new GATracker(core.getDisplay(), "UA-34730019-1", "AS3", false); | |
tracker.trackPageview((this._movieData.currentPageUrl + this._movieData.title)); | |
} catch(e:Error) { | |
this.addToGlobalLog("[error] google analyse fail"); | |
}; | |
} | |
public function get canRecord():Boolean{ | |
return (this._canRecord); | |
} | |
public function set canRecord(_arg1:Boolean):void{ | |
this._canRecord = _arg1; | |
} | |
} | |
}//package com.netease.openplayer | |
package com.netease.openplayer.model { | |
import flash.events.*; | |
import com.netease.openplayer.event.*; | |
import flash.utils.*; | |
import com.netease.openplayer.util.*; | |
public class OpenStorage extends EventDispatcher { | |
private var movieData:OpenMovieData; | |
private var userid:String; | |
private var sharedUtil:SharedUtil; | |
private var postUtil:PostUtil; | |
private var remoteSycTimeoutId:Number; | |
private var canSycRemote:Boolean = true; | |
private var delayDuration:Number = 180000; | |
public function OpenStorage(){ | |
this.sharedUtil = new SharedUtil(); | |
this.postUtil = new PostUtil(); | |
this.readLocalRecord(); | |
} | |
public function readRemoteRecord(_arg1:OpenMovieData):void{ | |
this.movieData = _arg1; | |
var _local2:Object = CookieUtil.getUser(); | |
if (_local2){ | |
GlobalData.log.addToGlobalLog("[info] read remote record"); | |
this.userid = _local2.userid; | |
this.getRemoteRecord(this.userid, this.movieData.mid); | |
} else { | |
GlobalData.log.addToGlobalLog("[info] user not login, use local record"); | |
this.dispatchEvent(new PlayerEvent(PlayerEvent.PLAYER_RECORD_READY)); | |
}; | |
} | |
private function getRemoteRecord(_arg1:String, _arg2:String):void{ | |
this.postUtil.getVideoRecord(_arg1, _arg2, this.cbGetRemoteRecord, this.getRemoteRecordFail); | |
} | |
private function getRemoteRecordFail(_arg1:Event):void{ | |
GlobalData.log.addToGlobalLog("[error] get remote record fail"); | |
this.dispatchEvent(new PlayerEvent(PlayerEvent.PLAYER_RECORD_READY)); | |
} | |
private function cbGetRemoteRecord(_arg1:Object):void{ | |
var _local2:Object = _arg1; | |
var _local3:Object = this.getHistory(); | |
if (_local2){ | |
if (_local2.status == -1){ | |
this.clearOneHistory(this.movieData.mid); | |
} else { | |
if (_local3){ | |
if (_local2.recordTime > _local3.flag){ | |
this.updateLocalHistory((((_local2.isComplete == 1)) ? 0 : (_local2.playedTime / 1000))); | |
}; | |
} else { | |
this.updateLocalHistory((((_local2.isComplete == 1)) ? 0 : (_local2.playedTime / 1000))); | |
}; | |
}; | |
}; | |
this.dispatchEvent(new PlayerEvent(PlayerEvent.PLAYER_RECORD_READY)); | |
} | |
private function readLocalRecord():void{ | |
this.sharedUtil.getShareObj(); | |
} | |
public function getHistoryList():Array{ | |
return (this.sharedUtil.getHistoryList()); | |
} | |
public function getHistory():Object{ | |
return (this.sharedUtil.getLastHistory(this.movieData.mid)); | |
} | |
public function clearHistoryList():void{ | |
this.sharedUtil.clearAllHistory(); | |
} | |
public function clearOneHistory(_arg1:String):void{ | |
this.sharedUtil.clearOneHistory(_arg1); | |
} | |
public function getAboutHistory():Object{ | |
return (this.sharedUtil.getAboutHistory(this.movieData.pid, this.movieData.mid)); | |
} | |
public function getRecordVolume():Number{ | |
return (this.sharedUtil.getVolume()); | |
} | |
public function setRecordVolume(_arg1:Number):void{ | |
this.sharedUtil.setVolume(_arg1); | |
} | |
public function getRecordIsContinue():Number{ | |
return (this.sharedUtil.getIsContinue()); | |
} | |
public function setRecordIsContinue(_arg1:Number):void{ | |
this.sharedUtil.setIsContinue(_arg1); | |
} | |
public function getDefaultQuality():String{ | |
var _local1:* = this.sharedUtil.getDefaultQuality(); | |
if (_local1){ | |
return ((_local1 as String)); | |
}; | |
return (""); | |
} | |
public function setDefaultQuality(_arg1:String):void{ | |
this.sharedUtil.setDefaultQuality(_arg1); | |
} | |
public function updateLocalHistory(_arg1:Number):void{ | |
this.sharedUtil.updateHistory(this.movieData, _arg1); | |
} | |
public function updateLocalAboutHistory(_arg1:Number):void{ | |
this.sharedUtil.updateAboutHistory(this.movieData, _arg1); | |
} | |
public function setLocalHistoryComplete():void{ | |
this.sharedUtil.setHistoryComplete(this.movieData.mid, this.movieData.pid); | |
} | |
public function sendRecordToRemote(_arg1:Number, _arg2:Boolean):void{ | |
var time:* = _arg1; | |
var isComplete:* = _arg2; | |
if (!this.userid){ | |
return; | |
}; | |
if (this.canSycRemote){ | |
this.canSycRemote = false; | |
clearTimeout(this.remoteSycTimeoutId); | |
this.postUtil.sendVideoRecord(this.userid, this.movieData.mid, ((isComplete) ? 1 : 0), Math.floor((time * 1000))); | |
if (isComplete){ | |
this.canSycRemote = true; | |
} else { | |
this.remoteSycTimeoutId = setTimeout(function ():void{ | |
canSycRemote = true; | |
}, this.delayDuration); | |
}; | |
}; | |
} | |
} | |
}//package com.netease.openplayer.model | |
package com.netease.openplayer.model { | |
public class Constant { | |
public static var qualityVars:Object = { | |
SD:{ | |
name:"标清", | |
quality:1, | |
bitrate:0 | |
}, | |
HD:{ | |
name:"高清", | |
quality:2, | |
bitrate:0 | |
}, | |
SHD:{ | |
name:"超清", | |
quality:3, | |
bitrate:0 | |
} | |
}; | |
public static var testVideoXmlUrl:String = "http://open.ws.netease.com//admin/getMovieInfo.do"; | |
public static var openAdXmlUrl:String = "http://so.open.163.com/v/list.htm"; | |
public static var cmsAdXmlUrl:String = "http://v.163.com/special/008568NC/ted_vad.xml"; | |
public static var shareXmlURL:String = "http://swf.ws.126.net/v/open/swf/share_lession.xml"; | |
public static var playAfterXmlUrl:String = "http://so.open.163.com/v/endlist.htm"; | |
public static var ipCheckUrl:String = "http://so.open.163.com/open/info.htm"; | |
public static var progressUpdateUrl:String = "http://so.open.163.com/open/dynamic/progress.do"; | |
public static var vvUrl:String = "http://so.open.163.com/vvlog.do"; | |
public static var vpUrl:String = "http://so.open.163.com/vplog.do"; | |
public static var vreUrl:String = "http://c.open.163.com/vr/re.do"; | |
public static var vrvUrl:String = "http://c.open.163.com/vr/sv.do"; | |
public static var openMyRecordUrl:String = "http://c.open.163.com/center/myRecord.htm?from=player"; | |
public static var captionCheckUrl:String = "http://so.open.163.com/movie/postcaption.do"; | |
public static var AESKey:String = "73C58BAFE578C593"; | |
public static var CRYKey:Object = { | |
1:"4fxGZqoGmesXqg2o", | |
2:"3fxVNqoPmesAqg2o" | |
}; | |
} | |
}//package com.netease.openplayer.model | |
package com.netease.openplayer.model { | |
import com.netease.eduplayercore.model.*; | |
import com.netease.openplayer.util.*; | |
public class MovieDataTemp { | |
public static function getDataTemp(_arg1:String):OpenMovieData{ | |
var md:* = null; | |
var file:* = _arg1; | |
md = new OpenMovieData(); | |
md.swfUrl = ""; | |
md.mid = "M8H1MD0KG"; | |
md.pid = "M957Q26VS"; | |
md.posterUrl = "http://vimg1.ws.126.net//image/snapshot_movie/default/1.jpg"; | |
md.videoXmlUrl = ""; | |
md.title = "视频"; | |
md.pnumber = 1; | |
md.pageUrl = "http://open.163.com"; | |
md.currentPageUrl = ""; | |
md.captionData = {hasCaption:false}; | |
md.defaultQuality = "sd"; | |
var start:* = 0; | |
if (((GlobalData.isInnerSite) && ((AnchorUtil.getAnchorTime() >= 0)))){ | |
start = AnchorUtil.getAnchorTime(); | |
GlobalData.playerConfig.isShowLastTime = false; | |
} else { | |
try { | |
start = GlobalData.recordObj.getHistory().time; | |
} catch(e:Error) { | |
}; | |
}; | |
md.start = start; | |
var mi:* = new MovieListItem({ | |
movieData:md, | |
bitrate:0, | |
quality:1, | |
qualityName:"标清", | |
urls:[file] | |
}); | |
md.movieItemList = []; | |
md.movieItemList.push(mi); | |
md.currentMode = mi; | |
return (md); | |
} | |
} | |
}//package com.netease.openplayer.model | |
package com.netease.openplayer.model { | |
import flash.display.*; | |
import com.netease.openplayer.*; | |
public class GlobalData { | |
public static var version:String = "2.13.25"; | |
public static var root:DisplayObject; | |
public static var stage:Stage; | |
public static var flashvars:Object; | |
public static var recordObj:OpenStorage; | |
public static var isInnerSite:Boolean; | |
public static var playerConfig:PlayerConfig; | |
public static var movieData:OpenMovieData; | |
public static var log:OpenLog; | |
} | |
}//package com.netease.openplayer.model | |
package com.netease.openplayer.model { | |
import com.netease.openplayer.event.*; | |
import com.netease.eduplayercore.model.*; | |
import com.netease.openplayer.util.*; | |
import com.netease.eduplayercore.util.*; | |
import flash.external.*; | |
public class OpenMovieData extends MovieData { | |
public var swfUrl:String = ""; | |
public var videoXmlUrl:String = ""; | |
public var title:String = ""; | |
public var pnumber:Number; | |
public var currentPageUrl:String = ""; | |
public var pageUrl:String = ""; | |
public var mid:String = ""; | |
public var pid:String = ""; | |
public var defaultQuality:String = ""; | |
public var captionData:Object; | |
public var captionArray:Array; | |
public var adData:XML; | |
public var hasAutoSeek:Boolean = false; | |
public var hasSendVV:Boolean = false; | |
public var hasPlayedPreAd:Boolean = false; | |
public var hasPlayedEndingAd:Boolean = false; | |
private function sendPlayerEvent(_arg1:String, _arg2=undefined):void{ | |
var _local3:PlayerEvent = new PlayerEvent(_arg1, _arg2); | |
this.dispatchEvent(_local3); | |
} | |
override public function reset(_arg1:Object):void{ | |
var movieBaseData:* = null; | |
var movieData:* = _arg1; | |
this.swfUrl = movieData.swfUrl; | |
try { | |
movieBaseData = this.praseSwfUrl(this.swfUrl); | |
} catch(e:Error) { | |
sendPlayerEvent(PlayerEvent.PLAYER_ERROR, "invalidSwfUrl"); | |
GlobalData.log.addToGlobalLog("[error] wrong format swfUrl"); | |
return; | |
}; | |
this.mid = movieBaseData.curVid; | |
this.pid = movieBaseData.curOnlyId; | |
this.posterUrl = movieBaseData.coverUrl; | |
this.videoXmlUrl = movieBaseData.videoXmlUrl; | |
this.checkIp(); | |
} | |
private function loadVideoXMl():void{ | |
GlobalData.log.addToGlobalLog("[info] start load videoXML..."); | |
var _videoXmlUrl:* = ""; | |
if (GlobalData.playerConfig.videoXmlUrl){ | |
_videoXmlUrl = GlobalData.playerConfig.videoXmlUrl; | |
} else { | |
if (GlobalData.playerConfig.isTest){ | |
_videoXmlUrl = ((Constant.testVideoXmlUrl + "?mid=") + this.mid); | |
} else { | |
_videoXmlUrl = this.videoXmlUrl; | |
}; | |
}; | |
FileLoadUtil.loadXML(_videoXmlUrl, this.loadVideoXmlComplete, function ():void{ | |
sendPlayerEvent(PlayerEvent.PLAYER_ERROR, "loadVideoXmlFail"); | |
GlobalData.log.addToGlobalLog("[error] load videoXML failed"); | |
}); | |
} | |
private function loadVideoXmlComplete(_arg1:XML):void{ | |
var q:* = null; | |
var videoData:* = null; | |
var mode:* = null; | |
var xmlObj:* = _arg1; | |
try { | |
videoData = this.readVideoXml(xmlObj); | |
} catch(e:Error) { | |
sendPlayerEvent(PlayerEvent.PLAYER_ERROR, "videoXmlFormatError"); | |
GlobalData.log.addToGlobalLog("[info] wrong format videoXML"); | |
return; | |
}; | |
GlobalData.log.addToGlobalLog("[info] load videoXML success"); | |
this.title = videoData.title; | |
this.pnumber = videoData.pnumber; | |
this.pageUrl = videoData.pageUrl; | |
this.currentPageUrl = videoData.currentPageUrl; | |
this.captionData = videoData.captionData; | |
this.defaultQuality = videoData.defaultQuality; | |
GlobalData.isInnerSite = videoData.isInnerSite; | |
GlobalData.log.addToGlobalLog(("[info] is innerSite:" + GlobalData.isInnerSite)); | |
if ((((GlobalData.playerConfig.isUserAutoPlay == 0)) || ((GlobalData.playerConfig.isUserAutoPlay == 1)))){ | |
GlobalData.playerConfig.isAutoPlay = (((GlobalData.playerConfig.isUserAutoPlay == 1)) ? true : false); | |
} else { | |
GlobalData.playerConfig.isAutoPlay = videoData.isInnerSite; | |
}; | |
GlobalData.log.addToGlobalLog(("[info] is auto play:" + GlobalData.playerConfig.isAutoPlay)); | |
var start:* = 0; | |
if (((GlobalData.isInnerSite) && ((AnchorUtil.getAnchorTime() >= 0)))){ | |
start = AnchorUtil.getAnchorTime(); | |
GlobalData.log.addToGlobalLog(("[info] load video from url start:" + start)); | |
GlobalData.playerConfig.isShowLastTime = false; | |
} else { | |
try { | |
start = GlobalData.recordObj.getHistory().time; | |
GlobalData.log.addToGlobalLog(("[info] load video from history start:" + start)); | |
} catch(e:Error) { | |
GlobalData.log.addToGlobalLog("[error] read history start error"); | |
}; | |
}; | |
this.start = start; | |
this._movieItemList = []; | |
for (q in videoData.videoList) { | |
mode = new MovieListItem({ | |
urls:videoData.videoList[q], | |
bitrate:Constant.qualityVars[q].bitrate, | |
qualityName:q, | |
quality:Constant.qualityVars[q].quality | |
}); | |
mode.movieData = this; | |
if (q == this.defaultQuality){ | |
this._currentMode = mode; | |
}; | |
this._movieItemList.push(mode); | |
}; | |
this._movieItemList.sort(function (_arg1:MovieListItem, _arg2:MovieListItem):Number{ | |
return ((_arg2.quality - _arg1.quality)); | |
}); | |
if (!this._currentMode){ | |
this._currentMode = this._movieItemList[0]; | |
}; | |
this.loadCaption(this.loadAdXml); | |
} | |
private function praseSwfUrl(_arg1:String):Object{ | |
var _local11:int; | |
var _local2:Array = _arg1.split("-"); | |
var _local3:String = _local2[2]; | |
var _local4 = (("http://" + _local2[3]) + ".jpg"); | |
var _local5:int; | |
while (_local5 < 3) { | |
_local11 = _local4.indexOf("_"); | |
if (_local11 != -1){ | |
_local4 = ((_local4.substr(0, _local11) + ".") + _local4.substr((_local11 + 1), _local4.length)); | |
}; | |
_local5++; | |
}; | |
if (_local4.indexOf("cimg2") != -1){ | |
_local4 = ("http://cimg2.163.com" + _local4.split("163.com")[1]); | |
}; | |
var _local6:String = _local3.substr((_local3.length - 2), 1); | |
var _local7:String = _local3.substr((_local3.length - 1), 1); | |
var _local8:String = _local2[2].split("_")[2]; | |
var _local9:String = _local2[2].split("_")[1]; | |
var _local10 = (((((("http://live.ws.126.net/movie/" + _local6) + "/") + _local7) + "/") + _local2[2]) + ".xml"); | |
return ({ | |
coverUrl:_local4, | |
curVid:_local8, | |
curOnlyId:_local9, | |
videoXmlUrl:_local10 | |
}); | |
} | |
private function readVideoXml(_arg1:XML):Object{ | |
var _local3:String; | |
var _local5:String; | |
var _local7:Object; | |
var _local10:*; | |
var _local12:*; | |
var _local13:String; | |
var _local14:String; | |
var _local15:String; | |
var _local21:String; | |
var _local22:String; | |
var _local23:int; | |
var _local24:int; | |
var _local2:XML = _arg1; | |
var _local4:Object = new Object(); | |
var _local6:Boolean; | |
var _local8:Number = 0; | |
var _local9:Number = 1; | |
if (_arg1.useMp4){ | |
_local8 = _arg1.useMp4; | |
}; | |
if (_arg1.protoVersion){ | |
_local9 = _arg1.protoVersion; | |
}; | |
switch (_local8){ | |
case 0: | |
_local3 = "flv"; | |
if (_local9 == 1){ | |
_local6 = false; | |
_local10 = _local2.flvUrl; | |
} else { | |
if (_local9 == 2){ | |
_local6 = true; | |
_local10 = _local2.flvUrlOrigin; | |
}; | |
}; | |
break; | |
case 1: | |
_local3 = "mp4"; | |
if (_local9 == 1){ | |
_local6 = false; | |
_local10 = _local2.playurl; | |
} else { | |
if (_local9 == 2){ | |
_local6 = true; | |
_local10 = _local2.playurl_origin; | |
}; | |
}; | |
break; | |
}; | |
var _local11:XMLList = _local10.children(); | |
if (_local11.length() == 0){ | |
GlobalData.log.addToGlobalLog("[error] video xml has no video url"); | |
throw (new Error("no urls")); | |
}; | |
for (_local13 in _local11) { | |
if (!_local11[_local13][_local3]){ | |
} else { | |
_local21 = _local11[_local13].name(); | |
_local21 = _local21.toUpperCase(); | |
_local4[_local21] = new Array(); | |
for each (_local12 in _local11[_local13][_local3]) { | |
if (_arg1.encrypt){ | |
_local23 = _arg1.encrypt; | |
_local22 = CryptoUtil.decryptoVideoUrl(_local12.toString(), _local23); | |
} else { | |
_local22 = _local12.toString(); | |
}; | |
_local4[_local21].push(_local22); | |
}; | |
}; | |
}; | |
for (_local14 in _local4) { | |
_local24 = 0; | |
while (_local24 < _local4[_local14].length) { | |
_local24++; | |
}; | |
}; | |
_local15 = GlobalData.recordObj.getDefaultQuality(); | |
if (_local15 != ""){ | |
_local5 = _local15; | |
} else { | |
if (((_local4["HD"]) && ((_local4["HD"].length > 0)))){ | |
_local5 = "HD"; | |
} else { | |
if (((_local4["SD"]) && ((_local4["SD"].length > 0)))){ | |
_local5 = "SD"; | |
} else { | |
_local5 = "SHD"; | |
}; | |
}; | |
}; | |
if (_local6){ | |
_local7 = this.readCaptionData(_arg1); | |
} else { | |
_local7 = {hasCaption:false}; | |
}; | |
var _local16:String = _arg1.title; | |
var _local17:Number = Number(_arg1.pnumber); | |
var _local18:String = _arg1.pageUrl; | |
var _local19:String = this.getCurrentPageUrl(); | |
var _local20:Boolean = this.isInnerSite(_arg1, _local19); | |
return ({ | |
title:_local16, | |
pnumber:_local17, | |
pageUrl:_local18, | |
currentPageUrl:_local19, | |
defaultQuality:_local5, | |
videoList:_local4, | |
captionData:_local7, | |
isInnerSite:_local20 | |
}); | |
} | |
private function readCaptionData(_arg1:XML):Object{ | |
var _local3:*; | |
var _local4:String; | |
var _local2:Object = {data:[]}; | |
if (_arg1.subs){ | |
for each (_local3 in _arg1.subs.sub) { | |
_local4 = (((_local3.name == "中文")) ? "C" : "E"); | |
_local2.data.push({ | |
url:_local3.url, | |
name:_local3.name, | |
tipTxt:(((_local3.name + "切换,快捷键“") + _local4) + "”") | |
}); | |
}; | |
}; | |
if ((((_local2.data.length == 1)) && ((_local2.data[0].name == "中文")))){ | |
_local2.data.push({ | |
url:"", | |
name:"英文", | |
tipTxt:"" | |
}); | |
}; | |
if ((((_local2.data.length == 1)) && (!((_local2.data[0].name == "中文"))))){ | |
_local2.data.unshift({ | |
url:"", | |
name:"中文", | |
tipTxt:"" | |
}); | |
}; | |
if (_local2.data.length > 0){ | |
_local2.hasCaption = true; | |
} else { | |
_local2.hasCaption = false; | |
}; | |
return (_local2); | |
} | |
private function getCurrentPageUrl():String{ | |
var _local1 = ""; | |
try { | |
_local1 = String(ExternalInterface.call("function getPageUrl(){return window.location.href}")); | |
_local1 = _local1.split("?")[0]; | |
} catch(e:Error) { | |
}; | |
return (_local1); | |
} | |
private function isInnerSite(_arg1:XML, _arg2:String=undefined):Boolean{ | |
if (!_arg2){ | |
return (false); | |
}; | |
var _local3:RegExp = /^(http:\/\/[^\/]+\/)/; | |
var _local4:Array = StringUtil.trim(_arg2).match(_local3); | |
if (_local4){ | |
if (_local4[0]){ | |
if ((((((_local4[0] == "http://open.163.com/")) || ((_local4[0] == "http://v.163.com/")))) || ((_local4[0] == "http://c.open.163.com/")))){ | |
if (((!((_arg2.indexOf(this.mid) == -1))) && (!((_arg2.indexOf(this.pid) == -1))))){ | |
return (true); | |
}; | |
}; | |
}; | |
}; | |
return (false); | |
} | |
private function checkIp():void{ | |
GlobalData.log.addToGlobalLog("[info] start check IP..."); | |
var _poster:* = new PostUtil(); | |
_poster.sendIPcheck(this.mid, this.pid, function (_arg1:Number):void{ | |
GlobalData.log.addToGlobalLog(("[info] check IP result:" + _arg1)); | |
switch (_arg1){ | |
case 0: | |
sendPlayerEvent(PlayerEvent.PLAYER_ERROR, "videoNotExist"); | |
break; | |
case 1: | |
getRcored(); | |
break; | |
case 2: | |
sendPlayerEvent(PlayerEvent.PLAYER_ERROR, "ipNotAllowed"); | |
break; | |
}; | |
}); | |
} | |
private function getRcored():void{ | |
GlobalData.recordObj.addEventListener(PlayerEvent.PLAYER_RECORD_READY, function ():void{ | |
loadVideoXMl(); | |
}); | |
GlobalData.log.canRecord = true; | |
GlobalData.recordObj.readRemoteRecord(this); | |
} | |
private function loadAdXml():void{ | |
var self:* = null; | |
var adXmlUrl:* = null; | |
GlobalData.log.addToGlobalLog("[info] start load adv..."); | |
self = this; | |
if (!GlobalData.playerConfig.isTEDPlay){ | |
adXmlUrl = ((Constant.openAdXmlUrl + "?pid=") + this.pid); | |
} else { | |
adXmlUrl = Constant.cmsAdXmlUrl; | |
}; | |
FileLoadUtil.loadXML(adXmlUrl, function (_arg1:XML):void{ | |
GlobalData.log.addToGlobalLog("[info] load adv success"); | |
self.adData = _arg1; | |
sendPlayerEvent(PlayerEvent.PLAYER_MOVIEDATA_READY, self); | |
}, function ():void{ | |
GlobalData.log.addToGlobalLog("[error] load adv failed"); | |
sendPlayerEvent(PlayerEvent.PLAYER_MOVIEDATA_READY, self); | |
}); | |
} | |
private function loadCaption(_arg1:Function):void{ | |
var next:* = _arg1; | |
GlobalData.log.addToGlobalLog("[info] start load caption..."); | |
FileLoadUtil.loadCaption(this.captionData, function (_arg1:Array):void{ | |
captionArray = _arg1; | |
GlobalData.log.addToGlobalLog("[info] load caption success"); | |
next(); | |
}, function ():void{ | |
GlobalData.log.addToGlobalLog("[error] load caption failed"); | |
next(); | |
}); | |
} | |
} | |
}//package com.netease.openplayer.model | |
package com.netease.openplayer.model { | |
import com.netease.eduplayercore.*; | |
public dynamic class PlayerConfig extends Config { | |
public var isTest:Boolean = false; | |
public var file:String; | |
public var url:String; | |
public var videoXmlUrl:String; | |
public var isUserAutoPlay:Number = NaN; | |
public var isSimple:Number = 0; | |
public var isContinue:Number = 0; | |
public var isShowPreAd:Number = 1; | |
public var isShowMidAd:Number = 1; | |
public var isShowEndingAd:Number = 1; | |
public var isShowPlayAfter:Number = 1; | |
public var isShowAboutTip:Number = 0; | |
public var isHideHistory:Number = 0; | |
public var isShowLastTime:Boolean = true; | |
public var enableLogo:Number = 1; | |
public var checkIP:Boolean = true; | |
public var namespace901:String = ""; | |
public var isTEDPlay:Number = 0; | |
public function PlayerConfig(_arg1:Object=null){ | |
super(_arg1); | |
this.beforePlay = true; | |
this.namespace901 = this.filterParam(this.namespace901); | |
if (GlobalData.recordObj.getRecordVolume() >= 0){ | |
this.volume = GlobalData.recordObj.getRecordVolume(); | |
}; | |
if (GlobalData.recordObj.getRecordIsContinue() >= 0){ | |
this.isContinue = GlobalData.recordObj.getRecordIsContinue(); | |
}; | |
} | |
} | |
}//package com.netease.openplayer.model | |
package com.netease.openplayer.player { | |
import flash.events.*; | |
import com.netease.openplayer.view.*; | |
import com.netease.openplayer.model.*; | |
import com.netease.eduplayercore.*; | |
import flash.display.*; | |
import flash.utils.*; | |
import com.netease.openplayer.controller.*; | |
import com.netease.openplayer.*; | |
import flash.ui.*; | |
public class Container extends Sprite { | |
private var _stageData:Object; | |
private var _height:Number; | |
private var _core:MediaCore; | |
private var _viewContainer:ViewContainer; | |
private var _programController:ProgramController; | |
private var _mediaController:ViewController; | |
private var _keyboardController:KeyboardController; | |
private var _jsAPI:JavascriptAPI; | |
private var _log:OpenLog; | |
private var _checkId:Number; | |
public function Container(_arg1:Object){ | |
var data:* = _arg1; | |
super(); | |
this.initStageData(data); | |
this._core = new MediaCore(GlobalData.playerConfig); | |
this._log = new OpenLog(this._core); | |
addChild(this._log); | |
GlobalData.log = this._log; | |
this._viewContainer = new ViewContainer(this._core); | |
addChild(this._viewContainer); | |
this._jsAPI = new JavascriptAPI(this._core, this._viewContainer); | |
this._programController = new ProgramController(this._core, this._viewContainer); | |
this._mediaController = new ViewController(this._core, this._viewContainer); | |
this._keyboardController = new KeyboardController(this._core, this._viewContainer); | |
this._log.addToGlobalLog("[info] init player, view, controller, event"); | |
this.initContextMenu(); | |
this._checkId = setInterval(function ():void{ | |
checkReady(); | |
}, 100); | |
} | |
private function initStageData(_arg1:Object):void{ | |
var stageData:* = _arg1; | |
this._stageData = stageData; | |
try { | |
GlobalData.root = stageData.root; | |
GlobalData.stage = stageData.stage; | |
GlobalData.flashvars = stageData.flashvars; | |
GlobalData.recordObj = new OpenStorage(); | |
} catch(e:Error) { | |
return; | |
}; | |
try { | |
this.initPlayerConfig(stageData); | |
} catch(e:Error) { | |
return; | |
}; | |
} | |
private function initPlayerConfig(_arg1:Object):void{ | |
GlobalData.playerConfig = new PlayerConfig(_arg1.flashvars); | |
} | |
private function checkReady():void{ | |
if (this._viewContainer.isReady){ | |
this.readyHandler(); | |
clearInterval(this._checkId); | |
}; | |
} | |
private function readyHandler():void{ | |
this._log.addToGlobalLog("[info] player ready"); | |
this._jsAPI.isPlayerReady = true; | |
this._programController.setSatgeData(this._stageData); | |
} | |
private function initContextMenu():void{ | |
var openMenu:* = new ContextMenu(); | |
var mi1:* = new ContextMenuItem(("OpenPlayer v" + GlobalData.version)); | |
var mi2:* = new ContextMenuItem("显示log信息"); | |
var mi3:* = new ContextMenuItem("复制log信息"); | |
mi2.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, function ():void{ | |
_log.showPanel(); | |
}); | |
mi3.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, function ():void{ | |
_log.paste(); | |
}); | |
openMenu.hideBuiltInItems(); | |
openMenu.customItems.push(mi1); | |
openMenu.customItems.push(mi2); | |
openMenu.customItems.push(mi3); | |
this.contextMenu = openMenu; | |
} | |
} | |
}//package com.netease.openplayer.player | |
package com.netease.openplayer.player { | |
import flash.events.*; | |
import flash.display.*; | |
import flash.system.*; | |
public class OpenPlayer extends Sprite { | |
private var _container:Container; | |
public function OpenPlayer(){ | |
Security.allowDomain("*"); | |
if (stage){ | |
this.resizeListaner(null); | |
} else { | |
this.addEventListener(Event.ADDED_TO_STAGE, this.initPlayer); | |
}; | |
} | |
private function resizeListaner(_arg1:Event=null):void{ | |
if (_arg1 != null){ | |
removeEventListener(Event.ADDED_TO_STAGE, this.resizeListaner); | |
}; | |
stage.scaleMode = StageScaleMode.NO_SCALE; | |
stage.align = StageAlign.TOP_LEFT; | |
if ((((stage.stageWidth == 0)) || ((stage.stageHeight == 0)))){ | |
stage.addEventListener(Event.RESIZE, this.resizeHandler); | |
} else { | |
this.initPlayer(); | |
}; | |
} | |
private function resizeHandler(_arg1:Event=null):void{ | |
if ((((stage.stageWidth > 0)) && ((stage.stageHeight > 0)))){ | |
stage.removeEventListener(Event.RESIZE, this.resizeHandler); | |
this.initPlayer(); | |
}; | |
} | |
private function initPlayer(_arg1:Event=null):void{ | |
try { | |
this.removeEventListener(Event.ADDED_TO_STAGE, this.initPlayer); | |
} catch(err:Error) { | |
}; | |
var _local2:Object = { | |
root:root, | |
stage:stage, | |
flashvars:stage.loaderInfo.parameters | |
}; | |
this._container = new Container(_local2); | |
addChild(this._container); | |
} | |
} | |
}//package com.netease.openplayer.player | |
package com.netease.openplayer.view.ad { | |
import flash.events.*; | |
import com.netease.openplayer.view.*; | |
import com.netease.openplayer.model.*; | |
import flash.display.*; | |
import flash.net.*; | |
import flash.utils.*; | |
import flash.text.*; | |
import com.netease.openplayer.util.*; | |
import flash.media.*; | |
import com.netease.eduplayercore.util.*; | |
public class VVideoAdPlayer extends BaseView { | |
private var video:Video; | |
private var connection:NetConnection; | |
private var stream:NetStream; | |
private var hasGetMeta:Boolean = false; | |
private var totalTime:Number; | |
private var ovWidth:Number; | |
private var ovHeight:Number; | |
protected var adUrl:String; | |
protected var adHref:String; | |
protected var bg:Sprite; | |
protected var djsArea:Sprite; | |
protected var djsBg:Sprite; | |
protected var loadTxt:TextField; | |
protected var djsTxt:TextField; | |
protected var skipBtn:Sprite; | |
protected var skipBtnTxt:TextField; | |
protected var ptTimer:Timer; | |
protected var advList:Array; | |
protected var movieData:OpenMovieData; | |
protected var ltimeText:String = "{time}"; | |
public function VVideoAdPlayer(_arg1:ViewContainer){ | |
this.advList = []; | |
super(); | |
this.appendAt(_arg1); | |
this.hide(); | |
} | |
override protected function initEvent():void{ | |
super.initEvent(); | |
this.addEventListener(MouseEvent.CLICK, this.toHref); | |
this.skipBtn.addEventListener(MouseEvent.CLICK, this.skipAd); | |
} | |
override protected function initView():void{ | |
super.initView(); | |
this.createMc(); | |
this.createStream(); | |
} | |
private function createMc():void{ | |
this.bg = new Sprite(); | |
this.bg.graphics.beginFill(0); | |
this.bg.graphics.drawRect(0, 0, 800, 600); | |
this.bg.graphics.endFill(); | |
this.addChild(this.bg); | |
this.video = new Video(); | |
this.addChild(this.video); | |
this.djsArea = new Sprite(); | |
this.addChild(this.djsArea); | |
this.djsBg = new Sprite(); | |
this.djsBg.alpha = 0.5; | |
this.djsBg.graphics.beginFill(0); | |
this.djsBg.graphics.drawRect(0, 0, 200, 23); | |
this.djsBg.graphics.endFill(); | |
this.djsArea.addChild(this.djsBg); | |
this.loadTxt = new TextField(); | |
this.djsArea.addChild(this.loadTxt); | |
this.loadTxt.x = 3; | |
this.loadTxt.y = 3; | |
this.loadTxt.textColor = 0xFFFFFF; | |
this.loadTxt.text = "正在加载..."; | |
this.djsTxt = new TextField(); | |
this.djsArea.addChild(this.djsTxt); | |
this.djsTxt.x = 3; | |
this.djsTxt.y = 3; | |
this.djsTxt.autoSize = TextFieldAutoSize.CENTER; | |
this.djsTxt.textColor = 16748836; | |
this.djsTxt.text = ""; | |
this.djsTxt.visible = false; | |
this.skipBtn = new Sprite(); | |
this.skipBtn.buttonMode = true; | |
this.skipBtn.mouseChildren = false; | |
this.djsArea.addChild(this.skipBtn); | |
this.skipBtn.x = 115; | |
this.skipBtn.y = 2; | |
this.skipBtnTxt = new TextField(); | |
this.skipBtn.addChild(this.skipBtnTxt); | |
this.skipBtnTxt.autoSize = TextFieldAutoSize.CENTER; | |
this.skipBtnTxt.textColor = 1478990; | |
this.skipBtnTxt.text = "立即播放"; | |
} | |
private function createStream():void{ | |
this.connection = new NetConnection(); | |
this.connection.addEventListener(NetStatusEvent.NET_STATUS, this.netStatusHandler); | |
this.connection.connect(null); | |
this.stream = new NetStream(this.connection); | |
this.stream.addEventListener(NetStatusEvent.NET_STATUS, this.netStatusHandler); | |
this.stream.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler); | |
this.stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, this.errorHandler); | |
var _local1:Object = new Object(); | |
_local1.onMetaData = this.onMetaData; | |
this.stream.client = _local1; | |
var _local2:SoundTransform = new SoundTransform(); | |
_local2.volume = 0.8; | |
this.stream.soundTransform = _local2; | |
this.video.attachNetStream(this.stream); | |
} | |
private function netStatusHandler(_arg1:NetStatusEvent):void{ | |
switch (_arg1.info.code){ | |
case "NetStream.Play.StreamNotFound": | |
GlobalData.log.addToGlobalLog("[error] load pre ad fail"); | |
this.playAdComplete(); | |
break; | |
case "NetStream.Play.Start": | |
break; | |
case "NetStream.Play.Stop": | |
GlobalData.log.addToGlobalLog("[info] pre ad end"); | |
this.playAdComplete(); | |
break; | |
}; | |
} | |
private function errorHandler(_arg1:Event):void{ | |
this.playAdComplete(); | |
} | |
private function onMetaData(_arg1:Object):void{ | |
if (_arg1 != null){ | |
this.ovWidth = Number(_arg1.width); | |
this.ovHeight = Number(_arg1.height); | |
this.reSize(_width, _height); | |
this.hasGetMeta = true; | |
this.totalTime = Number(_arg1.duration); | |
}; | |
} | |
private function toHref(_arg1:MouseEvent=null):void{ | |
if (this.adHref != null){ | |
navigateToURL(new URLRequest(this.adHref), "_blank"); | |
}; | |
} | |
protected function skipAd(_arg1:Event=null):void{ | |
_arg1.stopPropagation(); | |
this.playAdComplete(); | |
} | |
protected function showTime(_arg1:Event=null):void{ | |
var _local2:int; | |
if (((this.hasGetMeta) && ((this.totalTime > 0)))){ | |
_local2 = Math.floor((this.totalTime - this.stream.time)); | |
if (_local2 > 0){ | |
this.loadTxt.visible = false; | |
this.djsTxt.visible = true; | |
this.djsTxt.text = this.ltimeText.replace(/{time}/ig, _local2); | |
} else { | |
this.ptTimer.removeEventListener(TimerEvent.TIMER, this.showTime); | |
this.ptTimer.stop(); | |
}; | |
}; | |
} | |
public function stopAdv(_arg1:Event=null):void{ | |
this.stream.close(); | |
if (this.ptTimer != null){ | |
this.ptTimer.removeEventListener(TimerEvent.TIMER, this.showTime); | |
this.ptTimer.stop(); | |
}; | |
} | |
protected function playAdComplete():void{ | |
this.stopAdv(); | |
this.hide(); | |
} | |
override public function reSize(_arg1:Number, _arg2:Number):void{ | |
super.reSize(_arg1, _arg2); | |
Stretcher.stretch(this.video, _arg1, _arg2, this.ovWidth, this.ovHeight); | |
this.video.x = ((_arg1 - this.video.width) / 2); | |
this.video.y = ((_arg2 - this.video.height) / 2); | |
this.bg.width = _arg1; | |
this.bg.height = _arg2; | |
this.djsArea.x = ((_arg1 - this.djsArea.width) - 10); | |
this.djsArea.y = 10; | |
} | |
override public function reset(_arg1=null):void{ | |
super.reset(_arg1); | |
this.movieData = _arg1; | |
} | |
public function playAd():void{ | |
} | |
protected function loadCmsAdData():void{ | |
var _local1:String = this.advList[0]; | |
if (((!(_local1)) || ((_local1 == "")))){ | |
this.playAdComplete(); | |
return; | |
}; | |
FileLoadUtil.loadXML(_local1, this.loadCmsAdDataComplete, this.loadCmsAdDataFail); | |
} | |
private function loadCmsAdDataComplete(_arg1:XML):void{ | |
GlobalData.log.addToGlobalLog("[info] load cms pre ad success"); | |
if (_arg1){ | |
if (_arg1.pq){ | |
this.ptTimer = new Timer(50); | |
this.ptTimer.addEventListener(TimerEvent.TIMER, this.showTime); | |
this.ptTimer.start(); | |
this.adHref = _arg1.pq.url; | |
this.adUrl = _arg1.pq.address; | |
}; | |
this.stream.play(this.adUrl); | |
} else { | |
this.playAdComplete(); | |
}; | |
} | |
private function loadCmsAdDataFail():void{ | |
GlobalData.log.addToGlobalLog("[error] load cms ad failed"); | |
this.playAdComplete(); | |
} | |
protected function loadOpenAd():void{ | |
this.ptTimer = new Timer(50); | |
this.ptTimer.addEventListener(TimerEvent.TIMER, this.showTime); | |
this.ptTimer.start(); | |
var _local1:* = this.randomSelectAd(); | |
var _local2:Boolean = (((Math.random() > 0.5)) || ((_local1.khan == 1))); | |
if (((((_local1) && (!((_local1.weight == 0))))) && (_local2))){ | |
this.adHref = _local1.link; | |
this.adUrl = _local1.url; | |
this.stream.play(this.adUrl); | |
} else { | |
this.playAdComplete(); | |
}; | |
} | |
private function randomSelectAd():Object{ | |
if (((!(this.advList)) || ((this.advList.length < 1)))){ | |
return (null); | |
}; | |
if (this.advList.length == 1){ | |
return (this.advList[0]); | |
}; | |
if (!this.advList[0].weight){ | |
return (this.advList[Math.floor((this.advList.length * Math.random()))]); | |
}; | |
var _local1:Array = []; | |
var _local2:Number = 0; | |
var _local3:int; | |
while (_local3 < this.advList.length) { | |
_local1.push({ | |
weight:Number(this.advList[_local3].weight), | |
rank1:_local2, | |
rank2:(_local2 + Number(this.advList[_local3].weight)), | |
index:_local3 | |
}); | |
_local2 = (_local2 + Number(this.advList[_local3].weight)); | |
_local3++; | |
}; | |
var _local4:Number = Math.floor((_local2 * Math.random())); | |
var _local5:int; | |
while (_local5 < _local1.length) { | |
if ((((_local4 >= _local1[_local5].rank1)) && ((_local4 <= _local1[_local5].rank2)))){ | |
return (this.advList[_local1[_local5].index]); | |
}; | |
_local5++; | |
}; | |
return (null); | |
} | |
override public function show(_arg1:Event=null):void{ | |
super.show(_arg1); | |
} | |
override public function hide(_arg1:Event=null):void{ | |
super.hide(_arg1); | |
} | |
} | |
}//package com.netease.openplayer.view.ad | |
package com.netease.openplayer.view.ad { | |
import flash.events.*; | |
import com.netease.openplayer.view.*; | |
import com.netease.openplayer.model.*; | |
import flash.display.*; | |
import flash.net.*; | |
import com.netease.openplayer.util.*; | |
import flash.system.*; | |
import flash.filters.*; | |
public class VPicAdPlayer extends BaseView { | |
private var adUrl:String; | |
private var adHref:String; | |
private var adType:String = ""; | |
private var swfPicMc:MovieClip; | |
private var swfPicMcWidth:Number; | |
private var swfPicMcHeight:Number; | |
private var midAdCloseBtn:MidAdCloseBtn; | |
private var midAdvList:Array; | |
private var movieData:OpenMovieData; | |
public function VPicAdPlayer(_arg1:ViewContainer){ | |
this.midAdvList = []; | |
super(); | |
this.appendAt(_arg1); | |
hide(); | |
} | |
override protected function initEvent():void{ | |
super.initEvent(); | |
this.swfPicMc.addEventListener(MouseEvent.CLICK, this.toHref); | |
this.midAdCloseBtn.addEventListener(MouseEvent.CLICK, this.closeMidAd); | |
} | |
override protected function initView():void{ | |
super.initView(); | |
this.createMidMc(); | |
} | |
override public function reSize(_arg1:Number, _arg2:Number):void{ | |
super.reSize(_arg1, _arg2); | |
this.scaleSwfPic(); | |
} | |
private function scaleSwfPic():void{ | |
if (((this.swfPicMcWidth) && (this.swfPicMcHeight))){ | |
if ((((this._width <= (this.swfPicMcWidth + 80))) || ((this._height <= (this.swfPicMcHeight + 80))))){ | |
StretcherUtil.viewScale(this.swfPicMc, this._width, this._height, (this.swfPicMcWidth + 80), (this.swfPicMcHeight + 80)); | |
}; | |
this.swfPicMc.x = ((this._width - this.swfPicMc.width) / 2); | |
this.swfPicMc.y = ((this._height - this.swfPicMc.height) / 2); | |
this.midAdCloseBtn.x = ((this.swfPicMc.x + this.swfPicMc.width) - (this.midAdCloseBtn.width / 2)); | |
this.midAdCloseBtn.y = (this.swfPicMc.y - (this.midAdCloseBtn.width / 2)); | |
}; | |
} | |
private function createMidMc():void{ | |
this.swfPicMc = new MovieClip(); | |
addChild(this.swfPicMc); | |
this.swfPicMc.buttonMode = true; | |
this.swfPicMc.filters = [new DropShadowFilter(0, 0, 0, 0.5, 5, 5, 1, 1)]; | |
this.midAdCloseBtn = new MidAdCloseBtn(); | |
addChild(this.midAdCloseBtn); | |
} | |
private function toHref(_arg1:MouseEvent=null):void{ | |
if (this.adHref != null){ | |
navigateToURL(new URLRequest(this.adHref), "_blank"); | |
}; | |
} | |
private function loadSwfOrPic(_arg1:String):void{ | |
try { | |
this.swfPicMc.removeChildAt(0); | |
} catch(e:Error) { | |
}; | |
var _local2:Loader = new Loader(); | |
_local2.contentLoaderInfo.addEventListener(Event.COMPLETE, this.swfOrPicLoadCom); | |
_local2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.loadSwfPicError); | |
_local2.load(new URLRequest(_arg1), new LoaderContext(true)); | |
} | |
private function loadSwfPicError(_arg1:Event=null):void{ | |
this.closeMidAd(); | |
} | |
private function swfOrPicLoadCom(_arg1:Event):void{ | |
var _local2:DisplayObject; | |
if (this.adType == "swf"){ | |
_local2 = Loader(_arg1.target.loader); | |
this.swfPicMc.addChild(_local2); | |
} else { | |
_local2 = _arg1.target.content; | |
this.swfPicMc.addChild(_arg1.target.content); | |
}; | |
var _local3:Number = (_local2.width / _local2.height); | |
if (_local2.width > this._width){ | |
this.swfPicMc.width = this._width; | |
this.swfPicMc.height = (this.swfPicMc.width / _local3); | |
}; | |
if (_local2.height > (this._height - 80)){ | |
this.swfPicMc.height = (this._height - 80); | |
this.swfPicMc.width = (this.swfPicMc.height * _local3); | |
}; | |
this.swfPicMcWidth = this.swfPicMc.width; | |
this.swfPicMcHeight = this.swfPicMc.height; | |
this.scaleSwfPic(); | |
this.show(); | |
} | |
public function closeMidAd(_arg1:Event=null):void{ | |
if (_arg1 != null){ | |
GlobalData.playerConfig.isShowMidAd = 0; | |
}; | |
hide(); | |
} | |
public function playAd(_arg1:Boolean):void{ | |
if (!_arg1){ | |
this.closeMidAd(); | |
return; | |
}; | |
if ((((this.midAdvList.length <= 0)) || (!(GlobalData.playerConfig.isShowMidAd)))){ | |
return; | |
}; | |
if (this.midAdvList.length > 0){ | |
if (GlobalData.playerConfig.isTEDPlay){ | |
this.loadCmsAdData(); | |
} else { | |
this.loadOpenAd(); | |
}; | |
}; | |
} | |
private function loadCmsAdData():void{ | |
var _local1:String = this.midAdvList[0]; | |
if (((!(_local1)) || ((_local1 == "")))){ | |
return; | |
}; | |
FileLoadUtil.loadXML(_local1, this.loadCmsAdDataComplete, this.loadCmsAdDataFail); | |
} | |
private function loadCmsAdDataComplete(_arg1:XML):void{ | |
var _local2:Object; | |
GlobalData.log.addToGlobalLog("[info] load cms pause ad success"); | |
if (_arg1){ | |
if (_arg1.adv){ | |
_local2 = new Object(); | |
_local2.link = _arg1.adv.link; | |
_local2.url = _arg1.adv.source; | |
this.loadAd(_local2); | |
}; | |
}; | |
} | |
private function loadCmsAdDataFail():void{ | |
GlobalData.log.addToGlobalLog("[error] load cms pause ad failed"); | |
} | |
private function loadOpenAd():void{ | |
this.loadAd(this.midAdvList[Math.floor((this.midAdvList.length * Math.random()))]); | |
} | |
private function loadAd(_arg1:Object):void{ | |
this.adUrl = _arg1.url; | |
var _local2:Array = this.adUrl.split("."); | |
this.adType = (_local2[(_local2.length - 1)] + "").toLowerCase(); | |
this.adHref = _arg1.link; | |
if ((((((((((this.adType == "jpg")) || ((this.adType == "jpeg")))) || ((this.adType == "png")))) || ((this.adType == "gif")))) || ((this.adType == "swf")))){ | |
this.loadSwfOrPic(this.adUrl); | |
}; | |
} | |
override public function reset(_arg1=null):void{ | |
var _local3:*; | |
this.movieData = _arg1; | |
var _local2:XML = ((_arg1 as OpenMovieData).adData as XML); | |
if (_local2 != null){ | |
if (((_local2.midAd) && ((_local2.midAd.item.length() > 0)))){ | |
for each (_local3 in _local2.midAd.item) { | |
this.midAdvList.push(_local3); | |
}; | |
}; | |
}; | |
} | |
} | |
}//package com.netease.openplayer.view.ad | |
package com.netease.openplayer.view.ad { | |
import com.netease.openplayer.view.*; | |
import com.netease.openplayer.event.*; | |
import com.netease.openplayer.model.*; | |
public class VPreVideoAdPlayer extends VVideoAdPlayer { | |
public function VPreVideoAdPlayer(_arg1:ViewContainer){ | |
super(_arg1); | |
this.ltimeText = "{time}秒后开始课程"; | |
this.skipBtnTxt.text = "立即播放"; | |
} | |
override public function playAd():void{ | |
super.playAd(); | |
if ((((((this.advList.length <= 0)) || (!(GlobalData.playerConfig.isShowPreAd)))) || (this.movieData.hasPlayedPreAd))){ | |
this.stopAdv(); | |
this.playAdComplete(); | |
return; | |
}; | |
this.movieData.hasPlayedPreAd = true; | |
show(); | |
if (GlobalData.playerConfig.isTEDPlay){ | |
loadCmsAdData(); | |
} else { | |
loadOpenAd(); | |
}; | |
} | |
override protected function playAdComplete():void{ | |
super.playAdComplete(); | |
dispatchEvent(new ViewEvent(ViewEvent.VIEW_PRE_AD_END)); | |
} | |
override public function reset(_arg1=null):void{ | |
var _local3:*; | |
super.reset(_arg1); | |
var _local2:XML = ((_arg1 as OpenMovieData).adData as XML); | |
if (_local2 != null){ | |
if (((_local2.preAd) && ((_local2.preAd.item.length() > 0)))){ | |
for each (_local3 in _local2.preAd.item) { | |
this.advList.push(_local3); | |
}; | |
}; | |
}; | |
} | |
} | |
}//package com.netease.openplayer.view.ad | |
package com.netease.openplayer.view.ad { | |
import com.netease.openplayer.view.*; | |
import com.netease.openplayer.event.*; | |
import com.netease.openplayer.model.*; | |
public class VEndingVideoAdPlayer extends VVideoAdPlayer { | |
public function VEndingVideoAdPlayer(_arg1:ViewContainer){ | |
super(_arg1); | |
this.ltimeText = "请等待{time}秒"; | |
this.skipBtnTxt.text = "跳过"; | |
} | |
override public function playAd():void{ | |
super.playAd(); | |
if ((((((this.advList.length <= 0)) || (!(GlobalData.playerConfig.isShowEndingAd)))) || (this.movieData.hasPlayedEndingAd))){ | |
this.stopAdv(); | |
this.playAdComplete(); | |
return; | |
}; | |
this.movieData.hasPlayedEndingAd = true; | |
show(); | |
if (GlobalData.playerConfig.isTEDPlay){ | |
loadCmsAdData(); | |
} else { | |
loadOpenAd(); | |
}; | |
} | |
override protected function playAdComplete():void{ | |
super.playAdComplete(); | |
dispatchEvent(new ViewEvent(ViewEvent.VIEW_ENDING_AD_END)); | |
} | |
override public function reset(_arg1=null):void{ | |
var _local3:*; | |
super.reset(_arg1); | |
var _local2:XML = ((_arg1 as OpenMovieData).adData as XML); | |
if (_local2 != null){ | |
if (((_local2.endAd) && ((_local2.endAd.item.length() > 0)))){ | |
for each (_local3 in _local2.endAd.item) { | |
this.advList.push(_local3); | |
}; | |
}; | |
}; | |
} | |
} | |
}//package com.netease.openplayer.view.ad | |
package com.netease.openplayer.view { | |
import flash.display.*; | |
public class VError extends BaseView { | |
private var bg:Sprite; | |
private var warning:Warning; | |
public function VError(_arg1:ViewContainer){ | |
this.appendAt(_arg1); | |
this.hide(); | |
} | |
override protected function initEvent():void{ | |
super.initEvent(); | |
} | |
override protected function initView():void{ | |
super.initView(); | |
this.bg = new Sprite(); | |
this.bg.graphics.clear(); | |
this.bg.graphics.beginFill(0, 1); | |
this.bg.graphics.drawRect(0, 0, 100, 100); | |
this.bg.graphics.endFill(); | |
this.bg.alpha = 1; | |
this.bg.x = 0; | |
this.bg.y = 0; | |
addChild(this.bg); | |
this.warning = new Warning(); | |
addChild(this.warning); | |
} | |
override public function reSize(_arg1:Number, _arg2:Number):void{ | |
super.reSize(_arg1, _arg2); | |
this.bg.width = _arg1; | |
this.bg.height = _arg2; | |
this.warning.x = ((_arg1 - this.warning.width) / 2); | |
this.warning.y = ((_arg2 - this.warning.height) / 2); | |
} | |
public function showError(_arg1:Object):void{ | |
this.warning.warningtip.text = (((_arg1.message + "[code:") + _arg1.code) + "]"); | |
this.warning.warningtip.width = (this.warning.warningtip.textWidth + 5); | |
this.reSize(_width, _height); | |
this.show(); | |
} | |
} | |
}//package com.netease.openplayer.view | |
package com.netease.openplayer.view.recommend { | |
import flash.events.*; | |
import com.netease.openplayer.view.*; | |
import com.netease.openplayer.event.*; | |
import com.netease.openplayer.model.*; | |
import flash.display.*; | |
import flash.utils.*; | |
import flash.text.*; | |
import com.netease.openplayer.util.*; | |
public class VPlayAfterShow extends BaseView { | |
private var playAfterBg:Sprite; | |
private var content:Sprite; | |
private var tjTitle:TextField; | |
private var showList:VPlayAfterList; | |
private var preBtn:prePageBtn; | |
private var nextBtn:NextPageBtn; | |
private var replaybtn:replayBtn; | |
private var tjData:Array; | |
private var rowCount:Number = 2; | |
private var lineCount:Number = 3; | |
private var pageCount:Number = 6; | |
private var posPage:Number = 1; | |
private var pageSum:Number = 0; | |
private var itemSum:Number = 0; | |
private var recyleShowId:Number; | |
public function VPlayAfterShow(_arg1:ViewContainer){ | |
this.tjData = []; | |
super(); | |
this.appendAt(_arg1); | |
this.hide(); | |
} | |
override protected function initEvent():void{ | |
super.initEvent(); | |
this.preBtn.addEventListener(MouseEvent.CLICK, this.showPreList); | |
this.nextBtn.addEventListener(MouseEvent.CLICK, this.showNextList); | |
this.replaybtn.addEventListener(MouseEvent.CLICK, this.replay); | |
} | |
override protected function initView():void{ | |
super.initView(); | |
this.playAfterBg = new Sprite(); | |
this.playAfterBg.alpha = 0.9; | |
this.playAfterBg.graphics.beginFill(0); | |
this.playAfterBg.graphics.drawRect(0, 0, 100, 100); | |
this.playAfterBg.graphics.endFill(); | |
addChild(this.playAfterBg); | |
this.content = new Sprite(); | |
addChild(this.content); | |
this.tjTitle = new TextField(); | |
this.tjTitle.multiline = false; | |
this.tjTitle.autoSize = TextFieldAutoSize.LEFT; | |
var _local1:TextFormat = new TextFormat(); | |
_local1.font = "微软雅黑,Microsoft YaHei"; | |
_local1.color = 0xAFAFAF; | |
_local1.size = 16; | |
_local1.align = "left"; | |
_local1.leading = 0; | |
this.tjTitle.defaultTextFormat = _local1; | |
this.tjTitle.text = "推荐课程"; | |
this.content.addChild(this.tjTitle); | |
this.showList = new VPlayAfterList(); | |
this.showList.appendAt(this.content); | |
this.preBtn = new prePageBtn(); | |
this.content.addChild(this.preBtn); | |
this.nextBtn = new NextPageBtn(); | |
this.content.addChild(this.nextBtn); | |
this.replaybtn = new replayBtn(); | |
this.content.addChild(this.replaybtn); | |
this.replaybtn.visible = false; | |
} | |
override public function reSize(_arg1:Number, _arg2:Number):void{ | |
var _local3:Number; | |
super.reSize(_arg1, _arg2); | |
this.playAfterBg.width = _arg1; | |
this.playAfterBg.height = _arg2; | |
if ((((_arg1 <= 300)) || ((_arg2 <= 200)))){ | |
StretcherUtil.viewScale(this.content, _arg1, _arg2, 300, 200); | |
}; | |
this.rowCount = Math.floor(((_arg1 - 50) / (VPlayAfterList.ITEM_WIDTH + 7))); | |
this.rowCount = (((this.rowCount > 2)) ? 2 : this.rowCount); | |
this.rowCount = (((this.rowCount < 1)) ? 1 : this.rowCount); | |
this.lineCount = Math.floor(((_arg2 - 50) / (VPlayAfterList.ITEM_HEIGHT + 7))); | |
this.lineCount = (((this.lineCount > 3)) ? 3 : this.lineCount); | |
this.lineCount = (((this.lineCount < 1)) ? 1 : this.lineCount); | |
this.posPage = 1; | |
this.pageCount = (this.rowCount * this.lineCount); | |
this.pageSum = Math.ceil((this.itemSum / this.pageCount)); | |
if (this.pageSum > 1){ | |
this.nextBtn.visible = true; | |
this.preBtn.visible = true; | |
if ((((this.rowCount > 1)) && ((this.itemSum > this.lineCount)))){ | |
_local3 = ((this.rowCount * (VPlayAfterList.ITEM_WIDTH + 7)) - this.nextBtn.width); | |
} else { | |
_local3 = (VPlayAfterList.ITEM_WIDTH - this.nextBtn.width); | |
}; | |
this.nextBtn.x = (this.tjTitle.x + _local3); | |
this.nextBtn.y = 0; | |
this.preBtn.x = (this.nextBtn.x - 36); | |
this.preBtn.y = 0; | |
} else { | |
this.nextBtn.visible = false; | |
this.preBtn.visible = false; | |
}; | |
this.showList.x = 0; | |
this.showList.y = (this.tjTitle.height + 10); | |
if (((!((this.tjData == null))) && (this.showList.visible))){ | |
this.showList.reset({ | |
rowCount:this.rowCount, | |
lineCount:this.lineCount, | |
posPage:this.posPage, | |
pageCount:this.pageCount, | |
pageSum:this.pageSum | |
}); | |
if (this.pageSum > 1){ | |
this.recyleShow(); | |
}; | |
}; | |
if ((((_arg1 >= 740)) && ((_arg2 >= 416)))){ | |
this.replaybtn.visible = true; | |
this.replaybtn.x = (this.showList.width + 20); | |
this.replaybtn.y = ((((this.showList.height - this.replaybtn.height) / 2) + this.tjTitle.height) + 10); | |
} else { | |
if (this.replaybtn != null){ | |
this.replaybtn.visible = false; | |
this.replaybtn.x = (this.replaybtn.y = 0); | |
}; | |
}; | |
this.content.x = ((_arg1 - this.content.width) / 2); | |
this.content.y = ((_arg2 - this.content.height) / 2); | |
} | |
override public function reset(_arg1=null):void{ | |
var _local3:*; | |
var _local2:XML = (_arg1 as XML); | |
if (((!((_local2 == null))) && (_local2.recommend.item))){ | |
this.tjData = []; | |
for each (_local3 in _local2.recommend.item) { | |
this.tjData.push(_local3); | |
}; | |
this.tjData = this.randomArray(this.tjData); | |
this.itemSum = this.tjData.length; | |
this.showList.dataArray = this.tjData; | |
}; | |
} | |
public function getPlayAfterData():void{ | |
var playAfterXmlUrl:* = null; | |
if (GlobalData.playerConfig.isShowPlayAfter == 1){ | |
playAfterXmlUrl = ((Constant.playAfterXmlUrl + "?plid=") + GlobalData.movieData.pid); | |
FileLoadUtil.loadXML(playAfterXmlUrl, function (_arg1:XML):void{ | |
reset(_arg1); | |
show(); | |
}, function ():void{ | |
show(); | |
}); | |
} else { | |
this.show(); | |
}; | |
} | |
private function randomArray(_arg1:Array):Array{ | |
var _local2:Array = []; | |
while (_arg1.length > 0) { | |
_local2.push(_arg1.splice(Math.floor((Math.random() * _arg1.length)), 1)[0]); | |
}; | |
return (_local2); | |
} | |
override public function show(_arg1:Event=null):void{ | |
this.visible = true; | |
this.showList.show(); | |
if (this.tjData.length <= 0){ | |
this.onlyShowReplay(); | |
} else { | |
this.reSize(this._width, this._height); | |
}; | |
} | |
override public function hide(_arg1:Event=null):void{ | |
super.hide(_arg1); | |
this.showList.hide(); | |
if (this.recyleShowId){ | |
clearInterval(this.recyleShowId); | |
}; | |
} | |
private function showPreList(_arg1:MouseEvent=null):void{ | |
this.posPage = ((((this.posPage - 1) <= 0)) ? this.pageSum : (this.posPage - 1)); | |
this.showList.buildItemList(this.posPage); | |
this.recyleShow(); | |
} | |
private function showNextList(_arg1:MouseEvent=null):void{ | |
this.posPage = ((((this.posPage + 1) > this.pageSum)) ? 1 : (this.posPage + 1)); | |
this.showList.buildItemList(this.posPage); | |
this.recyleShow(); | |
} | |
private function recyleShow():void{ | |
if (this.recyleShowId){ | |
clearInterval(this.recyleShowId); | |
}; | |
this.recyleShowId = setInterval(function ():void{ | |
showNextList(); | |
}, 10000); | |
} | |
private function replay(_arg1:Event=null):void{ | |
this.dispatchEvent(new ViewEvent(ViewEvent.VIEW_PLAY)); | |
} | |
private function onlyShowReplay():void{ | |
this.tjTitle.visible = false; | |
this.preBtn.visible = false; | |
this.nextBtn.visible = false; | |
this.showList.hide(); | |
this.x = 0; | |
this.y = 0; | |
this.replaybtn.visible = true; | |
this.replaybtn.x = ((this.content.width - this.replaybtn.width) / 2); | |
this.replaybtn.y = ((this.content.height - this.replaybtn.height) / 2); | |
this.content.x = ((width - this.content.width) / 2); | |
this.content.y = ((height - this.content.height) / 2); | |
} | |
} | |
}//package com.netease.openplayer.view.recommend | |
package com.netease.openplayer.view.recommend { | |
import flash.events.*; | |
import com.netease.openplayer.view.*; | |
import flash.display.*; | |
import flash.net.*; | |
import flash.utils.*; | |
import flash.text.*; | |
import caurina.transitions.*; | |
import com.netease.openplayer.util.*; | |
import com.netease.eduplayercore.util.*; | |
public class VPlayAfterList extends BaseView { | |
public static var ITEM_WIDTH:Number = 260; | |
public static var ITEM_HEIGHT:Number = 68; | |
public static var ITEM_IMG_WIDTH:Number = 120; | |
public static var ITEM_IMG_HEIGHT:Number = 68; | |
private var _dataArray:Array; | |
private var rowCount:Number = 2; | |
private var lineCount:Number = 3; | |
private var pageCount:Number = 6; | |
private var posPage:Number = 1; | |
private var pageSum:Number = 0; | |
private var itemSum:Number = 0; | |
private var zbArray:Array; | |
public function VPlayAfterList(){ | |
this.zbArray = []; | |
super(); | |
this.hide(); | |
} | |
override public function hide(_arg1:Event=null):void{ | |
super.hide(_arg1); | |
} | |
override protected function initEvent():void{ | |
super.initEvent(); | |
} | |
override protected function initView():void{ | |
super.initView(); | |
this.hide(); | |
} | |
override public function reset(_arg1=null):void{ | |
if (_arg1){ | |
this.posPage = _arg1.posPage; | |
this.rowCount = _arg1.rowCount; | |
this.lineCount = _arg1.lineCount; | |
this.pageCount = _arg1.pageCount; | |
this.pageSum = _arg1.pageSum; | |
} else { | |
return; | |
}; | |
this.itemSum = this.dataArray.length; | |
this.resetListParam(width, height); | |
this.buildItemList(this.posPage); | |
} | |
override public function show(_arg1:Event=null):void{ | |
super.show(_arg1); | |
} | |
public function buildItemList(_arg1:Number):void{ | |
if (this.dataArray == null){ | |
return; | |
}; | |
this.posPage = _arg1; | |
var _local2:Array = this.getPageDataByPage(_arg1); | |
this.removeChildren(); | |
var _local3:int; | |
while (_local3 < _local2.length) { | |
if (((!((_local2[_local3] == null))) && (!((this.zbArray[_local3] == null))))){ | |
this.createVideoItem(_local2[_local3], this.zbArray[_local3], _local3); | |
}; | |
_local3++; | |
}; | |
} | |
private function getPageDataByPage(_arg1:Number):Array{ | |
var _local2:Array = []; | |
var _local3:int = (((_arg1 > this.pageSum)) ? 1 : _arg1); | |
var _local4:int = ((((_local3 * this.pageCount) > this.itemSum)) ? this.itemSum : (_local3 * this.pageCount)); | |
_local2 = this.dataArray.slice(((_local3 - 1) * this.pageCount), _local4); | |
return (_local2); | |
} | |
private function resetListParam(_arg1:Number, _arg2:Number):void{ | |
var _local4:int; | |
this.zbArray = []; | |
var _local3:int; | |
while (_local3 < this.rowCount) { | |
_local4 = 0; | |
while (_local4 < this.lineCount) { | |
this.zbArray.push({ | |
x:(((_local3 < 1)) ? 0 : ((_local3 * ITEM_WIDTH) + (14 * _local3))), | |
y:(((_local4 < 1)) ? 0 : ((_local4 * ITEM_HEIGHT) + (14 * _local4))) | |
}); | |
_local4++; | |
}; | |
_local3++; | |
}; | |
} | |
private function createVideoItem(_arg1:Object, _arg2:Object, _arg3:int):Sprite{ | |
var sprite:* = null; | |
var bg:* = null; | |
var videoName:* = null; | |
var playTime:* = null; | |
var data:* = _arg1; | |
var zb:* = _arg2; | |
var index:* = _arg3; | |
sprite = new Sprite(); | |
sprite.buttonMode = true; | |
sprite.mouseChildren = false; | |
bg = new Sprite(); | |
bg.graphics.beginFill(0x303030); | |
bg.graphics.drawRect(0, 0, 100, 100); | |
bg.graphics.endFill(); | |
sprite.addChild(bg); | |
bg.width = ITEM_WIDTH; | |
bg.height = ITEM_HEIGHT; | |
var imgArea:* = new MovieClip(); | |
imgArea.graphics.beginFill(0); | |
imgArea.graphics.drawRect(0, 0, ITEM_IMG_WIDTH, ITEM_IMG_HEIGHT); | |
imgArea.graphics.endFill(); | |
sprite.addChild(imgArea); | |
this.loadVideoImg(data.imgUrl, sprite, imgArea); | |
videoName = new TextField(); | |
sprite.addChild(videoName); | |
videoName.multiline = true; | |
videoName.wordWrap = true; | |
videoName.height = 38; | |
videoName.width = 127; | |
videoName.x = 125; | |
videoName.y = 6; | |
var tf1:* = new TextFormat(); | |
tf1.font = "宋体"; | |
tf1.color = 0xC8C8C8; | |
tf1.size = 13; | |
tf1.align = "left"; | |
tf1.leading = 2; | |
videoName.defaultTextFormat = tf1; | |
videoName.text = data.title; | |
playTime = new TextField(); | |
sprite.addChild(playTime); | |
playTime.multiline = false; | |
playTime.height = 20; | |
playTime.width = 127; | |
playTime.x = 125; | |
playTime.y = 43; | |
var tf2:* = new TextFormat(); | |
tf2.font = "宋体"; | |
tf2.color = 0x666666; | |
tf2.size = 12; | |
tf2.align = "left"; | |
tf2.leading = 0; | |
playTime.defaultTextFormat = tf2; | |
playTime.text = ((data.times)!="") ? ("播放:" + data.times) : ""; | |
sprite.addEventListener(MouseEvent.ROLL_OVER, function (_arg1:Event=null):void{ | |
hoverVideoItem(bg, videoName, playTime); | |
}); | |
sprite.addEventListener(MouseEvent.ROLL_OUT, function (_arg1:Event=null):void{ | |
OutVideoItem(bg, videoName, playTime); | |
}); | |
sprite.addEventListener(MouseEvent.CLICK, function (_arg1:Event=null):void{ | |
ClickVideoItem(data.link); | |
}); | |
sprite.x = zb.x; | |
sprite.y = zb.y; | |
addChild(sprite); | |
sprite.alpha = 0; | |
setTimeout(function ():void{ | |
Tweener.addTween(sprite, { | |
alpha:1, | |
time:0.4, | |
transition:"easeOutQuad", | |
onComplete:function ():void{ | |
} | |
}); | |
}, (index * 100)); | |
return (sprite); | |
} | |
private function hoverVideoItem(_arg1:Sprite, _arg2:TextField, _arg3:TextField):void{ | |
_arg1.graphics.beginFill(1478990); | |
_arg1.graphics.drawRect(0, 0, 100, 100); | |
_arg1.graphics.endFill(); | |
_arg1.width = ITEM_WIDTH; | |
_arg1.height = ITEM_HEIGHT; | |
_arg2.textColor = 0xFFFFFF; | |
_arg3.textColor = 0xFFFFFF; | |
} | |
private function OutVideoItem(_arg1:Sprite, _arg2:TextField, _arg3:TextField):void{ | |
_arg1.graphics.beginFill(0x303030); | |
_arg1.graphics.drawRect(0, 0, 100, 100); | |
_arg1.graphics.endFill(); | |
_arg1.width = ITEM_WIDTH; | |
_arg1.height = ITEM_HEIGHT; | |
_arg2.textColor = 0xC8C8C8; | |
_arg3.textColor = 0x666666; | |
} | |
private function ClickVideoItem(_arg1:String):void{ | |
navigateToURL(new URLRequest(_arg1), "_blank"); | |
} | |
private function loadVideoImg(_arg1:String, _arg2:Sprite, _arg3:MovieClip):void{ | |
var imgUrl:* = _arg1; | |
var item:* = _arg2; | |
var mc:* = _arg3; | |
FileLoadUtil.loadPic(imgUrl, function (_arg1:Loader):void{ | |
if (mc != null){ | |
mc.addChild(_arg1); | |
Stretcher.stretch(_arg1, ITEM_IMG_WIDTH, ITEM_IMG_HEIGHT); | |
_arg1.x = ((ITEM_IMG_WIDTH - _arg1.width) / 2); | |
_arg1.y = ((ITEM_IMG_HEIGHT - _arg1.height) / 2); | |
}; | |
}, null); | |
} | |
public function get dataArray():Array{ | |
return (this._dataArray); | |
} | |
public function set dataArray(_arg1:Array):void{ | |
this._dataArray = _arg1; | |
} | |
} | |
}//package com.netease.openplayer.view.recommend | |
package com.netease.openplayer.view { | |
import flash.events.*; | |
import flash.display.*; | |
public interface IView { | |
function appendAt(_arg1:Sprite):void; | |
function reset(_arg1=null):void; | |
function show(_arg1:Event=null):void; | |
function hide(_arg1:Event=null):void; | |
function active(_arg1:Event=null):void; | |
function disable(_arg1:Event=null):void; | |
function reSize(_arg1:Number, _arg2:Number):void; | |
function setFullScreenMode(_arg1:Boolean):void; | |
} | |
}//package com.netease.openplayer.view | |
package com.netease.openplayer.view { | |
import flash.display.*; | |
public class VDataLoading extends BaseView { | |
private var loadingMc:Loading; | |
private var bg:Sprite; | |
public function VDataLoading(_arg1:ViewContainer){ | |
this.appendAt(_arg1); | |
} | |
override protected function initView():void{ | |
this.bg = new Sprite(); | |
this.bg.graphics.beginFill(0); | |
this.bg.graphics.drawRect(0, 0, 100, 100); | |
this.bg.graphics.endFill(); | |
this.bg.mouseChildren = false; | |
this.bg.doubleClickEnabled = true; | |
addChild(this.bg); | |
this.loadingMc = new Loading(); | |
addChild(this.loadingMc); | |
} | |
override public function reSize(_arg1:Number, _arg2:Number):void{ | |
super.reSize(_arg1, _arg2); | |
this.bg.width = _arg1; | |
this.bg.height = _arg2; | |
this.loadingMc.x = ((_arg1 - this.loadingMc.width) / 2); | |
this.loadingMc.y = ((_arg2 - this.loadingMc.height) / 2); | |
} | |
} | |
}//package com.netease.openplayer.view | |
package com.netease.openplayer.view { | |
import flash.events.*; | |
import com.netease.openplayer.event.*; | |
import com.netease.openplayer.model.*; | |
import flash.display.*; | |
import flash.utils.*; | |
import flash.text.*; | |
import caurina.transitions.*; | |
public class VFullScreenTitle extends BaseView { | |
private var _hideTimeout:Number; | |
private var _hideDur:Number = 3000; | |
private var _videoTitle:TextField; | |
private var _exitFullScreenBt:ExitFullScreenBt; | |
private var _bg:Sprite; | |
public function VFullScreenTitle(_arg1:ViewContainer){ | |
this.appendAt(_arg1); | |
super(); | |
this.hide(); | |
} | |
public function slideUp():void{ | |
Tweener.addTween(this, { | |
y:(-(this._exitFullScreenBt.height) - 10), | |
alpha:0, | |
time:0.8, | |
transition:"easeOutQuad", | |
onComplete:function ():void{ | |
hide(); | |
} | |
}); | |
} | |
override protected function initEvent():void{ | |
super.initEvent(); | |
this._exitFullScreenBt.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent):void{ | |
dispatchEvent(new ViewEvent(ViewEvent.VIEW_FULLSCREEN)); | |
}); | |
this._parent.addEventListener(MouseEvent.ROLL_OVER, this.onMouseIn); | |
this._parent.addEventListener(MouseEvent.ROLL_OUT, this.onMouseOut); | |
this._parent.addEventListener(MouseEvent.MOUSE_MOVE, this.onMouseMove); | |
} | |
override public function reset(_arg1=null):void{ | |
super.reset(_arg1); | |
this._videoTitle.text = ((_arg1 as OpenMovieData).title + ""); | |
} | |
private function onMouseOut(_arg1:MouseEvent=null):void{ | |
this.slideUp(); | |
} | |
private function onMouseIn(_arg1:MouseEvent=null):void{ | |
if (this._fullScreen){ | |
this.slideDown(); | |
}; | |
} | |
private function onMouseMove(_arg1:MouseEvent=null):void{ | |
var evt = _arg1; | |
if (this._hideTimeout){ | |
clearTimeout(this._hideTimeout); | |
this.onMouseIn(); | |
}; | |
this._hideTimeout = setTimeout(function ():void{ | |
onMouseOut(); | |
}, this._hideDur); | |
} | |
override protected function initView():void{ | |
super.initView(); | |
this._bg = new Sprite(); | |
this._bg.graphics.beginFill(0); | |
this._bg.graphics.drawRect(0, 0, 800, 100); | |
this._bg.graphics.endFill(); | |
this._bg.alpha = 0.7; | |
addChild(this._bg); | |
this._videoTitle = new TextField(); | |
this._videoTitle.multiline = false; | |
this._videoTitle.height = 25; | |
this._videoTitle.width = 700; | |
addChild(this._videoTitle); | |
var _local1:TextFormat = new TextFormat(); | |
_local1.font = "宋体"; | |
_local1.color = 0xFFFFFF; | |
_local1.size = 16; | |
_local1.align = "left"; | |
_local1.leading = 0; | |
this._videoTitle.defaultTextFormat = _local1; | |
this._videoTitle.x = 5; | |
this._videoTitle.y = 10; | |
this._exitFullScreenBt = new ExitFullScreenBt(); | |
addChild(this._exitFullScreenBt); | |
} | |
public function slideDown():void{ | |
this.show(); | |
Tweener.addTween(this, { | |
y:0, | |
alpha:1, | |
time:0.3, | |
transition:"easeOutQuad", | |
onComplete:function ():void{ | |
} | |
}); | |
} | |
override public function reSize(_arg1:Number, _arg2:Number):void{ | |
super.reSize(_arg1, _arg2); | |
this._exitFullScreenBt.x = ((_arg1 - this._exitFullScreenBt.width) - 5); | |
this._exitFullScreenBt.y = 5; | |
this._bg.width = _arg1; | |
this._bg.height = (this._exitFullScreenBt.height + 10); | |
} | |
override public function setFullScreenMode(_arg1:Boolean):void{ | |
super.setFullScreenMode(_arg1); | |
if (!this._fullScreen){ | |
this.slideUp(); | |
}; | |
} | |
} | |
}//package com.netease.openplayer.view | |
package com.netease.openplayer.view.video { | |
import com.netease.openplayer.view.*; | |
import com.netease.openplayer.event.*; | |
import com.netease.openplayer.model.*; | |
import com.netease.eduplayercore.*; | |
public class VVideo extends BaseView { | |
private var _core:MediaCore; | |
private var _display:VDisplay; | |
private var _caption:VCaption; | |
private var _movieData:OpenMovieData; | |
public function VVideo(_arg1:ViewContainer, _arg2:MediaCore){ | |
this.appendAt(_arg1); | |
this._core = _arg2; | |
addChild(this._core); | |
this._display = new VDisplay(); | |
addChild(this._display); | |
this._caption = new VCaption(); | |
addChild(this._caption); | |
super(); | |
} | |
override protected function initEvent():void{ | |
super.initEvent(); | |
this._display.addEventListener(ViewEvent.VIEW_TOGGLEPLAY, this.viewEventHandler); | |
this._display.addEventListener(ViewEvent.VIEW_FULLSCREEN, this.viewEventHandler); | |
} | |
private function viewEventHandler(_arg1:ViewEvent):void{ | |
this.dispatchEvent(_arg1); | |
} | |
override protected function initView():void{ | |
super.initView(); | |
} | |
override public function reset(_arg1=null):void{ | |
super.reset(_arg1); | |
this._movieData = (_arg1 as OpenMovieData); | |
this.initCaption(this._movieData.captionArray); | |
} | |
public function setBuffering():void{ | |
this._display.setLoading(); | |
} | |
public function setBufferingfull():void{ | |
this._display.hideUI(); | |
} | |
public function setPause():void{ | |
this._display.setPlayPause(false); | |
} | |
public function setPlay():void{ | |
this._display.setPlayPause(true); | |
} | |
private function initCaption(_arg1:Array):void{ | |
this._caption.reset(_arg1); | |
} | |
public function showCaption(_arg1:Number):void{ | |
this._caption.setPosition(_arg1); | |
} | |
public function slideDownCaption():void{ | |
this._caption.slideDown(); | |
} | |
public function slideUpCaption():void{ | |
this._caption.slideUp(); | |
} | |
public function showOrHideCaptionCn(_arg1:Boolean):void{ | |
this._caption.showOrHideCn(_arg1); | |
} | |
public function showOrHideCaptionEn(_arg1:Boolean):void{ | |
this._caption.showOrHideEn(_arg1); | |
} | |
override public function reSize(_arg1:Number, _arg2:Number):void{ | |
super.reSize(_arg1, _arg2); | |
this._core.resize(_arg1, _arg2); | |
this._display.reSize(_arg1, _arg2); | |
this._caption.reSize(_arg1, _arg2); | |
} | |
} | |
}//package com.netease.openplayer.view.video | |
package com.netease.openplayer.view.video { | |
import flash.events.*; | |
import com.netease.openplayer.view.*; | |
import com.netease.openplayer.event.*; | |
import flash.display.*; | |
import flash.utils.*; | |
public class VDisplay extends BaseView { | |
private var loadingMc:Loading; | |
private var bg:Sprite; | |
private var _dbTimeoutId:Number; | |
public function VDisplay(){ | |
this.hideUI(); | |
} | |
override protected function initEvent():void{ | |
this.bg.addEventListener(MouseEvent.DOUBLE_CLICK, this.clickHanler); | |
this.bg.addEventListener(MouseEvent.CLICK, this.clickHanler); | |
} | |
override protected function initView():void{ | |
this.bg = new Sprite(); | |
this.bg.alpha = 0; | |
this.bg.graphics.beginFill(0); | |
this.bg.graphics.drawRect(0, 0, 100, 100); | |
this.bg.graphics.endFill(); | |
this.bg.mouseChildren = false; | |
this.bg.doubleClickEnabled = true; | |
addChild(this.bg); | |
this.loadingMc = new Loading(); | |
addChild(this.loadingMc); | |
} | |
override public function reSize(_arg1:Number, _arg2:Number):void{ | |
super.reSize(_arg1, _arg2); | |
this.bg.width = _arg1; | |
this.bg.height = _arg2; | |
this.loadingMc.x = ((_arg1 - this.loadingMc.width) / 2); | |
this.loadingMc.y = ((_arg2 - this.loadingMc.height) / 2); | |
} | |
public function clickHanler(_arg1:MouseEvent):void{ | |
var event:* = _arg1; | |
if (event.type == MouseEvent.CLICK){ | |
this._dbTimeoutId = setTimeout(function ():void{ | |
togglePlayHandler(); | |
}, 220); | |
} else { | |
clearTimeout(this._dbTimeoutId); | |
this.fullscreenHandler(); | |
}; | |
} | |
private function togglePlayHandler():void{ | |
this.dispatchEvent(new ViewEvent(ViewEvent.VIEW_TOGGLEPLAY)); | |
} | |
private function fullscreenHandler():void{ | |
this.dispatchEvent(new ViewEvent(ViewEvent.VIEW_FULLSCREEN)); | |
} | |
public function hideUI():void{ | |
this.loadingMc.visible = false; | |
} | |
public function setLoading():void{ | |
this.hideUI(); | |
this.loadingMc.visible = true; | |
} | |
public function setPlayPause(_arg1:Boolean):void{ | |
this.hideUI(); | |
} | |
} | |
}//package com.netease.openplayer.view.video | |
package com.netease.openplayer.view.video { | |
import flash.events.*; | |
import com.netease.openplayer.view.*; | |
import flash.text.*; | |
import caurina.transitions.*; | |
import mx.utils.*; | |
import flash.external.*; | |
import flash.filters.*; | |
public class VCaption extends BaseView { | |
private var disabled:Boolean = false; | |
private var _captions:Array; | |
private var _position:Number; | |
private var _current:Array; | |
private var _fields:Array; | |
private var texts:Array; | |
private var _fieldWidth:Number = 250; | |
private var tfs:Array; | |
private var fs:Number = 16; | |
private var isSlideDown:Boolean = true; | |
public function VCaption(){ | |
this.texts = ["", ""]; | |
super(); | |
} | |
override protected function initEvent():void{ | |
(this._fields[0] as TextField).addEventListener(MouseEvent.MOUSE_UP, this.selectClick); | |
(this._fields[1] as TextField).addEventListener(MouseEvent.MOUSE_UP, this.selectClick); | |
} | |
override protected function initView():void{ | |
var _local4:TextField; | |
this._fields = new Array(); | |
var _local1:TextFormat = new TextFormat(); | |
_local1.font = "微软雅黑,Microsoft YaHei"; | |
_local1.color = 0xFFFFFF; | |
_local1.size = 16; | |
_local1.align = "center"; | |
_local1.leading = 0; | |
var _local2:TextFormat = new TextFormat(); | |
_local2.font = "Verdana"; | |
_local2.color = 0xFFFFFF; | |
_local2.size = 13; | |
_local2.align = "center"; | |
_local2.leading = 0; | |
this.tfs = new Array(); | |
this.tfs.push(_local1); | |
this.tfs.push(_local2); | |
var _local3:int; | |
while (_local3 < 2) { | |
_local4 = new TextField(); | |
_local4.width = this._fieldWidth; | |
_local4.autoSize = TextFieldAutoSize.CENTER; | |
_local4.multiline = true; | |
_local4.selectable = true; | |
_local4.wordWrap = true; | |
_local4.mouseWheelEnabled = false; | |
_local4.filters = [new DropShadowFilter(3, 60, 0, 0.5, 2, 2, 1, 1), new GlowFilter(0x191919, 0.8, 2, 2, 8, 5)]; | |
_local4.alpha = 1; | |
_local4.defaultTextFormat = this.tfs[_local3]; | |
this._fields.push(_local4); | |
addChild(_local4); | |
_local3++; | |
}; | |
this.textResize(); | |
} | |
override public function reSize(_arg1:Number, _arg2:Number):void{ | |
super.reSize(_arg1, _arg2); | |
var _local3:Number = Math.round((this._width * 0.8)); | |
var _local4:Number = Math.round((this._height / 19)); | |
_local4 = (((_local4 < 15)) ? 15 : _local4); | |
_local4 = (((_local4 > 42)) ? 42 : _local4); | |
(this._fields[0] as TextField).width = ((this._fields[1] as TextField).width = _local3); | |
(this.tfs[0] as TextFormat).size = _local4; | |
(this.tfs[1] as TextFormat).size = Math.round((_local4 * 0.6)); | |
this.fs = _local4; | |
this._fields[0].defaultTextFormat = this.tfs[0]; | |
this._fields[1].defaultTextFormat = this.tfs[1]; | |
this.width = _local3; | |
this.x = ((this._width - this.width) / 2); | |
if (this.isSlideDown){ | |
this.y = ((_arg2 - (_local4 * 2)) - 5); | |
} else { | |
this.y = ((_arg2 - (_local4 * 2)) - 45); | |
}; | |
this._renderCaption(this.texts); | |
} | |
override public function reset(_arg1=null):void{ | |
hide(); | |
var _local2:Array = (_arg1 as Array); | |
this._current = [-1, -1]; | |
this._captions = [null, null]; | |
if (((!(_local2)) || (((!(_local2[0])) && (!(_local2[1])))))){ | |
this.disabled = true; | |
return; | |
}; | |
this.disabled = false; | |
var _local3:int = _local2.length; | |
var _local4:int; | |
while (_local4 < _local3) { | |
if ((_local2[_local4] is String)){ | |
this._captions[_local4] = new Array({ | |
begin:0, | |
text:_local2[_local4] | |
}); | |
} else { | |
if ((_local2[_local4] is Array)){ | |
this._captions[_local4] = _local2[_local4]; | |
}; | |
}; | |
_local4++; | |
}; | |
} | |
public function setPosition(_arg1:Number):void{ | |
if (this.disabled){ | |
return; | |
}; | |
this._position = _arg1; | |
if (this._captions){ | |
this.selectCaption(); | |
}; | |
} | |
private function selectCaption():void{ | |
var _local4:Number; | |
var _local1:Array = [-1, -1]; | |
var _local2:Boolean; | |
var _local3:int; | |
while (_local3 < 2) { | |
if (this._captions[_local3] == null){ | |
} else { | |
_local4 = 0; | |
while (_local4 < this._captions[_local3].length) { | |
if ((((this._captions[_local3][_local4]["begin"] <= this._position)) && ((((_local4 == (this._captions[_local3].length - 1))) || ((this._captions[_local3][(_local4 + 1)]["begin"] >= this._position)))))){ | |
_local1[_local3] = _local4; | |
break; | |
}; | |
_local4++; | |
}; | |
if (_local1[_local3] == -1){ | |
this.texts[_local3] = ""; | |
} else { | |
this.texts[_local3] = this._captions[_local3][_local4]["text"]; | |
}; | |
if (this._current[_local3] != _local1[_local3]){ | |
_local2 = true; | |
this._current[_local3] = _local1[_local3]; | |
}; | |
}; | |
_local3++; | |
}; | |
if (_local2){ | |
this._renderCaption(this.texts); | |
}; | |
} | |
private function _renderCaption(_arg1:Array):void{ | |
var _local3:TextField; | |
if ((((_arg1[0] == "")) && ((_arg1[1] == "")))){ | |
this.visible = false; | |
return; | |
}; | |
this.visible = true; | |
var _local2:int; | |
while (_local2 < 2) { | |
_local3 = (this._fields[_local2] as TextField); | |
_local3.defaultTextFormat = this.tfs[_local2]; | |
_local3.text = _arg1[_local2]; | |
_local2++; | |
}; | |
this.textResize(); | |
} | |
private function textResize():void{ | |
if (((!((this._fields[0] == null))) && (!((this._fields[1] == null))))){ | |
this._fields[0].x = 0; | |
this._fields[1].y = 0; | |
this._fields[1].x = 0; | |
if ((this._fields[0] as TextField).numLines > 1){ | |
this._fields[0].y = (-((this.fs + 3)) * 2.1); | |
} else { | |
this._fields[0].y = -((this.fs + 3)); | |
}; | |
}; | |
} | |
private function selectClick(_arg1:Event):void{ | |
var _local2:TextField = (_arg1.target as TextField); | |
var _local3:String = StringUtil.trim(("" + _local2.text.slice(_local2.selectionBeginIndex, _local2.selectionEndIndex))); | |
if (_local3 != ""){ | |
if (ExternalInterface.available){ | |
try { | |
ExternalInterface.call("videoTranslate", _local3); | |
} catch(e:Error) { | |
}; | |
}; | |
//unresolved jump | |
}; | |
} | |
public function slideDown():void{ | |
var to:* = ((this._height - (this.fs * 2)) - 5); | |
Tweener.addTween(this, { | |
y:to, | |
time:0.8, | |
transition:"easeOutQuad", | |
onComplete:function ():void{ | |
isSlideDown = true; | |
} | |
}); | |
} | |
public function slideUp():void{ | |
var to:* = ((this._height - (this.fs * 2)) - 45); | |
Tweener.addTween(this, { | |
y:to, | |
time:0.3, | |
transition:"easeOutQuad", | |
onComplete:function ():void{ | |
isSlideDown = false; | |
} | |
}); | |
} | |
public function showOrHideCn(_arg1:Boolean):void{ | |
(this._fields[0] as TextField).visible = _arg1; | |
} | |
public function showOrHideEn(_arg1:Boolean):void{ | |
(this._fields[1] as TextField).visible = _arg1; | |
} | |
public function get isCnVisible():Boolean{ | |
return ((this._fields[0] as TextField).visible); | |
} | |
public function get isEnVisible():Boolean{ | |
return ((this._fields[1] as TextField).visible); | |
} | |
} | |
}//package com.netease.openplayer.view.video | |
package com.netease.openplayer.view.panel { | |
import flash.events.*; | |
import com.netease.openplayer.view.*; | |
import com.netease.openplayer.model.*; | |
import flash.display.*; | |
import flash.net.*; | |
import com.netease.openplayer.util.*; | |
import com.netease.eduplayercore.util.*; | |
public class VHistoryPanel extends BaseView { | |
private var _historyPanel:historyPanel; | |
private var ow:Number; | |
private var oh:Number; | |
public function VHistoryPanel(_arg1:ViewContainer){ | |
this.appendAt(_arg1); | |
this.hide(); | |
} | |
public function close(_arg1:Event=null):void{ | |
this.hide(); | |
var _local2:ViewContainer = (this._parent as ViewContainer); | |
_local2.mediaUnLock(); | |
if (_local2.components["playerafter"].visible == false){ | |
_local2.core.play(); | |
}; | |
} | |
override protected function initEvent():void{ | |
super.initEvent(); | |
this._historyPanel.historyCloseBtn.addEventListener(MouseEvent.CLICK, this.close); | |
this._historyPanel.clearBtn.addEventListener(MouseEvent.CLICK, this.clearHistory); | |
} | |
override protected function initView():void{ | |
super.initView(); | |
this._historyPanel = new historyPanel(); | |
addChild(this._historyPanel); | |
this.hide(); | |
this.ow = this.width; | |
this.oh = this.height; | |
} | |
override public function reset(_arg1=null):void{ | |
super.reset(_arg1); | |
var _local2:int; | |
while (_local2 < 5) { | |
this._historyPanel[("line" + _local2)].visible = false; | |
_local2++; | |
}; | |
var _local3:Array = GlobalData.recordObj.getHistoryList(); | |
var _local4:MovieClip; | |
_local2 = 0; | |
while (_local2 < _local3.length) { | |
if (_local2 >= 5){ | |
return; | |
}; | |
_local4 = this._historyPanel[("line" + _local2)]; | |
_local4.title.text = this.dealTitle(StringUtil.unescape(((_local3[_local2].pnumber)!=0) ? ((("第" + _local3[_local2].pnumber) + "集-") + _local3[_local2].title) : ("(单集)" + _local3[_local2].title))); | |
if (_local3[_local2].vid == GlobalData.movieData.mid){ | |
_local4.poslook.visible = true; | |
_local4.time.visible = false; | |
_local4.continueTxt.visible = false; | |
} else { | |
_local4.time.text = ("观看到 " + StringUtil.formatter(_local3[_local2].time)); | |
_local4.time.visible = true; | |
_local4.poslook.visible = false; | |
_local4.continueTxt.visible = false; | |
}; | |
_local4.mouseChildren = false; | |
_local4.buttonMode = true; | |
try { | |
_local4.removeEventListener(MouseEvent.CLICK, this.clickFun); | |
} catch(e:Error) { | |
}; | |
try { | |
_local4.removeEventListener(MouseEvent.MOUSE_OVER, this.overFun); | |
} catch(e:Error) { | |
}; | |
try { | |
_local4.removeEventListener(MouseEvent.MOUSE_OUT, this.outFun); | |
} catch(e:Error) { | |
}; | |
_local4.data = _local3[_local2].pageUrl; | |
_local4.addEventListener(MouseEvent.CLICK, this.clickFun); | |
_local4.addEventListener(MouseEvent.MOUSE_OVER, this.overFun); | |
_local4.addEventListener(MouseEvent.MOUSE_OUT, this.outFun); | |
_local4.gotoAndStop(1); | |
_local4.visible = true; | |
_local2++; | |
}; | |
} | |
private function dealTitle(_arg1:String):String{ | |
var _local3:Number; | |
var _local2:Number = this._historyPanel["line1"].title.width; | |
if (_arg1.length > 17){ | |
_local3 = Math.floor(((_local2 - 25) / 12)); | |
return ((_arg1.substr(0, _local3) + "...")); | |
}; | |
return (_arg1); | |
} | |
override public function show(_arg1:Event=null):void{ | |
this.reset(); | |
var _local2:ViewContainer = (this._parent as ViewContainer); | |
_local2.mediaLock(); | |
_local2.components["share"].hide(); | |
_local2.components["setting"].hide(); | |
super.show(); | |
_local2.playMidAd(false); | |
if (!_local2.components["playerafter"].visible){ | |
_local2.core.pause(); | |
}; | |
} | |
override public function reSize(_arg1:Number, _arg2:Number):void{ | |
super.reSize(_arg1, _arg2); | |
if ((((_arg1 < this.ow)) || ((_arg2 < this.oh)))){ | |
StretcherUtil.viewScale(this, _arg1, _arg2, this.ow, this.oh); | |
}; | |
this.x = ((_arg1 - this.width) / 2); | |
this.y = ((_arg2 - this.height) / 2); | |
} | |
private function clickFun(_arg1:MouseEvent):void{ | |
navigateToURL(new URLRequest(_arg1.target.data), "_self"); | |
} | |
private function overFun(_arg1:MouseEvent):void{ | |
var _local2:MovieClip = MovieClip(_arg1.target); | |
if (!_local2.poslook.visible){ | |
_local2.continueTxt.visible = true; | |
_local2.time.visible = false; | |
}; | |
_local2.gotoAndStop(2); | |
} | |
private function outFun(_arg1:MouseEvent):void{ | |
var _local2:MovieClip = MovieClip(_arg1.target); | |
if (!_local2.poslook.visible){ | |
_local2.continueTxt.visible = false; | |
_local2.time.visible = true; | |
}; | |
_local2.gotoAndStop(1); | |
} | |
public function clearHistory(_arg1:MouseEvent):void{ | |
GlobalData.recordObj.clearHistoryList(); | |
this.reset(); | |
} | |
} | |
}//package com.netease.openplayer.view.panel | |
package com.netease.openplayer.view.panel { | |
import flash.events.*; | |
import com.netease.openplayer.view.*; | |
import com.netease.openplayer.event.*; | |
import com.netease.openplayer.model.*; | |
import flash.display.*; | |
import flash.net.*; | |
import flash.utils.*; | |
import caurina.transitions.*; | |
import flash.ui.*; | |
public class VMenuPanel extends BaseView { | |
private var _menuPanel:menuPanel; | |
private var isShow:Boolean = false; | |
private var _hideTimeout:Number; | |
private var _hideDur:Number = 8000; | |
public function VMenuPanel(_arg1:ViewContainer){ | |
this.appendAt(_arg1); | |
super(); | |
this.hide(); | |
} | |
public function slideRight():void{ | |
var to:* = this._width; | |
Tweener.addTween(this, { | |
x:to, | |
alpha:0, | |
time:0.8, | |
transition:"easeOutQuad", | |
onComplete:function ():void{ | |
isShow = false; | |
hide(); | |
} | |
}); | |
} | |
override protected function initEvent():void{ | |
super.initEvent(); | |
if (GlobalData.playerConfig.isSimple){ | |
return; | |
}; | |
this._parent.addEventListener(MouseEvent.ROLL_OVER, this.onMouseIn); | |
this._parent.addEventListener(MouseEvent.ROLL_OUT, this.onMouseOut); | |
this._parent.addEventListener(MouseEvent.MOUSE_MOVE, this.onMouseMove); | |
this._menuPanel.shareBtn.addEventListener(MouseEvent.CLICK, this.clickShareBtnHandler); | |
this._menuPanel.fullScreenBtn.addEventListener(MouseEvent.CLICK, this.clickFullScreenBtnHandler); | |
this._menuPanel.fullScreenBtn2.addEventListener(MouseEvent.CLICK, this.clickFullScreenBtnHandler); | |
this._menuPanel.historyBtn.addEventListener(MouseEvent.CLICK, this.clickHistoryBtnHandler); | |
} | |
private function onMouseOut(_arg1:MouseEvent=null):void{ | |
this.slideRight(); | |
if (this._fullScreen){ | |
Mouse.hide(); | |
}; | |
} | |
private function onMouseIn(_arg1:MouseEvent=null):void{ | |
this.slideLeft(); | |
} | |
private function onMouseMove(_arg1:MouseEvent=null):void{ | |
var evt = _arg1; | |
if (this._hideTimeout){ | |
clearTimeout(this._hideTimeout); | |
this.onMouseIn(); | |
}; | |
this._hideTimeout = setTimeout(function ():void{ | |
onMouseOut(); | |
}, this._hideDur); | |
} | |
override protected function initView():void{ | |
super.initView(); | |
if (GlobalData.playerConfig.isSimple){ | |
return; | |
}; | |
this._menuPanel = new menuPanel(); | |
addChild(this._menuPanel); | |
this.blendMode = BlendMode.LAYER; | |
this._menuPanel.fullScreenBtn2.visible = false; | |
this.hideOrShowHistory(GlobalData.playerConfig.isHideHistory); | |
} | |
private function hideOrShowHistory(_arg1:Number):void{ | |
if (_arg1 == 1){ | |
this._menuPanel.historyBtn.mouseEnabled = false; | |
this._menuPanel.historyBtn.visible = false; | |
this._menuPanel.menuPanelBg.height = 128; | |
this.reSize(this._width, this._height); | |
}; | |
} | |
override public function reSize(_arg1:Number, _arg2:Number):void{ | |
super.reSize(_arg1, _arg2); | |
if (GlobalData.playerConfig.isSimple){ | |
return; | |
}; | |
this.y = ((_arg2 - this._menuPanel.menuPanelBg.height) / 2); | |
if (this.isShow){ | |
this.x = (_arg1 - this.width); | |
} else { | |
this.x = _arg1; | |
}; | |
} | |
public function slideLeft():void{ | |
this.show(); | |
var to:* = (this._width - this.width); | |
Tweener.addTween(this, { | |
x:to, | |
alpha:1, | |
time:0.8, | |
onComplete:function ():void{ | |
isShow = true; | |
} | |
}); | |
} | |
private function clickShareBtnHandler(_arg1:MouseEvent):void{ | |
(this._parent as ViewContainer).components["share"].show(); | |
} | |
private function clickFullScreenBtnHandler(_arg1:MouseEvent):void{ | |
this.dispatchEvent(new ViewEvent(ViewEvent.VIEW_FULLSCREEN)); | |
} | |
private function clickHistoryBtnHandler(_arg1:MouseEvent):void{ | |
navigateToURL(new URLRequest(Constant.openMyRecordUrl), "_blank"); | |
} | |
override public function setFullScreenMode(_arg1:Boolean):void{ | |
super.setFullScreenMode(_arg1); | |
if (GlobalData.playerConfig.isSimple){ | |
return; | |
}; | |
if (this._fullScreen){ | |
this._hideDur = 3000; | |
this._menuPanel.fullScreenBtn.visible = false; | |
this._menuPanel.fullScreenBtn2.visible = true; | |
} else { | |
this._hideDur = 8000; | |
this._menuPanel.fullScreenBtn2.visible = false; | |
this._menuPanel.fullScreenBtn.visible = true; | |
}; | |
this.slideLeft(); | |
} | |
} | |
}//package com.netease.openplayer.view.panel | |
package com.netease.openplayer.view.panel { | |
import flash.events.*; | |
import com.netease.openplayer.view.*; | |
import com.netease.openplayer.model.*; | |
import flash.net.*; | |
import com.netease.openplayer.util.*; | |
import flash.system.*; | |
public class VSharePanel extends BaseView { | |
public static var SHARE_TXTS:Array = ["分享到网易微博", "分享到开心网", "分享到人人网", "分享到豆瓣", "分享到新浪微博", "分享到搜狐微博", "分享到腾讯微博", "分享到QQ空间"]; | |
private var _sharePanle:sharePanel; | |
private var dataList:Array; | |
private var shareBtnArray:Array; | |
private var shareXML:XML; | |
private var _movieData:OpenMovieData; | |
private var ow:Number; | |
private var oh:Number; | |
public function VSharePanel(_arg1:ViewContainer){ | |
this.dataList = new Array(); | |
this.shareBtnArray = new Array(); | |
super(); | |
this.appendAt(_arg1); | |
this.hide(); | |
} | |
override protected function initEvent():void{ | |
super.initEvent(); | |
this._sharePanle.shareClose.addEventListener(MouseEvent.CLICK, this.close); | |
this.shareBtnArray = [this._sharePanle.shareNeteaseBtn, this._sharePanle.shareKaixinBtn, this._sharePanle.shareRenrenBtn, this._sharePanle.shareDoubanBtn, this._sharePanle.shareSinaBtn, this._sharePanle.shareSouhuBtn, this._sharePanle.shareTencentBtn, this._sharePanle.shareQzoneBtn]; | |
var _local1:int; | |
while (_local1 < this.shareBtnArray.length) { | |
this.shareBtnArray[_local1].indexNumber = _local1; | |
this.shareBtnArray[_local1].addEventListener(MouseEvent.CLICK, this.shareTowebsite); | |
this.shareBtnArray[_local1].addEventListener(MouseEvent.MOUSE_MOVE, this.showShareTip); | |
this.shareBtnArray[_local1].addEventListener(MouseEvent.ROLL_OUT, this.hideShareTip); | |
_local1++; | |
}; | |
var _local2 = 1; | |
while (_local2 <= 3) { | |
this._sharePanle[("copybtn" + _local2)].addEventListener(MouseEvent.CLICK, this.copyFun); | |
_local2++; | |
}; | |
} | |
override protected function initView():void{ | |
super.initView(); | |
this._sharePanle = new sharePanel(); | |
addChild(this._sharePanle); | |
this.hide(); | |
this.ow = this.width; | |
this.oh = this.height; | |
} | |
override public function reSize(_arg1:Number, _arg2:Number):void{ | |
super.reSize(_arg1, _arg2); | |
if ((((_arg1 < this.ow)) || ((_arg2 < this.oh)))){ | |
StretcherUtil.viewScale(this, _arg1, _arg2, this.ow, this.oh); | |
}; | |
this.x = ((_arg1 - this.width) / 2); | |
this.y = ((_arg2 - this.height) / 2); | |
} | |
public function close(_arg1:Event=null):void{ | |
this.hide(); | |
var _local2:ViewContainer = (this._parent as ViewContainer); | |
_local2.mediaUnLock(); | |
if (_local2.components["playerafter"].visible == false){ | |
_local2.core.play(); | |
}; | |
} | |
override public function reset(_arg1=null):void{ | |
this._movieData = (_arg1 as OpenMovieData); | |
} | |
private function initPanel(_arg1:XML):void{ | |
this.shareXML = _arg1; | |
var _local2:String = this._movieData.swfUrl.replace("v01", "v02"); | |
this.dataList[2] = _local2; | |
this.dataList[1] = (((("<object width=\"640\" height=\"360\"><param name=\"movie\" value=\"" + _local2) + "\"></param><param name=\"allowScriptAccess\" value=\"always\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"") + _local2) + "\" type=\"application/x-shockwave-flash\" width=\"640\" height=\"360\" allowFullScreen=\"true\" wmode=\"transparent\" allowScriptAccess=\"always\"></embed></object>"); | |
this.dataList[0] = this._movieData.pageUrl; | |
this._sharePanle.copyText1.text = this.dataList[0]; | |
this._sharePanle.copyText2.text = this.dataList[1]; | |
this._sharePanle.copyText3.text = this.dataList[2]; | |
super.show(); | |
} | |
private function copyFun(_arg1:MouseEvent):void{ | |
this.reset(this.shareXML); | |
var _local2:Number = Number(_arg1.target.name.split("copybtn")[1]); | |
this._sharePanle[("copyText" + _local2)].text = "已复制"; | |
System.setClipboard(this.dataList[(_local2 - 1)]); | |
} | |
private function shareTowebsite(_arg1:MouseEvent):void{ | |
var _local4:String; | |
var _local2:int = _arg1.currentTarget.indexNumber; | |
var _local3 = ""; | |
if (this.shareXML.item[_local2].toString().indexOf("$title") != -1){ | |
_local4 = this.shareXML.item[_local2].toString().replace("$title", (("《" + this._movieData.title) + "》")); | |
} else { | |
_local4 = ((("《" + this._movieData.title) + "》") + this.shareXML.item[_local2]); | |
}; | |
_local3 = ((((((((((this.shareXML.item[_local2].@url + "?") + this.shareXML.item[_local2].@variableurl) + "=") + this._movieData.pageUrl) + "&title=") + encodeURI(_local4)) + "&") + this.shareXML.item[_local2].@variablecontent) + "=") + encodeURI(_local4)); | |
if (_local2 == 0){ | |
_local3 = ((((((((((this.shareXML.item[_local2].@url + "?") + this.shareXML.item[_local2].@variableurl) + "=") + this._movieData.pageUrl) + "&source=OE00SVvHa0nHgkut") + "&") + this.shareXML.item[_local2].@variablecontent) + "=") + encodeURI(_local4)) + encodeURI((" " + this._movieData.pageUrl))); | |
}; | |
if (_local2 == 4){ | |
_local3 = (_local3 + "&appkey=2216871876"); | |
}; | |
if (_local2 == 5){ | |
_local3 = (_local3 + "&content=utf-8&pic"); | |
}; | |
if (_local2 == 7){ | |
_local3 = (_local3 + "&showcount=1"); | |
}; | |
navigateToURL(new URLRequest(_local3), "_blank"); | |
} | |
private function showShareTip(_arg1:MouseEvent):void{ | |
if (!this._sharePanle.shareTip){ | |
this._sharePanle.shareTip = new shareBtnTip(); | |
addChild(this._sharePanle.shareTip); | |
this._sharePanle.shareTip.visible = false; | |
}; | |
var _local2:int = _arg1.currentTarget.indexNumber; | |
this._sharePanle.shareTip.shareTipTxt.text = SHARE_TXTS[_local2]; | |
this._sharePanle.shareTip.x = (mouseX + 2); | |
this._sharePanle.shareTip.y = ((mouseY - this._sharePanle.shareTip.height) - 8); | |
this._sharePanle.shareTip.visible = true; | |
} | |
private function hideShareTip(_arg1:Event):void{ | |
if (this._sharePanle.shareTip){ | |
this._sharePanle.shareTip.visible = false; | |
}; | |
} | |
override public function show(_arg1:Event=null):void{ | |
var e = _arg1; | |
var vc:* = (this._parent as ViewContainer); | |
vc.mediaLock(); | |
vc.components["history"].hide(); | |
vc.components["setting"].hide(); | |
vc.playMidAd(false); | |
if (!vc.components["playerafter"].visible){ | |
vc.core.pause(); | |
}; | |
if (!this.shareXML){ | |
FileLoadUtil.loadShareXML(function (_arg1:XML):void{ | |
initPanel(_arg1); | |
}, function ():void{ | |
}); | |
} else { | |
super.show(); | |
}; | |
} | |
} | |
}//package com.netease.openplayer.view.panel | |
package com.netease.openplayer.view.panel { | |
import flash.events.*; | |
import com.netease.openplayer.view.*; | |
import com.netease.openplayer.model.*; | |
import com.netease.openplayer.util.*; | |
public class VSettingPanel extends BaseView { | |
private var settingPanel:SettingPanel; | |
private var lbChecked:Boolean = false; | |
private var ow:Number; | |
private var oh:Number; | |
public function VSettingPanel(_arg1:ViewContainer){ | |
this.appendAt(_arg1); | |
hide(); | |
} | |
override protected function initEvent():void{ | |
super.initEvent(); | |
this.settingPanel.settingCloseBtn.addEventListener(MouseEvent.CLICK, this.close); | |
this.settingPanel.savebtn.addEventListener(MouseEvent.CLICK, this.save); | |
this.settingPanel.cancelbtn.addEventListener(MouseEvent.CLICK, this.close); | |
this.settingPanel.lbCheckBtn.addEventListener(MouseEvent.CLICK, this.checkContinue); | |
} | |
override protected function initView():void{ | |
super.initView(); | |
this.settingPanel = new SettingPanel(); | |
addChild(this.settingPanel); | |
this.settingPanel.lbCheckBtn.gotoAndStop(1); | |
this.settingPanel.lbCheckBtn.buttonMode = true; | |
this.ow = this.width; | |
this.oh = this.height; | |
} | |
override public function reSize(_arg1:Number, _arg2:Number):void{ | |
super.reSize(_arg1, _arg2); | |
if ((((_arg1 < this.ow)) || ((_arg2 < this.oh)))){ | |
StretcherUtil.viewScale(this, _arg1, _arg2, this.ow, this.oh); | |
}; | |
this.x = ((_arg1 - this.width) / 2); | |
this.y = ((_arg2 - this.height) / 2); | |
} | |
override public function show(_arg1:Event=null):void{ | |
var _local2:ViewContainer = (this._parent as ViewContainer); | |
_local2.mediaLock(); | |
_local2.components["history"].hide(); | |
_local2.components["share"].hide(); | |
super.show(); | |
_local2.playMidAd(false); | |
if (!_local2.components["playerafter"].visible){ | |
_local2.core.pause(); | |
}; | |
this.reset(); | |
} | |
public function close(_arg1:Event=null):void{ | |
this.hide(); | |
var _local2:ViewContainer = (this._parent as ViewContainer); | |
_local2.mediaUnLock(); | |
if (_local2.components["playerafter"].visible == false){ | |
_local2.core.play(); | |
}; | |
} | |
override public function reset(_arg1=null):void{ | |
if (GlobalData.playerConfig.isContinue == 1){ | |
this.settingPanel.lbCheckBtn.gotoAndStop(2); | |
this.lbChecked = true; | |
} else { | |
this.settingPanel.lbCheckBtn.gotoAndStop(1); | |
this.lbChecked = false; | |
}; | |
} | |
private function checkContinue(_arg1:Event=null):void{ | |
if (this.lbChecked == false){ | |
this.settingPanel.lbCheckBtn.gotoAndStop(2); | |
this.lbChecked = true; | |
} else { | |
this.settingPanel.lbCheckBtn.gotoAndStop(1); | |
this.lbChecked = false; | |
}; | |
} | |
private function save(_arg1:Event=null):void{ | |
GlobalData.playerConfig.isContinue = (((this.lbChecked == true)) ? 1 : 0); | |
GlobalData.recordObj.setRecordIsContinue(GlobalData.playerConfig.isContinue); | |
this.close(); | |
} | |
} | |
}//package com.netease.openplayer.view.panel | |
package com.netease.openplayer.view { | |
import flash.events.*; | |
import com.netease.openplayer.event.*; | |
import com.netease.openplayer.model.*; | |
import com.netease.eduplayercore.*; | |
import flash.display.*; | |
import com.netease.openplayer.view.video.*; | |
import com.netease.openplayer.view.ad.*; | |
import com.netease.openplayer.view.recommend.*; | |
import com.netease.openplayer.view.control.*; | |
import com.netease.openplayer.view.panel.*; | |
public class ViewContainer extends Sprite { | |
private var _width:Number; | |
private var _height:Number; | |
private var _core:MediaCore; | |
private var _vvideo:VVideo; | |
private var _preVideoAdPlayer:VPreVideoAdPlayer; | |
private var _endingVideoAdPlayer:VEndingVideoAdPlayer; | |
private var _pauseAdPlayer:VPicAdPlayer; | |
private var _playAfter:VPlayAfterShow; | |
private var _controlBar:VCtrlBar; | |
private var _menuPanel:VMenuPanel; | |
private var _settingPanel:VSettingPanel; | |
private var _sharePanel:VSharePanel; | |
private var _historyPanel:VHistoryPanel; | |
private var _tips:VTip; | |
private var _fullScreenTitle:VFullScreenTitle; | |
private var _error:VError; | |
private var _poster:VPoster; | |
private var _dataLoading:VDataLoading; | |
private var _isFullScreenMode:Boolean = false; | |
private var _movieData:OpenMovieData; | |
private var _components:Object; | |
private var _isReady:Boolean = false; | |
private var _isLocked:Boolean = false; | |
public function ViewContainer(_arg1:MediaCore){ | |
this._components = new Object(); | |
super(); | |
this._core = _arg1; | |
this.initView(); | |
this.initEvent(); | |
this._isReady = true; | |
} | |
private function sendViewEvent(_arg1:String, _arg2=undefined):void{ | |
var _local3:ViewEvent = new ViewEvent(_arg1, _arg2); | |
this.dispatchEvent(_local3); | |
} | |
private function initView():void{ | |
this._vvideo = new VVideo(this, this._core); | |
this.setComponent(this._vvideo, "video"); | |
this._playAfter = new VPlayAfterShow(this); | |
this.setComponent(this._playAfter, "playerafter"); | |
this._menuPanel = new VMenuPanel(this); | |
this.setComponent(this._menuPanel, "menu"); | |
this._settingPanel = new VSettingPanel(this); | |
this.setComponent(this._settingPanel, "setting"); | |
this._sharePanel = new VSharePanel(this); | |
this.setComponent(this._sharePanel, "share"); | |
this._historyPanel = new VHistoryPanel(this); | |
this.setComponent(this._historyPanel, "history"); | |
this._tips = new VTip(this); | |
this.setComponent(this._tips, "tips"); | |
this._controlBar = new VCtrlBar(this); | |
this.setComponent(this._controlBar, "controlBar"); | |
this._fullScreenTitle = new VFullScreenTitle(this); | |
this.setComponent(this._fullScreenTitle, "fullScreenTitle"); | |
this._preVideoAdPlayer = new VPreVideoAdPlayer(this); | |
this.setComponent(this._preVideoAdPlayer, "preVideoAd"); | |
this._endingVideoAdPlayer = new VEndingVideoAdPlayer(this); | |
this.setComponent(this._endingVideoAdPlayer, "endingVideoAd"); | |
this._pauseAdPlayer = new VPicAdPlayer(this); | |
this.setComponent(this._pauseAdPlayer, "pauseAd"); | |
this._poster = new VPoster(this); | |
this.setComponent(this._poster, "poster"); | |
this._dataLoading = new VDataLoading(this); | |
this.setComponent(this._dataLoading, "dataLoading"); | |
this._error = new VError(this); | |
this.setComponent(this._error, "error"); | |
this.resizeHandler(); | |
} | |
private function setComponent(_arg1:IView, _arg2:String):void{ | |
this._components[_arg2] = _arg1; | |
} | |
private function initEvent():void{ | |
GlobalData.stage.addEventListener(Event.RESIZE, this.resizeHandler); | |
this._controlBar.addEventListener(ViewEvent.VIEW_VOLUME, this.viewEventHandler); | |
this._controlBar.addEventListener(ViewEvent.VIEW_MUTE, this.viewEventHandler); | |
this._controlBar.addEventListener(ViewEvent.VIEW_PLAY, this.viewEventHandler); | |
this._controlBar.addEventListener(ViewEvent.VIEW_PAUSE, this.viewEventHandler); | |
this._controlBar.addEventListener(ViewEvent.VIEW_SEEK, this.viewEventHandler); | |
this._controlBar.addEventListener(ViewEvent.VIEW_CHANGE_QUALITY, this.viewEventHandler); | |
this._poster.addEventListener(ViewEvent.VIEW_PLAY, this.viewEventHandler); | |
this._vvideo.addEventListener(ViewEvent.VIEW_TOGGLEPLAY, this.viewEventHandler); | |
this._vvideo.addEventListener(ViewEvent.VIEW_FULLSCREEN, this.viewEventHandler); | |
this._preVideoAdPlayer.addEventListener(ViewEvent.VIEW_PRE_AD_END, this.viewEventHandler); | |
this._endingVideoAdPlayer.addEventListener(ViewEvent.VIEW_ENDING_AD_END, this.viewEventHandler); | |
this._playAfter.addEventListener(ViewEvent.VIEW_PLAY, this.viewEventHandler); | |
this._fullScreenTitle.addEventListener(ViewEvent.VIEW_FULLSCREEN, this.viewEventHandler); | |
this._tips.addEventListener(ViewEvent.VIEW_SEEK, this.viewEventHandler); | |
this._menuPanel.addEventListener(ViewEvent.VIEW_FULLSCREEN, this.viewEventHandler); | |
this._settingPanel.addEventListener(ViewEvent.VIEW_PLAY, this.viewEventHandler); | |
this._sharePanel.addEventListener(ViewEvent.VIEW_PLAY, this.viewEventHandler); | |
this._historyPanel.addEventListener(ViewEvent.VIEW_PLAY, this.viewEventHandler); | |
this._settingPanel.addEventListener(ViewEvent.VIEW_PAUSE, this.viewEventHandler); | |
this._sharePanel.addEventListener(ViewEvent.VIEW_PAUSE, this.viewEventHandler); | |
this._historyPanel.addEventListener(ViewEvent.VIEW_PAUSE, this.viewEventHandler); | |
} | |
private function viewEventHandler(_arg1:ViewEvent):void{ | |
this.dispatchEvent(_arg1); | |
} | |
private function resizeHandler(_arg1:Event=null):void{ | |
this._width = GlobalData.stage.stageWidth; | |
this._height = GlobalData.stage.stageHeight; | |
this.resize(this._width, this._height); | |
} | |
public function resize(_arg1:Number, _arg2:Number):void{ | |
var _local3:String; | |
for (_local3 in this.components) { | |
(this.components[_local3] as BaseView).reSize(_arg1, _arg2); | |
}; | |
this.changeFullScreenMode((GlobalData.stage.displayState == StageDisplayState.FULL_SCREEN)); | |
} | |
public function fullScreen():void{ | |
var _local1:Stage = GlobalData.stage; | |
_local1.focus = _local1; | |
if (_local1.displayState == StageDisplayState.FULL_SCREEN){ | |
_local1.displayState = StageDisplayState.NORMAL; | |
} else { | |
_local1.displayState = StageDisplayState.FULL_SCREEN; | |
}; | |
this.changeFullScreenMode((_local1.displayState == StageDisplayState.FULL_SCREEN)); | |
} | |
public function changeFullScreenMode(_arg1:Boolean):void{ | |
var _local2:String; | |
this._isFullScreenMode = _arg1; | |
for (_local2 in this.components) { | |
(this.components[_local2] as BaseView).setFullScreenMode(this._isFullScreenMode); | |
}; | |
} | |
public function setMovieData(_arg1:OpenMovieData):void{ | |
var _local2:String; | |
this._movieData = _arg1; | |
for (_local2 in this.components) { | |
(this.components[_local2] as BaseView).reset(this._movieData); | |
}; | |
this.resize(this._width, this._height); | |
} | |
public function playerLock():void{ | |
this._isLocked = true; | |
this._controlBar.hide(); | |
this._vvideo.hide(); | |
this._menuPanel.hide(); | |
this.mouseChildren = false; | |
this.mouseEnabled = false; | |
} | |
public function playerUnLock():void{ | |
this._controlBar.show(); | |
this._vvideo.show(); | |
this._menuPanel.show(); | |
this.mouseChildren = true; | |
this.mouseEnabled = true; | |
this._isLocked = false; | |
} | |
public function mediaLock():void{ | |
this._isLocked = true; | |
this._controlBar.disable(); | |
this._vvideo.disable(); | |
} | |
public function mediaUnLock():void{ | |
this._controlBar.active(); | |
this._vvideo.active(); | |
this._isLocked = false; | |
} | |
public function showError(_arg1:Object):void{ | |
this._error.showError(_arg1); | |
this.playerLock(); | |
} | |
public function showDataLoading():void{ | |
this._dataLoading.show(); | |
} | |
public function hideDataLoading():void{ | |
this._dataLoading.hide(); | |
} | |
public function showVideoLoading():void{ | |
this._vvideo.setBuffering(); | |
} | |
public function showCover():void{ | |
this._poster.show(); | |
} | |
public function setPlayState(_arg1:Boolean):void{ | |
this._controlBar.setPlayPause(_arg1); | |
if (_arg1){ | |
this._vvideo.setPlay(); | |
} else { | |
this._vvideo.setPause(); | |
}; | |
} | |
public function setLoadProgress(_arg1:Number):void{ | |
this._controlBar.setLoadProgress(_arg1); | |
} | |
public function setPlayProgress(_arg1:Number, _arg2:Number):void{ | |
this._controlBar.updatePlayProgress(_arg1, _arg2); | |
} | |
public function setTotalTime(_arg1:Number):void{ | |
this._controlBar.setTotalTime(_arg1); | |
} | |
public function setVolume(_arg1:Number):void{ | |
this._controlBar.setVolume(_arg1); | |
} | |
public function showReplay():void{ | |
this._controlBar.setCompleteStatus(); | |
this._playAfter.getPlayAfterData(); | |
if (this._isFullScreenMode){ | |
this.fullScreen(); | |
}; | |
} | |
public function hideReplay():void{ | |
this._playAfter.hide(); | |
} | |
public function playPreAd():void{ | |
this._preVideoAdPlayer.playAd(); | |
} | |
public function playEndingAd():void{ | |
this._endingVideoAdPlayer.playAd(); | |
} | |
public function showCaption(_arg1:Number):void{ | |
this._vvideo.showCaption(_arg1); | |
} | |
public function playMidAd(_arg1:Boolean):void{ | |
this._pauseAdPlayer.playAd(_arg1); | |
} | |
public function setforward(_arg1:Number):void{ | |
this._controlBar.seekforward(_arg1); | |
} | |
public function setbackward(_arg1:Number):void{ | |
this._controlBar.seekbackward(_arg1); | |
} | |
public function get components():Object{ | |
return (this._components); | |
} | |
public function get isReady():Boolean{ | |
return (this._isReady); | |
} | |
public function get core():MediaCore{ | |
return (this._core); | |
} | |
public function get isLocked():Boolean{ | |
return (this._isLocked); | |
} | |
} | |
}//package com.netease.openplayer.view | |
package com.netease.openplayer.view.control { | |
import flash.events.*; | |
import com.netease.openplayer.view.*; | |
import com.netease.openplayer.event.*; | |
import com.netease.openplayer.model.*; | |
import flash.utils.*; | |
import caurina.transitions.*; | |
import flash.geom.*; | |
public class VVolumeBar extends BaseView { | |
private var closeSoundBt:CloseSoundBt; | |
private var openSoundBt:OpenSoundBt; | |
private var lineMc:VolumeLine; | |
private var timer:Timer; | |
private var targetFrame:Number = 1; | |
private var btnHeight:Number = 0; | |
private var volumeBgHeight:Number = 0; | |
private var _isDrag:Boolean = false; | |
private var _volumeStore:Number = 0; | |
override protected function initEvent():void{ | |
super.initEvent(); | |
this.closeSoundBt.addEventListener(MouseEvent.CLICK, this.closeSoundEvent); | |
this.openSoundBt.addEventListener(MouseEvent.CLICK, this.openSoundEvent); | |
this.closeSoundBt.addEventListener(MouseEvent.ROLL_OVER, this.showVolumeSlide); | |
this.openSoundBt.addEventListener(MouseEvent.ROLL_OVER, this.showVolumeSlide); | |
this.openSoundBt.addEventListener(MouseEvent.ROLL_OUT, this.hideVolumeSlide); | |
this.closeSoundBt.addEventListener(MouseEvent.ROLL_OUT, this.hideVolumeSlide); | |
this.lineMc.addEventListener(MouseEvent.ROLL_OUT, this.hideVolumeSlide); | |
this.lineMc.buttonMode = true; | |
this.lineMc.volumebg.addEventListener(MouseEvent.CLICK, this.volumeBgClick); | |
this.lineMc.volumebtn.addEventListener(MouseEvent.MOUSE_DOWN, this.volumeBtnDownEvent); | |
} | |
override protected function initView():void{ | |
super.initView(); | |
this.closeSoundBt = new CloseSoundBt(); | |
addChild(this.closeSoundBt); | |
this.openSoundBt = new OpenSoundBt(); | |
addChild(this.openSoundBt); | |
this.lineMc = new VolumeLine(); | |
this.lineMc.visible = false; | |
this.lineMc.volumebg.mouseEnabled = true; | |
this.lineMc.volume.mouseEnabled = false; | |
this.lineMc.x = 0; | |
this.lineMc.y = 0; | |
addChild(this.lineMc); | |
this.closeSoundBt.y = (this.openSoundBt.y = (this.lineMc.height + 9)); | |
this.openSoundBt.x = (this.closeSoundBt.x = ((this.lineMc.width - this.closeSoundBt.width) / 2)); | |
this.openSoundBt.visible = false; | |
this.btnHeight = (this.lineMc.volumebtn.height - 6); | |
this.volumeBgHeight = this.lineMc.volumebg.height; | |
} | |
private function volumeBgClick(_arg1:MouseEvent):void{ | |
var _local2:Number = this.lineMc.mouseY; | |
this.lineMc.volumebtn.y = ((((_local2 - 3) < 10)) ? 10 : ((((_local2 - 3) > (84 - this.btnHeight))) ? (84 - this.btnHeight) : (_local2 - 3))); | |
this.lineMc.volume.y = (this.lineMc.volumebtn.y + this.btnHeight); | |
this.lineMc.volume.height = ((((87 - this.lineMc.volume.y) < 0)) ? 0 : (87 - this.lineMc.volume.y)); | |
this.volumeChangeEvent(); | |
this.storeVolume(); | |
} | |
public function volumeBtnDownEvent(_arg1:MouseEvent):void{ | |
var _local2:Number = (this.lineMc.volumebg.y - 3); | |
var _local3:Number = (this.lineMc.volumebg.height - this.btnHeight); | |
var _local4:Number = this.lineMc.volumebtn.x; | |
var _local5:Number = 0; | |
var _local6:Rectangle = new Rectangle(_local4, _local2, _local5, _local3); | |
this.lineMc.volumebtn.startDrag(false, _local6); | |
this._isDrag = true; | |
stage.addEventListener(MouseEvent.MOUSE_MOVE, this.volumeBtnMoveEvent); | |
stage.addEventListener(MouseEvent.MOUSE_UP, this.volumeBtnUpEvent); | |
} | |
private function showVolumeSlide(_arg1:MouseEvent):void{ | |
var event:* = _arg1; | |
this.lineMc.visible = true; | |
Tweener.addTween(this.lineMc, { | |
alpha:1, | |
time:0.4, | |
onComplete:function ():void{ | |
} | |
}); | |
} | |
private function hideVolumeSlide(_arg1:MouseEvent):void{ | |
var event:* = _arg1; | |
if (((((!((event.currentTarget == this.lineMc))) && ((event.localY > 0)))) || ((((event.currentTarget == this.lineMc)) && ((((((event.localY < 0)) || ((event.localX <= 0)))) || ((event.localX > this.lineMc.width)))))))){ | |
Tweener.addTween(this.lineMc, { | |
alpha:0, | |
time:0.4, | |
onComplete:function ():void{ | |
lineMc.visible = false; | |
} | |
}); | |
}; | |
} | |
private function volumeBtnMoveEvent(_arg1:MouseEvent):void{ | |
this.lineMc.volume.height = (((87 - this.lineMc.volumebtn.y) - this.lineMc.volumebtn.height) + 3); | |
this.lineMc.volume.y = (87 - this.lineMc.volume.height); | |
this.volumeChangeEvent(); | |
} | |
private function volumeBtnUpEvent(_arg1:MouseEvent):void{ | |
this._isDrag = false; | |
stage.removeEventListener(MouseEvent.MOUSE_UP, this.volumeBtnUpEvent); | |
stage.removeEventListener(MouseEvent.MOUSE_MOVE, this.volumeBtnMoveEvent); | |
this.lineMc.volumebtn.stopDrag(); | |
this.volumeChangeEvent(); | |
this.storeVolume(); | |
} | |
public function setVolume(_arg1:Number):void{ | |
_arg1 = (((_arg1 > 1)) ? 1 : _arg1); | |
_arg1 = (((_arg1 < 0)) ? 0 : _arg1); | |
GlobalData.playerConfig.volume = _arg1; | |
if (_arg1 > 0){ | |
this.setMute(false); | |
} else { | |
this.setMute(true); | |
}; | |
this.lineMc.volume.height = (_arg1 * (this.lineMc.volumebg.height - (this.lineMc.volumebtn.height - 6))); | |
this.lineMc.volume.y = (87 - this.lineMc.volume.height); | |
this.lineMc.volumebtn.y = ((this.lineMc.volume.y - this.lineMc.volumebtn.height) + 3); | |
dispatchEvent(new ViewEvent(ViewEvent.VIEW_VOLUME, _arg1)); | |
this.storeVolume(); | |
} | |
private function volumeChangeEvent(_arg1:MouseEvent=null):void{ | |
var _local2:Number = ((((87 - this.lineMc.volumebtn.height) - this.lineMc.volumebtn.y) + 3) / (this.lineMc.volumebg.height - (this.lineMc.volumebtn.height - 6))); | |
_local2 = (((_local2 > 1)) ? 1 : _local2); | |
_local2 = (((_local2 < 0)) ? 0 : _local2); | |
if (_local2 > 0){ | |
this.setMute(false); | |
} else { | |
this.setMute(true); | |
}; | |
GlobalData.playerConfig.volume = _local2; | |
dispatchEvent(new ViewEvent(ViewEvent.VIEW_VOLUME, _local2)); | |
} | |
private function closeSoundEvent(_arg1:MouseEvent):void{ | |
this._volumeStore = GlobalData.playerConfig.volume; | |
this.dispatchEvent(new ViewEvent(ViewEvent.VIEW_MUTE, true)); | |
this.setVolume(0); | |
} | |
private function openSoundEvent(_arg1:MouseEvent):void{ | |
this.dispatchEvent(new ViewEvent(ViewEvent.VIEW_MUTE, false)); | |
this.setVolume(this._volumeStore); | |
} | |
private function setMute(_arg1:Boolean):void{ | |
if (_arg1){ | |
this.openSoundBt.visible = true; | |
this.closeSoundBt.visible = false; | |
} else { | |
this.openSoundBt.visible = false; | |
this.closeSoundBt.visible = true; | |
}; | |
} | |
private function storeVolume():void{ | |
GlobalData.recordObj.setRecordVolume(GlobalData.playerConfig.volume); | |
} | |
override public function reSize(_arg1:Number, _arg2:Number):void{ | |
} | |
} | |
}//package com.netease.openplayer.view.control | |
package com.netease.openplayer.view.control { | |
import flash.events.*; | |
import com.netease.openplayer.view.*; | |
import flash.display.*; | |
import com.netease.openplayer.view.control.event.*; | |
import caurina.transitions.*; | |
import com.netease.openplayer.view.control.ui.*; | |
public class VCaptionSelect extends BaseView { | |
private var _statusBtn:VCtrlStatusBtn; | |
private var _selectlist:VCtrlSelectList; | |
private var _captionTip:CaptionTip; | |
private var _captionData:Object; | |
private var _canShowTip:Boolean = true; | |
public function VCaptionSelect(_arg1:ViewContainer){ | |
this._parent = _arg1; | |
} | |
override protected function initEvent():void{ | |
super.initEvent(); | |
this._statusBtn.addEventListener(CtrlBarEvent.STATUSBTN_ACTIVE, this.showList); | |
this._statusBtn.addEventListener(CtrlBarEvent.STATUSBTN_DEFAULT, this.hideList); | |
this._selectlist.addEventListener(CtrlBarEvent.QUALITY_SELECTBTN_CLICK, this.onClickSlectBtn); | |
this._selectlist.addEventListener(CtrlBarEvent.QUALITY_SELECTBTN_MOUSEOVER, this.onMouseoverSlectBtn); | |
this._selectlist.addEventListener(CtrlBarEvent.QUALITY_SELECTBTN_MOUSEOUT, this.onMouseoutSlectBtn); | |
} | |
override protected function initView():void{ | |
super.initView(); | |
this._selectlist = new VCtrlSelectList(false); | |
this.addChild(this._selectlist); | |
this._selectlist.visible = false; | |
this._selectlist.x = -7; | |
this._statusBtn = new VCtrlStatusBtn("字幕"); | |
this.addChild(this._statusBtn); | |
this._statusBtn.y = 6; | |
this._captionTip = new CaptionTip(); | |
addChild(this._captionTip); | |
this._captionTip.blendMode = BlendMode.LAYER; | |
this._captionTip.visible = false; | |
this._captionTip.x = -142; | |
} | |
override public function reset(_arg1=null):void{ | |
super.reset(_arg1); | |
this._captionData = _arg1.captionData; | |
if (!this._captionData.hasCaption){ | |
this._statusBtn.setDisable(); | |
return; | |
}; | |
this._statusBtn.setDefault(); | |
var _local2:Array = this._captionData.data; | |
var _local3:Array = []; | |
var _local4:int; | |
while (_local4 < _local2.length) { | |
_local3.push({ | |
name:_local2[_local4].name, | |
isDisable:(_local2[_local4].url == ""), | |
isActive:!((_local2[_local4].url == "")), | |
data:_local2[_local4] | |
}); | |
_local4++; | |
}; | |
this._selectlist.setListData(_local3); | |
this._selectlist.y = -(this._selectlist.height); | |
} | |
private function showList(_arg1:Event=null):void{ | |
var evt = _arg1; | |
this._selectlist.visible = true; | |
Tweener.addTween(this._selectlist, { | |
alpha:1, | |
time:0.3, | |
onComplete:function ():void{ | |
} | |
}); | |
} | |
private function hideList(_arg1:Event=null):void{ | |
var evt = _arg1; | |
Tweener.addTween(this._selectlist, { | |
alpha:0, | |
time:0.3, | |
onComplete:function ():void{ | |
_selectlist.visible = false; | |
} | |
}); | |
} | |
private function onClickSlectBtn(_arg1:CtrlBarEvent):void{ | |
var _local2:Object = _arg1.data; | |
if (_local2.index == 0){ | |
(this._parent as ViewContainer).components["video"].showOrHideCaptionCn(_local2.isActive); | |
} else { | |
(this._parent as ViewContainer).components["video"].showOrHideCaptionEn(_local2.isActive); | |
}; | |
} | |
private function onMouseoverSlectBtn(_arg1:CtrlBarEvent):void{ | |
this.optionHover(_arg1); | |
} | |
private function onMouseoutSlectBtn(_arg1:CtrlBarEvent):void{ | |
this.optionOut(_arg1); | |
} | |
private function optionHover(_arg1:CtrlBarEvent):void{ | |
if (!this._canShowTip){ | |
this._captionTip.visible = false; | |
return; | |
}; | |
this._captionTip.captionTiptxt.text = _arg1.data.data.tipTxt; | |
if (_arg1.data.index == 0){ | |
this._captionTip.y = -54; | |
} else { | |
this._captionTip.y = -26; | |
}; | |
this._captionTip.visible = true; | |
} | |
private function optionOut(_arg1:Event):void{ | |
this._captionTip.visible = false; | |
} | |
override public function setFullScreenMode(_arg1:Boolean):void{ | |
super.setFullScreenMode(_arg1); | |
this._canShowTip = !(_arg1); | |
} | |
public function selectCn():void{ | |
this._selectlist.clickBtnByIndex(0); | |
} | |
public function selectEn():void{ | |
this._selectlist.clickBtnByIndex(1); | |
} | |
} | |
}//package com.netease.openplayer.view.control | |
package com.netease.openplayer.view.control { | |
import flash.events.*; | |
import com.netease.openplayer.view.*; | |
import com.netease.openplayer.event.*; | |
import com.netease.openplayer.model.*; | |
import com.netease.eduplayercore.model.*; | |
import com.netease.openplayer.view.control.event.*; | |
import caurina.transitions.*; | |
import com.netease.openplayer.view.control.ui.*; | |
public class VQualitySelect extends BaseView { | |
private var _statusBtn:VCtrlStatusBtn; | |
private var _selectlist:VCtrlSelectList; | |
private var _movieItemList:Array; | |
private var _posMovieItem:MovieListItem; | |
public function VQualitySelect(){ | |
this._movieItemList = []; | |
super(); | |
} | |
override protected function initEvent():void{ | |
super.initEvent(); | |
this._statusBtn.addEventListener(CtrlBarEvent.STATUSBTN_ACTIVE, this.showList); | |
this._statusBtn.addEventListener(CtrlBarEvent.STATUSBTN_DEFAULT, this.hideList); | |
this._selectlist.addEventListener(CtrlBarEvent.QUALITY_SELECTBTN_CLICK, this.onClickQualityBtn); | |
} | |
override protected function initView():void{ | |
super.initView(); | |
this._selectlist = new VCtrlSelectList(true); | |
this.addChild(this._selectlist); | |
this._selectlist.visible = false; | |
this._selectlist.x = -7; | |
this._statusBtn = new VCtrlStatusBtn(); | |
this.addChild(this._statusBtn); | |
this._statusBtn.y = 6; | |
} | |
override public function reset(_arg1=null):void{ | |
super.reset(_arg1); | |
this._movieItemList = _arg1.movieItemList; | |
this._posMovieItem = _arg1.currentMode; | |
this.buildQualityList(); | |
} | |
private function buildQualityList():void{ | |
if (!this._movieItemList){ | |
return; | |
}; | |
this._statusBtn.setText(Constant.qualityVars[this._posMovieItem.qualityName].name); | |
if (this._movieItemList.length <= 1){ | |
this._statusBtn.setDisable(); | |
return; | |
}; | |
this._statusBtn.setDefault(); | |
var _local1:Array = []; | |
var _local2:int; | |
while (_local2 < this._movieItemList.length) { | |
_local1.push({ | |
name:Constant.qualityVars[this._movieItemList[_local2].qualityName].name, | |
isActive:(this._movieItemList[_local2].quality == this._posMovieItem.quality), | |
data:this._movieItemList[_local2] | |
}); | |
_local2++; | |
}; | |
this._selectlist.setListData(_local1); | |
this._selectlist.y = -(this._selectlist.height); | |
} | |
private function showList(_arg1:Event=null):void{ | |
var evt = _arg1; | |
this._selectlist.visible = true; | |
Tweener.addTween(this._selectlist, { | |
alpha:1, | |
time:0.3, | |
onComplete:function ():void{ | |
} | |
}); | |
} | |
private function hideList(_arg1:Event=null):void{ | |
var evt = _arg1; | |
Tweener.addTween(this._selectlist, { | |
alpha:0, | |
time:0.3, | |
onComplete:function ():void{ | |
_selectlist.visible = false; | |
} | |
}); | |
} | |
private function onClickQualityBtn(_arg1:CtrlBarEvent):void{ | |
var _local2:MovieListItem = (_arg1.data.data as MovieListItem); | |
this._posMovieItem = _local2; | |
this._statusBtn.setText(Constant.qualityVars[this._posMovieItem.qualityName].name); | |
this._statusBtn.setDefault(); | |
this.dispatchEvent(new ViewEvent(ViewEvent.VIEW_CHANGE_QUALITY, { | |
name:_local2.qualityName, | |
quailty:_local2.quality | |
})); | |
} | |
} | |
}//package com.netease.openplayer.view.control | |
package com.netease.openplayer.view.control.event { | |
import flash.events.*; | |
public class CtrlBarEvent extends Event { | |
public static var STATUSBTN_DEFAULT:String = "controlbtndefault"; | |
public static var STATUSBTN_ACTIVE:String = "controlbtnaction"; | |
public static var QUALITY_SELECTBTN_CLICK:String = "qualitybtnclick"; | |
public static var QUALITY_SELECTBTN_MOUSEOVER:String = "qualitybtnmouseover"; | |
public static var QUALITY_SELECTBTN_MOUSEOUT:String = "qualitybtnmouseout"; | |
public static var CAPTION_SELECTBTN_CLICK:String = "captionselectbtnclick"; | |
public var data; | |
public function CtrlBarEvent(_arg1:String, _arg2=null){ | |
super(_arg1, false, false); | |
this.data = _arg2; | |
} | |
override public function clone():Event{ | |
return (new CtrlBarEvent(this.type, this.data)); | |
} | |
override public function toString():String{ | |
return ((((("[CtrlBarEvent type=\"" + type) + " data=\"") + this.data) + "\"]")); | |
} | |
} | |
}//package com.netease.openplayer.view.control.event | |
package com.netease.openplayer.view.control.ui { | |
import flash.display.*; | |
import com.netease.openplayer.view.control.event.*; | |
public class VCtrlSelectList extends Sprite { | |
private var _bg:StatusListBg; | |
private var _btnsCon:Sprite; | |
private var _listData:Array; | |
private var _btnlist:Array; | |
private var _padding:Number = 5; | |
private var _btnWidth:Number = 63; | |
private var _btnHeight:Number = 22; | |
private var _isRelated:Boolean = false; | |
public function VCtrlSelectList(_arg1:Boolean=false){ | |
this._btnlist = []; | |
super(); | |
this._isRelated = _arg1; | |
this.build(); | |
} | |
public function build():void{ | |
this._bg = new StatusListBg(); | |
this.addChild(this._bg); | |
this._bg.x = 0; | |
this._bg.y = 0; | |
this._btnsCon = new Sprite(); | |
this.addChild(this._btnsCon); | |
} | |
public function setListData(_arg1:Array):void{ | |
this._listData = _arg1; | |
var _local2:int; | |
while (_local2 < this._btnlist.length) { | |
this.removeChild(this._btnlist[_local2]); | |
_local2++; | |
}; | |
this.initList(); | |
} | |
public function initList():void{ | |
this._bg.width = 76; | |
this._bg.height = 0; | |
var _local1:int; | |
while (_local1 < this._listData.length) { | |
this._btnlist.push(this.allocListBtn({ | |
index:_local1, | |
name:this._listData[_local1].name, | |
isActive:this._listData[_local1].isActive, | |
isDisable:this._listData[_local1].isDisable, | |
data:this._listData[_local1].data | |
})); | |
_local1++; | |
}; | |
this._bg.height = (this._bg.height + this._padding); | |
} | |
public function allocListBtn(_arg1:Object):SelectListBtn{ | |
var _local2:SelectListBtn = new SelectListBtn(_arg1.index, _arg1.name, this._isRelated, _arg1.data); | |
this._btnsCon.addChild(_local2); | |
if (_arg1.isActive){ | |
_local2.setPos(); | |
} else { | |
if (_arg1.isDisable){ | |
_local2.setDisable(); | |
}; | |
}; | |
_local2.x = ((this._bg.width - this._btnWidth) / 2); | |
var _local3:Number = (this._btnHeight + this._padding); | |
_local2.y = (this._padding + (_arg1.index * _local3)); | |
_local2.addEventListener(CtrlBarEvent.QUALITY_SELECTBTN_CLICK, this.clickListBtn); | |
_local2.addEventListener(CtrlBarEvent.QUALITY_SELECTBTN_MOUSEOVER, this.listBtnMouseOver); | |
_local2.addEventListener(CtrlBarEvent.QUALITY_SELECTBTN_MOUSEOUT, this.listBtnMouseOut); | |
this._bg.height = (this._bg.height + _local3); | |
return (_local2); | |
} | |
public function clickListBtn(_arg1:CtrlBarEvent):void{ | |
var _local2:int; | |
while (_local2 < this._btnlist.length) { | |
if (_arg1.data.index == _local2){ | |
this.dispatchEvent(_arg1); | |
} else { | |
if (this._isRelated){ | |
(this._btnlist[_local2] as SelectListBtn).setUnPos(); | |
}; | |
}; | |
_local2++; | |
}; | |
} | |
public function listBtnMouseOver(_arg1:CtrlBarEvent):void{ | |
this.dispatchEvent(_arg1); | |
} | |
public function listBtnMouseOut(_arg1:CtrlBarEvent):void{ | |
this.dispatchEvent(_arg1); | |
} | |
public function getBtnlist():Array{ | |
return (this._btnlist); | |
} | |
public function clickBtnByIndex(_arg1:Number=0):void{ | |
(this._btnlist[_arg1] as SelectListBtn).onclick(); | |
} | |
} | |
}//package com.netease.openplayer.view.control.ui | |
import flash.events.*; | |
import flash.display.*; | |
import flash.text.*; | |
import com.netease.openplayer.view.control.event.*; | |
class SelectListBtn extends Sprite { | |
private var _index:Number; | |
private var _name:String; | |
private var _data; | |
private var _text:TextField; | |
private var _bg:StatusListBtnBg; | |
private var _isActive:Boolean = false; | |
private var _isRelated:Boolean = false; | |
public function SelectListBtn(_arg1:Number, _arg2:String="", _arg3:Boolean=false, _arg4=null):void{ | |
this._data = _arg4; | |
this._index = _arg1; | |
this._name = _arg2; | |
this._isRelated = _arg3; | |
this.mouseChildren = false; | |
this.build(); | |
} | |
private function build():void{ | |
this._bg = new StatusListBtnBg(); | |
this.addChild(this._bg); | |
this._text = new TextField(); | |
this._text.text = this._name; | |
var _local1:TextFormat = new TextFormat(); | |
_local1.font = "Arial,宋体"; | |
_local1.color = 0xFFFFFF; | |
_local1.size = 13; | |
_local1.align = "center"; | |
_local1.leading = 0; | |
this._text.autoSize = TextFieldAutoSize.CENTER; | |
this._text.x = 24; | |
this._text.y = ((20 - this._text.height) / 2); | |
this._text.setTextFormat(_local1); | |
this.addChild(this._text); | |
this.addEventListener(MouseEvent.CLICK, this.onclick); | |
this.addEventListener(MouseEvent.MOUSE_OVER, this.onMouseOver); | |
this.addEventListener(MouseEvent.MOUSE_OUT, this.onMouseOut); | |
this.setUnPos(); | |
} | |
public function setDisable():void{ | |
var _local1:TextFormat = new TextFormat(); | |
_local1.color = 0x93C900; | |
this._text.setTextFormat(_local1); | |
this.removeEventListener(MouseEvent.CLICK, this.onclick); | |
this.removeEventListener(MouseEvent.MOUSE_OVER, this.onMouseOver); | |
this.removeEventListener(MouseEvent.MOUSE_OUT, this.onMouseOut); | |
this.buttonMode = false; | |
this._bg.gotoAndStop(1); | |
} | |
public function setPos():void{ | |
this._isActive = true; | |
var _local1:TextFormat = new TextFormat(); | |
_local1.color = 0xFFFFFF; | |
this._text.setTextFormat(_local1); | |
this.buttonMode = !(this._isRelated); | |
this._bg.gotoAndStop(3); | |
} | |
public function setUnPos():void{ | |
this._isActive = false; | |
var _local1:TextFormat = new TextFormat(); | |
_local1.color = 0x999999; | |
this._text.setTextFormat(_local1); | |
this.buttonMode = true; | |
this._bg.gotoAndStop(2); | |
} | |
public function onclick(_arg1:MouseEvent=null):void{ | |
if (((this._isActive) && (this._isRelated))){ | |
return; | |
}; | |
if (this._isActive){ | |
this.setUnPos(); | |
} else { | |
this.setPos(); | |
}; | |
this.sendEvent(CtrlBarEvent.QUALITY_SELECTBTN_CLICK); | |
} | |
private function onMouseOver(_arg1:MouseEvent=null):void{ | |
var _local2:TextFormat; | |
if (!this._isActive){ | |
_local2 = new TextFormat(); | |
_local2.color = 0xFFFFFF; | |
this._text.setTextFormat(_local2); | |
}; | |
this.sendEvent(CtrlBarEvent.QUALITY_SELECTBTN_MOUSEOVER); | |
} | |
private function onMouseOut(_arg1:MouseEvent=null):void{ | |
var _local2:TextFormat; | |
if (!this._isActive){ | |
_local2 = new TextFormat(); | |
_local2.color = 0x999999; | |
this._text.setTextFormat(_local2); | |
}; | |
this.sendEvent(CtrlBarEvent.QUALITY_SELECTBTN_MOUSEOUT); | |
} | |
private function sendEvent(_arg1:String):void{ | |
this.dispatchEvent(new CtrlBarEvent(_arg1, { | |
data:this._data, | |
index:this._index, | |
isActive:this._isActive | |
})); | |
} | |
} | |
package com.netease.openplayer.view.control.ui { | |
import flash.events.*; | |
import flash.display.*; | |
import flash.text.*; | |
import com.netease.openplayer.view.control.event.*; | |
public class VCtrlStatusBtn extends Sprite { | |
private var _text:TextField; | |
private var _bg:StatusBtnBg; | |
private var _isActive:Boolean = false; | |
private var _canClick:Boolean; | |
public function VCtrlStatusBtn(_arg1:String="", _arg2:Boolean=true){ | |
this._canClick = _arg2; | |
this.mouseChildren = false; | |
this.build(_arg1); | |
} | |
private function build(_arg1:String):void{ | |
var _local2:String = ((_arg1) ? _arg1 : ""); | |
this._bg = new StatusBtnBg(); | |
this.addChild(this._bg); | |
this._text = new TextField(); | |
this._text.text = _local2; | |
this.addChild(this._text); | |
this.setText(_local2); | |
} | |
public function setText(_arg1:String):void{ | |
this._text.text = _arg1; | |
var _local2:TextFormat = new TextFormat(); | |
_local2.font = "Arial,宋体"; | |
_local2.color = 0xFFFFFF; | |
_local2.size = 13; | |
_local2.align = "center"; | |
_local2.leading = 0; | |
this._text.setTextFormat(_local2); | |
this._text.autoSize = TextFieldAutoSize.CENTER; | |
this._text.x = ((this._bg.width - this._text.width) / 2); | |
this._text.y = ((this._bg.height - this._text.height) / 2); | |
} | |
public function setDisable():void{ | |
var _local1:TextFormat = new TextFormat(); | |
_local1.color = 0x5E5E5E; | |
this._text.setTextFormat(_local1); | |
this._bg.gotoAndStop(3); | |
this.buttonMode = false; | |
this.mouseEnabled = false; | |
this.removeEventListener(MouseEvent.CLICK, this.onclick); | |
} | |
public function setDefault():void{ | |
this.removeEventListener(MouseEvent.CLICK, this.onclick); | |
if (this._canClick){ | |
this.addEventListener(MouseEvent.CLICK, this.onclick); | |
}; | |
this._isActive = false; | |
var _local1:TextFormat = new TextFormat(); | |
_local1.color = 0x7E7E7E; | |
this._bg.gotoAndStop(2); | |
this._text.setTextFormat(_local1); | |
this.buttonMode = true; | |
this.dispatchEvent(new CtrlBarEvent(CtrlBarEvent.STATUSBTN_DEFAULT)); | |
} | |
public function setActive():void{ | |
this.removeEventListener(MouseEvent.CLICK, this.onclick); | |
if (this._canClick){ | |
this.addEventListener(MouseEvent.CLICK, this.onclick); | |
}; | |
this._isActive = true; | |
var _local1:TextFormat = new TextFormat(); | |
_local1.color = 1478990; | |
this._bg.gotoAndStop(1); | |
this._text.setTextFormat(_local1); | |
this.buttonMode = true; | |
this.dispatchEvent(new CtrlBarEvent(CtrlBarEvent.STATUSBTN_ACTIVE)); | |
} | |
private function onclick(_arg1:MouseEvent=null):void{ | |
if (this._isActive){ | |
this.setDefault(); | |
} else { | |
this.setActive(); | |
}; | |
} | |
} | |
}//package com.netease.openplayer.view.control.ui | |
package com.netease.openplayer.view.control { | |
import flash.events.*; | |
import com.netease.openplayer.view.*; | |
import com.netease.openplayer.event.*; | |
import com.netease.openplayer.model.*; | |
import flash.net.*; | |
import flash.utils.*; | |
import com.netease.eduplayercore.util.*; | |
public class VTip extends BaseView { | |
private var autoSeekTips:AutoSeekTips; | |
private var aboutHistoryTips:AboutHistoryTip; | |
private var historyData:Object; | |
private var _movieData:OpenMovieData; | |
public function VTip(_arg1:ViewContainer){ | |
this.appendAt(_arg1); | |
} | |
override protected function initEvent():void{ | |
this.autoSeekTips.bt.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent):void{ | |
autoSeekTips.visible = false; | |
}); | |
this.autoSeekTips.replayBt.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent):void{ | |
autoSeekTips.visible = false; | |
dispatchEvent(new ViewEvent(ViewEvent.VIEW_SEEK, 0)); | |
}); | |
this.aboutHistoryTips.bt.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent):void{ | |
aboutHistoryTips.visible = false; | |
}); | |
this.aboutHistoryTips.yesBt.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent):void{ | |
navigateToURL(new URLRequest(aboutHistoryTips.url), "_self"); | |
}); | |
this.aboutHistoryTips.noBt.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent):void{ | |
aboutHistoryTips.visible = false; | |
}); | |
} | |
override protected function initView():void{ | |
this.autoSeekTips = new AutoSeekTips(); | |
this.autoSeekTips.gotoAndStop(1); | |
this.autoSeekTips.visible = false; | |
addChild(this.autoSeekTips); | |
this.aboutHistoryTips = new AboutHistoryTip(); | |
this.aboutHistoryTips.gotoAndStop(1); | |
this.aboutHistoryTips.visible = false; | |
this.aboutHistoryTips.txt.autoSize = "left"; | |
this.aboutHistoryTips.txt.multiline = false; | |
this.aboutHistoryTips.txt.wordWrap = false; | |
addChild(this.aboutHistoryTips); | |
} | |
override public function reSize(_arg1:Number, _arg2:Number):void{ | |
super.reSize(_arg1, _arg2); | |
var _local3:Number = 43; | |
this.autoSeekTips.x = 0; | |
this.autoSeekTips.y = (((this._height - _local3) - this.autoSeekTips.height) + 7); | |
this.autoSeekTips.line.width = _arg1; | |
this.autoSeekTips.bt.x = (this.autoSeekTips.line.width - 30); | |
this.aboutHistoryTips.x = 0; | |
this.aboutHistoryTips.y = ((this.autoSeekTips.visible) ? (this.autoSeekTips.y - this.aboutHistoryTips.height) : (((this._height - _local3) - this.aboutHistoryTips.height) + 7)); | |
this.aboutHistoryTips.line.width = _arg1; | |
this.aboutHistoryTips.bt.x = (this.aboutHistoryTips.line.width - 30); | |
if ((((this.aboutHistoryTips.visible == true)) && (this.historyData))){ | |
this.showAboutHistoryTip(this.historyData); | |
}; | |
} | |
public function showAutoSeekTip(_arg1:String):void{ | |
var text:* = _arg1; | |
this.autoSeekTips.txt.text = text; | |
this.autoSeekTips.visible = true; | |
setTimeout(function ():void{ | |
autoSeekTips.visible = false; | |
}, 8000); | |
} | |
public function showAboutHistoryTip(_arg1:Object):void{ | |
var wordNumber:* = NaN; | |
var data:* = _arg1; | |
this.historyData = data; | |
var text:* = StringUtil.unescape(data.text); | |
this.aboutHistoryTips.txt.text = (("《" + text) + "》"); | |
var textWidth:* = (this.aboutHistoryTips.line.width - 340); | |
if (textWidth < this.aboutHistoryTips.txt.textWidth){ | |
wordNumber = Math.floor(((textWidth - 45) / 12)); | |
text = (text.substr(0, wordNumber) + "..."); | |
this.aboutHistoryTips.txt.text = (("《" + text) + "》"); | |
}; | |
this.aboutHistoryTips.time.text = ((("第" + data.pnumber) + "集 ") + data.time); | |
this.aboutHistoryTips.url = data.url; | |
this.resizeAboutHistoryTipsText(); | |
this.aboutHistoryTips.visible = true; | |
setTimeout(function ():void{ | |
aboutHistoryTips.visible = false; | |
}, 8000); | |
} | |
private function resizeAboutHistoryTipsText():void{ | |
this.aboutHistoryTips.txt.x = 87; | |
this.aboutHistoryTips.time.x = (this.aboutHistoryTips.txt.textWidth + this.aboutHistoryTips.txt.x); | |
this.aboutHistoryTips.tipsTxt.x = ((this.aboutHistoryTips.time.x + this.aboutHistoryTips.time.textWidth) + 20); | |
this.aboutHistoryTips.yesBt.x = ((this.aboutHistoryTips.tipsTxt.x + this.aboutHistoryTips.tipsTxt.width) + 10); | |
this.aboutHistoryTips.noBt.x = ((this.aboutHistoryTips.yesBt.x + this.aboutHistoryTips.yesBt.width) + 10); | |
} | |
override public function reset(_arg1=null):void{ | |
super.reset(_arg1); | |
this._movieData = _arg1; | |
} | |
public function showTips():void{ | |
var _local1:Object; | |
var _local2:Object; | |
var _local3:String; | |
if (GlobalData.playerConfig.isShowLastTime == true){ | |
_local1 = GlobalData.recordObj.getHistory(); | |
_local2 = GlobalData.recordObj.getAboutHistory(); | |
if (_local2 != null){ | |
if ((((_local1 == null)) && ((GlobalData.playerConfig.isShowAboutTip == 1)))){ | |
this.showAboutHistoryTip({ | |
text:_local2.title, | |
time:StringUtil.formatter(_local2.time), | |
url:_local2.pageUrl, | |
pnumber:_local2.pnumber | |
}); | |
}; | |
} else { | |
GlobalData.recordObj.updateLocalAboutHistory(0); | |
}; | |
if (_local1 != null){ | |
if (_local1.time >= 5){ | |
_local3 = StringUtil.formatter(_local1.time); | |
_local3 = (("(" + _local3) + ")"); | |
this.showAutoSeekTip(_local3); | |
}; | |
} else { | |
GlobalData.recordObj.updateLocalHistory(0); | |
}; | |
}; | |
} | |
} | |
}//package com.netease.openplayer.view.control | |
package com.netease.openplayer.view.control { | |
import flash.events.*; | |
import com.netease.openplayer.view.*; | |
import com.netease.openplayer.event.*; | |
import com.netease.openplayer.model.*; | |
import flash.display.*; | |
import flash.net.*; | |
import flash.utils.*; | |
import caurina.transitions.*; | |
import com.netease.eduplayercore.util.*; | |
import flash.system.*; | |
import flash.ui.*; | |
import flash.geom.*; | |
public class VCtrlBar extends BaseView { | |
private var playBtn:PlayBt_Big; | |
private var volumeBar:VVolumeBar; | |
private var captionSelecter:VCaptionSelect; | |
private var qualitySelecter:VQualitySelect; | |
private var ctrlBar:CtrlBar_Base; | |
private var timeTip:TimeTip; | |
private var smalltip:smallTip; | |
private var _curTime:Number = 0; | |
private var _totalTime:Number = 0; | |
private var _timeBtDis:Number = 0; | |
private var _isDrag:Boolean = false; | |
private var _loadProgress:Number = -1; | |
private var _playProgress:Number = -1; | |
private var _currentTime:Number = -1; | |
private var isShow:Boolean = false; | |
private var _hideTimeout:Number; | |
private var _hideDur:Number = 8000; | |
public function VCtrlBar(_arg1:ViewContainer){ | |
this.appendAt(_arg1); | |
super(); | |
hide(); | |
} | |
override protected function initEvent():void{ | |
super.initEvent(); | |
this.playBtn.addEventListener(MouseEvent.CLICK, this.resume); | |
this.ctrlBar.playBt.addEventListener(MouseEvent.CLICK, this.resume); | |
this.ctrlBar.pauseBt.addEventListener(MouseEvent.CLICK, this.pause); | |
this.ctrlBar.progressBar.bottomBar.addEventListener(MouseEvent.MOUSE_DOWN, this.barMouseDownEvent); | |
this.ctrlBar.progressBar.timePointBt.addEventListener(MouseEvent.MOUSE_DOWN, this.timePointDownEvent); | |
this.ctrlBar.progressBar.addEventListener(MouseEvent.MOUSE_MOVE, this.showHoverTime); | |
this.ctrlBar.progressBar.addEventListener(MouseEvent.ROLL_OUT, this.hideHoverTime); | |
this.ctrlBar.settingBtn.addEventListener(MouseEvent.CLICK, this.clickSettingBtn); | |
this.ctrlBar.settingBtn.addEventListener(MouseEvent.MOUSE_OVER, function (_arg1:MouseEvent):void{ | |
showSmallTip("设置", 36, (ctrlBar.settingBtn.x - 11)); | |
}); | |
this.ctrlBar.settingBtn.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:MouseEvent):void{ | |
hideSmallTip(); | |
}); | |
this.ctrlBar.openlogo.addEventListener(MouseEvent.CLICK, this.backToOpen); | |
this.ctrlBar.openlogo.addEventListener(MouseEvent.MOUSE_OVER, function (_arg1:MouseEvent):void{ | |
showSmallTip("返回网易公开课观看", 120, (ctrlBar.openlogo.x - 5)); | |
}); | |
this.ctrlBar.openlogo.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:MouseEvent):void{ | |
hideSmallTip(); | |
}); | |
this.volumeBar.addEventListener(ViewEvent.VIEW_VOLUME, this.viewEventHandler); | |
this.volumeBar.addEventListener(ViewEvent.VIEW_MUTE, this.viewEventHandler); | |
this.qualitySelecter.addEventListener(ViewEvent.VIEW_CHANGE_QUALITY, this.viewEventHandler); | |
this._parent.addEventListener(MouseEvent.ROLL_OVER, this.onMouseIn); | |
this._parent.addEventListener(MouseEvent.ROLL_OUT, this.onMouseOut); | |
this._parent.addEventListener(MouseEvent.MOUSE_MOVE, this.onMouseMove); | |
} | |
private function viewEventHandler(_arg1:ViewEvent):void{ | |
this.dispatchEvent(_arg1); | |
} | |
private function onMouseOut(_arg1:MouseEvent=null):void{ | |
this.slideDown(); | |
if (this._fullScreen){ | |
Mouse.hide(); | |
}; | |
} | |
private function onMouseIn(_arg1:MouseEvent=null):void{ | |
Mouse.show(); | |
this.slideUp(); | |
} | |
private function onMouseMove(_arg1:MouseEvent=null):void{ | |
var evt = _arg1; | |
if (this._hideTimeout){ | |
clearTimeout(this._hideTimeout); | |
this.onMouseIn(); | |
}; | |
this._hideTimeout = setTimeout(function ():void{ | |
onMouseOut(); | |
}, this._hideDur); | |
} | |
override protected function initView():void{ | |
super.initView(); | |
this.blendMode = BlendMode.LAYER; | |
this.playBtn = new PlayBt_Big(); | |
addChild(this.playBtn); | |
this.playBtn.x = 15; | |
this.playBtn.y = -64; | |
this.ctrlBar = new CtrlBar_Base(); | |
addChild(this.ctrlBar); | |
this.volumeBar = new VVolumeBar(); | |
this.volumeBar.appendAt(this.ctrlBar); | |
this.captionSelecter = new VCaptionSelect((this._parent as ViewContainer)); | |
this.ctrlBar.addChild(this.captionSelecter); | |
this.captionSelecter.y = 12; | |
this.qualitySelecter = new VQualitySelect(); | |
this.ctrlBar.addChild(this.qualitySelecter); | |
this.qualitySelecter.y = 12; | |
this.smalltip = new smallTip(); | |
this.ctrlBar.addChild(this.smalltip); | |
this.smalltip.y = -17; | |
this.smalltip.visible = false; | |
this.ctrlBar.progressBar.bottomBar.buttonMode = true; | |
this.ctrlBar.progressBar.loadedBar.mouseEnabled = false; | |
this.ctrlBar.progressBar.playTimeBar.mouseEnabled = false; | |
this.ctrlBar.timeTxt.text = ((StringUtil.formatter(this._curTime) + " / ") + StringUtil.formatter(this._totalTime)); | |
this.ctrlBar.playBt.visible = false; | |
this.ctrlBar.playBt.x = 0; | |
this.ctrlBar.playBt.y = 11; | |
this.ctrlBar.pauseBt.x = 0; | |
this.ctrlBar.pauseBt.y = 11; | |
this.disableLogo(); | |
} | |
override public function setFullScreenMode(_arg1:Boolean):void{ | |
super.setFullScreenMode(_arg1); | |
if (this._fullScreen){ | |
this._hideDur = 3000; | |
} else { | |
this._hideDur = 8000; | |
}; | |
this.slideUp(); | |
} | |
override public function reSize(_arg1:Number, _arg2:Number):void{ | |
super.reSize(_arg1, _arg2); | |
this.ctrlBar.bgMc.width = _arg1; | |
this.ctrlBar.progressBar.bottomBar.width = _arg1; | |
this.resizeProgressBar(); | |
this.setPlayProgress(this._playProgress); | |
this.ctrlBar.playBt.x = 0; | |
this.ctrlBar.playBt.y = (((this.ctrlBar.bgMc.height - this.ctrlBar.playBt.height) / 2) + 11); | |
this.ctrlBar.pauseBt.x = 0; | |
this.ctrlBar.pauseBt.y = (((this.ctrlBar.bgMc.height - this.ctrlBar.pauseBt.height) / 2) + 11); | |
this.ctrlBar.openlogo.x = ((_arg1 - this.ctrlBar.openlogo.width) - 3); | |
this.ctrlBar.logoDevline.x = (this.ctrlBar.openlogo.x - 7); | |
if (GlobalData.playerConfig.isSimple){ | |
this.ctrlBar.captionDevline.visible = false; | |
this.ctrlBar.settingDevline.visible = false; | |
this.ctrlBar.settingBtn.visible = false; | |
this.qualitySelecter.visible = false; | |
this.captionSelecter.visible = false; | |
this.volumeBar.x = (this.ctrlBar.logoDevline.x - 33); | |
this.volumeBar.y = (-(this.volumeBar.height) + 35); | |
} else { | |
this.captionSelecter.x = (this.ctrlBar.logoDevline.x - 39); | |
this.ctrlBar.captionDevline.x = (this.captionSelecter.x - 7); | |
this.qualitySelecter.x = (this.ctrlBar.captionDevline.x - 39); | |
this.ctrlBar.qualityDevline.x = (this.qualitySelecter.x - 7); | |
this.ctrlBar.settingBtn.x = (this.ctrlBar.qualityDevline.x - 24); | |
this.ctrlBar.settingDevline.x = (this.ctrlBar.settingBtn.x - 11); | |
this.volumeBar.x = (this.ctrlBar.settingDevline.x - 33); | |
this.volumeBar.y = (-(this.volumeBar.height) + 35); | |
}; | |
this.x = 0; | |
this.y = _arg2; | |
} | |
override public function reset(_arg1=null):void{ | |
super.reset(_arg1); | |
this.captionSelecter.reset(_arg1); | |
this.qualitySelecter.reset(_arg1); | |
this.setVolume(GlobalData.playerConfig.volume); | |
this.initLogo(); | |
} | |
public function slideUp():void{ | |
this.visible = true; | |
var to:* = (this._height - 43); | |
Tweener.addTween(this, { | |
y:to, | |
alpha:1, | |
time:0.3, | |
transition:"easeOutQuad", | |
onComplete:function ():void{ | |
isShow = true; | |
} | |
}); | |
(this._parent as ViewContainer).components["video"].slideUpCaption(); | |
} | |
public function slideDown():void{ | |
var to:* = this._height; | |
Tweener.addTween(this, { | |
y:to, | |
alpha:0, | |
time:0.8, | |
transition:"easeOutQuad", | |
onComplete:function ():void{ | |
isShow = false; | |
} | |
}); | |
(this._parent as ViewContainer).components["video"].slideDownCaption(); | |
} | |
private function resizeProgressBar():void{ | |
this.ctrlBar.progressBar.loadedBar.width = (this._loadProgress * this.ctrlBar.progressBar.bottomBar.width); | |
} | |
private function screenModeChangeEvent(_arg1:MouseEvent):void{ | |
this.dispatchEvent(new ViewEvent(ViewEvent.VIEW_FULLSCREEN)); | |
} | |
private function resume(_arg1:MouseEvent):void{ | |
this.dispatchEvent(new ViewEvent(ViewEvent.VIEW_PLAY)); | |
} | |
private function pause(_arg1:MouseEvent):void{ | |
this.dispatchEvent(new ViewEvent(ViewEvent.VIEW_PAUSE)); | |
} | |
private function barMouseDownEvent(_arg1:MouseEvent=null):void{ | |
if (this._totalTime <= 0){ | |
return; | |
}; | |
var _local2:Number = (this.ctrlBar.progressBar.mouseX - this._timeBtDis); | |
var _local3:Number = (this.ctrlBar.progressBar.bottomBar.width - this.ctrlBar.progressBar.timePointBt.width); | |
_local2 = (((_local2 < 0)) ? 0 : _local2); | |
_local2 = (((_local2 > _local3)) ? _local3 : _local2); | |
var _local4:Number = (_local2 / _local3); | |
this.ctrlBar.progressBar.timePointBt.x = _local2; | |
this.timePointMoveEvent(); | |
this.dispatchEvent(new ViewEvent(ViewEvent.VIEW_SEEK, Math.floor((_local4 * this._totalTime)))); | |
} | |
private function timePointDownEvent(_arg1:MouseEvent):void{ | |
if (this._totalTime <= 0){ | |
return; | |
}; | |
this._timeBtDis = (this.ctrlBar.progressBar.mouseX - this.ctrlBar.progressBar.timePointBt.x); | |
var _local2:Number = this.ctrlBar.progressBar.timePointBt.y; | |
var _local3:Number = 0; | |
var _local4:Number = 0; | |
var _local5:Number = (this.ctrlBar.progressBar.bottomBar.width - this.ctrlBar.progressBar.timePointBt.width); | |
var _local6:Rectangle = new Rectangle(_local4, _local2, _local5, _local3); | |
this.ctrlBar.progressBar.timePointBt.startDrag(false, _local6); | |
this._isDrag = true; | |
stage.addEventListener(MouseEvent.MOUSE_MOVE, this.timePointMoveEvent); | |
stage.addEventListener(MouseEvent.MOUSE_UP, this.timePointUpEvent); | |
} | |
private function timePointMoveEvent(_arg1:MouseEvent=null):void{ | |
var _local2:Number = ((this.ctrlBar.progressBar.timePointBt.x / (this.ctrlBar.progressBar.bottomBar.width - this.ctrlBar.progressBar.timePointBt.width)) * this._totalTime); | |
var _local3:Number = (_local2 / this._totalTime); | |
this.setPlayProgress(_local3); | |
this.setCurrentTime(_local2); | |
} | |
private function timePointUpEvent(_arg1:MouseEvent):void{ | |
this._isDrag = false; | |
stage.removeEventListener(MouseEvent.MOUSE_UP, this.timePointUpEvent); | |
stage.removeEventListener(MouseEvent.MOUSE_MOVE, this.timePointMoveEvent); | |
this.ctrlBar.progressBar.timePointBt.stopDrag(); | |
this.barMouseDownEvent(); | |
this._timeBtDis = 0; | |
} | |
public function setPlayPause(_arg1:Boolean):void{ | |
if (_arg1){ | |
this.playBtn.visible = false; | |
this.ctrlBar.pauseBt.visible = true; | |
this.ctrlBar.playBt.visible = false; | |
} else { | |
this.ctrlBar.pauseBt.visible = false; | |
this.ctrlBar.playBt.visible = true; | |
this.playBtn.visible = true; | |
}; | |
} | |
public function setCompleteStatus():void{ | |
this.playBtn.visible = false; | |
this.ctrlBar.pauseBt.visible = false; | |
this.ctrlBar.playBt.visible = true; | |
} | |
public function updatePlayProgress(_arg1:Number, _arg2:Number):void{ | |
if ((((_arg2 <= 0)) || (this._isDrag))){ | |
return; | |
}; | |
this._currentTime = _arg1; | |
var _local3:Number = (_arg1 / _arg2); | |
this.setPlayProgress(_local3); | |
this.setCurrentTime(_arg1); | |
this.setTotalTime(_arg2); | |
} | |
public function setPlayProgress(_arg1:Number):void{ | |
this._playProgress = _arg1; | |
_arg1 = (((_arg1 < 0)) ? 0 : _arg1); | |
_arg1 = (((_arg1 > 1)) ? 1 : _arg1); | |
var _local2:Number = (_arg1 * (this.ctrlBar.progressBar.bottomBar.width - this.ctrlBar.progressBar.timePointBt.width)); | |
_local2 = Math.ceil(_local2); | |
this.ctrlBar.progressBar.timePointBt.x = _local2; | |
this.ctrlBar.progressBar.playTimeBar.width = (_local2 + (this.ctrlBar.progressBar.timePointBt.width / 2)); | |
} | |
public function setLoadProgress(_arg1:Number):void{ | |
this._loadProgress = (_arg1 / 100); | |
this._loadProgress = (((this._loadProgress > 1)) ? 1 : this._loadProgress); | |
this._loadProgress = (((this._loadProgress < 0)) ? 0 : this._loadProgress); | |
this.ctrlBar.progressBar.loadedBar.width = (this._loadProgress * this.ctrlBar.progressBar.bottomBar.width); | |
} | |
public function seekforward(_arg1:Number):void{ | |
var _local2:Number = (this._currentTime + _arg1); | |
if ((((this._totalTime > 0)) && ((_local2 > this._totalTime)))){ | |
_local2 = (this._totalTime - _arg1); | |
}; | |
this.updatePlayProgress(_local2, this._totalTime); | |
this.dispatchEvent(new ViewEvent(ViewEvent.VIEW_SEEK, _local2)); | |
} | |
public function seekbackward(_arg1:Number):void{ | |
var _local2:Number = (this._currentTime - _arg1); | |
if ((((this._totalTime > 0)) && ((_local2 < 0)))){ | |
_local2 = 0; | |
}; | |
this.updatePlayProgress(_local2, this._totalTime); | |
this.dispatchEvent(new ViewEvent(ViewEvent.VIEW_SEEK, _local2)); | |
} | |
public function setCurrentTime(_arg1:Number):void{ | |
this._curTime = _arg1; | |
this.ctrlBar.timeTxt.text = ((StringUtil.formatter(this._curTime) + " / ") + StringUtil.formatter(this._totalTime)); | |
} | |
public function setTotalTime(_arg1:Number):void{ | |
this._totalTime = _arg1; | |
this.ctrlBar.timeTxt.text = ((StringUtil.formatter(this._curTime) + " / ") + StringUtil.formatter(this._totalTime)); | |
} | |
public function setVolume(_arg1:Number):void{ | |
this.volumeBar.setVolume(_arg1); | |
} | |
public function get progressBarDrag():Boolean{ | |
return (this._isDrag); | |
} | |
private function initLogo():void{ | |
if (((!(GlobalData.isInnerSite)) && ((GlobalData.playerConfig.enableLogo == 1)))){ | |
this.enableLogo(); | |
}; | |
} | |
private function backToOpen(_arg1:MouseEvent):void{ | |
navigateToURL(new URLRequest(GlobalData.movieData.pageUrl), "_blank"); | |
} | |
private function disableLogo():void{ | |
this.ctrlBar.openlogo.mouseChildren = false; | |
this.ctrlBar.openlogo.mouseEnabled = false; | |
} | |
private function enableLogo():void{ | |
this.ctrlBar.openlogo.mouseChildren = true; | |
this.ctrlBar.openlogo.mouseEnabled = true; | |
this.ctrlBar.openlogo.buttonMode = true; | |
} | |
private function clickSettingBtn(_arg1:MouseEvent):void{ | |
var _local2:ViewContainer = (this._parent as ViewContainer); | |
_local2.components["setting"].show(); | |
} | |
private function showSmallTip(_arg1:String, _arg2:Number, _arg3:Number):void{ | |
this.smalltip.txt.text = _arg1; | |
this.smalltip.txt.width = _arg2; | |
this.smalltip.scaleX = 1; | |
this.smalltip.scaleY = 1; | |
this.smalltip.bg.width = _arg2; | |
this.smalltip.x = _arg3; | |
this.smalltip.visible = true; | |
} | |
private function hideSmallTip():void{ | |
if (this.smalltip){ | |
this.smalltip.visible = false; | |
}; | |
} | |
private function showHoverTime(_arg1:MouseEvent):void{ | |
var _local2:Number; | |
var _local3:String; | |
if (this._totalTime > 0){ | |
_local2 = (mouseX - this.ctrlBar.progressBar.x); | |
if (_local2 < 0){ | |
_local2 = 0; | |
}; | |
if (_local2 > this.ctrlBar.progressBar.width){ | |
_local2 = this.ctrlBar.progressBar.width; | |
}; | |
_local3 = StringUtil.formatter(((_local2 / this.ctrlBar.progressBar.width) * this._totalTime)); | |
if (((!(this.timeTip)) && (stage))){ | |
this.timeTip = new TimeTip(); | |
if (Capabilities.version.indexOf("11,3,31") != -1){ | |
Object(this.timeTip).tipText.y = (Object(this.timeTip).tipText.y + 3); | |
}; | |
stage.addChild(this.timeTip); | |
}; | |
if (this.timeTip){ | |
this.timeTip.visible = true; | |
this.timeTip.x = (_arg1.stageX - (this.timeTip.width / 2)); | |
this.timeTip.x = (((this.timeTip.x < 0)) ? 0 : this.timeTip.x); | |
this.timeTip.x = (((this.timeTip.x > (this.ctrlBar.progressBar.width - this.timeTip.width))) ? (this.ctrlBar.progressBar.width - this.timeTip.width) : this.timeTip.x); | |
this.timeTip.y = ((this.y - this.timeTip.height) + 2); | |
this.timeTip.timetxt.text = _local3; | |
}; | |
}; | |
} | |
private function hideHoverTime(_arg1:MouseEvent):void{ | |
if (this.timeTip){ | |
this.timeTip.visible = false; | |
}; | |
} | |
public function selectCn():void{ | |
this.captionSelecter.selectCn(); | |
} | |
public function selectEn():void{ | |
this.captionSelecter.selectEn(); | |
} | |
} | |
}//package com.netease.openplayer.view.control | |
package com.netease.openplayer.view { | |
import flash.events.*; | |
import com.netease.openplayer.event.*; | |
import flash.display.*; | |
import com.netease.openplayer.util.*; | |
public class VPoster extends BaseView { | |
private var posterUrl:String; | |
private var bg:Sprite; | |
private var coverLoader:Loader; | |
private var loaderWrap:MovieClip; | |
private var playBtn:PlayBt_Big; | |
public function VPoster(_arg1:ViewContainer){ | |
this.appendAt(_arg1); | |
hide(); | |
} | |
override protected function initEvent():void{ | |
this.addEventListener(MouseEvent.CLICK, this.playHandler); | |
} | |
private function playHandler(_arg1:MouseEvent):void{ | |
this.hide(); | |
this.dispatchEvent(new ViewEvent(ViewEvent.VIEW_PLAY)); | |
} | |
override protected function initView():void{ | |
this.bg = new Sprite(); | |
this.bg.graphics.clear(); | |
this.bg.graphics.beginFill(0, 1); | |
this.bg.graphics.drawRect(0, 0, 100, 100); | |
this.bg.graphics.endFill(); | |
this.bg.alpha = 1; | |
this.bg.x = 0; | |
this.bg.y = 0; | |
addChild(this.bg); | |
this.loaderWrap = new MovieClip(); | |
addChild(this.loaderWrap); | |
this.playBtn = new PlayBt_Big(); | |
addChild(this.playBtn); | |
this.buttonMode = true; | |
} | |
override public function reset(_arg1=null):void{ | |
super.reset(_arg1); | |
this.posterUrl = _arg1.posterUrl; | |
} | |
override public function reSize(_arg1:Number, _arg2:Number):void{ | |
super.reSize(_arg1, _arg2); | |
this.bg.width = _arg1; | |
this.bg.height = _arg2; | |
this.loaderWrap.x = 0; | |
this.loaderWrap.y = 0; | |
this.playBtn.x = ((_arg1 - this.playBtn.width) / 2); | |
this.playBtn.y = ((_arg2 - this.playBtn.height) / 2); | |
if (this.coverLoader){ | |
this.coverLoader.x = 0; | |
this.coverLoader.y = 0; | |
this.coverLoader.width = _arg1; | |
this.coverLoader.height = _arg2; | |
}; | |
} | |
override public function show(_arg1:Event=null):void{ | |
var e = _arg1; | |
super.show(); | |
if (((!(this.posterUrl)) || ((this.posterUrl == "")))){ | |
this.reset(); | |
return; | |
}; | |
FileLoadUtil.loadPic(this.posterUrl, function (_arg1:Loader):void{ | |
showCover(_arg1); | |
}, function ():void{ | |
}); | |
} | |
private function showCover(_arg1:Loader):void{ | |
if (this.coverLoader){ | |
this.loaderWrap.removeChild(this.coverLoader); | |
}; | |
if (_arg1 != null){ | |
this.coverLoader = (_arg1 as Loader); | |
this.loaderWrap.addChild(this.coverLoader); | |
}; | |
this.reSize(this._width, this._height); | |
} | |
} | |
}//package com.netease.openplayer.view | |
package com.netease.openplayer.view { | |
import flash.events.*; | |
import flash.display.*; | |
public class BaseView extends Sprite implements IView { | |
protected var _parent:Sprite; | |
protected var _width:Number; | |
protected var _height:Number; | |
protected var _isDisabled:Boolean = false; | |
protected var _fullScreen:Boolean = false; | |
public function BaseView(){ | |
this.initView(); | |
this.initEvent(); | |
} | |
protected function initView():void{ | |
} | |
protected function initEvent():void{ | |
} | |
public function active(_arg1:Event=null):void{ | |
this._isDisabled = false; | |
this.mouseEnabled = true; | |
this.mouseChildren = true; | |
} | |
public function appendAt(_arg1:Sprite):void{ | |
this.x = 0; | |
this.y = 0; | |
this._parent = _arg1; | |
_arg1.addChild(this); | |
} | |
public function disable(_arg1:Event=null):void{ | |
this._isDisabled = true; | |
this.mouseEnabled = false; | |
this.mouseChildren = false; | |
} | |
public function reset(_arg1=null):void{ | |
} | |
public function hide(_arg1:Event=null):void{ | |
this.visible = false; | |
} | |
public function reSize(_arg1:Number, _arg2:Number):void{ | |
this._width = _arg1; | |
this._height = _arg2; | |
} | |
public function show(_arg1:Event=null):void{ | |
this.visible = true; | |
} | |
public function get isDisabled():Boolean{ | |
return (this._isDisabled); | |
} | |
public function setFullScreenMode(_arg1:Boolean):void{ | |
this._fullScreen = _arg1; | |
} | |
} | |
}//package com.netease.openplayer.view | |
package com.netease.openplayer.util { | |
import flash.external.*; | |
public class CookieUtil { | |
private static var inited:Boolean = false; | |
private static var funcName:String = "openPlayer_getCookie"; | |
private static var getCookieFuncStr:String = ((((((((((((((((((((((((((("function(){" + "if (window.") + funcName) + "==null){") + "window.") + funcName) + " = function(){") + "var _pairs = document.cookie.split('; '),") + "_user = {},") + "_pinfo = [];") + "for (var i = 0, pair; pair = _pairs[i] && _pairs[i].split('='); i++) {") + "if (decodeURIComponent(pair[0]) === 'P_INFO'){") + "_user.pinfo = decodeURIComponent(pair[1] || '');") + "_pinfo = _user.pinfo.split('|');") + "}") + "if (decodeURIComponent(pair[0]) === 'S_INFO')") + "_user.sinfo = decodeURIComponent(pair[1] || '');") + "}") + "if(!!_user.pinfo){") + "if((_pinfo[2] === 1)||(!!_user.sinfo)){") + "_user.logout = 'http://reg.163.com/Logout.jsp?username='+_pinfo[0];") + "_user.userid = _pinfo[0];") + "return _user;") + "}") + "}") + "}") + "}") + "}"); | |
public static function insertScript():void{ | |
try { | |
ExternalInterface.call(getCookieFuncStr); | |
} catch(e:Error) { | |
}; | |
} | |
public static function getUser():Object{ | |
if (!inited){ | |
CookieUtil.insertScript(); | |
inited = true; | |
}; | |
var user:* = null; | |
try { | |
user = ExternalInterface.call(("window." + funcName)); | |
} catch(e:Error) { | |
return (null); | |
}; | |
return (user); | |
} | |
} | |
}//package com.netease.openplayer.util | |
package com.netease.openplayer.util { | |
public class SRTUtil { | |
public static function parseCaptions(_arg1:String):Array{ | |
var _local5:Object; | |
var _local2:Array = new Array({ | |
begin:0, | |
text:"" | |
}); | |
_arg1 = _arg1.replace(/^\s+/, "").replace(/\s+$/, ""); | |
var _local3:Array = _arg1.split("\r\n\r\n"); | |
if (_local3.length == 1){ | |
_local3 = _arg1.split("\n\n"); | |
}; | |
var _local4:Number = 0; | |
while (_local4 < _local3.length) { | |
_local5 = SRTUtil.parseCaption(_local3[_local4]); | |
if (_local5["text"]){ | |
_local2.push(_local5); | |
if (_local5["end"]){ | |
_local2.push({ | |
begin:_local5["end"], | |
text:"" | |
}); | |
delete _local5["end"]; | |
}; | |
}; | |
_local4++; | |
}; | |
return (_local2); | |
} | |
private static function parseCaption(_arg1:String):Object{ | |
var _local4:Number; | |
var _local5:Number; | |
var _local2:Object = new Object(); | |
var _local3:Array = _arg1.split("\r\n"); | |
if (_local3.length == 1){ | |
_local3 = _arg1.split("\n"); | |
}; | |
try { | |
_local4 = _local3[1].indexOf(" --> "); | |
if (_local4 > 0){ | |
_local2["begin"] = SRTUtil.seconds(_local3[1].substr(0, _local4)); | |
_local2["end"] = SRTUtil.seconds(_local3[1].substr((_local4 + 5))); | |
}; | |
if (_local3[2]){ | |
_local2["text"] = _local3[2]; | |
_local5 = 3; | |
while (_local5 < _local3.length) { | |
_local2["text"] = (_local2["text"] + ("\n" + _local3[_local5])); | |
_local5++; | |
}; | |
}; | |
} catch(err:Error) { | |
}; | |
return (_local2); | |
} | |
public static function seconds(_arg1:String):Number{ | |
_arg1 = _arg1.replace(",", "."); | |
var _local2:Array = _arg1.split(":"); | |
var _local3:Number = 0; | |
if (_arg1.substr(-2) == "ms"){ | |
_local3 = (Number(_arg1.substr(0, (_arg1.length - 2))) / 1000); | |
} else { | |
if (_arg1.substr(-1) == "s"){ | |
_local3 = Number(_arg1.substr(0, (_arg1.length - 1))); | |
} else { | |
if (_arg1.substr(-1) == "m"){ | |
_local3 = (Number(_arg1.substr(0, (_arg1.length - 1))) * 60); | |
} else { | |
if (_arg1.substr(-1) == "h"){ | |
_local3 = (Number(_arg1.substr(0, (_arg1.length - 1))) * 3600); | |
} else { | |
if (_local2.length > 1){ | |
_local3 = Number(_local2[(_local2.length - 1)]); | |
_local3 = (_local3 + (Number(_local2[(_local2.length - 2)]) * 60)); | |
if (_local2.length == 3){ | |
_local3 = (_local3 + (Number(_local2[(_local2.length - 3)]) * 3600)); | |
}; | |
} else { | |
_local3 = Number(_arg1); | |
}; | |
}; | |
}; | |
}; | |
}; | |
return (_local3); | |
} | |
} | |
}//package com.netease.openplayer.util | |
package com.netease.openplayer.util { | |
import com.netease.openplayer.model.*; | |
import flash.utils.*; | |
import com.hurlant.crypto.symmetric.*; | |
import com.netease.eduplayercore.util.*; | |
import com.hurlant.crypto.*; | |
public class CryptoUtil { | |
public static function encrypt(_arg1:String, _arg2:String):String{ | |
var keyBytes:* = null; | |
var contentBytes:* = null; | |
var aes:* = null; | |
var content:* = _arg1; | |
var password:* = _arg2; | |
try { | |
keyBytes = new ByteArray(); | |
keyBytes.writeMultiByte(password, "utf-8"); | |
keyBytes.position = 0; | |
contentBytes = new ByteArray(); | |
contentBytes.writeMultiByte(content, "utf-8"); | |
contentBytes.position = 0; | |
aes = Crypto.getCipher("aes-ecb", keyBytes, Crypto.getPad("pkcs5")); | |
aes.encrypt(contentBytes); | |
contentBytes.position = 0; | |
return (StringUtil.parseByte2HexStr(contentBytes)); | |
} catch(e:Error) { | |
return (null); | |
}; | |
return (null); | |
} | |
public static function decryptoVideoUrl(_arg1:String, _arg2:int=1):String{ | |
var result:* = null; | |
var ivBytes:* = null; | |
var cipher:* = null; | |
var ivm:* = null; | |
var cstr:* = _arg1; | |
var ver:int = _arg2; | |
var key:* = Constant.CRYKey[String(ver)]; | |
var keyBytes:* = new ByteArray(); | |
var contentBytes:* = new ByteArray(); | |
keyBytes.writeMultiByte(key, "utf-8"); | |
keyBytes.position = 0; | |
contentBytes = StringUtil.hexStrToBytes(cstr); | |
contentBytes.position = 0; | |
try { | |
ivBytes = new ByteArray(); | |
cipher = Crypto.getCipher("aes-ecb", keyBytes); | |
if ((cipher is IVMode)){ | |
ivm = (cipher as IVMode); | |
ivm.IV = ivBytes; | |
}; | |
cipher.decrypt(contentBytes); | |
contentBytes.position = 0; | |
} catch(e:Error) { | |
}; | |
contentBytes.position = 0; | |
var res:* = contentBytes.readUTFBytes(contentBytes.bytesAvailable); | |
return (res); | |
} | |
} | |
}//package com.netease.openplayer.util | |
package com.netease.openplayer.util { | |
import flash.external.*; | |
public class AnchorUtil { | |
public static function getAnchorTime():Number{ | |
var _local2:String; | |
var _local3:Array; | |
var _local4:int; | |
var _local5:Array; | |
var _local6:Number; | |
var _local1:Number = -1; | |
try { | |
if (ExternalInterface.available){ | |
_local2 = ExternalInterface.call("window.location.search.toString"); | |
if (_local2 != ""){ | |
_local2 = _local2.slice(1); | |
_local3 = _local2.split("&"); | |
_local4 = 0; | |
while (_local4 < _local3.length) { | |
_local5 = _local3[_local4].split("="); | |
if (_local5[0] == "startTime"){ | |
_local6 = parseInt(_local5[1]); | |
if (!isNaN(_local6)){ | |
_local1 = _local6; | |
}; | |
break; | |
}; | |
_local4++; | |
}; | |
}; | |
}; | |
} catch(e:Error) { | |
}; | |
return (_local1); | |
} | |
} | |
}//package com.netease.openplayer.util | |
package com.netease.openplayer.util { | |
import com.netease.openplayer.model.*; | |
import flash.net.*; | |
public class SharedUtil { | |
private var shareObj; | |
public function getShareObj():void{ | |
var id:* = null; | |
var engList:* = null; | |
var i:* = 0; | |
this.shareObj = null; | |
try { | |
this.shareObj = SharedObject.getLocal("163FlvPlayer_a3", "/"); | |
if (this.shareObj.data.id == null){ | |
id = ((100000000 + Math.floor((Math.random() * 999999999))) + ""); | |
engList = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]; | |
i = 0; | |
while (i < 6) { | |
id = (id + engList[Math.floor((Math.random() * engList.length))]); | |
i = (i + 1); | |
}; | |
this.shareObj.data.id = id; | |
this.shareObj.data.volume = 0.8; | |
this.shareObj.data.isContinue = 0; | |
this.shareObj.data.defaultQuality = ""; | |
this.shareObj.data.hasShareObject = true; | |
if (!this.shareObj.data.hasOwnProperty("history")){ | |
this.shareObj.data.history = new Array(); | |
this.shareObj.data.about = new Array(); | |
}; | |
this.flushShareObj(); | |
}; | |
} catch(e:Error) { | |
this.shareObj = new Object(); | |
this.shareObj.data = new Object(); | |
this.shareObj.data.volume = 0.8; | |
this.shareObj.data.isContinue = 0; | |
this.shareObj.data.defaultQuality = ""; | |
this.shareObj.data.history = new Array(); | |
this.shareObj.data.about = new Array(); | |
}; | |
} | |
public function getVolume():Number{ | |
return (this.shareObj.data.volume); | |
} | |
public function setVolume(_arg1:Number):void{ | |
this.shareObj.data.volume = _arg1; | |
this.flushShareObj(); | |
} | |
public function getIsContinue():Number{ | |
return (this.shareObj.data.isContinue); | |
} | |
public function setIsContinue(_arg1:Number):void{ | |
this.shareObj.data.isContinue = _arg1; | |
this.flushShareObj(); | |
} | |
public function getDefaultQuality():String{ | |
return (this.shareObj.data.defaultQuality); | |
} | |
public function setDefaultQuality(_arg1:String):void{ | |
this.shareObj.data.defaultQuality = _arg1; | |
this.flushShareObj(); | |
} | |
public function updateHistory(_arg1:OpenMovieData, _arg2:Number):void{ | |
var _local3:Object; | |
var _local7:Object; | |
var _local4:int; | |
while (_local4 < this.shareObj.data.history.length) { | |
if (this.shareObj.data.history[_local4].vid == _arg1.mid){ | |
_local3 = this.shareObj.data.history[_local4]; | |
break; | |
}; | |
_local4++; | |
}; | |
var _local5:Date = new Date(); | |
var _local6:Number = _local5.getTime(); | |
if (_arg2 == 0){ | |
if (_local3 == null){ | |
if (this.shareObj.data.history.length >= 10){ | |
this.shareObj.data.history.pop(); | |
}; | |
_local7 = { | |
onlyId:_arg1.pid, | |
vid:_arg1.mid, | |
time:0, | |
pnumber:Number(_arg1.pnumber), | |
title:(_arg1.title + ""), | |
pageUrl:(_arg1.pageUrl + ""), | |
isComplete:false, | |
flag:_local6, | |
imagePath:_arg1.posterUrl | |
}; | |
this.shareObj.data.history.unshift(_local7); | |
} else { | |
this.shareObj.data.history.sortOn("flag", (Array.DESCENDING | Array.NUMERIC)); | |
}; | |
} else { | |
if (_local3 != null){ | |
_local3.time = _arg2; | |
_local3.isComplete = false; | |
_local3.flag = _local6; | |
this.shareObj.data.history.sortOn("flag", (Array.DESCENDING | Array.NUMERIC)); | |
}; | |
}; | |
} | |
public function updateAboutHistory(_arg1:OpenMovieData, _arg2:Number):void{ | |
var _local3:Object; | |
var _local8:Object; | |
var _local4:int; | |
_local4 = 0; | |
while (_local4 < this.shareObj.data.about.length) { | |
if (this.shareObj.data.about[_local4].onlyId == _arg1.pid){ | |
_local3 = this.shareObj.data.about[_local4]; | |
break; | |
}; | |
_local4++; | |
}; | |
var _local5:Date = new Date(); | |
var _local6:Number = _local5.getTime(); | |
var _local7:Object = { | |
onlyId:_arg1.pid, | |
vid:_arg1.mid, | |
time:_arg2, | |
pnumber:Number(_arg1.pnumber), | |
title:(_arg1.title + ""), | |
pageUrl:(_arg1.pageUrl + ""), | |
isComplete:false, | |
flag:_local6, | |
imagePath:_arg1.posterUrl | |
}; | |
if (_local3 == null){ | |
if (this.shareObj.data.about.length >= 10){ | |
this.shareObj.data.about.pop(); | |
}; | |
this.shareObj.data.about.unshift({ | |
onlyId:_arg1.pid, | |
data:[_local7] | |
}); | |
} else { | |
_local4 = 0; | |
while (_local4 < _local3.data.length) { | |
if (_local3.data[_local4].vid == _arg1.mid){ | |
_local8 = _local3.data[_local4]; | |
break; | |
}; | |
_local4++; | |
}; | |
if (_local8 == null){ | |
if (_local3.data.length >= 10){ | |
_local3.data.pop(); | |
}; | |
_local3.data.push(_local7); | |
} else { | |
_local8.time = _arg2; | |
_local8.isComplate = false; | |
_local3.flag = _local6; | |
}; | |
_local3.data.sortOn("flag", (Array.DESCENDING | Array.NUMERIC)); | |
}; | |
} | |
public function setHistoryComplete(_arg1:String, _arg2:String):void{ | |
var _local4:Object; | |
var _local5:int; | |
var _local3:int; | |
_local3 = 0; | |
while (_local3 < this.shareObj.data.history.length) { | |
if (this.shareObj.data.history[_local3].vid == _arg1){ | |
this.shareObj.data.history[_local3].isComplete = true; | |
}; | |
_local3++; | |
}; | |
_local3 = 0; | |
while (_local3 < this.shareObj.data.about.length) { | |
if (this.shareObj.data.about[_local3].onlyId == _arg2){ | |
_local4 = this.shareObj.data.about[_local3]; | |
_local5 = 0; | |
while (_local5 < _local4.data.length) { | |
if (_local4.data[_local5].vid == _arg1){ | |
_local4.data[_local5].isComplete = true; | |
break; | |
}; | |
_local5++; | |
}; | |
break; | |
}; | |
_local3++; | |
}; | |
this.flushShareObj(); | |
} | |
public function getHistoryList():Array{ | |
return (this.shareObj.data.history); | |
} | |
public function getLastHistory(_arg1:String):Object{ | |
var _local2:int; | |
while (_local2 < this.shareObj.data.history.length) { | |
if (this.shareObj.data.history[_local2].vid == _arg1){ | |
if (this.shareObj.data.history[_local2].isComplete){ | |
return (null); | |
}; | |
return (this.shareObj.data.history[_local2]); | |
}; | |
_local2++; | |
}; | |
return (null); | |
} | |
public function getAboutHistory(_arg1:String, _arg2:String):Object{ | |
var _local4:int; | |
var _local3:int; | |
while (_local3 < this.shareObj.data.about.length) { | |
if (this.shareObj.data.about[_local3].onlyId == _arg1){ | |
_local4 = 0; | |
while (_local4 < this.shareObj.data.about[_local3].data.length) { | |
if (this.shareObj.data.about[_local3].data[_local4].vid != _arg2){ | |
return (this.shareObj.data.about[_local3].data[_local4]); | |
}; | |
_local4++; | |
}; | |
}; | |
_local3++; | |
}; | |
return (null); | |
} | |
public function flushShareObj():void{ | |
var flushStatus:* = null; | |
if (this.shareObj.data.hasOwnProperty("hasShareObject")){ | |
flushStatus = null; | |
try { | |
flushStatus = this.shareObj.flush(); | |
} catch(error:Error) { | |
}; | |
if (flushStatus != null){ | |
switch (flushStatus){ | |
case SharedObjectFlushStatus.PENDING: | |
break; | |
case SharedObjectFlushStatus.FLUSHED: | |
break; | |
}; | |
}; | |
}; | |
} | |
public function clearOneHistory(_arg1:String):void{ | |
var _local2:int; | |
while (_local2 < this.shareObj.data.history.length) { | |
if (this.shareObj.data.history[_local2].vid == _arg1){ | |
(this.shareObj.data.history as Array).splice(_local2, 1); | |
}; | |
_local2++; | |
}; | |
} | |
public function clearAllHistory():void{ | |
this.shareObj.data.history = new Array(); | |
this.shareObj.data.about = new Array(); | |
this.flushShareObj(); | |
} | |
} | |
}//package com.netease.openplayer.util | |
package com.netease.openplayer.util { | |
import flash.display.*; | |
public class StretcherUtil { | |
public static function viewScale(_arg1:DisplayObject, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):void{ | |
var _local6:Number = (_arg2 / _arg4); | |
var _local7:Number = (_arg3 / _arg5); | |
var _local8:Number = (((_local6 < _local7)) ? _local6 : _local7); | |
_arg1.scaleX = (_arg1.scaleY = _local8); | |
} | |
} | |
}//package com.netease.openplayer.util | |
package com.netease.openplayer.util { | |
import flash.utils.*; | |
import com.netease.openplayer.*; | |
public class UulogUtil { | |
private var _hasSendBegin:Boolean = false; | |
private var _hasSendHalf:Boolean = false; | |
private var _duration:Number = 0; | |
private var _playTimeSum:Number = 0; | |
private var _interval:Number; | |
public function UulogUtil(_arg1:Number){ | |
this._duration = _arg1; | |
} | |
private function sum():void{ | |
this._playTimeSum = (this._playTimeSum + 1); | |
} | |
public function record():void{ | |
if (!this._interval){ | |
this._interval = setInterval(this.sum, 1000); | |
}; | |
if (((!(this._hasSendBegin)) && ((this._playTimeSum >= Math.floor((this._duration * 0.1)))))){ | |
JavascriptAPI.callJs("videoplay_uulog", 0.1); | |
this._hasSendBegin = true; | |
return; | |
}; | |
if (((!(this._hasSendHalf)) && ((this._playTimeSum >= Math.floor((this._duration * 0.5)))))){ | |
JavascriptAPI.callJs("videoplay_uulog", 0.5); | |
this._hasSendHalf = true; | |
return; | |
}; | |
} | |
public function pauseRecord():void{ | |
if (this._interval){ | |
clearInterval(this._interval); | |
this._interval = undefined; | |
}; | |
} | |
} | |
}//package com.netease.openplayer.util | |
package com.netease.openplayer.util { | |
import flash.events.*; | |
import com.netease.openplayer.model.*; | |
import flash.display.*; | |
import flash.net.*; | |
public class FileLoadUtil { | |
public static function loadXML(_arg1:String, _arg2:Function, _arg3:Function):void{ | |
var stream:* = null; | |
var loadSuccess:* = null; | |
var loadError:* = null; | |
var url:* = _arg1; | |
var success:* = _arg2; | |
var fail:* = _arg3; | |
loadSuccess = function (_arg1:Event):void{ | |
var xmlObj:* = null; | |
var e:* = _arg1; | |
try { | |
xmlObj = new XML(stream.readMultiByte(stream.bytesAvailable, "gbk")); | |
} catch(error:Error) { | |
fail(e); | |
loadComplete(); | |
return; | |
}; | |
success(xmlObj); | |
loadComplete(); | |
}; | |
loadError = function (_arg1:Event):void{ | |
if (fail != null){ | |
fail(_arg1); | |
}; | |
loadComplete(); | |
}; | |
var loadComplete:* = function ():void{ | |
stream.removeEventListener(Event.COMPLETE, loadSuccess); | |
stream.removeEventListener(IOErrorEvent.IO_ERROR, loadError); | |
stream = null; | |
}; | |
stream = new URLStream(); | |
stream.addEventListener(Event.COMPLETE, loadSuccess); | |
stream.addEventListener(IOErrorEvent.IO_ERROR, loadError); | |
stream.load(new URLRequest(url)); | |
} | |
public static function loadShareXML(_arg1:Function, _arg2:Function):void{ | |
var success:* = _arg1; | |
var fail:* = _arg2; | |
var shareurl:* = new URLLoader(new URLRequest(Constant.shareXmlURL)); | |
shareurl.addEventListener(Event.COMPLETE, function (_arg1:Event):void{ | |
var _local2:XML = XML(_arg1.currentTarget.data); | |
success(_local2); | |
}); | |
} | |
public static function loadPic(_arg1:String, _arg2:Function, _arg3:Function):void{ | |
var coverLoader:* = null; | |
var loadSuccess:* = null; | |
var loadError:* = null; | |
var url:* = _arg1; | |
var success:* = _arg2; | |
var fail:* = _arg3; | |
loadSuccess = function ():void{ | |
success(coverLoader); | |
loadComplete(); | |
}; | |
loadError = function ():void{ | |
if (fail != null){ | |
fail(coverLoader); | |
}; | |
loadComplete(); | |
}; | |
var loadComplete:* = function ():void{ | |
coverLoader.removeEventListener(Event.COMPLETE, loadSuccess); | |
coverLoader.removeEventListener(IOErrorEvent.IO_ERROR, loadError); | |
coverLoader = null; | |
}; | |
coverLoader = new Loader(); | |
coverLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadSuccess); | |
coverLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError); | |
coverLoader.load(new URLRequest(url)); | |
} | |
public static function loadCaption(_arg1:Object, _arg2:Function, _arg3:Function):void{ | |
var _cd:* = null; | |
var captions:* = null; | |
var captionData:* = _arg1; | |
var success:* = _arg2; | |
var fail:* = _arg3; | |
var loadSecond:* = function ():void{ | |
if (_cd.data[1].url == ""){ | |
success(captions); | |
return; | |
}; | |
loadOneCaption(_cd.data[1].url, function (_arg1:Array):void{ | |
captions[1] = _arg1; | |
success(captions); | |
}, function (_arg1:Event):void{ | |
if (fail != null){ | |
fail(_arg1); | |
}; | |
}); | |
}; | |
_cd = captionData; | |
captions = [null, null]; | |
if (!_cd.hasCaption){ | |
success(captions); | |
return; | |
}; | |
if (_cd.data[0].url != ""){ | |
loadOneCaption(_cd.data[0].url, function (_arg1:Array):void{ | |
captions[0] = _arg1; | |
loadSecond(); | |
}, function (_arg1:Event):void{ | |
if (fail != null){ | |
fail(_arg1); | |
}; | |
}); | |
} else { | |
loadSecond(); | |
return; | |
}; | |
} | |
public static function loadOneCaption(_arg1:String, _arg2:Function, _arg3:Function):void{ | |
var loadsuccess:* = null; | |
var url:* = _arg1; | |
var success:* = _arg2; | |
var fail:* = _arg3; | |
loadsuccess = function (_arg1:Event):void{ | |
var _local2:Array = SRTUtil.parseCaptions(String(_arg1.target.data)); | |
success(_local2); | |
}; | |
var _enloader:* = new URLLoader(); | |
_enloader.addEventListener(Event.COMPLETE, loadsuccess); | |
_enloader.addEventListener(IOErrorEvent.IO_ERROR, fail); | |
_enloader.load(new URLRequest(url)); | |
} | |
} | |
}//package com.netease.openplayer.util | |
package com.netease.openplayer.util { | |
import flash.events.*; | |
import com.netease.openplayer.model.*; | |
import flash.net.*; | |
import com.adobe.serialization.json.*; | |
import com.netease.openplayer.*; | |
public class PostUtil { | |
private function sendData(_arg1:String, _arg2:String, _arg3:URLVariables, _arg4:Function, _arg5:Function=null):void{ | |
var url:* = _arg1; | |
var method:* = _arg2; | |
var params:* = _arg3; | |
var completeFn:* = _arg4; | |
var errorFn = _arg5; | |
var _request:* = new URLRequest(); | |
_request.url = url; | |
_request.method = method; | |
_request.data = params; | |
var _loader:* = new URLLoader(); | |
_loader.addEventListener(Event.COMPLETE, completeFn); | |
_loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, function (_arg1:Event):void{ | |
if (errorFn != null){ | |
errorFn(_arg1); | |
}; | |
}); | |
_loader.addEventListener(IOErrorEvent.IO_ERROR, function (_arg1:Event):void{ | |
if (errorFn != null){ | |
errorFn(_arg1); | |
}; | |
}); | |
try { | |
_loader.load(_request); | |
} catch(e:Error) { | |
if (errorFn != null){ | |
errorFn(e); | |
}; | |
}; | |
} | |
public function sendVV():void{ | |
var _data:* = new URLVariables(); | |
_data.mid = GlobalData.movieData.mid; | |
_data.plid = GlobalData.movieData.pid; | |
_data.url = ((GlobalData.movieData.currentPageUrl) ? GlobalData.movieData.currentPageUrl : ""); | |
this.sendData(Constant.vvUrl, URLRequestMethod.POST, _data, function (_arg1:Event):void{ | |
}); | |
} | |
public function sendIPcheck(_arg1:String, _arg2:String, _arg3:Function):void{ | |
var mid:* = _arg1; | |
var pid:* = _arg2; | |
var cb:* = _arg3; | |
var _data:* = new URLVariables(); | |
_data.mid = mid; | |
_data.plid = pid; | |
this.sendData(Constant.ipCheckUrl, URLRequestMethod.GET, _data, function (_arg1:Event):void{ | |
var _local2 = (_arg1.currentTarget.data + ""); | |
var _local3:Number = Number(_local2.substr(5, 1)); | |
cb(_local3); | |
}, function (_arg1:Event):void{ | |
cb(1); | |
}); | |
} | |
public function sendVideoLog(_arg1:Object):void{ | |
var _logData:* = _arg1; | |
var _data:* = new URLVariables(); | |
_data.mid = _logData.mid; | |
_data.plid = _logData.pid; | |
_data.swfUrl = _logData.swfUrl; | |
_data.videoXmlUrl = _logData.videoXmlUrl; | |
_data.url = _logData.url; | |
_data.quality = _logData.quality; | |
_data.urlIndex = _logData.urlIndex; | |
_data.loadMetaTime = _logData.loadMetaTime; | |
_data.loadStreamTime = "-1"; | |
_data.duration = _logData.duration; | |
_data.isError = !((_logData.errorMessage == "")); | |
_data.errorMessage = _logData.errorMessage; | |
GlobalData.log.addToGlobalLog("[info] send video log"); | |
this.sendData(Constant.vpUrl, URLRequestMethod.POST, _data, function (_arg1:Event):void{ | |
}); | |
} | |
public function sendProgress():void{ | |
var user:* = CookieUtil.getUser(); | |
if (!user){ | |
return; | |
}; | |
var _userId:* = user.userid; | |
var _csStr:* = ((_userId + ",") + GlobalData.movieData.mid); | |
var _data:* = new URLVariables(); | |
_csStr = CryptoUtil.encrypt(_csStr, Constant.AESKey); | |
if (_csStr != null){ | |
_data.pa = _csStr; | |
} else { | |
return; | |
}; | |
this.sendData(Constant.progressUpdateUrl, URLRequestMethod.GET, _data, function (_arg1:Event):void{ | |
}); | |
} | |
public function getVideoRecord(_arg1:String, _arg2:String, _arg3:Function, _arg4:Function):void{ | |
var ursId:* = _arg1; | |
var mid:* = _arg2; | |
var callBack:* = _arg3; | |
var errorFn:* = _arg4; | |
var _data:* = new URLVariables(); | |
_data.ursid = ursId; | |
_data.mid = mid; | |
this.sendData(Constant.vreUrl, URLRequestMethod.POST, _data, function (_arg1:Event):void{ | |
var jObj:* = undefined; | |
var evt:* = _arg1; | |
try { | |
jObj = JSON.decode(evt.currentTarget.data); | |
} catch(error:Error) { | |
GlobalData.log.addToGlobalLog("[erroe] read remote record fail"); | |
jObj = null; | |
}; | |
callBack(jObj); | |
}, errorFn); | |
} | |
public function sendVideoRecord(_arg1:String, _arg2:String, _arg3:int, _arg4:Number):void{ | |
var ursId:* = _arg1; | |
var mid:* = _arg2; | |
var isComplete:* = _arg3; | |
var time:* = _arg4; | |
var _data:* = new URLVariables(); | |
_data.ursid = ursId; | |
_data.mid = mid; | |
_data.isc = isComplete; | |
_data.pt = time; | |
_data.rt = new Date().getTime(); | |
this.sendData(Constant.vrvUrl, URLRequestMethod.POST, _data, function (_arg1:Event):void{ | |
}); | |
} | |
public function sendCaptionCheckInfo(_arg1:String, _arg2:String, _arg3:String, _arg4:int, _arg5:String):void{ | |
var userId:* = _arg1; | |
var pid:* = _arg2; | |
var mid:* = _arg3; | |
var time:* = _arg4; | |
var comment:* = _arg5; | |
var _data:* = new URLVariables(); | |
_data.userid = userId; | |
_data.playID = pid; | |
_data.movieID = mid; | |
_data.longth = time; | |
_data.comment = comment; | |
this.sendData(Constant.captionCheckUrl, URLRequestMethod.POST, _data, function (_arg1:Event):void{ | |
try { | |
JavascriptAPI.callJs("postCaptionCheckInfoComplete", _arg1.currentTarget.data); | |
} catch(error:Error) { | |
}; | |
}); | |
} | |
} | |
}//package com.netease.openplayer.util | |
package com.netease.openplayer.controller { | |
import flash.events.*; | |
import com.netease.eduplayercore.interfaces.*; | |
import com.netease.openplayer.view.*; | |
import com.netease.openplayer.event.*; | |
import com.netease.openplayer.model.*; | |
import com.netease.openplayer.*; | |
public class ProgramController extends EventDispatcher { | |
private var _viewContainer:ViewContainer; | |
private var _core:IMediaCore; | |
private var _stageData:Object; | |
private var _md:OpenMovieData; | |
public function ProgramController(_arg1:IMediaCore, _arg2:ViewContainer){ | |
super(null); | |
this._viewContainer = _arg2; | |
this._core = _arg1; | |
} | |
public function setSatgeData(_arg1:Object):void{ | |
var _local2:String; | |
var _local3:OpenMovieData; | |
this._stageData = _arg1; | |
this._viewContainer.showDataLoading(); | |
this._viewContainer.playerLock(); | |
if (GlobalData.playerConfig.file){ | |
_local3 = MovieDataTemp.getDataTemp(GlobalData.playerConfig.file); | |
GlobalData.log.canRecord = false; | |
GlobalData.playerConfig.isShowLastTime = false; | |
this.setMovieData(_local3); | |
return; | |
}; | |
if (GlobalData.playerConfig.url){ | |
_local2 = GlobalData.playerConfig.url; | |
} else { | |
_local2 = this._stageData.root.loaderInfo.url; | |
}; | |
this.loadNewMovie({swfUrl:_local2}); | |
} | |
public function loadNewMovie(_arg1:Object):void{ | |
this._md = new OpenMovieData(); | |
this._md.addEventListener(PlayerEvent.PLAYER_ERROR, this.playerEventHandler); | |
this._md.addEventListener(PlayerEvent.PLAYER_MOVIEDATA_READY, this.playerEventHandler); | |
this._md.reset(_arg1); | |
} | |
private function playerEventHandler(_arg1:PlayerEvent):void{ | |
switch (_arg1.type){ | |
case PlayerEvent.PLAYER_ERROR: | |
this._viewContainer.showError(OpenVideoError[(_arg1.data as String)]); | |
break; | |
case PlayerEvent.PLAYER_MOVIEDATA_READY: | |
this.setMovieData((_arg1.data as OpenMovieData)); | |
break; | |
}; | |
} | |
private function setMovieData(_arg1:OpenMovieData):void{ | |
this._viewContainer.hideDataLoading(); | |
GlobalData.movieData = _arg1; | |
this._core.setMovieData(GlobalData.movieData); | |
this._viewContainer.setMovieData(GlobalData.movieData); | |
if (GlobalData.playerConfig.isAutoPlay){ | |
GlobalData.log.addToGlobalLog("[info] play movie auto..."); | |
this._viewContainer.playerUnLock(); | |
this._viewContainer.mediaLock(); | |
this._core.loadMovie(); | |
} else { | |
GlobalData.log.addToGlobalLog("[info] not play movie auto, show cover"); | |
this._viewContainer.showCover(); | |
this._viewContainer.playerUnLock(); | |
this._viewContainer.setPlayState(false); | |
}; | |
} | |
} | |
}//package com.netease.openplayer.controller | |
package com.netease.openplayer.controller { | |
import flash.events.*; | |
import com.netease.openplayer.view.*; | |
import com.netease.openplayer.event.*; | |
import com.netease.openplayer.model.*; | |
import com.netease.eduplayercore.*; | |
import com.netease.eduplayercore.events.*; | |
import com.netease.openplayer.*; | |
import flash.external.*; | |
public class ViewController extends EventDispatcher { | |
private var _core:MediaCore; | |
private var _viewContainer:ViewContainer; | |
public function ViewController(_arg1:MediaCore, _arg2:ViewContainer){ | |
super(null); | |
this._core = _arg1; | |
this._viewContainer = _arg2; | |
this.initMediaEvent(); | |
this.initPlayerStateEvent(); | |
this.initViewEvent(); | |
} | |
private function initMediaEvent():void{ | |
this._core.addEventListener(MediaEvent.PLAYER_MEDIA_META, this.mediaEventHandler); | |
this._core.addEventListener(MediaEvent.PLAYER_MEDIA_BEFOREPLAY, this.mediaEventHandler); | |
this._core.addEventListener(MediaEvent.PLAYER_MEDIA_BUFFER, this.mediaEventHandler); | |
this._core.addEventListener(MediaEvent.PLAYER_MEDIA_BUFFER_FULL, this.mediaEventHandler); | |
this._core.addEventListener(MediaEvent.PLAYER_MEDIA_ERROR, this.mediaEventHandler); | |
this._core.addEventListener(MediaEvent.PLAYER_MEDIA_QUALITYCHANGED, this.mediaEventHandler); | |
this._core.addEventListener(MediaEvent.PLAYER_MEDIA_SEEK, this.mediaEventHandler); | |
this._core.addEventListener(MediaEvent.PLAYER_MEDIA_TIME, this.mediaEventHandler); | |
this._core.addEventListener(MediaEvent.PLAYER_MEDIA_VOLUME, this.mediaEventHandler); | |
this._core.addEventListener(MediaEvent.PLAYER_MEDIA_REPLAY, this.mediaEventHandler); | |
} | |
private function initPlayerStateEvent():void{ | |
this._core.addEventListener(PlayerStateEvent.PLAYER_STATE, this.playerStateEventHandler); | |
} | |
private function initViewEvent():void{ | |
this._viewContainer.addEventListener(ViewEvent.VIEW_TOGGLEPLAY, this.viewEventHandler); | |
this._viewContainer.addEventListener(ViewEvent.VIEW_PLAY, this.viewEventHandler); | |
this._viewContainer.addEventListener(ViewEvent.VIEW_PAUSE, this.viewEventHandler); | |
this._viewContainer.addEventListener(ViewEvent.VIEW_SEEK, this.viewEventHandler); | |
this._viewContainer.addEventListener(ViewEvent.VIEW_VOLUME, this.viewEventHandler); | |
this._viewContainer.addEventListener(ViewEvent.VIEW_MUTE, this.viewEventHandler); | |
this._viewContainer.addEventListener(ViewEvent.VIEW_FULLSCREEN, this.viewEventHandler); | |
this._viewContainer.addEventListener(ViewEvent.VIEW_CHANGE_QUALITY, this.viewEventHandler); | |
this._viewContainer.addEventListener(ViewEvent.VIEW_PRE_AD_END, this.viewEventHandler); | |
this._viewContainer.addEventListener(ViewEvent.VIEW_ENDING_AD_END, this.viewEventHandler); | |
} | |
private function mediaEventHandler(_arg1:MediaEvent):void{ | |
switch (_arg1.type){ | |
case MediaEvent.PLAYER_MEDIA_NEWITEM: | |
this._viewContainer.showVideoLoading(); | |
this._viewContainer.mediaLock(); | |
break; | |
case MediaEvent.PLAYER_MEDIA_META: | |
this._viewContainer.setTotalTime(_arg1.metadata.duration); | |
this._viewContainer.mediaUnLock(); | |
break; | |
case MediaEvent.PLAYER_MEDIA_BUFFER: | |
this._viewContainer.setLoadProgress(_arg1.bufferPercent); | |
break; | |
case MediaEvent.PLAYER_MEDIA_BEFOREPLAY: | |
this._viewContainer.mediaLock(); | |
this._viewContainer.playPreAd(); | |
break; | |
case MediaEvent.PLAYER_MEDIA_BUFFER_FULL: | |
break; | |
case MediaEvent.PLAYER_MEDIA_ERROR: | |
this._viewContainer.showError(OpenVideoError[_arg1.errorMessage]); | |
break; | |
case MediaEvent.PLAYER_MEDIA_QUALITYCHANGED: | |
break; | |
case MediaEvent.PLAYER_MEDIA_SEEK: | |
break; | |
case MediaEvent.PLAYER_MEDIA_TIME: | |
this._viewContainer.setPlayProgress(_arg1.position, _arg1.duration); | |
this._viewContainer.showCaption(_arg1.position); | |
break; | |
case MediaEvent.PLAYER_MEDIA_REPLAY: | |
this._viewContainer.hideReplay(); | |
this._viewContainer.mediaUnLock(); | |
break; | |
case MediaEvent.PLAYER_MEDIA_VOLUME: | |
break; | |
}; | |
} | |
private function playerStateEventHandler(_arg1:PlayerStateEvent):void{ | |
switch (_arg1.newstate){ | |
case PlayerStates.PLAYING: | |
this._viewContainer.playMidAd(false); | |
this._viewContainer.setPlayState(true); | |
this._viewContainer.hideReplay(); | |
break; | |
case PlayerStates.PAUSE: | |
this._viewContainer.setPlayState(false); | |
break; | |
case PlayerStates.BUFFERING: | |
this._viewContainer.showVideoLoading(); | |
break; | |
case PlayerStates.IDLE: | |
this._viewContainer.hideReplay(); | |
this._viewContainer.playMidAd(false); | |
this._viewContainer.showVideoLoading(); | |
this._viewContainer.mediaLock(); | |
break; | |
case PlayerStates.COMPLETE: | |
this._viewContainer.mediaLock(); | |
this._viewContainer.playEndingAd(); | |
break; | |
}; | |
} | |
private function viewEventHandler(_arg1:ViewEvent):void{ | |
switch (_arg1.type){ | |
case ViewEvent.VIEW_PLAY: | |
this._core.play(); | |
break; | |
case ViewEvent.VIEW_PAUSE: | |
this._core.pause(); | |
this._viewContainer.playMidAd(true); | |
break; | |
case ViewEvent.VIEW_TOGGLEPLAY: | |
this._core.toggle(); | |
if (this._core.getState() == PlayerStates.PAUSE){ | |
this._viewContainer.playMidAd(true); | |
}; | |
break; | |
case ViewEvent.VIEW_SEEK: | |
this._core.seek(_arg1.data); | |
break; | |
case ViewEvent.VIEW_MUTE: | |
this._core.mute(_arg1.data); | |
break; | |
case ViewEvent.VIEW_VOLUME: | |
this._core.voluem(_arg1.data); | |
break; | |
case ViewEvent.VIEW_FULLSCREEN: | |
this._viewContainer.fullScreen(); | |
break; | |
case ViewEvent.VIEW_CHANGE_QUALITY: | |
this._core.changeQuality(_arg1.data.name); | |
GlobalData.recordObj.setDefaultQuality(_arg1.data.name); | |
break; | |
case ViewEvent.VIEW_PRE_AD_END: | |
this._viewContainer.components["tips"].showTips(); | |
this._viewContainer.mediaUnLock(); | |
this._core.play(); | |
break; | |
case ViewEvent.VIEW_ENDING_AD_END: | |
this._viewContainer.mediaUnLock(); | |
this.completeHandler(); | |
break; | |
}; | |
} | |
private function completeHandler():void{ | |
var canContinue:* = NaN; | |
var _canContinue:* = NaN; | |
if (GlobalData.playerConfig.namespace901 != ""){ | |
try { | |
ExternalInterface.call((GlobalData.playerConfig.namespace901 + ".playEndHandle")); | |
} catch(e:Error) { | |
}; | |
}; | |
if (GlobalData.playerConfig.isContinue == 0){ | |
this._viewContainer.showReplay(); | |
} else { | |
canContinue = 1; | |
try { | |
_canContinue = ExternalInterface.call("playNext", GlobalData.playerConfig.isContinue); | |
if ((((canContinue == 0)) || (!((canContinue == _canContinue))))){ | |
this._viewContainer.showReplay(); | |
}; | |
} catch(e:Error) { | |
_viewContainer.showReplay(); | |
}; | |
}; | |
} | |
} | |
}//package com.netease.openplayer.controller | |
package com.netease.openplayer.controller { | |
import flash.events.*; | |
import com.netease.openplayer.view.*; | |
import com.netease.openplayer.model.*; | |
import com.netease.eduplayercore.*; | |
import flash.ui.*; | |
public class KeyboardController { | |
private var _core:MediaCore; | |
private var _viewContainer:ViewContainer; | |
public function KeyboardController(_arg1:MediaCore, _arg2:ViewContainer){ | |
this._core = _arg1; | |
this._viewContainer = _arg2; | |
this.initEvent(); | |
} | |
private function initEvent():void{ | |
GlobalData.stage.addEventListener(KeyboardEvent.KEY_DOWN, this.keyDownHandler); | |
} | |
private function keyDownHandler(_arg1:KeyboardEvent):void{ | |
if (this._viewContainer.isLocked){ | |
return; | |
}; | |
switch (_arg1.keyCode){ | |
case Keyboard.SPACE: | |
this._core.toggle(); | |
break; | |
case Keyboard.ENTER: | |
this._core.play(); | |
break; | |
case Keyboard.LEFT: | |
this._viewContainer.setbackward(8); | |
break; | |
case Keyboard.RIGHT: | |
this._viewContainer.setforward(8); | |
break; | |
case Keyboard.UP: | |
this._viewContainer.setVolume((GlobalData.playerConfig.volume + 0.15)); | |
break; | |
case Keyboard.DOWN: | |
this._viewContainer.setVolume((GlobalData.playerConfig.volume - 0.15)); | |
break; | |
case 67: | |
this._viewContainer.components["controlBar"].selectCn(); | |
break; | |
case 69: | |
this._viewContainer.components["controlBar"].selectEn(); | |
break; | |
}; | |
} | |
} | |
}//package com.netease.openplayer.controller | |
package com.netease.openplayer.event { | |
import flash.events.*; | |
public class ViewEvent extends Event { | |
public static var VIEW_PLAY:String = "viewPlay"; | |
public static var VIEW_PAUSE:String = "viewPause"; | |
public static var VIEW_TOGGLEPLAY:String = "viewTogglePlay"; | |
public static var VIEW_SEEK:String = "viewSeek"; | |
public static var VIEW_FULLSCREEN:String = "viewFullscreen"; | |
public static var VIEW_VOLUME:String = "viewVolume"; | |
public static var VIEW_MUTE:String = "viewMute"; | |
public static var VIEW_CHANGE_QUALITY:String = "viewChnageQulity"; | |
public static var VIEW_PRE_AD_END:String = "viewPreAdEnd"; | |
public static var VIEW_ENDING_AD_END:String = "viewEndingAdEnd"; | |
public var data; | |
public function ViewEvent(_arg1:String, _arg2=undefined){ | |
super(_arg1); | |
this.data = _arg2; | |
} | |
override public function clone():Event{ | |
return (new ViewEvent(this.type, this.data)); | |
} | |
override public function toString():String{ | |
return ((((("[ViewEvent type=\"" + type) + " data=\"") + this.data) + "\"]")); | |
} | |
} | |
}//package com.netease.openplayer.event | |
package com.netease.openplayer.event { | |
import flash.events.*; | |
public class PlayerEvent extends Event { | |
public static var PLAYER_PROGRAM_NEW:String = "playerprogramnew"; | |
public static var PLAYER_ERROR:String = "playerError"; | |
public static var PLAYER_RECORD_READY:String = "recordready"; | |
public static var PLAYER_MOVIEDATA_READY:String = "moviedataready"; | |
public var data; | |
public function PlayerEvent(_arg1:String, _arg2=null){ | |
super(_arg1, false, false); | |
this.data = _arg2; | |
} | |
override public function clone():Event{ | |
return (new PlayerEvent(this.type, this.data)); | |
} | |
override public function toString():String{ | |
return ((((("[PlayerEvent type=\"" + type) + " data=\"") + this.data) + "\"]")); | |
} | |
} | |
}//package com.netease.openplayer.event | |
package com.netease.openplayer { | |
import com.netease.openplayer.view.*; | |
import com.netease.openplayer.model.*; | |
import com.netease.eduplayercore.*; | |
import com.netease.openplayer.util.*; | |
import flash.external.*; | |
public class JavascriptAPI { | |
private var _isPlayerReady:Boolean = false; | |
private var _core:MediaCore; | |
private var _viewContainer:ViewContainer; | |
public function JavascriptAPI(_arg1:MediaCore, _arg2:ViewContainer){ | |
this._core = _arg1; | |
this._viewContainer = _arg2; | |
this.initAPI(); | |
} | |
public static function callJs(_arg1:String, _arg2=undefined):void{ | |
var fn:* = _arg1; | |
var args:* = _arg2; | |
if (ExternalInterface.available){ | |
try { | |
ExternalInterface.call(fn, args); | |
} catch(e:Error) { | |
}; | |
}; | |
} | |
private function initAPI():void{ | |
if (ExternalInterface.available){ | |
try { | |
ExternalInterface.addCallback("reSize", function (_arg1:Number, _arg2:Number):void{ | |
_viewContainer.resize(_arg1, _arg2); | |
}); | |
ExternalInterface.addCallback("doStop", function ():void{ | |
_core.pause(); | |
}); | |
ExternalInterface.addCallback("doPlay", function ():void{ | |
_core.play(); | |
}); | |
ExternalInterface.addCallback("doSeek", function (_arg1:Number):void{ | |
_core.seek(_arg1); | |
}); | |
ExternalInterface.addCallback("isContinue", function ():Number{ | |
return (GlobalData.playerConfig.isContinue); | |
}); | |
ExternalInterface.addCallback("getPosition", function ():Number{ | |
return (_core.getPosition()); | |
}); | |
ExternalInterface.addCallback("inited", function ():Boolean{ | |
return (_isPlayerReady); | |
}); | |
ExternalInterface.addCallback("postCaptionCheckInfo", function (_arg1:String, _arg2:int, _arg3:String):Boolean{ | |
new PostUtil().sendCaptionCheckInfo(_arg1, GlobalData.movieData.pid, GlobalData.movieData.mid, _arg2, _arg3); | |
return (true); | |
}); | |
ExternalInterface.call("playerReady"); | |
} catch(e:Error) { | |
}; | |
}; | |
} | |
public function get isPlayerReady():Boolean{ | |
return (this._isPlayerReady); | |
} | |
public function set isPlayerReady(_arg1:Boolean):void{ | |
this._isPlayerReady = _arg1; | |
} | |
} | |
}//package com.netease.openplayer | |
package com.netease.openplayer { | |
public class OpenVideoError { | |
public static var linkTimeout:Object = { | |
code:6, | |
message:"连接超时,请尝试刷新页面" | |
}; | |
public static var notSupportMedia:Object = { | |
code:7, | |
message:"视频格式错误" | |
}; | |
public static var ioError:Object = { | |
code:8, | |
message:"网络错误" | |
}; | |
public static var asyncError:Object = { | |
code:9, | |
message:"播放器错误" | |
}; | |
public static var networkerror:Object = { | |
code:10, | |
message:"网络错误" | |
}; | |
public static var invalidSwfUrl:Object = { | |
code:1, | |
message:"无效的地址" | |
}; | |
public static var videoNotExist:Object = { | |
code:2, | |
message:"该视频不存在或者已被删除" | |
}; | |
public static var ipNotAllowed:Object = { | |
code:3, | |
message:"您所在的地区未被授权观看该视频" | |
}; | |
public static var loadVideoXmlFail:Object = { | |
code:4, | |
message:"视频信息加载失败" | |
}; | |
public static var videoXmlFormatError:Object = { | |
code:5, | |
message:"视频数据格式异常" | |
}; | |
} | |
}//package com.netease.openplayer | |
package com.netease.eduplayercore.model { | |
public dynamic class MovieListItem { | |
public var type:String = ""; | |
public var bitrate:Number = 0; | |
public var quality:Number = -1; | |
public var qualityName:String = ""; | |
public var duration:Number = -1; | |
public var errorCode:String = ""; | |
public var errorMessage:String = ""; | |
public var playIndex:Number = 0; | |
public var urls:Array; | |
public var movieData:MovieData; | |
public function MovieListItem(_arg1:Object=null){ | |
var _local2:String; | |
this.urls = []; | |
super(); | |
for (_local2 in _arg1) { | |
this[_local2] = _arg1[_local2]; | |
}; | |
this.type = this.getMediaType(); | |
} | |
private function getMediaType():String{ | |
var _local2:Array; | |
var _local1 = "flv"; | |
if (this.urls.length >= 1){ | |
if (((!(!(this.urls[0]))) && (!((this.urls[0] == ""))))){ | |
_local2 = (this.urls[0] as String).split("."); | |
if (((_local2) && ((_local2.length > 0)))){ | |
_local1 = _local2[(_local2.length - 1)]; | |
}; | |
}; | |
}; | |
trace(("type:" + _local1)); | |
return (_local1); | |
} | |
public function toString():String{ | |
return ((((((((("[MovieListItem type=\"" + this.type) + "\" quality=\"") + this.quality) + "\" urls=\"") + this.urls.join(",")) + "\" playIndex=\"") + this.playIndex) + "\"]")); | |
} | |
} | |
}//package com.netease.eduplayercore.model | |
package com.netease.eduplayercore.model { | |
import flash.events.*; | |
public class MovieData extends EventDispatcher { | |
protected var _posterUrl:String; | |
protected var _start:Number = 0; | |
protected var _movieItemList:Array; | |
protected var _currentMode:MovieListItem; | |
protected var _hasPreload:Boolean = false; | |
public function MovieData(_arg1:IEventDispatcher=null){ | |
super(_arg1); | |
} | |
public function reset(_arg1:Object):void{ | |
} | |
public function getFixQuality(_arg1:Number):MovieListItem{ | |
var _local3:MovieListItem; | |
var _local2:Number = (this._movieItemList.length - 1); | |
while (_local2 >= 0) { | |
_local3 = (this._movieItemList[_local2] as MovieListItem); | |
if (_arg1 >= _local3.bitrate){ | |
return (this._movieItemList[_local2]); | |
}; | |
_local2--; | |
}; | |
return (this._movieItemList[0]); | |
} | |
public function changeQualityByName(_arg1:String):void{ | |
var _local2:uint; | |
var _local3:uint = this._movieItemList.length; | |
while (_local2 < _local3) { | |
trace(((("localeCompare:" + (this._movieItemList[_local2] as MovieListItem).qualityName) + " ") + _arg1)); | |
if (!(this._movieItemList[_local2] as MovieListItem).qualityName.localeCompare(_arg1)){ | |
this._currentMode = this._movieItemList[_local2]; | |
}; | |
_local2++; | |
}; | |
} | |
public function get currentMode():MovieListItem{ | |
return (this._currentMode); | |
} | |
public function get start():Number{ | |
return (this._start); | |
} | |
public function set start(_arg1:Number):void{ | |
this._start = _arg1; | |
} | |
public function get posterUrl():String{ | |
return (this._posterUrl); | |
} | |
public function get movieItemList():Array{ | |
return (this._movieItemList); | |
} | |
public function get hasPreload():Boolean{ | |
return (this._hasPreload); | |
} | |
public function set hasPreload(_arg1:Boolean):void{ | |
this._hasPreload = _arg1; | |
} | |
public function set posterUrl(_arg1:String):void{ | |
this._posterUrl = _arg1; | |
} | |
public function set currentMode(_arg1:MovieListItem):void{ | |
this._currentMode = _arg1; | |
} | |
public function set movieItemList(_arg1:Array):void{ | |
this._movieItemList = _arg1; | |
} | |
} | |
}//package com.netease.eduplayercore.model | |
package com.netease.eduplayercore.log { | |
import flash.events.*; | |
import flash.display.*; | |
import flash.text.*; | |
import com.netease.eduplayercore.util.*; | |
import flash.system.*; | |
import flash.filters.*; | |
public class LogPanel extends Sprite { | |
private static var instance:LogPanel; | |
private var _bg:Sprite; | |
private var _memTxt:TextField; | |
private var _fpsTxt:TextField; | |
private var _logTxt:TextField; | |
public function LogPanel(){ | |
this.initEvent(); | |
this.hide(); | |
} | |
private function initView():void{ | |
this._bg = new Sprite(); | |
addChild(this._bg); | |
this._bg.graphics.clear(); | |
this._bg.graphics.beginFill(0, 1); | |
this._bg.graphics.drawRect(0, 0, 100, 100); | |
this._bg.graphics.endFill(); | |
this._bg.alpha = 0.75; | |
this._bg.x = 0; | |
this._bg.y = 0; | |
this._bg.filters = [new DropShadowFilter(2, 60, 0, 0.4, 2, 2, 1, 1)]; | |
var _local1:TextFormat = new TextFormat(); | |
_local1.font = "微软雅黑,Microsoft YaHei"; | |
_local1.color = 0xFFFFFF; | |
_local1.size = 12; | |
_local1.leading = 4; | |
this._fpsTxt = new TextField(); | |
this._memTxt = new TextField(); | |
this._fpsTxt.defaultTextFormat = _local1; | |
this._fpsTxt.autoSize = TextFieldAutoSize.LEFT; | |
this._fpsTxt.text = ("FPS: " + Number(stage.frameRate).toFixed(2)); | |
this._fpsTxt.selectable = false; | |
this._fpsTxt.textColor = 0xFFFFFF; | |
this._fpsTxt.x = 10; | |
this._fpsTxt.y = 10; | |
addChild(this._fpsTxt); | |
this._memTxt.defaultTextFormat = _local1; | |
this._memTxt.autoSize = TextFieldAutoSize.LEFT; | |
this._memTxt.text = ("MEM: " + StringUtil.bytesToString(System.totalMemory)); | |
this._memTxt.selectable = false; | |
this._memTxt.textColor = 0xFFFFFF; | |
this._memTxt.x = 100; | |
this._memTxt.y = 10; | |
addChild(this._memTxt); | |
this._logTxt = new TextField(); | |
this._logTxt.multiline = true; | |
this._logTxt.defaultTextFormat = _local1; | |
this._logTxt.x = 10; | |
this._logTxt.y = 30; | |
addChild(this._logTxt); | |
this.addEventListener(Event.ENTER_FRAME, this.onEnterFrame); | |
this.stage.addEventListener(Event.RESIZE, this.resizeHandler); | |
this.resizeHandler(); | |
} | |
private function initEvent():void{ | |
this.addEventListener(Event.ADDED_TO_STAGE, this.onAddToStage); | |
} | |
private function onAddToStage(_arg1:Event):void{ | |
if (instance == null){ | |
instance = this; | |
this.initView(); | |
}; | |
} | |
private function onEnterFrame(_arg1:Event):void{ | |
this._fpsTxt.text = ("FPS: " + Number(stage.frameRate).toFixed(2)); | |
this._memTxt.text = ("MEM: " + StringUtil.bytesToString(System.totalMemory)); | |
} | |
private function resizeHandler(_arg1:Event=null):void{ | |
this.resize(stage.stageWidth, stage.stageHeight); | |
} | |
public function resize(_arg1:Number, _arg2:Number):void{ | |
this._bg.width = (_arg1 * 0.8); | |
this._bg.height = (_arg2 * 0.8); | |
this._logTxt.width = (this._bg.width - (this._logTxt.x * 2)); | |
this._logTxt.height = (this._bg.height - this._logTxt.y); | |
this.x = ((_arg1 - this._bg.width) / 2); | |
this.y = ((_arg2 - this._bg.height) / 2); | |
} | |
public function addVideoLog(_arg1:String):void{ | |
this._logTxt.appendText(_arg1); | |
} | |
public function show():void{ | |
this.visible = true; | |
} | |
public function hide():void{ | |
this.visible = false; | |
} | |
} | |
}//package com.netease.eduplayercore.log | |
package com.netease.eduplayercore.log { | |
import com.netease.eduplayercore.model.*; | |
public class LogData { | |
private var _itm:MovieListItem; | |
private var _startloadTime:Number = -1; | |
private var _loadStreamTime:Number = -1; | |
private var _loadMetaTime:Number = -1; | |
private var _loadMetaDuration:Number = -1; | |
private var _errorCode:String = ""; | |
private var _errorMessage:String = ""; | |
public function LogData(_arg1:MovieListItem){ | |
this._itm = _arg1; | |
} | |
public function addErrorLog(_arg1:Object):void{ | |
var _local2:Boolean = (((((this._itm.playIndex == (this._itm.urls.length - 1))) && (_arg1.code))) && (!((_arg1.code == "")))); | |
this._errorMessage = ((((("errorCode:" + _arg1.code) + ",errorMessage:") + _arg1.message) + ",allFail:") + _local2); | |
} | |
public function getLog():Object{ | |
return ({ | |
quality:this._itm.quality, | |
url:this._itm.urls[this._itm.playIndex], | |
urlIndex:this._itm.playIndex, | |
loadMetaTime:this._loadMetaDuration, | |
duration:this._itm.duration, | |
errorMessage:this._errorMessage | |
}); | |
} | |
public function get startloadTime():Number{ | |
return (this._startloadTime); | |
} | |
public function set startloadTime(_arg1:Number):void{ | |
this._startloadTime = _arg1; | |
} | |
public function get loadStreamTime():Number{ | |
return (this._loadStreamTime); | |
} | |
public function set loadStreamTime(_arg1:Number):void{ | |
this._loadStreamTime = _arg1; | |
} | |
public function get loadMetaTime():Number{ | |
return (this._loadMetaTime); | |
} | |
public function set loadMetaTime(_arg1:Number):void{ | |
this._loadMetaTime = _arg1; | |
this._loadMetaDuration = (this._loadMetaTime - this._startloadTime); | |
} | |
public function get loadMetaDuration():Number{ | |
return (this._loadMetaDuration); | |
} | |
public function set loadMetaDuration(_arg1:Number):void{ | |
this._loadMetaDuration = _arg1; | |
} | |
} | |
}//package com.netease.eduplayercore.log | |
package com.netease.eduplayercore.log { | |
import com.netease.eduplayercore.interfaces.*; | |
import com.netease.eduplayercore.*; | |
import com.netease.eduplayercore.events.*; | |
import com.netease.eduplayercore.model.*; | |
import flash.display.*; | |
import flash.system.*; | |
public class VideoLog extends Sprite { | |
protected var _core:IMediaCore; | |
protected var _logItems:Array; | |
protected var _currentLogData:LogData; | |
protected var _globalLogTxt:String = ""; | |
protected var _logPanel:LogPanel; | |
public function VideoLog(_arg1:IMediaCore){ | |
this._logItems = []; | |
super(); | |
this._core = _arg1; | |
this.initEvent(); | |
this.addToGlobalLog(("[info] flashPlayer version:" + this.getFlashPlayerVersion())); | |
} | |
private function initEvent():void{ | |
this._core.addEventListener(PlayerStateEvent.PLAYER_STATE, this.stateEventHandler); | |
this._core.addEventListener(MediaEvent.PLAYER_MEDIA_NEWMOVIE, this.mediaEventHandler); | |
this._core.addEventListener(MediaEvent.PLAYER_MEDIA_NEWITEM, this.mediaEventHandler); | |
this._core.addEventListener(MediaEvent.PLAYER_MEDIA_META, this.mediaEventHandler); | |
this._core.addEventListener(MediaEvent.PLAYER_MEDIA_BUFFER, this.mediaEventHandler); | |
this._core.addEventListener(MediaEvent.PLAYER_MEDIA_BUFFER_FULL, this.mediaEventHandler); | |
this._core.addEventListener(MediaEvent.PLAYER_MEDIA_ERROR, this.mediaEventHandler); | |
this._core.addEventListener(MediaEvent.PLAYER_MEDIA_QUALITYCHANGED, this.mediaEventHandler); | |
this._core.addEventListener(MediaEvent.PLAYER_MEDIA_SEEK, this.mediaEventHandler); | |
this._core.addEventListener(MediaEvent.PLAYER_MEDIA_TIME, this.mediaEventHandler); | |
this._core.addEventListener(MediaEvent.PLAYER_MEDIA_VOLUME, this.mediaEventHandler); | |
this._core.addEventListener(MediaEvent.PLAYER_MEDIA_MUTE, this.mediaEventHandler); | |
this._core.addEventListener(MediaEvent.PLAYER_BANDWIDTH_CHECK, this.mediaEventHandler); | |
this._core.addEventListener(MediaEvent.PLAYER_MEDIA_REPLAY, this.mediaEventHandler); | |
} | |
private function stateEventHandler(_arg1:PlayerStateEvent):void{ | |
switch (_arg1.newstate){ | |
case PlayerStates.PLAYING: | |
this.addToGlobalLog("[info] state:playing"); | |
break; | |
case PlayerStates.PAUSE: | |
this.addToGlobalLog("[info] state:pause"); | |
break; | |
case PlayerStates.BUFFERING: | |
this.addToGlobalLog("[info] state:buffering"); | |
break; | |
case PlayerStates.IDLE: | |
this.addToGlobalLog("[info] state:idle"); | |
break; | |
case PlayerStates.COMPLETE: | |
this.addToGlobalLog("[info] state:complete"); | |
break; | |
}; | |
this.stateLoghandler(_arg1); | |
} | |
protected function stateLoghandler(_arg1:PlayerStateEvent):void{ | |
} | |
private function mediaEventHandler(_arg1:MediaEvent):void{ | |
switch (_arg1.type){ | |
case MediaEvent.PLAYER_MEDIA_NEWMOVIE: | |
this.addToGlobalLog("[info] set new movie data"); | |
break; | |
case MediaEvent.PLAYER_MEDIA_NEWITEM: | |
this.createNewLogItem(_arg1.data); | |
this.addToGlobalLog("[info] load new video"); | |
this._currentLogData.startloadTime = new Date().time; | |
break; | |
case MediaEvent.PLAYER_MEDIA_META: | |
this.addToGlobalLog("[info] get video meta data"); | |
this._currentLogData.loadMetaTime = new Date().time; | |
break; | |
case MediaEvent.PLAYER_MEDIA_BUFFER: | |
break; | |
case MediaEvent.PLAYER_MEDIA_BUFFER_FULL: | |
break; | |
case MediaEvent.PLAYER_MEDIA_ERROR: | |
this.addToGlobalLog(("[error]" + _arg1.errorMessage)); | |
break; | |
case MediaEvent.PLAYER_MEDIA_QUALITYCHANGED: | |
this.addToGlobalLog(("[info] change quality:" + _arg1.currentQuality)); | |
break; | |
case MediaEvent.PLAYER_MEDIA_SEEK: | |
break; | |
case MediaEvent.PLAYER_MEDIA_TIME: | |
break; | |
case MediaEvent.PLAYER_MEDIA_VOLUME: | |
this.addToGlobalLog(("[info] change volume:" + _arg1.volume)); | |
break; | |
case MediaEvent.PLAYER_MEDIA_MUTE: | |
this.addToGlobalLog(("[info] mute:" + _arg1.mute)); | |
break; | |
case MediaEvent.PLAYER_MEDIA_REPLAY: | |
this.addToGlobalLog("[info] replay"); | |
break; | |
case MediaEvent.PLAYER_BANDWIDTH_CHECK: | |
break; | |
}; | |
this.mediaLoghandler(_arg1); | |
} | |
protected function mediaLoghandler(_arg1:MediaEvent):void{ | |
} | |
private function createNewLogItem(_arg1:MovieListItem):void{ | |
var _local2:LogData = new LogData(_arg1); | |
this._logItems.push(_local2); | |
this._currentLogData = _local2; | |
} | |
public function addToGlobalLog(_arg1:String):void{ | |
this._globalLogTxt = (this._globalLogTxt + (_arg1 + "\n")); | |
if (this._logPanel){ | |
this._logPanel.addVideoLog((_arg1 + "\n")); | |
}; | |
} | |
public function outputLog():String{ | |
return (this._globalLogTxt); | |
} | |
public function showPanel():void{ | |
if (!this._logPanel){ | |
this._logPanel = new LogPanel(); | |
stage.addChild(this._logPanel); | |
this._logPanel.addVideoLog(this._globalLogTxt); | |
}; | |
if (this._logPanel.visible){ | |
this._logPanel.hide(); | |
} else { | |
this._logPanel.show(); | |
}; | |
} | |
public function paste():void{ | |
System.setClipboard(this.outputLog()); | |
} | |
private function getFlashPlayerVersion():Number{ | |
var _local1:String = Capabilities.version; | |
var _local2:Array = _local1.split(/\s|,/); | |
var _local3:Number = Number(String(((_local2[1] + ".") + _local2[2]))); | |
return (_local3); | |
} | |
} | |
}//package com.netease.eduplayercore.log | |
package com.netease.eduplayercore { | |
public class PlayerStates { | |
public static var IDLE:String = "IDLE"; | |
public static var BUFFERING:String = "BUFFERING"; | |
public static var PLAYING:String = "PLAYING"; | |
public static var PAUSE:String = "PAUSE"; | |
public static var COMPLETE:String = "complete"; | |
} | |
}//package com.netease.eduplayercore | |
package com.netease.eduplayercore.util { | |
import flash.utils.*; | |
public class StringUtil { | |
public static function trim(_arg1:String):String{ | |
if (_arg1 == null){ | |
return (null); | |
}; | |
var _local2:RegExp = /^\s+|\s+$/g; | |
return (_arg1.replace(_local2, "")); | |
} | |
public static function formatter(_arg1:Number):String{ | |
var _local4:uint; | |
var _local2 = ""; | |
var _local3:uint = 60; | |
while (_local3) { | |
_local4 = Math.floor((_arg1 / _local3)); | |
_local2 = (_local2 + (zero(_local4) + ":")); | |
_arg1 = (_arg1 % _local3); | |
_local3 = (_local3 / 60); | |
}; | |
_local2 = _local2.substr(0, (_local2.length - 1)); | |
return (_local2); | |
} | |
public static function zero(_arg1:Number):String{ | |
if (_arg1 < 10){ | |
return (("0" + _arg1)); | |
}; | |
return (("" + _arg1)); | |
} | |
public static function unescape(_arg1:String):String{ | |
if ((((_arg1 == null)) || ((_arg1 == "")))){ | |
return (_arg1); | |
}; | |
var _local2:String = _arg1; | |
_local2 = _local2.replace("<", "<"); | |
_local2 = _local2.replace(">", ">"); | |
_local2 = _local2.replace("\r\n", "<br/>"); | |
_local2 = _local2.replace("\n", "<br/>"); | |
_local2 = _local2.replace(" ", " "); | |
_local2 = _local2.replace("&'", "&"); | |
_local2 = _local2.replace(""", "\""); | |
_local2 = _local2.replace("'", "'"); | |
_local2 = _local2.replace("(", "("); | |
_local2 = _local2.replace(")", ")"); | |
_local2 = _local2.replace("@", "@"); | |
return (_local2); | |
} | |
public static function parseByte2HexStr(_arg1:ByteArray):String{ | |
var _local4:uint; | |
var _local2 = ""; | |
var _local3 = ""; | |
while (_arg1.bytesAvailable) { | |
_local4 = (_arg1.readUnsignedByte() & 0xFF); | |
_local3 = _local4.toString(16); | |
if (_local3.length == 1){ | |
_local3 = ("0" + _local3); | |
}; | |
_local2 = (_local2 + _local3.toUpperCase()); | |
}; | |
return (_local2); | |
} | |
public static function hexStrToBytes(_arg1:String):ByteArray{ | |
var _local2:ByteArray = new ByteArray(); | |
var _local3:int; | |
while (_local3 < (_arg1.length / 2)) { | |
_local2.writeByte(parseInt(_arg1.substring((2 * _local3), ((2 * _local3) + 2)), 16)); | |
_local3++; | |
}; | |
_local2.position = 0; | |
return (_local2); | |
} | |
public static function bytesToString(_arg1:uint):String{ | |
var _local2:String; | |
if (_arg1 < 0x0400){ | |
_local2 = (String(_arg1) + "b"); | |
} else { | |
if (_arg1 < 0x2800){ | |
_local2 = (Number((_arg1 / 0x0400)).toFixed(2) + "kb"); | |
} else { | |
if (_arg1 < 102400){ | |
_local2 = (Number((_arg1 / 0x0400)).toFixed(1) + "kb"); | |
} else { | |
if (_arg1 < 0x100000){ | |
_local2 = (int((_arg1 / 0x0400)) + "kb"); | |
} else { | |
if (_arg1 < 0xA00000){ | |
_local2 = (Number((_arg1 / 0x100000)).toFixed(2) + "mb"); | |
} else { | |
if (_arg1 < 104857600){ | |
_local2 = (Number((_arg1 / 0x100000)).toFixed(1) + "mb"); | |
} else { | |
_local2 = (int((_arg1 / 0x100000)) + "mb"); | |
}; | |
}; | |
}; | |
}; | |
}; | |
}; | |
return (_local2); | |
} | |
} | |
}//package com.netease.eduplayercore.util | |
package com.netease.eduplayercore.util { | |
import flash.display.*; | |
public class Stretcher { | |
public static function stretch(_arg1:DisplayObject, _arg2:Number, _arg3:Number, _arg4:Number=undefined, _arg5:Number=undefined):void{ | |
if ((((_arg2 == 0)) || ((_arg3 == 0)))){ | |
return; | |
}; | |
if (!_arg4){ | |
_arg4 = _arg1.width; | |
_arg5 = _arg1.height; | |
}; | |
var _local6:Number = (_arg2 / _arg4); | |
var _local7:Number = (_arg3 / _arg5); | |
var _local8:Number = (((_local6 < _local7)) ? _local6 : _local7); | |
_arg1.width = (_arg4 * _local8); | |
_arg1.height = (_arg5 * _local8); | |
_arg1.x = Math.round(((_arg2 - _arg1.width) / 2)); | |
_arg1.y = Math.round(((_arg3 - _arg1.height) / 2)); | |
if (_arg1.width > 0){ | |
_arg1.width = Math.ceil(_arg1.width); | |
}; | |
if (_arg1.height > 0){ | |
_arg1.height = Math.ceil(_arg1.height); | |
}; | |
} | |
} | |
}//package com.netease.eduplayercore.util | |
package com.netease.eduplayercore.media { | |
import flash.events.*; | |
import com.netease.eduplayercore.*; | |
import com.netease.eduplayercore.events.*; | |
import com.netease.eduplayercore.model.*; | |
import flash.display.*; | |
import flash.net.*; | |
import flash.utils.*; | |
import flash.media.*; | |
import com.netease.eduplayercore.util.*; | |
public class HttpMediaProvider extends BaseMediaProvider { | |
private var _url:String; | |
protected var _connection:NetConnection; | |
protected var _stream:NetStream; | |
protected var _transformer:SoundTransform; | |
protected var _interval:Number; | |
protected var _offset:Object; | |
protected var _buffered:Number = 0; | |
protected var _totalBytes:Number = 0; | |
protected var _keyframes:Object; | |
protected var _video:Video; | |
protected var _hasGetMetaData:Boolean = false; | |
protected var _hasAutoSeek:Boolean = false; | |
private var _bandwidthChecking:Boolean = false; | |
private var _bandwidthInterval:Number = 5000; | |
private var _bwChecktimeoutId:Number; | |
public function HttpMediaProvider(_arg1:Number, _arg2:Number){ | |
this._offset = { | |
time:0, | |
byte:0 | |
}; | |
super(_arg1, _arg2); | |
} | |
override public function initMediaProvider(_arg1:Config):void{ | |
super.initMediaProvider(_arg1); | |
this._video = new Video(320, 240); | |
this._video.smoothing = true; | |
this._video.visible = false; | |
addChild(this._video); | |
this.resize(this._width, this._height); | |
this._transformer = new SoundTransform(); | |
} | |
private function createStream():void{ | |
if (this._connection){ | |
this._connection.close(); | |
this._connection = null; | |
}; | |
if (this._stream){ | |
this._stream.close(); | |
this._stream = null; | |
}; | |
this._connection = new NetConnection(); | |
this._connection.connect(null); | |
this._stream = new NetStream(this._connection); | |
this._stream.addEventListener(NetStatusEvent.NET_STATUS, this.statusHandler); | |
this._stream.addEventListener(IOErrorEvent.IO_ERROR, this.ioErrorHandler); | |
this._stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, this.asyncErrorHandler); | |
this._stream.bufferTime = 1; | |
this._stream.client = this; | |
this._video.attachNetStream(this._stream); | |
} | |
private function ioErrorHandler(_arg1:ErrorEvent):void{ | |
this.showError("ioError"); | |
} | |
private function asyncErrorHandler(_arg1:ErrorEvent):void{ | |
this.showError("asyncError"); | |
} | |
private function statusHandler(_arg1:NetStatusEvent):void{ | |
trace(_arg1.info.code); | |
switch (_arg1.info.code){ | |
case "NetStream.Play.Start": | |
this.beforePlay(); | |
break; | |
case "NetStream.Play.Stop": | |
if (((this._hasGetMetaData) && (!(this._hasPlayComplete)))){ | |
this.complete(); | |
}; | |
break; | |
case "NetStream.Play.StreamNotFound": | |
this.showError("linkTimeout"); | |
break; | |
case "NetStream.Play.NoSupportedTrackFound": | |
this.showError("notSupportMedia"); | |
break; | |
}; | |
} | |
public function onPlayStatus(_arg1:Object):void{ | |
if (_arg1.code == "NetStream.Play.Complete"){ | |
if (((this._hasGetMetaData) && (!(this._hasPlayComplete)))){ | |
this.complete(); | |
}; | |
}; | |
} | |
public function onMetaData(_arg1:Object):void{ | |
var _local2:String; | |
if (!_arg1){ | |
this.showError("notSupportMedia"); | |
return; | |
}; | |
trace(("meta信息:" + this._hasGetMetaData)); | |
if (!this._hasGetMetaData){ | |
trace("meta信息:"); | |
if (_arg1.width){ | |
this._vwidth = _arg1.width; | |
this._vheight = _arg1.height; | |
this.resize(this._width, this._height); | |
}; | |
trace(((("this._vwidth:" + this._vwidth) + ", this._vheight:") + this._vheight)); | |
if (((_arg1.duration) && ((this._duration <= 0)))){ | |
trace(("meta dur:" + _arg1.duration)); | |
this._duration = _arg1.duration; | |
this._item.duration = _arg1.duration; | |
}; | |
this._totalBytes = this._stream.bytesTotal; | |
if (!this._keyframes){ | |
if (_arg1.seekpoints){ | |
this._keyframes = { | |
times:new Array(), | |
filepositions:new Array() | |
}; | |
for (_local2 in _arg1.seekpoints) { | |
this._keyframes.times[_local2] = Number(_arg1.seekpoints[_local2]["time"]); | |
this._keyframes.filepositions[_local2] = Number(_arg1.seekpoints[_local2]["offset"]); | |
}; | |
} else { | |
this._keyframes = _arg1.keyframes; | |
}; | |
}; | |
this._hasGetMetaData = true; | |
sendMediaEvent(MediaEvent.PLAYER_MEDIA_META, {metadata:_arg1}); | |
this.autoSeek(); | |
}; | |
} | |
protected function autoSeek():void{ | |
trace("autoSeek"); | |
if ((((this._starttime > 0)) && (!(this._hasAutoSeek)))){ | |
this._offset = this.seekOffset(this._starttime); | |
this.loadStream(); | |
}; | |
this._hasAutoSeek = true; | |
} | |
protected function beforePlay():void{ | |
trace("beforeplay"); | |
if (((!(this._hasAutoSeek)) && ((this._starttime > 0)))){ | |
trace("还未AutoSeek"); | |
return; | |
}; | |
if (((this._cfg.beforePlay) && (!(this._item.movieData.hasPreload)))){ | |
this._item.movieData.hasPreload = true; | |
this.pause(); | |
sendMediaEvent(MediaEvent.PLAYER_MEDIA_TIME, { | |
position:this._starttime, | |
duration:this._duration | |
}); | |
sendMediaEvent(MediaEvent.PLAYER_MEDIA_BEFOREPLAY); | |
}; | |
} | |
public function onLastSecond(_arg1:Object):void{ | |
trace(_arg1.toString()); | |
} | |
protected function positionHandler():void{ | |
if (this._duration <= 0){ | |
return; | |
}; | |
var _local1:Number = (Math.round((Math.min(this._stream.time, Math.max(this._duration, 0)) * 100)) / 100); | |
if ((((((this._stream.bufferLength < 1)) && ((this._state == PlayerStates.PLAYING)))) && ((this._buffered < 100)))){ | |
this.setState(PlayerStates.BUFFERING); | |
} else { | |
if ((((this._stream.bufferLength > 1)) && ((this._state == PlayerStates.BUFFERING)))){ | |
this.sendMediaEvent(MediaEvent.PLAYER_MEDIA_BUFFER_FULL); | |
this.setState(PlayerStates.PLAYING); | |
}; | |
}; | |
if (this._buffered <= 100){ | |
this._buffered = Math.floor((100 * ((this._stream.bytesLoaded / this._totalBytes) + (this._offset.byte / this._totalBytes)))); | |
this._buffered = Math.min(100, this._buffered); | |
sendBufferEvent(this._buffered); | |
}; | |
if (this._state == PlayerStates.PLAYING){ | |
this._position = _local1; | |
if (_item.type == "mp4"){ | |
this._position = (this._position + this._offset.time); | |
}; | |
sendMediaEvent(MediaEvent.PLAYER_MEDIA_TIME, { | |
position:this._position, | |
duration:this._duration | |
}); | |
}; | |
if ((((this._state == PlayerStates.PLAYING)) && (!(this._bandwidthChecking)))){ | |
this._bandwidthChecking = true; | |
clearTimeout(this._bwChecktimeoutId); | |
this._bwChecktimeoutId = setTimeout(this.checkBandwidth, this._bandwidthInterval, this._stream.bytesLoaded); | |
}; | |
} | |
private function checkBandwidth(_arg1:Number):void{ | |
var _local2:Number = this._stream.bytesLoaded; | |
var _local3:Number = (Math.ceil(((_local2 - _arg1) / 0x0400)) / (this._bandwidthInterval / 1000)); | |
if (_local3 > 0){ | |
this.sendMediaEvent(MediaEvent.PLAYER_BANDWIDTH_CHECK, {data:_local3}); | |
}; | |
this._bandwidthChecking = false; | |
} | |
override public function load(_arg1:MovieListItem, _arg2:Number, _arg3:Number=undefined):void{ | |
this.createStream(); | |
this._video.visible = true; | |
this._url = _arg1.urls[_arg1.playIndex]; | |
this.setVolume(this._volume); | |
super.load(_arg1, _arg2, _arg3); | |
} | |
override public function loadStream():void{ | |
super.loadStream(); | |
trace("loadStream"); | |
this.setState(PlayerStates.BUFFERING); | |
var _local1:String = this._url; | |
var _local2:Number = this._offset.byte; | |
if (_item.type == "mp4"){ | |
_local2 = this._offset.time; | |
}; | |
if (this._offset.time == 0){ | |
} else { | |
if (_local1.indexOf("?") > -1){ | |
_local1 = (_local1 + ("&start=" + _local2)); | |
} else { | |
_local1 = (_local1 + ("?start=" + _local2)); | |
}; | |
}; | |
this.getUrl(_local1, this.onGetUrl); | |
} | |
override public function reloadStream():void{ | |
super.reloadStream(); | |
trace("reloadStream"); | |
var _local1:Number = (((this._position == 0)) ? this._starttime : this._position); | |
this._offset = this.seekOffset(_local1); | |
this.loadStream(); | |
} | |
protected function getUrl(_arg1:String, _arg2:Function):void{ | |
_arg2(_arg1); | |
} | |
protected function onGetUrl(_arg1:String):void{ | |
trace(("load url:" + _arg1)); | |
this._stream.play(_arg1); | |
clearInterval(this._interval); | |
this._interval = setInterval(this.positionHandler, 100); | |
} | |
override public function changeQuailty(_arg1=null):void{ | |
super.changeQuailty(_arg1); | |
this.stop(); | |
this.load((_arg1 as MovieListItem), this._starttime); | |
} | |
override public function pause():void{ | |
super.pause(); | |
if (this._stream){ | |
this._stream.pause(); | |
}; | |
} | |
override public function play():void{ | |
super.play(); | |
clearInterval(this._interval); | |
this._interval = setInterval(this.positionHandler, 100); | |
if (this._stream){ | |
this._stream.resume(); | |
}; | |
} | |
override public function resize(_arg1:Number, _arg2:Number):void{ | |
super.resize(_arg1, _arg2); | |
if (this._video){ | |
Stretcher.stretch(this._video, _arg1, _arg2, _vwidth, _vheight); | |
}; | |
} | |
override public function seek(_arg1:Number, _arg2:Number=0):void{ | |
var _local3:Object; | |
var _local4:Number; | |
var _local5:Number; | |
if (((!(this._hasGetMetaData)) || (!(this._stream)))){ | |
return; | |
}; | |
super.seek(_arg1, _arg2); | |
_hasPlayComplete = false; | |
clearInterval(this._interval); | |
trace(("seek:" + _arg1)); | |
if (this._keyframes){ | |
_local3 = this.seekOffset(_arg1, _arg2); | |
_local4 = _local3.time; | |
_local5 = _local3.byte; | |
if ((((_local5 < this._offset.byte)) || ((_local5 >= (this._offset.byte + this._stream.bytesLoaded))))){ | |
this._offset = _local3; | |
this.loadStream(); | |
} else { | |
if (_item.type == "mp4"){ | |
this._stream.seek((_local3.time - this._offset.time)); | |
} else { | |
this._stream.seek(_local3.time); | |
}; | |
}; | |
trace("seek后播放"); | |
this.play(); | |
} else { | |
_starttime = _arg1; | |
return; | |
}; | |
this._interval = setInterval(this.positionHandler, 100); | |
} | |
protected function seekOffset(_arg1:Number, _arg2:Number=0):Object{ | |
if (((!(this._keyframes)) || ((_arg1 == 0)))){ | |
return ({ | |
byte:0, | |
time:0 | |
}); | |
}; | |
var _local3:Number = 0; | |
while (_local3 < (this._keyframes.times.length - 1)) { | |
if (_arg2 > 0){ | |
if (this._keyframes.times[_local3] >= _arg1){ | |
break; | |
}; | |
} else { | |
if ((((this._keyframes.times[_local3] <= _arg1)) && ((this._keyframes.times[(_local3 + 1)] >= _arg1)))){ | |
break; | |
}; | |
}; | |
_local3++; | |
}; | |
return ({ | |
byte:this._keyframes.filepositions[_local3], | |
time:this._keyframes.times[_local3] | |
}); | |
} | |
override public function setVolume(_arg1:Number):void{ | |
super.setVolume(_arg1); | |
this.streamVolume(_arg1); | |
} | |
private function streamVolume(_arg1:Number):void{ | |
this._transformer.volume = _arg1; | |
if (this._stream){ | |
this._stream.soundTransform = this._transformer; | |
}; | |
} | |
override public function stop():void{ | |
super.stop(); | |
if (this._stream){ | |
this._stream.close(); | |
}; | |
this._offset = { | |
time:0, | |
byte:0 | |
}; | |
this._keyframes = undefined; | |
this._hasGetMetaData = false; | |
this._hasAutoSeek = false; | |
this._video.visible = false; | |
clearInterval(this._interval); | |
} | |
override public function get display():DisplayObject{ | |
return (this._video); | |
} | |
} | |
}//package com.netease.eduplayercore.media | |
package com.netease.eduplayercore.media { | |
import flash.events.*; | |
import com.netease.eduplayercore.*; | |
import com.netease.eduplayercore.events.*; | |
import com.netease.eduplayercore.model.*; | |
import flash.net.*; | |
import flash.utils.*; | |
import flash.media.*; | |
public class SoundMediaProvider extends BaseMediaProvider { | |
private var _sound:Sound; | |
private var _transformer:SoundTransform; | |
private var _channel:SoundChannel; | |
private var _context:SoundLoaderContext; | |
private var _positionInterval:Number; | |
private var _buffered:Boolean; | |
private var _endtime:Number; | |
private var _hasGetDuration:Boolean = false; | |
public function SoundMediaProvider(){ | |
super(0, 0); | |
} | |
override public function initMediaProvider(_arg1:Config):void{ | |
super.initMediaProvider(_arg1); | |
this._transformer = new SoundTransform(); | |
this._context = new SoundLoaderContext(0, true); | |
} | |
private function completeHandler(_arg1:Event):void{ | |
complete(); | |
} | |
private function errorHandler(_arg1:ErrorEvent):void{ | |
this.showError("ioError"); | |
} | |
override public function load(_arg1:MovieListItem, _arg2:Number, _arg3:Number=undefined):void{ | |
super.load(_arg1, _arg2, _arg3); | |
this._endtime = _arg3; | |
} | |
override public function loadStream():void{ | |
super.loadStream(); | |
this.setState(PlayerStates.BUFFERING); | |
this._sound = new Sound(); | |
this._sound.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler); | |
this._sound.addEventListener(ProgressEvent.PROGRESS, this.positionHandler); | |
this._sound.load(new URLRequest(_item.urls[this._item.playIndex]), this._context); | |
sendBufferEvent(0); | |
this.setVolume(this._cfg.volume); | |
this.play(); | |
} | |
protected function positionHandler(_arg1:ProgressEvent=null):void{ | |
if ((this._sound.bytesLoaded / this._sound.bytesTotal) > 0.1){ | |
if (this._endtime){ | |
this._duration = (_item.duration = (this._endtime - this._starttime)); | |
} else { | |
this._duration = (_item.duration = (((this._sound.length / 1000) / this._sound.bytesLoaded) * this._sound.bytesTotal)); | |
}; | |
if (!this._hasGetDuration){ | |
this._hasGetDuration = true; | |
sendMediaEvent(MediaEvent.PLAYER_MEDIA_META, {metadata:{duration:this._duration}}); | |
}; | |
}; | |
if (!this._buffered){ | |
sendBufferEvent(Math.round(((100 * this._sound.bytesLoaded) / this._sound.bytesTotal))); | |
if ((((this._sound.bytesLoaded == this._sound.bytesTotal)) && ((this._sound.bytesTotal > 0)))){ | |
this._buffered = true; | |
}; | |
}; | |
if ((((state == PlayerStates.BUFFERING)) && (!(this._sound.isBuffering)))){ | |
sendMediaEvent(MediaEvent.PLAYER_MEDIA_BUFFER_FULL); | |
setState(PlayerStates.PLAYING); | |
} else { | |
if ((((state == PlayerStates.PLAYING)) && (this._sound.isBuffering))){ | |
setState(PlayerStates.BUFFERING); | |
}; | |
}; | |
if ((((state == PlayerStates.PLAYING)) && (this._channel))){ | |
_position = (Math.floor((this._channel.position / 100)) / 10); | |
if (((this._endtime) && ((this._endtime <= _position)))){ | |
trace("播放提前结束"); | |
this.pause(); | |
this.complete(); | |
return; | |
}; | |
sendMediaEvent(MediaEvent.PLAYER_MEDIA_TIME, { | |
position:_position, | |
duration:_item.duration | |
}); | |
}; | |
} | |
override public function pause():void{ | |
super.pause(); | |
if (this._positionInterval){ | |
clearInterval(this._positionInterval); | |
this._positionInterval = undefined; | |
}; | |
if (this._channel){ | |
this._channel.stop(); | |
}; | |
} | |
override public function play():void{ | |
super.play(); | |
if ((((_position == 0)) && ((this._starttime > 0)))){ | |
this.seek(this._starttime); | |
return; | |
}; | |
if (!this._positionInterval){ | |
this._positionInterval = setInterval(this.positionHandler, 100); | |
}; | |
if (this._channel){ | |
this._channel.stop(); | |
this._channel = null; | |
}; | |
this._channel = this._sound.play((_position * 1000), 0, this._transformer); | |
this._channel.addEventListener(Event.SOUND_COMPLETE, this.completeHandler); | |
if (((this._cfg.beforePlay) && (!(this._item.movieData.hasPreload)))){ | |
this._item.movieData.hasPreload = true; | |
this.pause(); | |
sendMediaEvent(MediaEvent.PLAYER_MEDIA_BEFOREPLAY); | |
}; | |
} | |
override public function seek(_arg1:Number, _arg2:Number=0):void{ | |
super.seek(_arg1); | |
this._hasPlayComplete = false; | |
if (this._sound){ | |
clearInterval(this._positionInterval); | |
this._positionInterval = undefined; | |
if (this._channel){ | |
this._channel.stop(); | |
}; | |
_position = _arg1; | |
this.play(); | |
}; | |
} | |
override public function stop():void{ | |
super.stop(); | |
clearInterval(this._positionInterval); | |
this._positionInterval = undefined; | |
this._buffered = false; | |
if (this._channel){ | |
this._channel.stop(); | |
this._channel = null; | |
}; | |
try { | |
this._sound.close(); | |
} catch(err:Error) { | |
}; | |
} | |
override public function setVolume(_arg1:Number):void{ | |
super.setVolume(_arg1); | |
this.streamVolume(_arg1); | |
} | |
protected function streamVolume(_arg1:Number):void{ | |
this._transformer.volume = _arg1; | |
if (this._channel){ | |
this._channel.soundTransform = this._transformer; | |
}; | |
} | |
} | |
}//package com.netease.eduplayercore.media | |
package com.netease.eduplayercore.media { | |
import com.netease.eduplayercore.interfaces.*; | |
import com.netease.eduplayercore.*; | |
import com.netease.eduplayercore.events.*; | |
import com.netease.eduplayercore.model.*; | |
import flash.display.*; | |
public class BaseMediaProvider extends Sprite implements IMediaProvider { | |
private var _version:String = "1.1.1"; | |
protected var _item:MovieListItem; | |
protected var _cfg:Config; | |
protected var _starttime:Number = 0; | |
protected var _duration:Number = 0; | |
protected var _position:Number = 0; | |
protected var _lastStopedPosition:Number = 0; | |
protected var _bufferPercent:Number; | |
protected var _volume:Number = 0.8; | |
protected var _tempVolume:Number; | |
protected var _state:String; | |
protected var _width:Number = 0; | |
protected var _height:Number = 0; | |
protected var _vwidth:Number = 0; | |
protected var _vheight:Number = 0; | |
protected var _errorCount:Number = 0; | |
protected var _hasPlayComplete:Boolean = false; | |
public function BaseMediaProvider(_arg1:Number, _arg2:Number){ | |
this._width = _arg1; | |
this._height = _arg2; | |
} | |
public function initMediaProvider(_arg1:Config):void{ | |
this._cfg = _arg1; | |
this._volume = ((_arg1.mute) ? 0 : _arg1.volume); | |
this._state = PlayerStates.IDLE; | |
this.setState(PlayerStates.IDLE); | |
} | |
public function ready():void{ | |
var _local1:PlayerStateEvent = new PlayerStateEvent(PlayerStateEvent.PLAYER_STATE, PlayerStates.IDLE, this._state); | |
this._state = PlayerStates.IDLE; | |
dispatchEvent(_local1); | |
} | |
protected function showError(_arg1:String):void{ | |
if (++this._errorCount <= 3){ | |
trace((("尝试第" + this._errorCount) + "次")); | |
this.reloadStream(); | |
return; | |
}; | |
this.stop(); | |
this.sendMediaEvent(MediaEvent.PLAYER_MEDIA_ERROR, {errorMessage:_arg1}); | |
} | |
public function setState(_arg1:String):void{ | |
var _local2:PlayerStateEvent; | |
trace(((this.state + " ") + _arg1)); | |
if (this.state != _arg1){ | |
_local2 = new PlayerStateEvent(PlayerStateEvent.PLAYER_STATE, _arg1, this.state); | |
this._state = _arg1; | |
dispatchEvent(_local2); | |
}; | |
} | |
protected function sendMediaEvent(_arg1:String, _arg2:Object=null):void{ | |
var _local4:String; | |
var _local3:MediaEvent = new MediaEvent(_arg1); | |
for (_local4 in _arg2) { | |
if (_local3.hasOwnProperty(_local4)){ | |
_local3[_local4] = _arg2[_local4]; | |
}; | |
}; | |
this.dispatchEvent(_local3); | |
} | |
protected function sendBufferEvent(_arg1:Number):void{ | |
var _local2:Object; | |
if (((((!((this._bufferPercent == _arg1))) || ((_arg1 == 0)))) && (((0 <= _arg1) < 100)))){ | |
this._bufferPercent = _arg1; | |
_local2 = {bufferPercent:this._bufferPercent}; | |
this.sendMediaEvent(MediaEvent.PLAYER_MEDIA_BUFFER, _local2); | |
}; | |
} | |
protected function sendQualityEvent(_arg1:String, _arg2:Number):void{ | |
var _local3:MediaEvent = new MediaEvent(_arg1); | |
_local3.currentQuality = _arg2; | |
dispatchEvent(_local3); | |
} | |
public function load(_arg1:MovieListItem, _arg2:Number, _arg3:Number=undefined):void{ | |
this.sendMediaEvent(MediaEvent.PLAYER_MEDIA_NEWITEM, {data:_arg1}); | |
this._item = _arg1; | |
this._starttime = _arg2; | |
this._errorCount = 0; | |
this.sendQualityEvent(MediaEvent.PLAYER_MEDIA_QUALITYCHANGED, this._item.quality); | |
this.loadStream(); | |
} | |
public function loadStream():void{ | |
} | |
public function reloadStream():void{ | |
} | |
public function changeQuailty(_arg1=null):void{ | |
this._starttime = (((this._lastStopedPosition == 0)) ? this._starttime : this._lastStopedPosition); | |
this._starttime = (((this._starttime == this._duration)) ? 0 : this._starttime); | |
} | |
public function mute(_arg1:Boolean):void{ | |
this.sendMediaEvent(MediaEvent.PLAYER_MEDIA_MUTE, {mute:_arg1}); | |
if (_arg1){ | |
this._tempVolume = this._volume; | |
this.setVolume(0); | |
} else { | |
this.setVolume(this._tempVolume); | |
}; | |
} | |
public function pause():void{ | |
this.setState(PlayerStates.PAUSE); | |
} | |
public function play():void{ | |
if (this._hasPlayComplete){ | |
this.seek(0); | |
return; | |
}; | |
this.setState(PlayerStates.PLAYING); | |
} | |
public function seek(_arg1:Number, _arg2:Number=0):void{ | |
this.sendMediaEvent(MediaEvent.PLAYER_MEDIA_SEEK, {position:_arg1}); | |
if (this._hasPlayComplete){ | |
this.sendMediaEvent(MediaEvent.PLAYER_MEDIA_REPLAY); | |
}; | |
} | |
public function setVolume(_arg1:Number):void{ | |
this.sendMediaEvent(MediaEvent.PLAYER_MEDIA_VOLUME, {volume:_arg1}); | |
this._volume = _arg1; | |
} | |
public function stop():void{ | |
this._hasPlayComplete = false; | |
this._duration = 0; | |
this._lastStopedPosition = this._position; | |
this._position = 0; | |
this._bufferPercent = 0; | |
this.setState(PlayerStates.IDLE); | |
} | |
public function toggle():void{ | |
if ((((this._state == PlayerStates.PAUSE)) || ((this._state == PlayerStates.COMPLETE)))){ | |
this.play(); | |
} else { | |
this.pause(); | |
}; | |
} | |
protected function complete():void{ | |
this._errorCount = 0; | |
if ((this._duration - this._position) > 3){ | |
this.showError("networkerror"); | |
return; | |
}; | |
this._hasPlayComplete = true; | |
this.setState(PlayerStates.COMPLETE); | |
} | |
public function resize(_arg1:Number, _arg2:Number):void{ | |
this._width = _arg1; | |
this._height = _arg2; | |
} | |
public function get state():String{ | |
return (this._state); | |
} | |
public function get position():Number{ | |
return (this._position); | |
} | |
public function get currentQuality():Number{ | |
return (this._item.quality); | |
} | |
public function get version():String{ | |
return (this._version); | |
} | |
public function get display():DisplayObject{ | |
return (null); | |
} | |
public function get lastStopedPosition():Number{ | |
return (this._lastStopedPosition); | |
} | |
} | |
}//package com.netease.eduplayercore.media | |
package com.netease.eduplayercore { | |
import com.netease.eduplayercore.interfaces.*; | |
import com.netease.eduplayercore.events.*; | |
import com.netease.eduplayercore.model.*; | |
import flash.display.*; | |
import com.netease.eduplayercore.media.*; | |
public class MediaCore extends Sprite implements IMediaCore { | |
protected var _hasLoadMovie:Boolean = false; | |
protected var _movieData:MovieData; | |
protected var _posMovieItem:MovieListItem; | |
protected var _width:Number; | |
protected var _height:Number; | |
protected var _cfg:Config; | |
protected var _bg:Sprite; | |
protected var _mediaSources:Array; | |
protected var _currentMediaProvider:IMediaProvider; | |
protected var _fileTypeMap:Object; | |
public function MediaCore(_arg1:Config){ | |
this._mediaSources = []; | |
this._fileTypeMap = {}; | |
super(); | |
this._cfg = _arg1; | |
this.initView(); | |
this.initMediaProviders(); | |
} | |
private function initView():void{ | |
this._bg = new Sprite(); | |
addChild(this._bg); | |
this._bg.graphics.clear(); | |
this._bg.graphics.beginFill(0, 1); | |
this._bg.graphics.drawRect(0, 0, 100, 100); | |
this._bg.graphics.endFill(); | |
this._bg.x = 0; | |
this._bg.y = 0; | |
} | |
protected function initMediaProviders():void{ | |
this.setupMediaProvider("http", new HttpMediaProvider(this._width, this._height), ["mp4", "flv"]); | |
this.setupMediaProvider("sound", new SoundMediaProvider(), ["mp3"]); | |
this.activeMediaProvider("http"); | |
} | |
protected function setupMediaProvider(_arg1:String, _arg2:IMediaProvider, _arg3:Array):void{ | |
this._mediaSources[_arg1] = _arg2; | |
_arg2.initMediaProvider(this._cfg); | |
this.addChild((_arg2 as Sprite)); | |
var _local4:int; | |
while (_local4 < _arg3.length) { | |
this._fileTypeMap[_arg3[_local4]] = _arg1; | |
_local4++; | |
}; | |
} | |
protected function activeMediaProvider(_arg1:String):Boolean{ | |
trace(("activeMediaProvider type:" + _arg1)); | |
var _local2:IMediaProvider = (this._mediaSources[_arg1] as IMediaProvider); | |
if (!_local2){ | |
this.sendMediaEvent(MediaEvent.PLAYER_MEDIA_ERROR, {errorMessage:"notSupportMedia"}); | |
return (false); | |
}; | |
if (this._currentMediaProvider != _local2){ | |
if (this._currentMediaProvider){ | |
this._currentMediaProvider.stop(); | |
this.removeChild((this._currentMediaProvider as Sprite)); | |
this.clearMediaEvent(this._currentMediaProvider); | |
}; | |
this.setMediaEvent(_local2); | |
this._currentMediaProvider = _local2; | |
this._currentMediaProvider.stop(); | |
this.addChild((this._currentMediaProvider as Sprite)); | |
this.resize(this._width, this._height); | |
} else { | |
this._currentMediaProvider.stop(); | |
}; | |
return (true); | |
} | |
protected function getProviderType(_arg1:String):String{ | |
return (this._fileTypeMap[_arg1]); | |
} | |
private function setMediaEvent(_arg1:IMediaProvider):void{ | |
_arg1.addEventListener(PlayerStateEvent.PLAYER_STATE, this.stateEventHandler); | |
_arg1.addEventListener(MediaEvent.PLAYER_MEDIA_BEFOREPLAY, this.mediaEventHandler); | |
_arg1.addEventListener(MediaEvent.PLAYER_MEDIA_NEWITEM, this.mediaEventHandler); | |
_arg1.addEventListener(MediaEvent.PLAYER_MEDIA_META, this.mediaEventHandler); | |
_arg1.addEventListener(MediaEvent.PLAYER_MEDIA_BUFFER, this.mediaEventHandler); | |
_arg1.addEventListener(MediaEvent.PLAYER_MEDIA_BUFFER_FULL, this.mediaEventHandler); | |
_arg1.addEventListener(MediaEvent.PLAYER_MEDIA_ERROR, this.mediaEventHandler); | |
_arg1.addEventListener(MediaEvent.PLAYER_MEDIA_QUALITYCHANGED, this.mediaEventHandler); | |
_arg1.addEventListener(MediaEvent.PLAYER_MEDIA_SEEK, this.mediaEventHandler); | |
_arg1.addEventListener(MediaEvent.PLAYER_MEDIA_TIME, this.mediaEventHandler); | |
_arg1.addEventListener(MediaEvent.PLAYER_MEDIA_VOLUME, this.mediaEventHandler); | |
_arg1.addEventListener(MediaEvent.PLAYER_MEDIA_MUTE, this.mediaEventHandler); | |
_arg1.addEventListener(MediaEvent.PLAYER_BANDWIDTH_CHECK, this.mediaEventHandler); | |
_arg1.addEventListener(MediaEvent.PLAYER_MEDIA_REPLAY, this.mediaEventHandler); | |
} | |
private function clearMediaEvent(_arg1:IMediaProvider):void{ | |
_arg1.removeEventListener(PlayerStateEvent.PLAYER_STATE, this.stateEventHandler); | |
_arg1.removeEventListener(MediaEvent.PLAYER_MEDIA_META, this.mediaEventHandler); | |
_arg1.removeEventListener(MediaEvent.PLAYER_MEDIA_BUFFER, this.mediaEventHandler); | |
_arg1.removeEventListener(MediaEvent.PLAYER_MEDIA_BUFFER_FULL, this.mediaEventHandler); | |
_arg1.removeEventListener(MediaEvent.PLAYER_MEDIA_ERROR, this.mediaEventHandler); | |
_arg1.removeEventListener(MediaEvent.PLAYER_MEDIA_QUALITYCHANGED, this.mediaEventHandler); | |
_arg1.removeEventListener(MediaEvent.PLAYER_MEDIA_SEEK, this.mediaEventHandler); | |
_arg1.removeEventListener(MediaEvent.PLAYER_MEDIA_TIME, this.mediaEventHandler); | |
_arg1.removeEventListener(MediaEvent.PLAYER_MEDIA_VOLUME, this.mediaEventHandler); | |
_arg1.removeEventListener(MediaEvent.PLAYER_MEDIA_MUTE, this.mediaEventHandler); | |
_arg1.removeEventListener(MediaEvent.PLAYER_BANDWIDTH_CHECK, this.mediaEventHandler); | |
_arg1.removeEventListener(MediaEvent.PLAYER_MEDIA_REPLAY, this.mediaEventHandler); | |
_arg1.removeEventListener(MediaEvent.PLAYER_MEDIA_NEWITEM, this.mediaEventHandler); | |
} | |
public function setMovieData(_arg1:MovieData):void{ | |
this._movieData = _arg1; | |
var _local2:MediaEvent = new MediaEvent(MediaEvent.PLAYER_MEDIA_NEWMOVIE); | |
_local2.data = this._movieData; | |
this.dispatchEvent(_local2); | |
this._hasLoadMovie = false; | |
} | |
public function loadMovie():void{ | |
var _local1:Boolean; | |
if (this._movieData){ | |
this._hasLoadMovie = true; | |
this._posMovieItem = this._movieData.currentMode; | |
_local1 = this.activeMediaProvider(this.getProviderType(this._posMovieItem.type)); | |
if (_local1){ | |
trace("start load new video"); | |
this._currentMediaProvider.load(this._posMovieItem, this._movieData.start); | |
}; | |
}; | |
} | |
public function changeQuality(_arg1:String):void{ | |
this._movieData.changeQualityByName(_arg1); | |
this._posMovieItem = this._movieData.currentMode; | |
this.activeMediaProvider(this.getProviderType(this._posMovieItem.type)); | |
this._currentMediaProvider.changeQuailty(this._posMovieItem); | |
} | |
public function switchNext():Boolean{ | |
if (this._posMovieItem.playIndex < (this._posMovieItem.urls.length - 1)){ | |
this._posMovieItem.playIndex++; | |
trace("尝试下一个地址"); | |
this.activeMediaProvider(this.getProviderType(this._posMovieItem.type)); | |
this._currentMediaProvider.changeQuailty(this._posMovieItem); | |
return (true); | |
}; | |
trace("没有更多地址了"); | |
return (false); | |
} | |
private function stateEventHandler(_arg1:PlayerStateEvent):void{ | |
this.dispatchEvent(_arg1); | |
} | |
private function mediaEventHandler(_arg1:MediaEvent):void{ | |
if (_arg1.type == MediaEvent.PLAYER_MEDIA_ERROR){ | |
if (this.switchNext()){ | |
return; | |
}; | |
}; | |
this.dispatchEvent(_arg1); | |
} | |
private function sendMediaEvent(_arg1:String, _arg2:Object=null):void{ | |
var _local4:String; | |
var _local3:MediaEvent = new MediaEvent(_arg1); | |
for (_local4 in _arg2) { | |
if (_local3.hasOwnProperty(_local4)){ | |
_local3[_local4] = _arg2[_local4]; | |
}; | |
}; | |
this.dispatchEvent(_local3); | |
} | |
public function play():void{ | |
if (!this._hasLoadMovie){ | |
this.loadMovie(); | |
return; | |
}; | |
this._currentMediaProvider.play(); | |
} | |
public function pause():void{ | |
this._currentMediaProvider.pause(); | |
} | |
public function toggle():void{ | |
this._currentMediaProvider.toggle(); | |
} | |
public function stop():void{ | |
this._currentMediaProvider.stop(); | |
} | |
public function seek(_arg1:Number, _arg2:Number=0):void{ | |
this._currentMediaProvider.seek(_arg1, _arg2); | |
} | |
public function mute(_arg1:Boolean):void{ | |
this._currentMediaProvider.mute(_arg1); | |
} | |
public function voluem(_arg1:Number):void{ | |
this._currentMediaProvider.setVolume(_arg1); | |
} | |
public function resize(_arg1:Number, _arg2:Number):void{ | |
this._width = _arg1; | |
this._height = _arg2; | |
this._bg.width = _arg1; | |
this._bg.height = _arg2; | |
this._currentMediaProvider.resize(_arg1, _arg2); | |
} | |
public function getPosition():Number{ | |
return (this._currentMediaProvider.position); | |
} | |
public function getState():String{ | |
return (this._currentMediaProvider.state); | |
} | |
public function getDisplay():DisplayObject{ | |
return (this._currentMediaProvider.display); | |
} | |
} | |
}//package com.netease.eduplayercore | |
package com.netease.eduplayercore { | |
public class Config { | |
public var volume:Number = 0.8; | |
public var mute:Boolean = false; | |
public var isAutoPlay:Boolean = false; | |
public var beforePlay:Boolean = false; | |
public function Config(_arg1:Object=null){ | |
var _local2:String; | |
var _local3:String; | |
super(); | |
try { | |
for (_local3 in _arg1) { | |
if (_arg1[_local3]){ | |
this[_local3] = this.changeVarData(_arg1[_local3]); | |
}; | |
}; | |
} catch(e:Error) { | |
}; | |
} | |
protected function changeVarData(_arg1:String){ | |
var _local2:*; | |
var _local3:String; | |
if (!_arg1){ | |
_local2 = null; | |
} else { | |
_local2 = (_arg1 + ""); | |
}; | |
if (!_local2){ | |
return (null); | |
}; | |
if (_arg1 == "true"){ | |
_local2 = true; | |
} else { | |
if (_arg1 == "false"){ | |
_local2 = false; | |
} else { | |
_local3 = _local2; | |
if (isNaN(Number(_local2))){ | |
_local2 = _local3; | |
} else { | |
_local2 = Number(_local2); | |
}; | |
}; | |
}; | |
return (_local2); | |
} | |
public function filterParam(_arg1:String):String{ | |
var _local2:RegExp = /^[\w\.]*$/g; | |
if (((_arg1) && (_local2.test(_arg1)))){ | |
return (_arg1); | |
}; | |
trace(("不合法的参数名称:" + _arg1)); | |
return (""); | |
} | |
public function toString():String{ | |
var _local2:String; | |
var _local1 = ""; | |
for (_local2 in this) { | |
_local1 = (_local1 + (((("[Config " + _local2) + "=\"") + this[_local2]) + "\"]\n")); | |
}; | |
return (_local1); | |
} | |
} | |
}//package com.netease.eduplayercore | |
package com.netease.eduplayercore.interfaces { | |
import flash.events.*; | |
import com.netease.eduplayercore.*; | |
import com.netease.eduplayercore.model.*; | |
import flash.display.*; | |
public interface IMediaProvider extends IEventDispatcher { | |
function initMediaProvider(_arg1:Config):void; | |
function load(_arg1:MovieListItem, _arg2:Number, _arg3:Number=undefined):void; | |
function play():void; | |
function pause():void; | |
function toggle():void; | |
function seek(_arg1:Number, _arg2:Number=0):void; | |
function stop():void; | |
function setVolume(_arg1:Number):void; | |
function mute(_arg1:Boolean):void; | |
function resize(_arg1:Number, _arg2:Number):void; | |
function changeQuailty(_arg1=null):void; | |
function get state():String; | |
function get position():Number; | |
function get currentQuality():Number; | |
function get display():DisplayObject; | |
} | |
}//package com.netease.eduplayercore.interfaces | |
package com.netease.eduplayercore.interfaces { | |
import flash.events.*; | |
import com.netease.eduplayercore.model.*; | |
import flash.display.*; | |
public interface IMediaCore extends IEventDispatcher { | |
function setMovieData(_arg1:MovieData):void; | |
function loadMovie():void; | |
function changeQuality(_arg1:String):void; | |
function play():void; | |
function pause():void; | |
function toggle():void; | |
function stop():void; | |
function seek(_arg1:Number, _arg2:Number=0):void; | |
function mute(_arg1:Boolean):void; | |
function voluem(_arg1:Number):void; | |
function resize(_arg1:Number, _arg2:Number):void; | |
function getPosition():Number; | |
function getState():String; | |
function getDisplay():DisplayObject; | |
} | |
}//package com.netease.eduplayercore.interfaces | |
package com.netease.eduplayercore.events { | |
import flash.events.*; | |
public class PlayerStateEvent extends Event { | |
public static var PLAYER_STATE:String = "playerState"; | |
public var newstate:String = ""; | |
public var oldstate:String = ""; | |
public function PlayerStateEvent(_arg1:String, _arg2:String, _arg3:String){ | |
super(_arg1); | |
this.newstate = _arg2; | |
this.oldstate = _arg3; | |
} | |
override public function clone():Event{ | |
return (new PlayerStateEvent(this.type, this.newstate, this.oldstate)); | |
} | |
override public function toString():String{ | |
return (((((((((("[PlayerStateEvent type=\"" + type) + "\"") + " oldstate=\"") + this.oldstate) + "\"") + " newstate=\"") + this.newstate) + "\"") + "]")); | |
} | |
} | |
}//package com.netease.eduplayercore.events | |
package com.netease.eduplayercore.events { | |
import flash.events.*; | |
public class MediaEvent extends Event { | |
public static var PLAYER_MEDIA_NEWMOVIE:String = "playerMediaNewMovie"; | |
public static var PLAYER_MEDIA_NEWITEM:String = "playerMediaNewMovieItem"; | |
public static var PLAYER_MEDIA_BUFFER:String = "playerMediaBuffer"; | |
public static var PLAYER_MEDIA_BUFFER_FULL:String = "playerMediaBufferFull"; | |
public static var PLAYER_MEDIA_ERROR:String = "playerMediaError"; | |
public static var PLAYER_MEDIA_SEEK:String = "playerMediaSeek"; | |
public static var PLAYER_MEDIA_TIME:String = "playerMediaTime"; | |
public static var PLAYER_MEDIA_VOLUME:String = "playerMediaVolume"; | |
public static var PLAYER_MEDIA_META:String = "playerMediaMeta"; | |
public static var PLAYER_MEDIA_BEFOREPLAY:String = "playerMediaBeforePlay"; | |
public static var PLAYER_MEDIA_COMPLETE:String = "playerMediaComplete"; | |
public static var PLAYER_MEDIA_REPLAY:String = "playerMediaReplay"; | |
public static var PLAYER_MEDIA_MUTE:String = "playerMediaMute"; | |
public static var PLAYER_MEDIA_QUALITYCHANGED:String = "playerMediaQualityChanged"; | |
public static var PLAYER_BANDWIDTH_CHECK:String = "playerMediaBandwidthCheck"; | |
public var bufferPercent:Number = -1; | |
public var duration:Number = -1; | |
public var metadata:Object = null; | |
public var position:Number = -1; | |
public var volume:Number = -1; | |
public var mute:Boolean = false; | |
public var currentQuality:Number; | |
public var errorMessage:String; | |
public var data; | |
public var message:String; | |
public function MediaEvent(_arg1:String){ | |
super(_arg1); | |
} | |
override public function clone():Event{ | |
var _local1:MediaEvent = new MediaEvent(this.type); | |
_local1.bufferPercent = this.bufferPercent; | |
_local1.duration = this.duration; | |
_local1.metadata = this.metadata; | |
_local1.position = this.position; | |
_local1.volume = this.volume; | |
_local1.mute = this.mute; | |
_local1.currentQuality = this.currentQuality; | |
_local1.errorMessage = this.errorMessage; | |
_local1.message = this.message; | |
_local1.data = this.data; | |
return (_local1); | |
} | |
override public function toString():String{ | |
var _local3:String; | |
var _local1 = (("[MediaEvent type=\"" + type) + "\""); | |
var _local2:MediaEvent = new MediaEvent(""); | |
for (_local3 in this.metadata) { | |
_local1 = (_local1 + ((((" " + _local3) + "=\"") + this.metadata[_local3]) + "\"")); | |
}; | |
if (this.bufferPercent != _local2.bufferPercent){ | |
_local1 = (_local1 + ((" bufferPercent=\"" + this.bufferPercent) + "\"")); | |
}; | |
if (this.duration != _local2.duration){ | |
_local1 = (_local1 + ((" duration=\"" + this.duration) + "\"")); | |
}; | |
if (this.position != _local2.position){ | |
_local1 = (_local1 + ((" position=\"" + this.position) + "\"")); | |
}; | |
if (this.volume != _local2.volume){ | |
_local1 = (_local1 + ((" volume=\"" + this.volume) + "\"")); | |
}; | |
if (this.mute != _local2.mute){ | |
_local1 = (_local1 + ((" mute=\"" + this.mute) + "\"")); | |
}; | |
if (this.currentQuality != _local2.currentQuality){ | |
_local1 = (_local1 + ((" currentQuality=\"" + this.currentQuality) + "\"")); | |
}; | |
if (this.errorMessage != _local2.errorMessage){ | |
_local1 = (_local1 + ((" errorMessage=\"" + this.errorMessage) + "\"")); | |
}; | |
_local1 = (_local1 + "]"); | |
return (_local1); | |
} | |
} | |
}//package com.netease.eduplayercore.events | |
package com.adobe.serialization.json { | |
public class JSONToken { | |
private var _value:Object; | |
private var _type:int; | |
public function JSONToken(_arg1:int=-1, _arg2:Object=null){ | |
this._type = _arg1; | |
this._value = _arg2; | |
} | |
public function get value():Object{ | |
return (this._value); | |
} | |
public function get type():int{ | |
return (this._type); | |
} | |
public function set type(_arg1:int):void{ | |
this._type = _arg1; | |
} | |
public function set value(_arg1:Object):void{ | |
this._value = _arg1; | |
} | |
} | |
}//package com.adobe.serialization.json | |
package com.adobe.serialization.json { | |
import flash.utils.*; | |
public class JSONEncoder { | |
private var jsonString:String; | |
public function JSONEncoder(_arg1){ | |
this.jsonString = this.convertToString(_arg1); | |
} | |
private function escapeString(_arg1:String):String{ | |
var _local3:String; | |
var _local6:String; | |
var _local7:String; | |
var _local2 = ""; | |
var _local4:Number = _arg1.length; | |
var _local5:int; | |
while (_local5 < _local4) { | |
_local3 = _arg1.charAt(_local5); | |
switch (_local3){ | |
case "\"": | |
_local2 = (_local2 + "\\\""); | |
break; | |
case "\\": | |
_local2 = (_local2 + "\\\\"); | |
break; | |
case "\b": | |
_local2 = (_local2 + "\\b"); | |
break; | |
case "\f": | |
_local2 = (_local2 + "\\f"); | |
break; | |
case "\n": | |
_local2 = (_local2 + "\\n"); | |
break; | |
case "\r": | |
_local2 = (_local2 + "\\r"); | |
break; | |
case "\t": | |
_local2 = (_local2 + "\\t"); | |
break; | |
default: | |
if (_local3 < " "){ | |
_local6 = _local3.charCodeAt(0).toString(16); | |
_local7 = (((_local6.length == 2)) ? "00" : "000"); | |
_local2 = (_local2 + (("\\u" + _local7) + _local6)); | |
} else { | |
_local2 = (_local2 + _local3); | |
}; | |
}; | |
_local5++; | |
}; | |
return ((("\"" + _local2) + "\"")); | |
} | |
private function arrayToString(_arg1:Array):String{ | |
var _local2 = ""; | |
var _local3:int; | |
while (_local3 < _arg1.length) { | |
if (_local2.length > 0){ | |
_local2 = (_local2 + ","); | |
}; | |
_local2 = (_local2 + this.convertToString(_arg1[_local3])); | |
_local3++; | |
}; | |
return ((("[" + _local2) + "]")); | |
} | |
public function getString():String{ | |
return (this.jsonString); | |
} | |
private function objectToString(_arg1:Object):String{ | |
var value:* = null; | |
var key:* = null; | |
var v:* = null; | |
var o:* = _arg1; | |
var s:* = ""; | |
var classInfo:* = describeType(o); | |
if (classInfo.@name.toString() == "Object"){ | |
for (key in o) { | |
value = o[key]; | |
if ((value is Function)){ | |
} else { | |
if (s.length > 0){ | |
s = (s + ","); | |
}; | |
s = (s + ((this.escapeString(key) + ":") + this.convertToString(value))); | |
}; | |
}; | |
} else { | |
for each (v in classInfo..*.(((name() == "variable")) || ((((name() == "accessor")) && ((attribute("access").charAt(0) == "r")))))) { | |
if (((v.metadata) && ((v.metadata.(@name == "Transient").length() > 0)))){ | |
} else { | |
if (s.length > 0){ | |
s = (s + ","); | |
}; | |
s = (s + ((this.escapeString(v.@name.toString()) + ":") + this.convertToString(o[v.@name]))); | |
}; | |
}; | |
}; | |
return ((("{" + s) + "}")); | |
} | |
private function convertToString(_arg1):String{ | |
if ((_arg1 is String)){ | |
return (this.escapeString((_arg1 as String))); | |
}; | |
if ((_arg1 is Number)){ | |
return (((isFinite((_arg1 as Number))) ? _arg1.toString() : "null")); | |
}; | |
if ((_arg1 is Boolean)){ | |
return (((_arg1) ? "true" : "false")); | |
}; | |
if ((_arg1 is Array)){ | |
return (this.arrayToString((_arg1 as Array))); | |
}; | |
if ((((_arg1 is Object)) && (!((_arg1 == null))))){ | |
return (this.objectToString(_arg1)); | |
}; | |
return ("null"); | |
} | |
} | |
}//package com.adobe.serialization.json | |
package com.adobe.serialization.json { | |
public class JSONParseError extends Error { | |
private var _location:int; | |
private var _text:String; | |
public function JSONParseError(_arg1:String="", _arg2:int=0, _arg3:String=""){ | |
super(_arg1); | |
name = "JSONParseError"; | |
this._location = _arg2; | |
this._text = _arg3; | |
} | |
public function get location():int{ | |
return (this._location); | |
} | |
public function get text():String{ | |
return (this._text); | |
} | |
} | |
}//package com.adobe.serialization.json | |
package com.adobe.serialization.json { | |
public class JSONTokenizer { | |
private var ch:String; | |
private var loc:int; | |
private var jsonString:String; | |
private var strict:Boolean; | |
private var controlCharsRegExp:RegExp; | |
private var obj:Object; | |
public function JSONTokenizer(_arg1:String, _arg2:Boolean){ | |
this.controlCharsRegExp = /[\x00-\x1F]/; | |
super(); | |
this.jsonString = _arg1; | |
this.strict = _arg2; | |
this.loc = 0; | |
this.nextChar(); | |
} | |
private function skipComments():void{ | |
if (this.ch == "/"){ | |
this.nextChar(); | |
switch (this.ch){ | |
case "/": | |
do { | |
this.nextChar(); | |
} while (((!((this.ch == "\n"))) && (!((this.ch == ""))))); | |
this.nextChar(); | |
break; | |
case "*": | |
this.nextChar(); | |
while (true) { | |
if (this.ch == "*"){ | |
this.nextChar(); | |
if (this.ch == "/"){ | |
this.nextChar(); | |
break; | |
}; | |
} else { | |
this.nextChar(); | |
}; | |
if (this.ch == ""){ | |
this.parseError("Multi-line comment not closed"); | |
}; | |
}; | |
break; | |
default: | |
this.parseError((("Unexpected " + this.ch) + " encountered (expecting '/' or '*' )")); | |
}; | |
}; | |
} | |
private function isDigit(_arg1:String):Boolean{ | |
return ((((_arg1 >= "0")) && ((_arg1 <= "9")))); | |
} | |
private function readNumber():JSONToken{ | |
var _local3:JSONToken; | |
var _local1 = ""; | |
if (this.ch == "-"){ | |
_local1 = (_local1 + "-"); | |
this.nextChar(); | |
}; | |
if (!this.isDigit(this.ch)){ | |
this.parseError("Expecting a digit"); | |
}; | |
if (this.ch == "0"){ | |
_local1 = (_local1 + this.ch); | |
this.nextChar(); | |
if (this.isDigit(this.ch)){ | |
this.parseError("A digit cannot immediately follow 0"); | |
} else { | |
if (((!(this.strict)) && ((this.ch == "x")))){ | |
_local1 = (_local1 + this.ch); | |
this.nextChar(); | |
if (this.isHexDigit(this.ch)){ | |
_local1 = (_local1 + this.ch); | |
this.nextChar(); | |
} else { | |
this.parseError("Number in hex format require at least one hex digit after \"0x\""); | |
}; | |
while (this.isHexDigit(this.ch)) { | |
_local1 = (_local1 + this.ch); | |
this.nextChar(); | |
}; | |
}; | |
}; | |
} else { | |
while (this.isDigit(this.ch)) { | |
_local1 = (_local1 + this.ch); | |
this.nextChar(); | |
}; | |
}; | |
if (this.ch == "."){ | |
_local1 = (_local1 + "."); | |
this.nextChar(); | |
if (!this.isDigit(this.ch)){ | |
this.parseError("Expecting a digit"); | |
}; | |
while (this.isDigit(this.ch)) { | |
_local1 = (_local1 + this.ch); | |
this.nextChar(); | |
}; | |
}; | |
if ((((this.ch == "e")) || ((this.ch == "E")))){ | |
_local1 = (_local1 + "e"); | |
this.nextChar(); | |
if ((((this.ch == "+")) || ((this.ch == "-")))){ | |
_local1 = (_local1 + this.ch); | |
this.nextChar(); | |
}; | |
if (!this.isDigit(this.ch)){ | |
this.parseError("Scientific notation number needs exponent value"); | |
}; | |
while (this.isDigit(this.ch)) { | |
_local1 = (_local1 + this.ch); | |
this.nextChar(); | |
}; | |
}; | |
var _local2:Number = Number(_local1); | |
if (((isFinite(_local2)) && (!(isNaN(_local2))))){ | |
_local3 = new JSONToken(); | |
_local3.type = JSONTokenType.NUMBER; | |
_local3.value = _local2; | |
return (_local3); | |
}; | |
this.parseError((("Number " + _local2) + " is not valid!")); | |
return (null); | |
} | |
public function unescapeString(_arg1:String):String{ | |
var _local6:*; | |
var _local7:*; | |
var _local8:*; | |
var _local9:*; | |
var _local10:*; | |
if (((this.strict) && (this.controlCharsRegExp.test(_arg1)))){ | |
this.parseError("String contains unescaped control character (0x00-0x1F)"); | |
}; | |
var _local2 = ""; | |
var _local3:int; | |
var _local4:int; | |
var _local5:int = _arg1.length; | |
do { | |
_local3 = _arg1.indexOf("\\", _local4); | |
if (_local3 >= 0){ | |
_local2 = (_local2 + _arg1.substr(_local4, (_local3 - _local4))); | |
_local4 = (_local3 + 2); | |
_local6 = (_local3 + 1); | |
_local7 = _arg1.charAt(_local6); | |
switch (_local7){ | |
case "\"": | |
_local2 = (_local2 + "\""); | |
break; | |
case "\\": | |
_local2 = (_local2 + "\\"); | |
break; | |
case "n": | |
_local2 = (_local2 + "\n"); | |
break; | |
case "r": | |
_local2 = (_local2 + "\r"); | |
break; | |
case "t": | |
_local2 = (_local2 + "\t"); | |
break; | |
case "u": | |
_local8 = ""; | |
if ((_local4 + 4) > _local5){ | |
this.parseError("Unexpected end of input. Expecting 4 hex digits after \\u."); | |
}; | |
_local9 = _local4; | |
while (_local9 < (_local4 + 4)) { | |
_local10 = _arg1.charAt(_local9); | |
if (!this.isHexDigit(_local10)){ | |
this.parseError(("Excepted a hex digit, but found: " + _local10)); | |
}; | |
_local8 = (_local8 + _local10); | |
_local9++; | |
}; | |
_local2 = (_local2 + String.fromCharCode(parseInt(_local8, 16))); | |
_local4 = (_local4 + 4); | |
break; | |
case "f": | |
_local2 = (_local2 + "\f"); | |
break; | |
case "/": | |
_local2 = (_local2 + "/"); | |
break; | |
case "b": | |
_local2 = (_local2 + "\b"); | |
break; | |
default: | |
_local2 = (_local2 + ("\\" + _local7)); | |
}; | |
} else { | |
_local2 = (_local2 + _arg1.substr(_local4)); | |
break; | |
}; | |
} while (_local4 < _local5); | |
return (_local2); | |
} | |
private function skipWhite():void{ | |
while (this.isWhiteSpace(this.ch)) { | |
this.nextChar(); | |
}; | |
} | |
private function isWhiteSpace(_arg1:String):Boolean{ | |
if ((((((((_arg1 == " ")) || ((_arg1 == "\t")))) || ((_arg1 == "\n")))) || ((_arg1 == "\r")))){ | |
return (true); | |
}; | |
if (((!(this.strict)) && ((_arg1.charCodeAt(0) == 160)))){ | |
return (true); | |
}; | |
return (false); | |
} | |
public function parseError(_arg1:String):void{ | |
throw (new JSONParseError(_arg1, this.loc, this.jsonString)); | |
} | |
private function readString():JSONToken{ | |
var _local3:*; | |
var _local4:*; | |
var _local1:int = this.loc; | |
do { | |
_local1 = this.jsonString.indexOf("\"", _local1); | |
if (_local1 >= 0){ | |
_local3 = 0; | |
_local4 = (_local1 - 1); | |
while (this.jsonString.charAt(_local4) == "\\") { | |
_local3++; | |
_local4--; | |
}; | |
if ((_local3 % 2) == 0){ | |
break; | |
}; | |
_local1++; | |
} else { | |
this.parseError("Unterminated string literal"); | |
}; | |
} while (true); | |
var _local2:JSONToken = new JSONToken(); | |
_local2.type = JSONTokenType.STRING; | |
_local2.value = this.unescapeString(this.jsonString.substr(this.loc, (_local1 - this.loc))); | |
this.loc = (_local1 + 1); | |
this.nextChar(); | |
return (_local2); | |
} | |
private function nextChar():String{ | |
return ((this.ch = this.jsonString.charAt(this.loc++))); | |
} | |
private function skipIgnored():void{ | |
var _local1:int; | |
do { | |
_local1 = this.loc; | |
this.skipWhite(); | |
this.skipComments(); | |
} while (_local1 != this.loc); | |
} | |
private function isHexDigit(_arg1:String):Boolean{ | |
return (((((this.isDigit(_arg1)) || ((((_arg1 >= "A")) && ((_arg1 <= "F")))))) || ((((_arg1 >= "a")) && ((_arg1 <= "f")))))); | |
} | |
public function getNextToken():JSONToken{ | |
var _local2:String; | |
var _local3:String; | |
var _local4:String; | |
var _local5:String; | |
var _local1:JSONToken = new JSONToken(); | |
this.skipIgnored(); | |
switch (this.ch){ | |
case "{": | |
_local1.type = JSONTokenType.LEFT_BRACE; | |
_local1.value = "{"; | |
this.nextChar(); | |
break; | |
case "}": | |
_local1.type = JSONTokenType.RIGHT_BRACE; | |
_local1.value = "}"; | |
this.nextChar(); | |
break; | |
case "[": | |
_local1.type = JSONTokenType.LEFT_BRACKET; | |
_local1.value = "["; | |
this.nextChar(); | |
break; | |
case "]": | |
_local1.type = JSONTokenType.RIGHT_BRACKET; | |
_local1.value = "]"; | |
this.nextChar(); | |
break; | |
case ",": | |
_local1.type = JSONTokenType.COMMA; | |
_local1.value = ","; | |
this.nextChar(); | |
break; | |
case ":": | |
_local1.type = JSONTokenType.COLON; | |
_local1.value = ":"; | |
this.nextChar(); | |
break; | |
case "t": | |
_local2 = ((("t" + this.nextChar()) + this.nextChar()) + this.nextChar()); | |
if (_local2 == "true"){ | |
_local1.type = JSONTokenType.TRUE; | |
_local1.value = true; | |
this.nextChar(); | |
} else { | |
this.parseError(("Expecting 'true' but found " + _local2)); | |
}; | |
break; | |
case "f": | |
_local3 = (((("f" + this.nextChar()) + this.nextChar()) + this.nextChar()) + this.nextChar()); | |
if (_local3 == "false"){ | |
_local1.type = JSONTokenType.FALSE; | |
_local1.value = false; | |
this.nextChar(); | |
} else { | |
this.parseError(("Expecting 'false' but found " + _local3)); | |
}; | |
break; | |
case "n": | |
_local4 = ((("n" + this.nextChar()) + this.nextChar()) + this.nextChar()); | |
if (_local4 == "null"){ | |
_local1.type = JSONTokenType.NULL; | |
_local1.value = null; | |
this.nextChar(); | |
} else { | |
this.parseError(("Expecting 'null' but found " + _local4)); | |
}; | |
break; | |
case "N": | |
_local5 = (("N" + this.nextChar()) + this.nextChar()); | |
if (_local5 == "NaN"){ | |
_local1.type = JSONTokenType.NAN; | |
_local1.value = NaN; | |
this.nextChar(); | |
} else { | |
this.parseError(("Expecting 'NaN' but found " + _local5)); | |
}; | |
break; | |
case "\"": | |
_local1 = this.readString(); | |
break; | |
default: | |
if (((this.isDigit(this.ch)) || ((this.ch == "-")))){ | |
_local1 = this.readNumber(); | |
} else { | |
if (this.ch == ""){ | |
return (null); | |
}; | |
this.parseError((("Unexpected " + this.ch) + " encountered")); | |
}; | |
}; | |
return (_local1); | |
} | |
} | |
}//package com.adobe.serialization.json | |
package com.adobe.serialization.json { | |
public class JSONTokenType { | |
public static const FALSE:int = 8; | |
public static const RIGHT_BRACKET:int = 4; | |
public static const NULL:int = 9; | |
public static const NUMBER:int = 11; | |
public static const TRUE:int = 7; | |
public static const RIGHT_BRACE:int = 2; | |
public static const STRING:int = 10; | |
public static const LEFT_BRACKET:int = 3; | |
public static const LEFT_BRACE:int = 1; | |
public static const UNKNOWN:int = -1; | |
public static const COMMA:int = 0; | |
public static const NAN:int = 12; | |
public static const COLON:int = 6; | |
} | |
}//package com.adobe.serialization.json | |
package com.adobe.serialization.json { | |
public class JSONDecoder { | |
private var strict:Boolean; | |
private var value; | |
private var tokenizer:JSONTokenizer; | |
private var token:JSONToken; | |
public function JSONDecoder(_arg1:String, _arg2:Boolean){ | |
this.strict = _arg2; | |
this.tokenizer = new JSONTokenizer(_arg1, _arg2); | |
this.nextToken(); | |
this.value = this.parseValue(); | |
if (((_arg2) && (!((this.nextToken() == null))))){ | |
this.tokenizer.parseError("Unexpected characters left in input stream"); | |
}; | |
} | |
private function nextToken():JSONToken{ | |
return ((this.token = this.tokenizer.getNextToken())); | |
} | |
private function parseObject():Object{ | |
var _local2:String; | |
var _local1:Object = new Object(); | |
this.nextToken(); | |
if (this.token.type == JSONTokenType.RIGHT_BRACE){ | |
return (_local1); | |
}; | |
if (((!(this.strict)) && ((this.token.type == JSONTokenType.COMMA)))){ | |
this.nextToken(); | |
if (this.token.type == JSONTokenType.RIGHT_BRACE){ | |
return (_local1); | |
}; | |
this.tokenizer.parseError(("Leading commas are not supported. Expecting '}' but found " + this.token.value)); | |
}; | |
if (this.token.type == JSONTokenType.STRING){ | |
_local2 = String(this.token.value); | |
this.nextToken(); | |
if (this.token.type == JSONTokenType.COLON){ | |
this.nextToken(); | |
_local1[_local2] = this.parseValue(); | |
this.nextToken(); | |
if (this.token.type == JSONTokenType.RIGHT_BRACE){ | |
return (_local1); | |
}; | |
if (this.token.type == JSONTokenType.COMMA){ | |
this.nextToken(); | |
if (!this.strict){ | |
if (this.token.type == JSONTokenType.RIGHT_BRACE){ | |
return (_local1); | |
}; | |
}; | |
} else { | |
this.tokenizer.parseError(("Expecting } or , but found " + this.token.value)); | |
}; | |
} else { | |
this.tokenizer.parseError(("Expecting : but found " + this.token.value)); | |
}; | |
} else { | |
this.tokenizer.parseError(("Expecting string but found " + this.token.value)); | |
}; | |
//unresolved jump | |
} | |
private function parseArray():Array{ | |
var _local1:Array = new Array(); | |
this.nextToken(); | |
if (this.token.type == JSONTokenType.RIGHT_BRACKET){ | |
return (_local1); | |
}; | |
if (((!(this.strict)) && ((this.token.type == JSONTokenType.COMMA)))){ | |
this.nextToken(); | |
if (this.token.type == JSONTokenType.RIGHT_BRACKET){ | |
return (_local1); | |
}; | |
this.tokenizer.parseError(("Leading commas are not supported. Expecting ']' but found " + this.token.value)); | |
}; | |
_local1.push(this.parseValue()); | |
this.nextToken(); | |
if (this.token.type == JSONTokenType.RIGHT_BRACKET){ | |
return (_local1); | |
}; | |
if (this.token.type == JSONTokenType.COMMA){ | |
this.nextToken(); | |
if (!this.strict){ | |
if (this.token.type == JSONTokenType.RIGHT_BRACKET){ | |
return (_local1); | |
}; | |
}; | |
} else { | |
this.tokenizer.parseError(("Expecting ] or , but found " + this.token.value)); | |
}; | |
//unresolved jump | |
} | |
public function getValue(){ | |
return (this.value); | |
} | |
private function parseValue():Object{ | |
if (this.token == null){ | |
this.tokenizer.parseError("Unexpected end of input"); | |
}; | |
switch (this.token.type){ | |
case JSONTokenType.LEFT_BRACE: | |
return (this.parseObject()); | |
case JSONTokenType.LEFT_BRACKET: | |
return (this.parseArray()); | |
case JSONTokenType.STRING: | |
case JSONTokenType.NUMBER: | |
case JSONTokenType.TRUE: | |
case JSONTokenType.FALSE: | |
case JSONTokenType.NULL: | |
return (this.token.value); | |
case JSONTokenType.NAN: | |
if (!this.strict){ | |
return (this.token.value); | |
}; | |
this.tokenizer.parseError(("Unexpected " + this.token.value)); | |
default: | |
this.tokenizer.parseError(("Unexpected " + this.token.value)); | |
}; | |
return (null); | |
} | |
} | |
}//package com.adobe.serialization.json | |
package com.adobe.serialization.json { | |
public class JSON { | |
public static function decode(_arg1:String, _arg2:Boolean=true){ | |
return (new JSONDecoder(_arg1, _arg2).getValue()); | |
} | |
public static function encode(_arg1:Object):String{ | |
return (new JSONEncoder(_arg1).getString()); | |
} | |
} | |
}//package com.adobe.serialization.json | |
package com.hurlant.crypto.rsa { | |
import flash.utils.*; | |
import com.hurlant.math.*; | |
import com.hurlant.crypto.prng.*; | |
import com.hurlant.util.*; | |
public class RSAKey { | |
public var dmp1:BigInteger; | |
protected var canDecrypt:Boolean; | |
public var d:BigInteger; | |
public var e:int; | |
public var dmq1:BigInteger; | |
public var n:BigInteger; | |
public var p:BigInteger; | |
public var q:BigInteger; | |
protected var canEncrypt:Boolean; | |
public var coeff:BigInteger; | |
public function RSAKey(_arg1:BigInteger, _arg2:int, _arg3:BigInteger=null, _arg4:BigInteger=null, _arg5:BigInteger=null, _arg6:BigInteger=null, _arg7:BigInteger=null, _arg8:BigInteger=null){ | |
this.n = _arg1; | |
this.e = _arg2; | |
this.d = _arg3; | |
this.p = _arg4; | |
this.q = _arg5; | |
this.dmp1 = _arg6; | |
this.dmq1 = _arg7; | |
this.coeff = _arg8; | |
canEncrypt = ((!((n == null))) && (!((e == 0)))); | |
canDecrypt = ((canEncrypt) && (!((d == null)))); | |
} | |
protected static function bigRandom(_arg1:int, _arg2:Random):BigInteger{ | |
var _local3:ByteArray; | |
var _local4:BigInteger; | |
if (_arg1 < 2){ | |
return (BigInteger.nbv(1)); | |
}; | |
_local3 = new ByteArray(); | |
_arg2.nextBytes(_local3, (_arg1 >> 3)); | |
_local3.position = 0; | |
_local4 = new BigInteger(_local3); | |
_local4.primify(_arg1, 1); | |
return (_local4); | |
} | |
public static function parsePublicKey(_arg1:String, _arg2:String):RSAKey{ | |
return (new RSAKey(new BigInteger(_arg1, 16), parseInt(_arg2, 16))); | |
} | |
public static function generate(_arg1:uint, _arg2:String):RSAKey{ | |
var _local3:Random; | |
var _local4:uint; | |
var _local5:RSAKey; | |
var _local6:BigInteger; | |
var _local7:BigInteger; | |
var _local8:BigInteger; | |
var _local9:BigInteger; | |
var _local10:BigInteger; | |
_local3 = new Random(); | |
_local4 = (_arg1 >> 1); | |
_local5 = new RSAKey(null, 0, null); | |
_local5.e = parseInt(_arg2, 16); | |
_local6 = new BigInteger(_arg2, 16); | |
while (true) { | |
while (true) { | |
_local5.p = bigRandom((_arg1 - _local4), _local3); | |
if ((((_local5.p.subtract(BigInteger.ONE).gcd(_local6).compareTo(BigInteger.ONE) == 0)) && (_local5.p.isProbablePrime(10)))){ | |
break; | |
}; | |
}; | |
while (true) { | |
_local5.q = bigRandom(_local4, _local3); | |
if ((((_local5.q.subtract(BigInteger.ONE).gcd(_local6).compareTo(BigInteger.ONE) == 0)) && (_local5.q.isProbablePrime(10)))){ | |
break; | |
}; | |
}; | |
if (_local5.p.compareTo(_local5.q) <= 0){ | |
_local10 = _local5.p; | |
_local5.p = _local5.q; | |
_local5.q = _local10; | |
}; | |
_local7 = _local5.p.subtract(BigInteger.ONE); | |
_local8 = _local5.q.subtract(BigInteger.ONE); | |
_local9 = _local7.multiply(_local8); | |
if (_local9.gcd(_local6).compareTo(BigInteger.ONE) == 0){ | |
_local5.n = _local5.p.multiply(_local5.q); | |
_local5.d = _local6.modInverse(_local9); | |
_local5.dmp1 = _local5.d.mod(_local7); | |
_local5.dmq1 = _local5.d.mod(_local8); | |
_local5.coeff = _local5.q.modInverse(_local5.p); | |
break; | |
}; | |
}; | |
return (_local5); | |
} | |
public static function parsePrivateKey(_arg1:String, _arg2:String, _arg3:String, _arg4:String=null, _arg5:String=null, _arg6:String=null, _arg7:String=null, _arg8:String=null):RSAKey{ | |
if (_arg4 == null){ | |
return (new RSAKey(new BigInteger(_arg1, 16), parseInt(_arg2, 16), new BigInteger(_arg3, 16))); | |
}; | |
return (new RSAKey(new BigInteger(_arg1, 16), parseInt(_arg2, 16), new BigInteger(_arg3, 16), new BigInteger(_arg4, 16), new BigInteger(_arg5, 16), new BigInteger(_arg6, 16), new BigInteger(_arg7), new BigInteger(_arg8))); | |
} | |
public function verify(_arg1:ByteArray, _arg2:ByteArray, _arg3:uint, _arg4:Function=null):void{ | |
_decrypt(doPublic, _arg1, _arg2, _arg3, _arg4, 1); | |
} | |
public function dump():String{ | |
var _local1:String; | |
_local1 = ((((("N=" + n.toString(16)) + "\n") + "E=") + e.toString(16)) + "\n"); | |
if (canDecrypt){ | |
_local1 = (_local1 + (("D=" + d.toString(16)) + "\n")); | |
if (((!((p == null))) && (!((q == null))))){ | |
_local1 = (_local1 + (("P=" + p.toString(16)) + "\n")); | |
_local1 = (_local1 + (("Q=" + q.toString(16)) + "\n")); | |
_local1 = (_local1 + (("DMP1=" + dmp1.toString(16)) + "\n")); | |
_local1 = (_local1 + (("DMQ1=" + dmq1.toString(16)) + "\n")); | |
_local1 = (_local1 + (("IQMP=" + coeff.toString(16)) + "\n")); | |
}; | |
}; | |
return (_local1); | |
} | |
protected function doPrivate2(_arg1:BigInteger):BigInteger{ | |
var _local2:BigInteger; | |
var _local3:BigInteger; | |
var _local4:BigInteger; | |
if ((((p == null)) && ((q == null)))){ | |
return (_arg1.modPow(d, n)); | |
}; | |
_local2 = _arg1.mod(p).modPow(dmp1, p); | |
_local3 = _arg1.mod(q).modPow(dmq1, q); | |
while (_local2.compareTo(_local3) < 0) { | |
_local2 = _local2.add(p); | |
}; | |
_local4 = _local2.subtract(_local3).multiply(coeff).mod(p).multiply(q).add(_local3); | |
return (_local4); | |
} | |
public function decrypt(_arg1:ByteArray, _arg2:ByteArray, _arg3:uint, _arg4:Function=null):void{ | |
_decrypt(doPrivate2, _arg1, _arg2, _arg3, _arg4, 2); | |
} | |
private function _decrypt(_arg1:Function, _arg2:ByteArray, _arg3:ByteArray, _arg4:uint, _arg5:Function, _arg6:int):void{ | |
var _local7:uint; | |
var _local8:int; | |
var _local9:BigInteger; | |
var _local10:BigInteger; | |
var _local11:ByteArray; | |
if (_arg5 == null){ | |
_arg5 = pkcs1unpad; | |
}; | |
if (_arg2.position >= _arg2.length){ | |
_arg2.position = 0; | |
}; | |
_local7 = getBlockSize(); | |
_local8 = (_arg2.position + _arg4); | |
while (_arg2.position < _local8) { | |
_local9 = new BigInteger(_arg2, _arg4); | |
_local10 = _arg1(_local9); | |
_local11 = _arg5(_local10, _local7); | |
_arg3.writeBytes(_local11); | |
}; | |
} | |
protected function doPublic(_arg1:BigInteger):BigInteger{ | |
return (_arg1.modPowInt(e, n)); | |
} | |
public function dispose():void{ | |
e = 0; | |
n.dispose(); | |
n = null; | |
Memory.gc(); | |
} | |
private function _encrypt(_arg1:Function, _arg2:ByteArray, _arg3:ByteArray, _arg4:uint, _arg5:Function, _arg6:int):void{ | |
var _local7:uint; | |
var _local8:int; | |
var _local9:BigInteger; | |
var _local10:BigInteger; | |
if (_arg5 == null){ | |
_arg5 = pkcs1pad; | |
}; | |
if (_arg2.position >= _arg2.length){ | |
_arg2.position = 0; | |
}; | |
_local7 = getBlockSize(); | |
_local8 = (_arg2.position + _arg4); | |
while (_arg2.position < _local8) { | |
_local9 = new BigInteger(_arg5(_arg2, _local8, _local7, _arg6), _local7); | |
_local10 = _arg1(_local9); | |
_local10.toArray(_arg3); | |
}; | |
} | |
private function rawpad(_arg1:ByteArray, _arg2:int, _arg3:uint):ByteArray{ | |
return (_arg1); | |
} | |
public function encrypt(_arg1:ByteArray, _arg2:ByteArray, _arg3:uint, _arg4:Function=null):void{ | |
_encrypt(doPublic, _arg1, _arg2, _arg3, _arg4, 2); | |
} | |
private function pkcs1pad(_arg1:ByteArray, _arg2:int, _arg3:uint, _arg4:uint=2):ByteArray{ | |
var _local5:ByteArray; | |
var _local6:uint; | |
var _local7:int; | |
var _local8:Random; | |
var _local9:int; | |
_local5 = new ByteArray(); | |
_local6 = _arg1.position; | |
_arg2 = Math.min(_arg2, _arg1.length, ((_local6 + _arg3) - 11)); | |
_arg1.position = _arg2; | |
_local7 = (_arg2 - 1); | |
while ((((_local7 >= _local6)) && ((_arg3 > 11)))) { | |
--_arg3; | |
var _local10 = _arg3; | |
var _temp1 = _local7; | |
_local7 = (_local7 - 1); | |
_local5[_local10] = _arg1[_temp1]; | |
}; | |
--_arg3; | |
_local10 = _arg3; | |
_local5[_local10] = 0; | |
_local8 = new Random(); | |
while (_arg3 > 2) { | |
_local9 = 0; | |
while (_local9 == 0) { | |
_local9 = ((_arg4)==2) ? _local8.nextByte() : 0xFF; | |
}; | |
--_arg3; | |
var _local11 = _arg3; | |
_local5[_local11] = _local9; | |
}; | |
--_arg3; | |
_local11 = _arg3; | |
_local5[_local11] = _arg4; | |
--_arg3; | |
var _local12 = _arg3; | |
_local5[_local12] = 0; | |
return (_local5); | |
} | |
private function pkcs1unpad(_arg1:BigInteger, _arg2:uint, _arg3:uint=2):ByteArray{ | |
var _local4:ByteArray; | |
var _local5:ByteArray; | |
var _local6:int; | |
_local4 = _arg1.toByteArray(); | |
_local5 = new ByteArray(); | |
_local6 = 0; | |
while ((((_local6 < _local4.length)) && ((_local4[_local6] == 0)))) { | |
_local6++; | |
}; | |
if (((!(((_local4.length - _local6) == (_arg2 - 1)))) || ((_local4[_local6] > 2)))){ | |
trace(((("PKCS#1 unpad: i=" + _local6) + ", expected b[i]==[0,1,2], got b[i]=") + _local4[_local6].toString(16))); | |
return (null); | |
}; | |
_local6++; | |
while (_local4[_local6] != 0) { | |
++_local6; | |
if (_local6 >= _local4.length){ | |
trace((((("PKCS#1 unpad: i=" + _local6) + ", b[i-1]!=0 (=") + _local4[(_local6 - 1)].toString(16)) + ")")); | |
return (null); | |
}; | |
}; | |
while (++_local6 < _local4.length) { | |
_local5.writeByte(_local4[_local6]); | |
}; | |
_local5.position = 0; | |
return (_local5); | |
} | |
public function getBlockSize():uint{ | |
return (((n.bitLength() + 7) / 8)); | |
} | |
public function toString():String{ | |
return ("rsa"); | |
} | |
public function sign(_arg1:ByteArray, _arg2:ByteArray, _arg3:uint, _arg4:Function=null):void{ | |
_encrypt(doPrivate2, _arg1, _arg2, _arg3, _arg4, 1); | |
} | |
protected function doPrivate(_arg1:BigInteger):BigInteger{ | |
var _local2:BigInteger; | |
var _local3:BigInteger; | |
if ((((p == null)) || ((q == null)))){ | |
return (_arg1.modPow(d, n)); | |
}; | |
_local2 = _arg1.mod(p).modPow(dmp1, p); | |
_local3 = _arg1.mod(q).modPow(dmq1, q); | |
while (_local2.compareTo(_local3) < 0) { | |
_local2 = _local2.add(p); | |
}; | |
return (_local2.subtract(_local3).multiply(coeff).mod(p).multiply(q).add(_local3)); | |
} | |
} | |
}//package com.hurlant.crypto.rsa | |
package com.hurlant.crypto.hash { | |
import flash.utils.*; | |
public interface IHash { | |
function toString():String; | |
function getHashSize():uint; | |
function getInputSize():uint; | |
function hash(_arg1:ByteArray):ByteArray; | |
} | |
}//package com.hurlant.crypto.hash | |
package com.hurlant.crypto.hash { | |
import flash.utils.*; | |
public class SHABase implements IHash { | |
public function getHashSize():uint{ | |
return (0); | |
} | |
public function toString():String{ | |
return ("sha"); | |
} | |
public function getInputSize():uint{ | |
return (64); | |
} | |
public function hash(_arg1:ByteArray):ByteArray{ | |
var _local2:uint; | |
var _local3:String; | |
var _local4:uint; | |
var _local5:Array; | |
var _local6:uint; | |
var _local7:Array; | |
var _local8:ByteArray; | |
var _local9:uint; | |
_local2 = _arg1.length; | |
_local3 = _arg1.endian; | |
_arg1.endian = Endian.BIG_ENDIAN; | |
_local4 = (_local2 * 8); | |
while ((_arg1.length % 4) != 0) { | |
_arg1[_arg1.length] = 0; | |
}; | |
_arg1.position = 0; | |
_local5 = []; | |
_local6 = 0; | |
while (_local6 < _arg1.length) { | |
_local5.push(_arg1.readUnsignedInt()); | |
_local6 = (_local6 + 4); | |
}; | |
_local7 = core(_local5, _local4); | |
_local8 = new ByteArray(); | |
_local9 = (getHashSize() / 4); | |
_local6 = 0; | |
while (_local6 < _local9) { | |
_local8.writeUnsignedInt(_local7[_local6]); | |
_local6++; | |
}; | |
_arg1.length = _local2; | |
_arg1.endian = _local3; | |
return (_local8); | |
} | |
protected function core(_arg1:Array, _arg2:uint):Array{ | |
return (null); | |
} | |
} | |
}//package com.hurlant.crypto.hash | |
package com.hurlant.crypto.hash { | |
import flash.utils.*; | |
public class MD5 implements IHash { | |
public static const HASH_SIZE:int = 16; | |
private function ff(_arg1:uint, _arg2:uint, _arg3:uint, _arg4:uint, _arg5:uint, _arg6:uint, _arg7:uint):uint{ | |
return (cmn(((_arg2 & _arg3) | (~(_arg2) & _arg4)), _arg1, _arg2, _arg5, _arg6, _arg7)); | |
} | |
private function hh(_arg1:uint, _arg2:uint, _arg3:uint, _arg4:uint, _arg5:uint, _arg6:uint, _arg7:uint):uint{ | |
return (cmn(((_arg2 ^ _arg3) ^ _arg4), _arg1, _arg2, _arg5, _arg6, _arg7)); | |
} | |
private function cmn(_arg1:uint, _arg2:uint, _arg3:uint, _arg4:uint, _arg5:uint, _arg6:uint):uint{ | |
return ((rol((((_arg2 + _arg1) + _arg4) + _arg6), _arg5) + _arg3)); | |
} | |
public function getHashSize():uint{ | |
return (HASH_SIZE); | |
} | |
private function ii(_arg1:uint, _arg2:uint, _arg3:uint, _arg4:uint, _arg5:uint, _arg6:uint, _arg7:uint):uint{ | |
return (cmn((_arg3 ^ (_arg2 | ~(_arg4))), _arg1, _arg2, _arg5, _arg6, _arg7)); | |
} | |
private function rol(_arg1:uint, _arg2:uint):uint{ | |
return (((_arg1 << _arg2) | (_arg1 >>> (32 - _arg2)))); | |
} | |
public function toString():String{ | |
return ("md5"); | |
} | |
public function getInputSize():uint{ | |
return (64); | |
} | |
private function gg(_arg1:uint, _arg2:uint, _arg3:uint, _arg4:uint, _arg5:uint, _arg6:uint, _arg7:uint):uint{ | |
return (cmn(((_arg2 & _arg4) | (_arg3 & ~(_arg4))), _arg1, _arg2, _arg5, _arg6, _arg7)); | |
} | |
public function hash(_arg1:ByteArray):ByteArray{ | |
var _local2:uint; | |
var _local3:String; | |
var _local4:Array; | |
var _local5:uint; | |
var _local6:Array; | |
var _local7:ByteArray; | |
_local2 = (_arg1.length * 8); | |
_local3 = _arg1.endian; | |
while ((_arg1.length % 4) != 0) { | |
_arg1[_arg1.length] = 0; | |
}; | |
_arg1.position = 0; | |
_local4 = []; | |
_arg1.endian = Endian.LITTLE_ENDIAN; | |
_local5 = 0; | |
while (_local5 < _arg1.length) { | |
_local4.push(_arg1.readUnsignedInt()); | |
_local5 = (_local5 + 4); | |
}; | |
_local6 = core_md5(_local4, _local2); | |
_local7 = new ByteArray(); | |
_local7.endian = Endian.LITTLE_ENDIAN; | |
_local5 = 0; | |
while (_local5 < 4) { | |
_local7.writeUnsignedInt(_local6[_local5]); | |
_local5++; | |
}; | |
_arg1.length = (_local2 / 8); | |
_arg1.endian = _local3; | |
return (_local7); | |
} | |
private function core_md5(_arg1:Array, _arg2:uint):Array{ | |
var _local3:uint; | |
var _local4:uint; | |
var _local5:uint; | |
var _local6:uint; | |
var _local7:uint; | |
var _local8:uint; | |
var _local9:uint; | |
var _local10:uint; | |
var _local11:uint; | |
_arg1[(_arg2 >> 5)] = (_arg1[(_arg2 >> 5)] | (128 << (_arg2 % 32))); | |
_arg1[((((_arg2 + 64) >>> 9) << 4) + 14)] = _arg2; | |
_local3 = 1732584193; | |
_local4 = 4023233417; | |
_local5 = 2562383102; | |
_local6 = 271733878; | |
_local7 = 0; | |
while (_local7 < _arg1.length) { | |
_arg1[_local7] = ((_arg1[_local7]) || (0)); | |
_arg1[(_local7 + 1)] = ((_arg1[(_local7 + 1)]) || (0)); | |
_arg1[(_local7 + 2)] = ((_arg1[(_local7 + 2)]) || (0)); | |
_arg1[(_local7 + 3)] = ((_arg1[(_local7 + 3)]) || (0)); | |
_arg1[(_local7 + 4)] = ((_arg1[(_local7 + 4)]) || (0)); | |
_arg1[(_local7 + 5)] = ((_arg1[(_local7 + 5)]) || (0)); | |
_arg1[(_local7 + 6)] = ((_arg1[(_local7 + 6)]) || (0)); | |
_arg1[(_local7 + 7)] = ((_arg1[(_local7 + 7)]) || (0)); | |
_arg1[(_local7 + 8)] = ((_arg1[(_local7 + 8)]) || (0)); | |
_arg1[(_local7 + 9)] = ((_arg1[(_local7 + 9)]) || (0)); | |
_arg1[(_local7 + 10)] = ((_arg1[(_local7 + 10)]) || (0)); | |
_arg1[(_local7 + 11)] = ((_arg1[(_local7 + 11)]) || (0)); | |
_arg1[(_local7 + 12)] = ((_arg1[(_local7 + 12)]) || (0)); | |
_arg1[(_local7 + 13)] = ((_arg1[(_local7 + 13)]) || (0)); | |
_arg1[(_local7 + 14)] = ((_arg1[(_local7 + 14)]) || (0)); | |
_arg1[(_local7 + 15)] = ((_arg1[(_local7 + 15)]) || (0)); | |
_local8 = _local3; | |
_local9 = _local4; | |
_local10 = _local5; | |
_local11 = _local6; | |
_local3 = ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 0)], 7, 3614090360); | |
_local6 = ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 1)], 12, 3905402710); | |
_local5 = ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 2)], 17, 606105819); | |
_local4 = ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 3)], 22, 3250441966); | |
_local3 = ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 4)], 7, 4118548399); | |
_local6 = ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 5)], 12, 1200080426); | |
_local5 = ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 6)], 17, 2821735955); | |
_local4 = ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 7)], 22, 4249261313); | |
_local3 = ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 8)], 7, 1770035416); | |
_local6 = ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 9)], 12, 2336552879); | |
_local5 = ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 10)], 17, 0xFFFF5BB1); | |
_local4 = ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 11)], 22, 2304563134); | |
_local3 = ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 12)], 7, 1804603682); | |
_local6 = ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 13)], 12, 4254626195); | |
_local5 = ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 14)], 17, 2792965006); | |
_local4 = ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 15)], 22, 1236535329); | |
_local3 = gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 1)], 5, 4129170786); | |
_local6 = gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 6)], 9, 3225465664); | |
_local5 = gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 11)], 14, 643717713); | |
_local4 = gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 0)], 20, 3921069994); | |
_local3 = gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 5)], 5, 3593408605); | |
_local6 = gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 10)], 9, 38016083); | |
_local5 = gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 15)], 14, 3634488961); | |
_local4 = gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 4)], 20, 3889429448); | |
_local3 = gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 9)], 5, 568446438); | |
_local6 = gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 14)], 9, 3275163606); | |
_local5 = gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 3)], 14, 4107603335); | |
_local4 = gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 8)], 20, 1163531501); | |
_local3 = gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 13)], 5, 2850285829); | |
_local6 = gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 2)], 9, 4243563512); | |
_local5 = gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 7)], 14, 1735328473); | |
_local4 = gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 12)], 20, 2368359562); | |
_local3 = hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 5)], 4, 4294588738); | |
_local6 = hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 8)], 11, 2272392833); | |
_local5 = hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 11)], 16, 1839030562); | |
_local4 = hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 14)], 23, 4259657740); | |
_local3 = hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 1)], 4, 2763975236); | |
_local6 = hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 4)], 11, 1272893353); | |
_local5 = hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 7)], 16, 4139469664); | |
_local4 = hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 10)], 23, 3200236656); | |
_local3 = hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 13)], 4, 681279174); | |
_local6 = hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 0)], 11, 3936430074); | |
_local5 = hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 3)], 16, 3572445317); | |
_local4 = hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 6)], 23, 76029189); | |
_local3 = hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 9)], 4, 3654602809); | |
_local6 = hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 12)], 11, 3873151461); | |
_local5 = hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 15)], 16, 530742520); | |
_local4 = hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 2)], 23, 3299628645); | |
_local3 = ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 0)], 6, 4096336452); | |
_local6 = ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 7)], 10, 1126891415); | |
_local5 = ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 14)], 15, 2878612391); | |
_local4 = ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 5)], 21, 4237533241); | |
_local3 = ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 12)], 6, 1700485571); | |
_local6 = ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 3)], 10, 2399980690); | |
_local5 = ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 10)], 15, 4293915773); | |
_local4 = ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 1)], 21, 2240044497); | |
_local3 = ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 8)], 6, 1873313359); | |
_local6 = ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 15)], 10, 4264355552); | |
_local5 = ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 6)], 15, 2734768916); | |
_local4 = ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 13)], 21, 1309151649); | |
_local3 = ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 4)], 6, 4149444226); | |
_local6 = ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 11)], 10, 3174756917); | |
_local5 = ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 2)], 15, 718787259); | |
_local4 = ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 9)], 21, 3951481745); | |
_local3 = (_local3 + _local8); | |
_local4 = (_local4 + _local9); | |
_local5 = (_local5 + _local10); | |
_local6 = (_local6 + _local11); | |
_local7 = (_local7 + 16); | |
}; | |
return ([_local3, _local4, _local5, _local6]); | |
} | |
} | |
}//package com.hurlant.crypto.hash | |
package com.hurlant.crypto.hash { | |
public class SHA224 extends SHA256 { | |
public function SHA224(){ | |
h = [3238371032, 914150663, 812702999, 4144912697, 4290775857, 1750603025, 1694076839, 3204075428]; | |
} | |
override public function getHashSize():uint{ | |
return (28); | |
} | |
override public function toString():String{ | |
return ("sha224"); | |
} | |
} | |
}//package com.hurlant.crypto.hash | |
package com.hurlant.crypto.hash { | |
import flash.utils.*; | |
public class HMAC { | |
private var bits:uint; | |
private var hash:IHash; | |
public function HMAC(_arg1:IHash, _arg2:uint=0){ | |
this.hash = _arg1; | |
this.bits = _arg2; | |
} | |
public function getHashSize():uint{ | |
if (bits != 0){ | |
return ((bits / 8)); | |
}; | |
return (hash.getHashSize()); | |
} | |
public function dispose():void{ | |
hash = null; | |
bits = 0; | |
} | |
public function compute(_arg1:ByteArray, _arg2:ByteArray):ByteArray{ | |
var _local3:ByteArray; | |
var _local4:ByteArray; | |
var _local5:ByteArray; | |
var _local6:uint; | |
var _local7:ByteArray; | |
var _local8:ByteArray; | |
if (_arg1.length > hash.getInputSize()){ | |
_local3 = hash.hash(_arg1); | |
} else { | |
_local3 = new ByteArray(); | |
_local3.writeBytes(_arg1); | |
}; | |
while (_local3.length < hash.getInputSize()) { | |
_local3[_local3.length] = 0; | |
}; | |
_local4 = new ByteArray(); | |
_local5 = new ByteArray(); | |
_local6 = 0; | |
while (_local6 < _local3.length) { | |
_local4[_local6] = (_local3[_local6] ^ 54); | |
_local5[_local6] = (_local3[_local6] ^ 92); | |
_local6++; | |
}; | |
_local4.position = _local3.length; | |
_local4.writeBytes(_arg2); | |
_local7 = hash.hash(_local4); | |
_local5.position = _local3.length; | |
_local5.writeBytes(_local7); | |
_local8 = hash.hash(_local5); | |
if ((((bits > 0)) && ((bits < (8 * _local8.length))))){ | |
_local8.length = (bits / 8); | |
}; | |
return (_local8); | |
} | |
public function toString():String{ | |
return ((("hmac-" + (((bits > 0)) ? (bits + "-") : "")) + hash.toString())); | |
} | |
} | |
}//package com.hurlant.crypto.hash | |
package com.hurlant.crypto.hash { | |
public class SHA256 extends SHABase implements IHash { | |
protected static const k:Array = [1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298]; | |
protected var h:Array; | |
public function SHA256(){ | |
h = [1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225]; | |
super(); | |
} | |
protected function rrol(_arg1:uint, _arg2:uint):uint{ | |
return (((_arg1 << (32 - _arg2)) | (_arg1 >>> _arg2))); | |
} | |
override public function toString():String{ | |
return ("sha256"); | |
} | |
override public function getHashSize():uint{ | |
return (32); | |
} | |
override protected function core(_arg1:Array, _arg2:uint):Array{ | |
var _local3:Array; | |
var _local4:uint; | |
var _local5:uint; | |
var _local6:uint; | |
var _local7:uint; | |
var _local8:uint; | |
var _local9:uint; | |
var _local10:uint; | |
var _local11:uint; | |
var _local12:uint; | |
var _local13:uint; | |
var _local14:uint; | |
var _local15:uint; | |
var _local16:uint; | |
var _local17:uint; | |
var _local18:uint; | |
var _local19:uint; | |
var _local20:uint; | |
var _local21:uint; | |
var _local22:uint; | |
var _local23:uint; | |
var _local24:uint; | |
var _local25:uint; | |
_arg1[(_arg2 >> 5)] = (_arg1[(_arg2 >> 5)] | (128 << (24 - (_arg2 % 32)))); | |
_arg1[((((_arg2 + 64) >> 9) << 4) + 15)] = _arg2; | |
_local3 = []; | |
_local4 = h[0]; | |
_local5 = h[1]; | |
_local6 = h[2]; | |
_local7 = h[3]; | |
_local8 = h[4]; | |
_local9 = h[5]; | |
_local10 = h[6]; | |
_local11 = h[7]; | |
_local12 = 0; | |
while (_local12 < _arg1.length) { | |
_local13 = _local4; | |
_local14 = _local5; | |
_local15 = _local6; | |
_local16 = _local7; | |
_local17 = _local8; | |
_local18 = _local9; | |
_local19 = _local10; | |
_local20 = _local11; | |
_local21 = 0; | |
while (_local21 < 64) { | |
if (_local21 < 16){ | |
_local3[_local21] = ((_arg1[(_local12 + _local21)]) || (0)); | |
} else { | |
_local24 = ((rrol(_local3[(_local21 - 15)], 7) ^ rrol(_local3[(_local21 - 15)], 18)) ^ (_local3[(_local21 - 15)] >>> 3)); | |
_local25 = ((rrol(_local3[(_local21 - 2)], 17) ^ rrol(_local3[(_local21 - 2)], 19)) ^ (_local3[(_local21 - 2)] >>> 10)); | |
_local3[_local21] = (((_local3[(_local21 - 16)] + _local24) + _local3[(_local21 - 7)]) + _local25); | |
}; | |
_local22 = (((rrol(_local4, 2) ^ rrol(_local4, 13)) ^ rrol(_local4, 22)) + (((_local4 & _local5) ^ (_local4 & _local6)) ^ (_local5 & _local6))); | |
_local23 = ((((_local11 + ((rrol(_local8, 6) ^ rrol(_local8, 11)) ^ rrol(_local8, 25))) + ((_local8 & _local9) ^ (_local10 & ~(_local8)))) + k[_local21]) + _local3[_local21]); | |
_local11 = _local10; | |
_local10 = _local9; | |
_local9 = _local8; | |
_local8 = (_local7 + _local23); | |
_local7 = _local6; | |
_local6 = _local5; | |
_local5 = _local4; | |
_local4 = (_local23 + _local22); | |
_local21++; | |
}; | |
_local4 = (_local4 + _local13); | |
_local5 = (_local5 + _local14); | |
_local6 = (_local6 + _local15); | |
_local7 = (_local7 + _local16); | |
_local8 = (_local8 + _local17); | |
_local9 = (_local9 + _local18); | |
_local10 = (_local10 + _local19); | |
_local11 = (_local11 + _local20); | |
_local12 = (_local12 + 16); | |
}; | |
return ([_local4, _local5, _local6, _local7, _local8, _local9, _local10, _local11]); | |
} | |
} | |
}//package com.hurlant.crypto.hash | |
package com.hurlant.crypto.hash { | |
import flash.utils.*; | |
public class MD2 implements IHash { | |
public static const HASH_SIZE:int = 16; | |
private static const S:Array = [41, 46, 67, 201, 162, 216, 124, 1, 61, 54, 84, 161, 236, 240, 6, 19, 98, 167, 5, 243, 192, 199, 115, 140, 152, 147, 43, 217, 188, 76, 130, 202, 30, 155, 87, 60, 253, 212, 224, 22, 103, 66, 111, 24, 138, 23, 229, 18, 190, 78, 196, 214, 218, 158, 222, 73, 160, 251, 245, 142, 187, 47, 238, 122, 169, 104, 121, 145, 21, 178, 7, 63, 148, 194, 16, 137, 11, 34, 95, 33, 128, 127, 93, 154, 90, 144, 50, 39, 53, 62, 204, 231, 191, 247, 151, 3, 0xFF, 25, 48, 179, 72, 165, 181, 209, 215, 94, 146, 42, 172, 86, 170, 198, 79, 184, 56, 210, 150, 164, 125, 182, 118, 252, 107, 226, 156, 116, 4, 241, 69, 157, 112, 89, 100, 113, 135, 32, 134, 91, 207, 101, 230, 45, 168, 2, 27, 96, 37, 173, 174, 176, 185, 246, 28, 70, 97, 105, 52, 64, 126, 15, 85, 71, 163, 35, 221, 81, 175, 58, 195, 92, 249, 206, 186, 197, 234, 38, 44, 83, 13, 110, 133, 40, 132, 9, 211, 223, 205, 244, 65, 129, 77, 82, 106, 220, 55, 200, 108, 193, 171, 250, 36, 225, 123, 8, 12, 189, 177, 74, 120, 136, 149, 139, 227, 99, 232, 109, 233, 203, 213, 254, 59, 0, 29, 57, 242, 239, 183, 14, 102, 88, 208, 228, 166, 119, 114, 248, 235, 117, 75, 10, 49, 68, 80, 180, 143, 237, 31, 26, 219, 153, 141, 51, 159, 17, 131, 20]; | |
public function getHashSize():uint{ | |
return (HASH_SIZE); | |
} | |
public function toString():String{ | |
return ("md2"); | |
} | |
public function getInputSize():uint{ | |
return (16); | |
} | |
public function hash(_arg1:ByteArray):ByteArray{ | |
var _local2:uint; | |
var _local3:uint; | |
var _local4:uint; | |
var _local5:ByteArray; | |
var _local6:uint; | |
var _local7:ByteArray; | |
var _local8:uint; | |
var _local9:uint; | |
var _local10:uint; | |
_local2 = _arg1.length; | |
_local3 = (((16 - (_arg1.length % 16))) || (16)); | |
do { | |
_arg1[_arg1.length] = _local3; | |
} while ((_arg1.length % 16) != 0); | |
_local4 = _arg1.length; | |
_local5 = new ByteArray(); | |
_local6 = 0; | |
_local3 = 0; | |
while (_local3 < _local4) { | |
_local8 = 0; | |
while (_local8 < 16) { | |
_local6 = (_local5[_local8] = (_local5[_local8] ^ S[(_arg1[(_local3 + _local8)] ^ _local6)])); | |
_local8++; | |
}; | |
_local3 = (_local3 + 16); | |
}; | |
_arg1.position = _arg1.length; | |
_arg1.writeBytes(_local5); | |
_local4 = (_local4 + 16); | |
_local7 = new ByteArray(); | |
_local3 = 0; | |
while (_local3 < _local4) { | |
_local8 = 0; | |
while (_local8 < 16) { | |
_local7[(32 + _local8)] = ((_local7[(16 + _local8)] = _arg1[(_local3 + _local8)]) ^ _local7[_local8]); | |
_local8++; | |
}; | |
_local9 = 0; | |
_local8 = 0; | |
while (_local8 < 18) { | |
_local10 = 0; | |
while (_local10 < 48) { | |
_local9 = (_local7[_local10] ^ S[_local9]); | |
_local7[_local10] = _local9; | |
_local10++; | |
}; | |
_local9 = ((_local9 + _local8) & 0xFF); | |
_local8++; | |
}; | |
_local3 = (_local3 + 16); | |
}; | |
_local7.length = 16; | |
_arg1.length = _local2; | |
return (_local7); | |
} | |
} | |
}//package com.hurlant.crypto.hash | |
package com.hurlant.crypto.hash { | |
public class SHA1 extends SHABase implements IHash { | |
public static const HASH_SIZE:int = 20; | |
private function ft(_arg1:uint, _arg2:uint, _arg3:uint, _arg4:uint):uint{ | |
if (_arg1 < 20){ | |
return (((_arg2 & _arg3) | (~(_arg2) & _arg4))); | |
}; | |
if (_arg1 < 40){ | |
return (((_arg2 ^ _arg3) ^ _arg4)); | |
}; | |
if (_arg1 < 60){ | |
return ((((_arg2 & _arg3) | (_arg2 & _arg4)) | (_arg3 & _arg4))); | |
}; | |
return (((_arg2 ^ _arg3) ^ _arg4)); | |
} | |
private function kt(_arg1:uint):uint{ | |
return (((_arg1)<20) ? 1518500249 : ((_arg1)<40) ? 1859775393 : ((_arg1)<60) ? 2400959708 : 3395469782); | |
} | |
override public function toString():String{ | |
return ("sha1"); | |
} | |
override public function getHashSize():uint{ | |
return (HASH_SIZE); | |
} | |
private function rol(_arg1:uint, _arg2:uint):uint{ | |
return (((_arg1 << _arg2) | (_arg1 >>> (32 - _arg2)))); | |
} | |
override protected function core(_arg1:Array, _arg2:uint):Array{ | |
var _local3:Array; | |
var _local4:uint; | |
var _local5:uint; | |
var _local6:uint; | |
var _local7:uint; | |
var _local8:uint; | |
var _local9:uint; | |
var _local10:uint; | |
var _local11:uint; | |
var _local12:uint; | |
var _local13:uint; | |
var _local14:uint; | |
var _local15:uint; | |
var _local16:uint; | |
_arg1[(_arg2 >> 5)] = (_arg1[(_arg2 >> 5)] | (128 << (24 - (_arg2 % 32)))); | |
_arg1[((((_arg2 + 64) >> 9) << 4) + 15)] = _arg2; | |
_local3 = []; | |
_local4 = 1732584193; | |
_local5 = 4023233417; | |
_local6 = 2562383102; | |
_local7 = 271733878; | |
_local8 = 3285377520; | |
_local9 = 0; | |
while (_local9 < _arg1.length) { | |
_local10 = _local4; | |
_local11 = _local5; | |
_local12 = _local6; | |
_local13 = _local7; | |
_local14 = _local8; | |
_local15 = 0; | |
while (_local15 < 80) { | |
if (_local15 < 16){ | |
_local3[_local15] = ((_arg1[(_local9 + _local15)]) || (0)); | |
} else { | |
_local3[_local15] = rol((((_local3[(_local15 - 3)] ^ _local3[(_local15 - 8)]) ^ _local3[(_local15 - 14)]) ^ _local3[(_local15 - 16)]), 1); | |
}; | |
_local16 = ((((rol(_local4, 5) + ft(_local15, _local5, _local6, _local7)) + _local8) + _local3[_local15]) + kt(_local15)); | |
_local8 = _local7; | |
_local7 = _local6; | |
_local6 = rol(_local5, 30); | |
_local5 = _local4; | |
_local4 = _local16; | |
_local15++; | |
}; | |
_local4 = (_local4 + _local10); | |
_local5 = (_local5 + _local11); | |
_local6 = (_local6 + _local12); | |
_local7 = (_local7 + _local13); | |
_local8 = (_local8 + _local14); | |
_local9 = (_local9 + 16); | |
}; | |
return ([_local4, _local5, _local6, _local7, _local8]); | |
} | |
} | |
}//package com.hurlant.crypto.hash | |
package com.hurlant.crypto { | |
import flash.utils.*; | |
import com.hurlant.crypto.symmetric.*; | |
import com.hurlant.crypto.hash.*; | |
import com.hurlant.crypto.rsa.*; | |
import com.hurlant.crypto.prng.*; | |
import com.hurlant.util.*; | |
public class Crypto { | |
private var b64:Base64; | |
public static function getCipher(_arg1:String, _arg2:ByteArray, _arg3:IPad=null):ICipher{ | |
var _local4:Array; | |
var _local5:ICipher; | |
_local4 = _arg1.split("-"); | |
switch (_local4[0]){ | |
case "simple": | |
_local4.shift(); | |
_arg1 = _local4.join("-"); | |
_local5 = getCipher(_arg1, _arg2, _arg3); | |
if ((_local5 is IVMode)){ | |
return (new SimpleIVMode((_local5 as IVMode))); | |
}; | |
return (_local5); | |
case "aes": | |
case "aes128": | |
case "aes192": | |
case "aes256": | |
_local4.shift(); | |
if ((_arg2.length * 8) == _local4[0]){ | |
_local4.shift(); | |
}; | |
return (getMode(_local4[0], new AESKey(_arg2), _arg3)); | |
case "bf": | |
case "blowfish": | |
_local4.shift(); | |
return (getMode(_local4[0], new BlowFishKey(_arg2), _arg3)); | |
case "des": | |
_local4.shift(); | |
if (((!((_local4[0] == "ede"))) && (!((_local4[0] == "ede3"))))){ | |
return (getMode(_local4[0], new DESKey(_arg2), _arg3)); | |
}; | |
if (_local4.length == 1){ | |
_local4.push("ecb"); | |
}; | |
case "3des": | |
case "des3": | |
_local4.shift(); | |
return (getMode(_local4[0], new TripleDESKey(_arg2), _arg3)); | |
case "xtea": | |
_local4.shift(); | |
return (getMode(_local4[0], new XTeaKey(_arg2), _arg3)); | |
case "rc4": | |
_local4.shift(); | |
return (new ARC4(_arg2)); | |
}; | |
return (null); | |
} | |
public static function getHash(_arg1:String):IHash{ | |
switch (_arg1){ | |
case "md2": | |
return (new MD2()); | |
case "md5": | |
return (new MD5()); | |
case "sha": | |
case "sha1": | |
return (new SHA1()); | |
case "sha224": | |
return (new SHA224()); | |
case "sha256": | |
return (new SHA256()); | |
}; | |
return (null); | |
} | |
public static function getRSA(_arg1:String, _arg2:String):RSAKey{ | |
return (RSAKey.parsePublicKey(_arg2, _arg1)); | |
} | |
private static function getMode(_arg1:String, _arg2:ISymmetricKey, _arg3:IPad=null):IMode{ | |
switch (_arg1){ | |
case "ecb": | |
return (new ECBMode(_arg2, _arg3)); | |
case "cfb": | |
return (new CFBMode(_arg2, _arg3)); | |
case "cfb8": | |
return (new CFB8Mode(_arg2, _arg3)); | |
case "ofb": | |
return (new OFBMode(_arg2, _arg3)); | |
case "ctr": | |
return (new CTRMode(_arg2, _arg3)); | |
case "cbc": | |
default: | |
return (new CBCMode(_arg2, _arg3)); | |
}; | |
} | |
public static function getKeySize(_arg1:String):uint{ | |
var _local2:Array; | |
_local2 = _arg1.split("-"); | |
switch (_local2[0]){ | |
case "simple": | |
_local2.shift(); | |
return (getKeySize(_local2.join("-"))); | |
case "aes128": | |
return (16); | |
case "aes192": | |
return (24); | |
case "aes256": | |
return (32); | |
case "aes": | |
_local2.shift(); | |
return ((parseInt(_local2[0]) / 8)); | |
case "bf": | |
case "blowfish": | |
return (16); | |
case "des": | |
_local2.shift(); | |
switch (_local2[0]){ | |
case "ede": | |
return (16); | |
case "ede3": | |
return (24); | |
default: | |
return (8); | |
}; | |
case "3des": | |
case "des3": | |
return (24); | |
case "xtea": | |
return (8); | |
case "rc4": | |
if (parseInt(_local2[1]) > 0){ | |
return ((parseInt(_local2[1]) / 8)); | |
}; | |
return (16); | |
}; | |
return (0); | |
} | |
public static function getPad(_arg1:String):IPad{ | |
switch (_arg1){ | |
case "null": | |
return (new NullPad()); | |
case "pkcs5": | |
default: | |
return (new PKCS5()); | |
}; | |
} | |
public static function getHMAC(_arg1:String):HMAC{ | |
var _local2:Array; | |
var _local3:uint; | |
_local2 = _arg1.split("-"); | |
if (_local2[0] == "hmac"){ | |
_local2.shift(); | |
}; | |
_local3 = 0; | |
if (_local2.length > 1){ | |
_local3 = parseInt(_local2[1]); | |
}; | |
return (new HMAC(getHash(_local2[0]), _local3)); | |
} | |
} | |
}//package com.hurlant.crypto | |
package com.hurlant.crypto.prng { | |
import flash.utils.*; | |
public interface IPRNG { | |
function init(_arg1:ByteArray):void; | |
function next():uint; | |
function dispose():void; | |
function getPoolSize():uint; | |
function toString():String; | |
} | |
}//package com.hurlant.crypto.prng | |
package com.hurlant.crypto.prng { | |
import flash.utils.*; | |
import flash.text.*; | |
import com.hurlant.util.*; | |
import flash.system.*; | |
public class Random { | |
private var psize:int; | |
private var ready:Boolean = false; | |
private var seeded:Boolean = false; | |
private var state:IPRNG; | |
private var pool:ByteArray; | |
private var pptr:int; | |
public function Random(_arg1:Class=null){ | |
var _local2:uint; | |
ready = false; | |
seeded = false; | |
super(); | |
if (_arg1 == null){ | |
_arg1 = ARC4; | |
}; | |
state = (new (_arg1)() as IPRNG); | |
psize = state.getPoolSize(); | |
pool = new ByteArray(); | |
pptr = 0; | |
while (pptr < psize) { | |
_local2 = (65536 * Math.random()); | |
var _local3 = pptr++; | |
pool[_local3] = (_local2 >>> 8); | |
var _local4 = pptr++; | |
pool[_local4] = (_local2 & 0xFF); | |
}; | |
pptr = 0; | |
seed(); | |
} | |
public function seed(_arg1:int=0):void{ | |
if (_arg1 == 0){ | |
_arg1 = new Date().getTime(); | |
}; | |
var _local2 = pptr++; | |
pool[_local2] = (pool[_local2] ^ (_arg1 & 0xFF)); | |
var _local3 = pptr++; | |
pool[_local3] = (pool[_local3] ^ ((_arg1 >> 8) & 0xFF)); | |
var _local4 = pptr++; | |
pool[_local4] = (pool[_local4] ^ ((_arg1 >> 16) & 0xFF)); | |
var _local5 = pptr++; | |
pool[_local5] = (pool[_local5] ^ ((_arg1 >> 24) & 0xFF)); | |
pptr = (pptr % psize); | |
seeded = true; | |
} | |
public function toString():String{ | |
return (("random-" + state.toString())); | |
} | |
public function dispose():void{ | |
var _local1:uint; | |
_local1 = 0; | |
while (_local1 < pool.length) { | |
pool[_local1] = (Math.random() * 0x0100); | |
_local1++; | |
}; | |
pool.length = 0; | |
pool = null; | |
state.dispose(); | |
state = null; | |
psize = 0; | |
pptr = 0; | |
Memory.gc(); | |
} | |
public function autoSeed():void{ | |
var _local1:ByteArray; | |
var _local2:Array; | |
var _local3:Font; | |
_local1 = new ByteArray(); | |
_local1.writeUnsignedInt(System.totalMemory); | |
_local1.writeUTF(Capabilities.serverString); | |
_local1.writeUnsignedInt(getTimer()); | |
_local1.writeUnsignedInt(new Date().getTime()); | |
_local2 = Font.enumerateFonts(true); | |
for each (_local3 in _local2) { | |
_local1.writeUTF(_local3.fontName); | |
_local1.writeUTF(_local3.fontStyle); | |
_local1.writeUTF(_local3.fontType); | |
}; | |
_local1.position = 0; | |
while (_local1.bytesAvailable >= 4) { | |
seed(_local1.readUnsignedInt()); | |
}; | |
} | |
public function nextByte():int{ | |
if (!ready){ | |
if (!seeded){ | |
autoSeed(); | |
}; | |
state.init(pool); | |
pool.length = 0; | |
pptr = 0; | |
ready = true; | |
}; | |
return (state.next()); | |
} | |
public function nextBytes(_arg1:ByteArray, _arg2:int):void{ | |
while (_arg2--) { | |
_arg1.writeByte(nextByte()); | |
}; | |
} | |
} | |
}//package com.hurlant.crypto.prng | |
package com.hurlant.crypto.prng { | |
import flash.utils.*; | |
import com.hurlant.crypto.symmetric.*; | |
import com.hurlant.util.*; | |
public class ARC4 implements IPRNG, IStreamCipher { | |
private const psize:uint = 0x0100; | |
private var S:ByteArray; | |
private var i:int = 0; | |
private var j:int = 0; | |
public function ARC4(_arg1:ByteArray=null){ | |
i = 0; | |
j = 0; | |
super(); | |
S = new ByteArray(); | |
if (_arg1){ | |
init(_arg1); | |
}; | |
} | |
public function decrypt(_arg1:ByteArray):void{ | |
encrypt(_arg1); | |
} | |
public function init(_arg1:ByteArray):void{ | |
var _local2:int; | |
var _local3:int; | |
var _local4:int; | |
_local2 = 0; | |
while (_local2 < 0x0100) { | |
S[_local2] = _local2; | |
_local2++; | |
}; | |
_local3 = 0; | |
_local2 = 0; | |
while (_local2 < 0x0100) { | |
_local3 = (((_local3 + S[_local2]) + _arg1[(_local2 % _arg1.length)]) & 0xFF); | |
_local4 = S[_local2]; | |
S[_local2] = S[_local3]; | |
S[_local3] = _local4; | |
_local2++; | |
}; | |
this.i = 0; | |
this.j = 0; | |
} | |
public function dispose():void{ | |
var _local1:uint; | |
_local1 = 0; | |
if (S != null){ | |
_local1 = 0; | |
while (_local1 < S.length) { | |
S[_local1] = (Math.random() * 0x0100); | |
_local1++; | |
}; | |
S.length = 0; | |
S = null; | |
}; | |
this.i = 0; | |
this.j = 0; | |
Memory.gc(); | |
} | |
public function encrypt(_arg1:ByteArray):void{ | |
var _local2:uint; | |
_local2 = 0; | |
while (_local2 < _arg1.length) { | |
var _temp1 = _local2; | |
_local2 = (_local2 + 1); | |
var _local3 = _temp1; | |
_arg1[_local3] = (_arg1[_local3] ^ next()); | |
}; | |
} | |
public function next():uint{ | |
var _local1:int; | |
i = ((i + 1) & 0xFF); | |
j = ((j + S[i]) & 0xFF); | |
_local1 = S[i]; | |
S[i] = S[j]; | |
S[j] = _local1; | |
return (S[((_local1 + S[i]) & 0xFF)]); | |
} | |
public function getBlockSize():uint{ | |
return (1); | |
} | |
public function getPoolSize():uint{ | |
return (psize); | |
} | |
public function toString():String{ | |
return ("rc4"); | |
} | |
} | |
}//package com.hurlant.crypto.prng | |
package com.hurlant.crypto.symmetric { | |
import flash.utils.*; | |
public class CFB8Mode extends IVMode implements IMode { | |
public function CFB8Mode(_arg1:ISymmetricKey, _arg2:IPad=null){ | |
super(_arg1, null); | |
} | |
public function toString():String{ | |
return ((key.toString() + "-cfb8")); | |
} | |
public function decrypt(_arg1:ByteArray):void{ | |
var _local2:ByteArray; | |
var _local3:ByteArray; | |
var _local4:uint; | |
var _local5:uint; | |
var _local6:uint; | |
_local2 = getIV4d(); | |
_local3 = new ByteArray(); | |
_local4 = 0; | |
while (_local4 < _arg1.length) { | |
_local5 = _arg1[_local4]; | |
_local3.position = 0; | |
_local3.writeBytes(_local2); | |
key.encrypt(_local2); | |
_arg1[_local4] = (_arg1[_local4] ^ _local2[0]); | |
_local6 = 0; | |
while (_local6 < (blockSize - 1)) { | |
_local2[_local6] = _local3[(_local6 + 1)]; | |
_local6++; | |
}; | |
_local2[(blockSize - 1)] = _local5; | |
_local4++; | |
}; | |
} | |
public function encrypt(_arg1:ByteArray):void{ | |
var _local2:ByteArray; | |
var _local3:ByteArray; | |
var _local4:uint; | |
var _local5:uint; | |
_local2 = getIV4e(); | |
_local3 = new ByteArray(); | |
_local4 = 0; | |
while (_local4 < _arg1.length) { | |
_local3.position = 0; | |
_local3.writeBytes(_local2); | |
key.encrypt(_local2); | |
_arg1[_local4] = (_arg1[_local4] ^ _local2[0]); | |
_local5 = 0; | |
while (_local5 < (blockSize - 1)) { | |
_local2[_local5] = _local3[(_local5 + 1)]; | |
_local5++; | |
}; | |
_local2[(blockSize - 1)] = _arg1[_local4]; | |
_local4++; | |
}; | |
} | |
} | |
}//package com.hurlant.crypto.symmetric | |
package com.hurlant.crypto.symmetric { | |
import flash.utils.*; | |
import com.hurlant.crypto.prng.*; | |
import com.hurlant.util.*; | |
public class AESKey implements ISymmetricKey { | |
private static const _Xtime2:Array = [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, 234, 236, 238, 240, 242, 244, 246, 248, 250, 252, 254, 27, 25, 31, 29, 19, 17, 23, 21, 11, 9, 15, 13, 3, 1, 7, 5, 59, 57, 63, 61, 51, 49, 55, 53, 43, 41, 47, 45, 35, 33, 39, 37, 91, 89, 95, 93, 83, 81, 87, 85, 75, 73, 79, 77, 67, 65, 71, 69, 123, 121, 127, 125, 115, 113, 119, 117, 107, 105, 111, 109, 99, 97, 103, 101, 155, 153, 159, 157, 147, 145, 151, 149, 139, 137, 143, 141, 131, 129, 135, 133, 187, 185, 191, 189, 179, 177, 183, 181, 171, 169, 175, 173, 163, 161, 167, 165, 219, 217, 223, 221, 211, 209, 215, 213, 203, 201, 207, 205, 195, 193, 199, 197, 251, 249, 0xFF, 253, 243, 241, 247, 245, 235, 233, 239, 237, 227, 225, 231, 229]; | |
private static const _Xtime9:Array = [0, 9, 18, 27, 36, 45, 54, 63, 72, 65, 90, 83, 108, 101, 126, 119, 144, 153, 130, 139, 180, 189, 166, 175, 216, 209, 202, 195, 252, 245, 238, 231, 59, 50, 41, 32, 31, 22, 13, 4, 115, 122, 97, 104, 87, 94, 69, 76, 171, 162, 185, 176, 143, 134, 157, 148, 227, 234, 241, 248, 199, 206, 213, 220, 118, 127, 100, 109, 82, 91, 64, 73, 62, 55, 44, 37, 26, 19, 8, 1, 230, 239, 244, 253, 194, 203, 208, 217, 174, 167, 188, 181, 138, 131, 152, 145, 77, 68, 95, 86, 105, 96, 123, 114, 5, 12, 23, 30, 33, 40, 51, 58, 221, 212, 207, 198, 249, 240, 235, 226, 149, 156, 135, 142, 177, 184, 163, 170, 236, 229, 254, 247, 200, 193, 218, 211, 164, 173, 182, 191, 128, 137, 146, 155, 124, 117, 110, 103, 88, 81, 74, 67, 52, 61, 38, 47, 16, 25, 2, 11, 215, 222, 197, 204, 243, 250, 225, 232, 159, 150, 141, 132, 187, 178, 169, 160, 71, 78, 85, 92, 99, 106, 113, 120, 15, 6, 29, 20, 43, 34, 57, 48, 154, 147, 136, 129, 190, 183, 172, 165, 210, 219, 192, 201, 246, 0xFF, 228, 237, 10, 3, 24, 17, 46, 39, 60, 53, 66, 75, 80, 89, 102, 111, 116, 125, 161, 168, 179, 186, 133, 140, 151, 158, 233, 224, 251, 242, 205, 196, 223, 214, 49, 56, 35, 42, 21, 28, 7, 14, 121, 112, 107, 98, 93, 84, 79, 70]; | |
private static const Nb:uint = 4; | |
private static const _XtimeB:Array = [0, 11, 22, 29, 44, 39, 58, 49, 88, 83, 78, 69, 116, 127, 98, 105, 176, 187, 166, 173, 156, 151, 138, 129, 232, 227, 254, 245, 196, 207, 210, 217, 123, 112, 109, 102, 87, 92, 65, 74, 35, 40, 53, 62, 15, 4, 25, 18, 203, 192, 221, 214, 231, 236, 241, 250, 147, 152, 133, 142, 191, 180, 169, 162, 246, 253, 224, 235, 218, 209, 204, 199, 174, 165, 184, 179, 130, 137, 148, 159, 70, 77, 80, 91, 106, 97, 124, 119, 30, 21, 8, 3, 50, 57, 36, 47, 141, 134, 155, 144, 161, 170, 183, 188, 213, 222, 195, 200, 249, 242, 239, 228, 61, 54, 43, 32, 17, 26, 7, 12, 101, 110, 115, 120, 73, 66, 95, 84, 247, 252, 225, 234, 219, 208, 205, 198, 175, 164, 185, 178, 131, 136, 149, 158, 71, 76, 81, 90, 107, 96, 125, 118, 31, 20, 9, 2, 51, 56, 37, 46, 140, 135, 154, 145, 160, 171, 182, 189, 212, 223, 194, 201, 248, 243, 238, 229, 60, 55, 42, 33, 16, 27, 6, 13, 100, 111, 114, 121, 72, 67, 94, 85, 1, 10, 23, 28, 45, 38, 59, 48, 89, 82, 79, 68, 117, 126, 99, 104, 177, 186, 167, 172, 157, 150, 139, 128, 233, 226, 0xFF, 244, 197, 206, 211, 216, 122, 113, 108, 103, 86, 93, 64, 75, 34, 41, 52, 63, 14, 5, 24, 19, 202, 193, 220, 215, 230, 237, 240, 251, 146, 153, 132, 143, 190, 181, 168, 163]; | |
private static const _XtimeE:Array = [0, 14, 28, 18, 56, 54, 36, 42, 112, 126, 108, 98, 72, 70, 84, 90, 224, 238, 252, 242, 216, 214, 196, 202, 144, 158, 140, 130, 168, 166, 180, 186, 219, 213, 199, 201, 227, 237, 0xFF, 241, 171, 165, 183, 185, 147, 157, 143, 129, 59, 53, 39, 41, 3, 13, 31, 17, 75, 69, 87, 89, 115, 125, 111, 97, 173, 163, 177, 191, 149, 155, 137, 135, 221, 211, 193, 207, 229, 235, 249, 247, 77, 67, 81, 95, 117, 123, 105, 103, 61, 51, 33, 47, 5, 11, 25, 23, 118, 120, 106, 100, 78, 64, 82, 92, 6, 8, 26, 20, 62, 48, 34, 44, 150, 152, 138, 132, 174, 160, 178, 188, 230, 232, 250, 244, 222, 208, 194, 204, 65, 79, 93, 83, 121, 119, 101, 107, 49, 63, 45, 35, 9, 7, 21, 27, 161, 175, 189, 179, 153, 151, 133, 139, 209, 223, 205, 195, 233, 231, 245, 251, 154, 148, 134, 136, 162, 172, 190, 176, 234, 228, 246, 248, 210, 220, 206, 192, 122, 116, 102, 104, 66, 76, 94, 80, 10, 4, 22, 24, 50, 60, 46, 32, 236, 226, 240, 254, 212, 218, 200, 198, 156, 146, 128, 142, 164, 170, 184, 182, 12, 2, 16, 30, 52, 58, 40, 38, 124, 114, 96, 110, 68, 74, 88, 86, 55, 57, 43, 37, 15, 1, 19, 29, 71, 73, 91, 85, 127, 113, 99, 109, 215, 217, 203, 197, 239, 225, 243, 253, 167, 169, 187, 181, 159, 145, 131, 141]; | |
private static const _Xtime2Sbox:Array = [198, 248, 238, 246, 0xFF, 214, 222, 145, 96, 2, 206, 86, 231, 181, 77, 236, 143, 31, 137, 250, 239, 178, 142, 251, 65, 179, 95, 69, 35, 83, 228, 155, 117, 225, 61, 76, 108, 126, 245, 131, 104, 81, 209, 249, 226, 171, 98, 42, 8, 149, 70, 157, 48, 55, 10, 47, 14, 36, 27, 223, 205, 78, 127, 234, 18, 29, 88, 52, 54, 220, 180, 91, 164, 118, 183, 125, 82, 221, 94, 19, 166, 185, 0, 193, 64, 227, 121, 182, 212, 141, 103, 114, 148, 152, 176, 133, 187, 197, 79, 237, 134, 154, 102, 17, 138, 233, 4, 254, 160, 120, 37, 75, 162, 93, 128, 5, 63, 33, 112, 241, 99, 119, 175, 66, 32, 229, 253, 191, 129, 24, 38, 195, 190, 53, 136, 46, 147, 85, 252, 122, 200, 186, 50, 230, 192, 25, 158, 163, 68, 84, 59, 11, 140, 199, 107, 40, 167, 188, 22, 173, 219, 100, 116, 20, 146, 12, 72, 184, 159, 189, 67, 196, 57, 49, 211, 242, 213, 139, 110, 218, 1, 177, 156, 73, 216, 172, 243, 207, 202, 244, 71, 16, 111, 240, 74, 92, 56, 87, 115, 151, 203, 161, 232, 62, 150, 97, 13, 15, 224, 124, 113, 204, 144, 6, 247, 28, 194, 106, 174, 105, 23, 153, 58, 39, 217, 235, 43, 34, 210, 169, 7, 51, 45, 60, 21, 201, 135, 170, 80, 165, 3, 89, 9, 26, 101, 215, 132, 208, 130, 41, 90, 30, 123, 168, 109, 44]; | |
private static const _Xtime3Sbox:Array = [165, 132, 153, 141, 13, 189, 177, 84, 80, 3, 169, 125, 25, 98, 230, 154, 69, 157, 64, 135, 21, 235, 201, 11, 236, 103, 253, 234, 191, 247, 150, 91, 194, 28, 174, 106, 90, 65, 2, 79, 92, 244, 52, 8, 147, 115, 83, 63, 12, 82, 101, 94, 40, 161, 15, 181, 9, 54, 155, 61, 38, 105, 205, 159, 27, 158, 116, 46, 45, 178, 238, 251, 246, 77, 97, 206, 123, 62, 113, 151, 245, 104, 0, 44, 96, 31, 200, 237, 190, 70, 217, 75, 222, 212, 232, 74, 107, 42, 229, 22, 197, 215, 85, 148, 207, 16, 6, 129, 240, 68, 186, 227, 243, 254, 192, 138, 173, 188, 72, 4, 223, 193, 117, 99, 48, 26, 14, 109, 76, 20, 53, 47, 225, 162, 204, 57, 87, 242, 130, 71, 172, 231, 43, 149, 160, 152, 209, 127, 102, 126, 171, 131, 202, 41, 211, 60, 121, 226, 29, 118, 59, 86, 78, 30, 219, 10, 108, 228, 93, 110, 239, 166, 168, 164, 55, 139, 50, 67, 89, 183, 140, 100, 210, 224, 180, 250, 7, 37, 175, 142, 233, 24, 213, 136, 111, 114, 36, 241, 199, 81, 35, 124, 156, 33, 221, 220, 134, 133, 144, 66, 196, 170, 216, 5, 1, 18, 163, 95, 249, 208, 145, 88, 39, 185, 56, 19, 179, 51, 187, 112, 137, 167, 182, 34, 146, 32, 73, 0xFF, 120, 122, 143, 248, 128, 23, 218, 49, 198, 184, 195, 176, 119, 17, 203, 252, 214, 58]; | |
private static const _InvSbox:Array = [82, 9, 106, 213, 48, 54, 165, 56, 191, 64, 163, 158, 129, 243, 215, 251, 124, 227, 57, 130, 155, 47, 0xFF, 135, 52, 142, 67, 68, 196, 222, 233, 203, 84, 123, 148, 50, 166, 194, 35, 61, 238, 76, 149, 11, 66, 250, 195, 78, 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162, 73, 109, 139, 209, 37, 114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92, 204, 93, 101, 182, 146, 108, 112, 72, 80, 253, 237, 185, 218, 94, 21, 70, 87, 167, 141, 157, 132, 144, 216, 171, 0, 140, 188, 211, 10, 247, 228, 88, 5, 184, 179, 69, 6, 208, 44, 30, 143, 202, 63, 15, 2, 193, 175, 189, 3, 1, 19, 138, 107, 58, 145, 17, 65, 79, 103, 220, 234, 151, 242, 207, 206, 240, 180, 230, 115, 150, 172, 116, 34, 231, 173, 53, 133, 226, 249, 55, 232, 28, 117, 223, 110, 71, 241, 26, 113, 29, 41, 197, 137, 111, 183, 98, 14, 170, 24, 190, 27, 252, 86, 62, 75, 198, 210, 121, 32, 154, 219, 192, 254, 120, 205, 90, 244, 31, 221, 168, 51, 136, 7, 199, 49, 177, 18, 16, 89, 39, 128, 236, 95, 96, 81, 127, 169, 25, 181, 74, 13, 45, 229, 122, 159, 147, 201, 156, 239, 160, 224, 59, 77, 174, 42, 245, 176, 200, 235, 187, 60, 131, 83, 153, 97, 23, 43, 4, 126, 186, 119, 214, 38, 225, 105, 20, 99, 85, 33, 12, 125]; | |
private static const _XtimeD:Array = [0, 13, 26, 23, 52, 57, 46, 35, 104, 101, 114, 127, 92, 81, 70, 75, 208, 221, 202, 199, 228, 233, 254, 243, 184, 181, 162, 175, 140, 129, 150, 155, 187, 182, 161, 172, 143, 130, 149, 152, 211, 222, 201, 196, 231, 234, 253, 240, 107, 102, 113, 124, 95, 82, 69, 72, 3, 14, 25, 20, 55, 58, 45, 32, 109, 96, 119, 122, 89, 84, 67, 78, 5, 8, 31, 18, 49, 60, 43, 38, 189, 176, 167, 170, 137, 132, 147, 158, 213, 216, 207, 194, 225, 236, 251, 246, 214, 219, 204, 193, 226, 239, 248, 245, 190, 179, 164, 169, 138, 135, 144, 157, 6, 11, 28, 17, 50, 63, 40, 37, 110, 99, 116, 121, 90, 87, 64, 77, 218, 215, 192, 205, 238, 227, 244, 249, 178, 191, 168, 165, 134, 139, 156, 145, 10, 7, 16, 29, 62, 51, 36, 41, 98, 111, 120, 117, 86, 91, 76, 65, 97, 108, 123, 118, 85, 88, 79, 66, 9, 4, 19, 30, 61, 48, 39, 42, 177, 188, 171, 166, 133, 136, 159, 146, 217, 212, 195, 206, 237, 224, 247, 250, 183, 186, 173, 160, 131, 142, 153, 148, 223, 210, 197, 200, 235, 230, 241, 252, 103, 106, 125, 112, 83, 94, 73, 68, 15, 2, 21, 24, 59, 54, 33, 44, 12, 1, 22, 27, 56, 53, 34, 47, 100, 105, 126, 115, 80, 93, 74, 71, 220, 209, 198, 203, 232, 229, 242, 0xFF, 180, 185, 174, 163, 128, 141, 154, 151]; | |
private static const _Sbox:Array = [99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 0xFF, 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22]; | |
private static var XtimeE:ByteArray = new ByteArray(); | |
private static var i:uint = 0; | |
private static var Xtime2Sbox:ByteArray = new ByteArray(); | |
private static var Xtime3Sbox:ByteArray = new ByteArray(); | |
private static var _Rcon:Array = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54]; | |
private static var Sbox:ByteArray = new ByteArray(); | |
private static var Rcon:ByteArray = new ByteArray(); | |
private static var InvSbox:ByteArray = new ByteArray(); | |
private static var Xtime2:ByteArray = new ByteArray(); | |
private static var Xtime9:ByteArray = new ByteArray(); | |
private static var XtimeB:ByteArray = new ByteArray(); | |
private static var XtimeD:ByteArray = new ByteArray(); | |
private var state:ByteArray; | |
private var tmp:ByteArray; | |
private var Nr:uint; | |
private var keyLength:uint; | |
private var key:ByteArray; | |
public function AESKey(_arg1:ByteArray){ | |
tmp = new ByteArray(); | |
state = new ByteArray(); | |
keyLength = _arg1.length; | |
this.key = new ByteArray(); | |
this.key.writeBytes(_arg1); | |
expandKey(); | |
} | |
public function toString():String{ | |
return (("aes" + (8 * keyLength))); | |
} | |
public function decrypt(_arg1:ByteArray, _arg2:uint=0):void{ | |
var _local3:uint; | |
state.position = 0; | |
state.writeBytes(_arg1, _arg2, (Nb * 4)); | |
addRoundKey(key, ((Nr * Nb) * 4)); | |
invShiftRows(); | |
_local3 = Nr; | |
while (_local3--) { | |
addRoundKey(key, ((_local3 * Nb) * 4)); | |
if (_local3){ | |
invMixSubColumns(); | |
}; | |
}; | |
_arg1.position = _arg2; | |
_arg1.writeBytes(state); | |
} | |
protected function invShiftRows():void{ | |
var _local1:uint; | |
state[0] = InvSbox[state[0]]; | |
state[4] = InvSbox[state[4]]; | |
state[8] = InvSbox[state[8]]; | |
state[12] = InvSbox[state[12]]; | |
_local1 = InvSbox[state[13]]; | |
state[13] = InvSbox[state[9]]; | |
state[9] = InvSbox[state[5]]; | |
state[5] = InvSbox[state[1]]; | |
state[1] = _local1; | |
_local1 = InvSbox[state[2]]; | |
state[2] = InvSbox[state[10]]; | |
state[10] = _local1; | |
_local1 = InvSbox[state[6]]; | |
state[6] = InvSbox[state[14]]; | |
state[14] = _local1; | |
_local1 = InvSbox[state[3]]; | |
state[3] = InvSbox[state[7]]; | |
state[7] = InvSbox[state[11]]; | |
state[11] = InvSbox[state[15]]; | |
state[15] = _local1; | |
} | |
public function dispose():void{ | |
var _local1:uint; | |
var _local2:Random; | |
_local2 = new Random(); | |
_local1 = 0; | |
while (_local1 < key.length) { | |
key[_local1] = _local2.nextByte(); | |
_local1++; | |
}; | |
Nr = _local2.nextByte(); | |
_local1 = 0; | |
while (_local1 < state.length) { | |
state[_local1] = _local2.nextByte(); | |
_local1++; | |
}; | |
_local1 = 0; | |
while (_local1 < tmp.length) { | |
tmp[_local1] = _local2.nextByte(); | |
_local1++; | |
}; | |
key.length = 0; | |
keyLength = 0; | |
state.length = 0; | |
tmp.length = 0; | |
key = null; | |
state = null; | |
tmp = null; | |
Nr = 0; | |
Memory.gc(); | |
} | |
protected function invMixSubColumns():void{ | |
var _local1:uint; | |
tmp.length = 0; | |
tmp[0] = (((XtimeE[state[0]] ^ XtimeB[state[1]]) ^ XtimeD[state[2]]) ^ Xtime9[state[3]]); | |
tmp[5] = (((Xtime9[state[0]] ^ XtimeE[state[1]]) ^ XtimeB[state[2]]) ^ XtimeD[state[3]]); | |
tmp[10] = (((XtimeD[state[0]] ^ Xtime9[state[1]]) ^ XtimeE[state[2]]) ^ XtimeB[state[3]]); | |
tmp[15] = (((XtimeB[state[0]] ^ XtimeD[state[1]]) ^ Xtime9[state[2]]) ^ XtimeE[state[3]]); | |
tmp[4] = (((XtimeE[state[4]] ^ XtimeB[state[5]]) ^ XtimeD[state[6]]) ^ Xtime9[state[7]]); | |
tmp[9] = (((Xtime9[state[4]] ^ XtimeE[state[5]]) ^ XtimeB[state[6]]) ^ XtimeD[state[7]]); | |
tmp[14] = (((XtimeD[state[4]] ^ Xtime9[state[5]]) ^ XtimeE[state[6]]) ^ XtimeB[state[7]]); | |
tmp[3] = (((XtimeB[state[4]] ^ XtimeD[state[5]]) ^ Xtime9[state[6]]) ^ XtimeE[state[7]]); | |
tmp[8] = (((XtimeE[state[8]] ^ XtimeB[state[9]]) ^ XtimeD[state[10]]) ^ Xtime9[state[11]]); | |
tmp[13] = (((Xtime9[state[8]] ^ XtimeE[state[9]]) ^ XtimeB[state[10]]) ^ XtimeD[state[11]]); | |
tmp[2] = (((XtimeD[state[8]] ^ Xtime9[state[9]]) ^ XtimeE[state[10]]) ^ XtimeB[state[11]]); | |
tmp[7] = (((XtimeB[state[8]] ^ XtimeD[state[9]]) ^ Xtime9[state[10]]) ^ XtimeE[state[11]]); | |
tmp[12] = (((XtimeE[state[12]] ^ XtimeB[state[13]]) ^ XtimeD[state[14]]) ^ Xtime9[state[15]]); | |
tmp[1] = (((Xtime9[state[12]] ^ XtimeE[state[13]]) ^ XtimeB[state[14]]) ^ XtimeD[state[15]]); | |
tmp[6] = (((XtimeD[state[12]] ^ Xtime9[state[13]]) ^ XtimeE[state[14]]) ^ XtimeB[state[15]]); | |
tmp[11] = (((XtimeB[state[12]] ^ XtimeD[state[13]]) ^ Xtime9[state[14]]) ^ XtimeE[state[15]]); | |
_local1 = 0; | |
while (_local1 < (4 * Nb)) { | |
state[_local1] = InvSbox[tmp[_local1]]; | |
_local1++; | |
}; | |
} | |
private function expandKey():void{ | |
var _local1:uint; | |
var _local2:uint; | |
var _local3:uint; | |
var _local4:uint; | |
var _local5:uint; | |
var _local6:uint; | |
var _local7:uint; | |
_local7 = (key.length / 4); | |
Nr = (_local7 + 6); | |
_local6 = _local7; | |
while (_local6 < (Nb * (Nr + 1))) { | |
_local1 = key[((4 * _local6) - 4)]; | |
_local2 = key[((4 * _local6) - 3)]; | |
_local3 = key[((4 * _local6) - 2)]; | |
_local4 = key[((4 * _local6) - 1)]; | |
if (!(_local6 % _local7)){ | |
_local5 = _local4; | |
_local4 = Sbox[_local1]; | |
_local1 = (Sbox[_local2] ^ Rcon[(_local6 / _local7)]); | |
_local2 = Sbox[_local3]; | |
_local3 = Sbox[_local5]; | |
} else { | |
if ((((_local7 > 6)) && (((_local6 % _local7) == 4)))){ | |
_local1 = Sbox[_local1]; | |
_local2 = Sbox[_local2]; | |
_local3 = Sbox[_local3]; | |
_local4 = Sbox[_local4]; | |
}; | |
}; | |
key[((4 * _local6) + 0)] = (key[(((4 * _local6) - (4 * _local7)) + 0)] ^ _local1); | |
key[((4 * _local6) + 1)] = (key[(((4 * _local6) - (4 * _local7)) + 1)] ^ _local2); | |
key[((4 * _local6) + 2)] = (key[(((4 * _local6) - (4 * _local7)) + 2)] ^ _local3); | |
key[((4 * _local6) + 3)] = (key[(((4 * _local6) - (4 * _local7)) + 3)] ^ _local4); | |
_local6++; | |
}; | |
} | |
protected function addRoundKey(_arg1:ByteArray, _arg2:uint):void{ | |
var _local3:uint; | |
_local3 = 0; | |
while (_local3 < 16) { | |
state[_local3] = (state[_local3] ^ _arg1[(_local3 + _arg2)]); | |
_local3++; | |
}; | |
} | |
public function encrypt(_arg1:ByteArray, _arg2:uint=0):void{ | |
var _local3:uint; | |
state.position = 0; | |
state.writeBytes(_arg1, _arg2, (Nb * 4)); | |
addRoundKey(key, 0); | |
_local3 = 1; | |
while (_local3 < (Nr + 1)) { | |
if (_local3 < Nr){ | |
mixSubColumns(); | |
} else { | |
shiftRows(); | |
}; | |
addRoundKey(key, ((_local3 * Nb) * 4)); | |
_local3++; | |
}; | |
_arg1.position = _arg2; | |
_arg1.writeBytes(state); | |
} | |
protected function mixSubColumns():void{ | |
tmp.length = 0; | |
tmp[0] = (((Xtime2Sbox[state[0]] ^ Xtime3Sbox[state[5]]) ^ Sbox[state[10]]) ^ Sbox[state[15]]); | |
tmp[1] = (((Sbox[state[0]] ^ Xtime2Sbox[state[5]]) ^ Xtime3Sbox[state[10]]) ^ Sbox[state[15]]); | |
tmp[2] = (((Sbox[state[0]] ^ Sbox[state[5]]) ^ Xtime2Sbox[state[10]]) ^ Xtime3Sbox[state[15]]); | |
tmp[3] = (((Xtime3Sbox[state[0]] ^ Sbox[state[5]]) ^ Sbox[state[10]]) ^ Xtime2Sbox[state[15]]); | |
tmp[4] = (((Xtime2Sbox[state[4]] ^ Xtime3Sbox[state[9]]) ^ Sbox[state[14]]) ^ Sbox[state[3]]); | |
tmp[5] = (((Sbox[state[4]] ^ Xtime2Sbox[state[9]]) ^ Xtime3Sbox[state[14]]) ^ Sbox[state[3]]); | |
tmp[6] = (((Sbox[state[4]] ^ Sbox[state[9]]) ^ Xtime2Sbox[state[14]]) ^ Xtime3Sbox[state[3]]); | |
tmp[7] = (((Xtime3Sbox[state[4]] ^ Sbox[state[9]]) ^ Sbox[state[14]]) ^ Xtime2Sbox[state[3]]); | |
tmp[8] = (((Xtime2Sbox[state[8]] ^ Xtime3Sbox[state[13]]) ^ Sbox[state[2]]) ^ Sbox[state[7]]); | |
tmp[9] = (((Sbox[state[8]] ^ Xtime2Sbox[state[13]]) ^ Xtime3Sbox[state[2]]) ^ Sbox[state[7]]); | |
tmp[10] = (((Sbox[state[8]] ^ Sbox[state[13]]) ^ Xtime2Sbox[state[2]]) ^ Xtime3Sbox[state[7]]); | |
tmp[11] = (((Xtime3Sbox[state[8]] ^ Sbox[state[13]]) ^ Sbox[state[2]]) ^ Xtime2Sbox[state[7]]); | |
tmp[12] = (((Xtime2Sbox[state[12]] ^ Xtime3Sbox[state[1]]) ^ Sbox[state[6]]) ^ Sbox[state[11]]); | |
tmp[13] = (((Sbox[state[12]] ^ Xtime2Sbox[state[1]]) ^ Xtime3Sbox[state[6]]) ^ Sbox[state[11]]); | |
tmp[14] = (((Sbox[state[12]] ^ Sbox[state[1]]) ^ Xtime2Sbox[state[6]]) ^ Xtime3Sbox[state[11]]); | |
tmp[15] = (((Xtime3Sbox[state[12]] ^ Sbox[state[1]]) ^ Sbox[state[6]]) ^ Xtime2Sbox[state[11]]); | |
state.position = 0; | |
state.writeBytes(tmp, 0, (Nb * 4)); | |
} | |
protected function shiftRows():void{ | |
var _local1:uint; | |
state[0] = Sbox[state[0]]; | |
state[4] = Sbox[state[4]]; | |
state[8] = Sbox[state[8]]; | |
state[12] = Sbox[state[12]]; | |
_local1 = Sbox[state[1]]; | |
state[1] = Sbox[state[5]]; | |
state[5] = Sbox[state[9]]; | |
state[9] = Sbox[state[13]]; | |
state[13] = _local1; | |
_local1 = Sbox[state[2]]; | |
state[2] = Sbox[state[10]]; | |
state[10] = _local1; | |
_local1 = Sbox[state[6]]; | |
state[6] = Sbox[state[14]]; | |
state[14] = _local1; | |
_local1 = Sbox[state[15]]; | |
state[15] = Sbox[state[11]]; | |
state[11] = Sbox[state[7]]; | |
state[7] = Sbox[state[3]]; | |
state[3] = _local1; | |
} | |
public function getBlockSize():uint{ | |
return (16); | |
} | |
while (i < 0x0100) { | |
Sbox[i] = _Sbox[i]; | |
InvSbox[i] = _InvSbox[i]; | |
Xtime2Sbox[i] = _Xtime2Sbox[i]; | |
Xtime3Sbox[i] = _Xtime3Sbox[i]; | |
Xtime2[i] = _Xtime2[i]; | |
Xtime9[i] = _Xtime9[i]; | |
XtimeB[i] = _XtimeB[i]; | |
XtimeD[i] = _XtimeD[i]; | |
XtimeE[i] = _XtimeE[i]; | |
i++; | |
}; | |
i = 0; | |
while (i < _Rcon.length) { | |
Rcon[i] = _Rcon[i]; | |
i++; | |
}; | |
} | |
}//package com.hurlant.crypto.symmetric | |
package com.hurlant.crypto.symmetric { | |
import flash.utils.*; | |
public class NullPad implements IPad { | |
public function pad(_arg1:ByteArray):void{ | |
} | |
public function unpad(_arg1:ByteArray):void{ | |
} | |
public function setBlockSize(_arg1:uint):void{ | |
} | |
} | |
}//package com.hurlant.crypto.symmetric | |
package com.hurlant.crypto.symmetric { | |
import flash.utils.*; | |
public class CBCMode extends IVMode implements IMode { | |
public function CBCMode(_arg1:ISymmetricKey, _arg2:IPad=null){ | |
super(_arg1, _arg2); | |
} | |
public function toString():String{ | |
return ((key.toString() + "-cbc")); | |
} | |
public function decrypt(_arg1:ByteArray):void{ | |
var _local2:ByteArray; | |
var _local3:ByteArray; | |
var _local4:uint; | |
var _local5:uint; | |
_local2 = getIV4d(); | |
_local3 = new ByteArray(); | |
_local4 = 0; | |
while (_local4 < _arg1.length) { | |
_local3.position = 0; | |
_local3.writeBytes(_arg1, _local4, blockSize); | |
key.decrypt(_arg1, _local4); | |
_local5 = 0; | |
while (_local5 < blockSize) { | |
_arg1[(_local4 + _local5)] = (_arg1[(_local4 + _local5)] ^ _local2[_local5]); | |
_local5++; | |
}; | |
_local2.position = 0; | |
_local2.writeBytes(_local3, 0, blockSize); | |
_local4 = (_local4 + blockSize); | |
}; | |
padding.unpad(_arg1); | |
} | |
public function encrypt(_arg1:ByteArray):void{ | |
var _local2:ByteArray; | |
var _local3:uint; | |
var _local4:uint; | |
padding.pad(_arg1); | |
_local2 = getIV4e(); | |
_local3 = 0; | |
while (_local3 < _arg1.length) { | |
_local4 = 0; | |
while (_local4 < blockSize) { | |
_arg1[(_local3 + _local4)] = (_arg1[(_local3 + _local4)] ^ _local2[_local4]); | |
_local4++; | |
}; | |
key.encrypt(_arg1, _local3); | |
_local2.position = 0; | |
_local2.writeBytes(_arg1, _local3, blockSize); | |
_local3 = (_local3 + blockSize); | |
}; | |
} | |
} | |
}//package com.hurlant.crypto.symmetric | |
package com.hurlant.crypto.symmetric { | |
import flash.utils.*; | |
import com.hurlant.util.*; | |
public class ECBMode implements IMode, ICipher { | |
private var key:ISymmetricKey; | |
private var padding:IPad; | |
public function ECBMode(_arg1:ISymmetricKey, _arg2:IPad=null){ | |
this.key = _arg1; | |
if (_arg2 == null){ | |
_arg2 = new PKCS5(_arg1.getBlockSize()); | |
} else { | |
_arg2.setBlockSize(_arg1.getBlockSize()); | |
}; | |
this.padding = _arg2; | |
} | |
public function encrypt(_arg1:ByteArray):void{ | |
var _local2:uint; | |
var _local3:ByteArray; | |
var _local4:ByteArray; | |
var _local5:uint; | |
padding.pad(_arg1); | |
_arg1.position = 0; | |
_local2 = key.getBlockSize(); | |
_local3 = new ByteArray(); | |
_local4 = new ByteArray(); | |
_local5 = 0; | |
while (_local5 < _arg1.length) { | |
_local3.length = 0; | |
_arg1.readBytes(_local3, 0, _local2); | |
key.encrypt(_local3); | |
_local4.writeBytes(_local3); | |
_local5 = (_local5 + _local2); | |
}; | |
_arg1.length = 0; | |
_arg1.writeBytes(_local4); | |
} | |
public function decrypt(_arg1:ByteArray):void{ | |
var _local2:uint; | |
var _local3:ByteArray; | |
var _local4:ByteArray; | |
var _local5:uint; | |
_arg1.position = 0; | |
_local2 = key.getBlockSize(); | |
if ((_arg1.length % _local2) != 0){ | |
throw (new Error(("ECB mode cipher length must be a multiple of blocksize " + _local2))); | |
}; | |
_local3 = new ByteArray(); | |
_local4 = new ByteArray(); | |
_local5 = 0; | |
while (_local5 < _arg1.length) { | |
_local3.length = 0; | |
_arg1.readBytes(_local3, 0, _local2); | |
key.decrypt(_local3); | |
_local4.writeBytes(_local3); | |
_local5 = (_local5 + _local2); | |
}; | |
padding.unpad(_local4); | |
_arg1.length = 0; | |
_arg1.writeBytes(_local4); | |
} | |
public function dispose():void{ | |
key.dispose(); | |
key = null; | |
padding = null; | |
Memory.gc(); | |
} | |
public function getBlockSize():uint{ | |
return (key.getBlockSize()); | |
} | |
public function toString():String{ | |
return ((key.toString() + "-ecb")); | |
} | |
} | |
}//package com.hurlant.crypto.symmetric | |
package com.hurlant.crypto.symmetric { | |
import flash.utils.*; | |
public class OFBMode extends IVMode implements IMode { | |
public function OFBMode(_arg1:ISymmetricKey, _arg2:IPad=null){ | |
super(_arg1, null); | |
} | |
public function toString():String{ | |
return ((key.toString() + "-ofb")); | |
} | |
private function core(_arg1:ByteArray, _arg2:ByteArray):void{ | |
var _local3:uint; | |
var _local4:ByteArray; | |
var _local5:uint; | |
var _local6:uint; | |
var _local7:uint; | |
_local3 = _arg1.length; | |
_local4 = new ByteArray(); | |
_local5 = 0; | |
while (_local5 < _arg1.length) { | |
key.encrypt(_arg2); | |
_local4.position = 0; | |
_local4.writeBytes(_arg2); | |
_local6 = (((_local5 + blockSize))<_local3) ? blockSize : (_local3 - _local5); | |
_local7 = 0; | |
while (_local7 < _local6) { | |
_arg1[(_local5 + _local7)] = (_arg1[(_local5 + _local7)] ^ _arg2[_local7]); | |
_local7++; | |
}; | |
_arg2.position = 0; | |
_arg2.writeBytes(_local4); | |
_local5 = (_local5 + blockSize); | |
}; | |
} | |
public function decrypt(_arg1:ByteArray):void{ | |
var _local2:ByteArray; | |
_local2 = getIV4d(); | |
core(_arg1, _local2); | |
} | |
public function encrypt(_arg1:ByteArray):void{ | |
var _local2:ByteArray; | |
_local2 = getIV4e(); | |
core(_arg1, _local2); | |
} | |
} | |
}//package com.hurlant.crypto.symmetric | |
package com.hurlant.crypto.symmetric { | |
import flash.utils.*; | |
import com.hurlant.util.*; | |
public class SimpleIVMode implements IMode, ICipher { | |
protected var mode:IVMode; | |
protected var cipher:ICipher; | |
public function SimpleIVMode(_arg1:IVMode){ | |
this.mode = _arg1; | |
cipher = (_arg1 as ICipher); | |
} | |
public function encrypt(_arg1:ByteArray):void{ | |
var _local2:ByteArray; | |
cipher.encrypt(_arg1); | |
_local2 = new ByteArray(); | |
_local2.writeBytes(mode.IV); | |
_local2.writeBytes(_arg1); | |
_arg1.position = 0; | |
_arg1.writeBytes(_local2); | |
} | |
public function decrypt(_arg1:ByteArray):void{ | |
var _local2:ByteArray; | |
_local2 = new ByteArray(); | |
_local2.writeBytes(_arg1, 0, getBlockSize()); | |
mode.IV = _local2; | |
_local2 = new ByteArray(); | |
_local2.writeBytes(_arg1, getBlockSize()); | |
cipher.decrypt(_local2); | |
_arg1.length = 0; | |
_arg1.writeBytes(_local2); | |
} | |
public function dispose():void{ | |
mode.dispose(); | |
mode = null; | |
cipher = null; | |
Memory.gc(); | |
} | |
public function toString():String{ | |
return (("simple-" + cipher.toString())); | |
} | |
public function getBlockSize():uint{ | |
return (mode.getBlockSize()); | |
} | |
} | |
}//package com.hurlant.crypto.symmetric | |
package com.hurlant.crypto.symmetric { | |
import flash.utils.*; | |
import com.hurlant.util.*; | |
public class DESKey implements ISymmetricKey { | |
private static const SP8:Array = [0x10001040, 0x1000, 262144, 268701760, 0x10000000, 0x10001040, 64, 0x10000000, 262208, 0x10040000, 268701760, 266240, 0x10041000, 266304, 0x1000, 64, 0x10040000, 0x10000040, 0x10001000, 4160, 266240, 262208, 0x10040040, 0x10041000, 4160, 0, 0, 0x10040040, 0x10000040, 0x10001000, 266304, 262144, 266304, 262144, 0x10041000, 0x1000, 64, 0x10040040, 0x1000, 266304, 0x10001000, 64, 0x10000040, 0x10040000, 0x10040040, 0x10000000, 262144, 0x10001040, 0, 268701760, 262208, 0x10000040, 0x10040000, 0x10001000, 0x10001040, 0, 268701760, 266240, 266240, 4160, 4160, 262208, 0x10000000, 0x10041000]; | |
private static const bytebit:Array = [128, 64, 32, 16, 8, 4, 2, 1]; | |
private static const bigbyte:Array = [0x800000, 0x400000, 0x200000, 0x100000, 524288, 262144, 131072, 65536, 0x8000, 0x4000, 0x2000, 0x1000, 0x0800, 0x0400, 0x0200, 0x0100, 128, 64, 32, 16, 8, 4, 2, 1]; | |
private static const pc1:Array = [56, 48, 40, 32, 24, 16, 8, 0, 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 60, 52, 44, 36, 28, 20, 12, 4, 27, 19, 11, 3]; | |
private static const pc2:Array = [13, 16, 10, 23, 0, 4, 2, 27, 14, 5, 20, 9, 22, 18, 11, 3, 25, 7, 15, 6, 26, 19, 12, 1, 40, 51, 30, 36, 46, 54, 29, 39, 50, 44, 32, 47, 43, 48, 38, 55, 33, 52, 45, 41, 49, 35, 28, 31]; | |
private static const Df_Key:Array = [1, 35, 69, 103, 137, 171, 205, 239, 254, 220, 186, 152, 118, 84, 50, 16, 137, 171, 205, 239, 1, 35, 69, 103]; | |
private static const totrot:Array = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28]; | |
private static const SP1:Array = [16843776, 0, 65536, 16843780, 16842756, 66564, 4, 65536, 0x0400, 16843776, 16843780, 0x0400, 16778244, 16842756, 16777216, 4, 0x0404, 16778240, 16778240, 66560, 66560, 16842752, 16842752, 16778244, 65540, 16777220, 16777220, 65540, 0, 0x0404, 66564, 16777216, 65536, 16843780, 4, 16842752, 16843776, 16777216, 16777216, 0x0400, 16842756, 65536, 66560, 16777220, 0x0400, 4, 16778244, 66564, 16843780, 65540, 16842752, 16778244, 16777220, 0x0404, 66564, 16843776, 0x0404, 16778240, 16778240, 0, 65540, 66560, 0, 16842756]; | |
private static const SP2:Array = [2148565024, 0x80008000, 0x8000, 1081376, 0x100000, 32, 0x80100020, 0x80008020, 0x80000020, 2148565024, 0x80108000, 0x80000000, 0x80008000, 0x100000, 32, 0x80100020, 0x108000, 0x100020, 0x80008020, 0, 0x80000000, 0x8000, 1081376, 0x80100000, 0x100020, 0x80000020, 0, 0x108000, 32800, 0x80108000, 0x80100000, 32800, 0, 1081376, 0x80100020, 0x100000, 0x80008020, 0x80100000, 0x80108000, 0x8000, 0x80100000, 0x80008000, 32, 2148565024, 1081376, 32, 0x8000, 0x80000000, 32800, 0x80108000, 0x100000, 0x80000020, 0x100020, 0x80008020, 0x80000020, 0x100020, 0x108000, 0, 0x80008000, 32800, 0x80000000, 0x80100020, 2148565024, 0x108000]; | |
private static const SP3:Array = [520, 134349312, 0, 134348808, 134218240, 0, 131592, 134218240, 131080, 134217736, 134217736, 131072, 134349320, 131080, 134348800, 520, 134217728, 8, 134349312, 0x0200, 131584, 134348800, 134348808, 131592, 134218248, 131584, 131072, 134218248, 8, 134349320, 0x0200, 134217728, 134349312, 134217728, 131080, 520, 131072, 134349312, 134218240, 0, 0x0200, 131080, 134349320, 134218240, 134217736, 0x0200, 0, 134348808, 134218248, 131072, 134217728, 134349320, 8, 131592, 131584, 134217736, 134348800, 134218248, 520, 134348800, 131592, 8, 134348808, 131584]; | |
private static const SP4:Array = [8396801, 8321, 8321, 128, 8396928, 0x800081, 0x800001, 8193, 0, 0x802000, 0x802000, 8396929, 129, 0, 0x800080, 0x800001, 1, 0x2000, 0x800000, 8396801, 128, 0x800000, 8193, 8320, 0x800081, 1, 8320, 0x800080, 0x2000, 8396928, 8396929, 129, 0x800080, 0x800001, 0x802000, 8396929, 129, 0, 0, 0x802000, 8320, 0x800080, 0x800081, 1, 8396801, 8321, 8321, 128, 8396929, 129, 1, 0x2000, 0x800001, 8193, 8396928, 0x800081, 8193, 8320, 0x800000, 8396801, 128, 0x800000, 0x2000, 8396928]; | |
private static const SP5:Array = [0x0100, 34078976, 34078720, 0x42000100, 524288, 0x0100, 0x40000000, 34078720, 0x40080100, 524288, 33554688, 0x40080100, 0x42000100, 0x42080000, 524544, 0x40000000, 33554432, 0x40080000, 0x40080000, 0, 0x40000100, 0x42080100, 0x42080100, 33554688, 0x42080000, 0x40000100, 0, 0x42000000, 34078976, 33554432, 0x42000000, 524544, 524288, 0x42000100, 0x0100, 33554432, 0x40000000, 34078720, 0x42000100, 0x40080100, 33554688, 0x40000000, 0x42080000, 34078976, 0x40080100, 0x0100, 33554432, 0x42080000, 0x42080100, 524544, 0x42000000, 0x42080100, 34078720, 0, 0x40080000, 0x42000000, 524544, 33554688, 0x40000100, 524288, 0, 0x40080000, 34078976, 0x40000100]; | |
private static const SP6:Array = [0x20000010, 0x20400000, 0x4000, 541081616, 0x20400000, 16, 541081616, 0x400000, 0x20004000, 4210704, 0x400000, 0x20000010, 0x400010, 0x20004000, 0x20000000, 16400, 0, 0x400010, 0x20004010, 0x4000, 0x404000, 0x20004010, 16, 0x20400010, 0x20400010, 0, 4210704, 0x20404000, 16400, 0x404000, 0x20404000, 0x20000000, 0x20004000, 16, 0x20400010, 0x404000, 541081616, 0x400000, 16400, 0x20000010, 0x400000, 0x20004000, 0x20000000, 16400, 0x20000010, 541081616, 0x404000, 0x20400000, 4210704, 0x20404000, 0, 0x20400010, 16, 0x4000, 0x20400000, 4210704, 0x4000, 0x400010, 0x20004010, 0, 0x20404000, 0x20000000, 0x400010, 0x20004010]; | |
private static const SP7:Array = [0x200000, 69206018, 67110914, 0, 0x0800, 67110914, 2099202, 69208064, 69208066, 0x200000, 0, 67108866, 2, 67108864, 69206018, 2050, 67110912, 2099202, 0x200002, 67110912, 67108866, 69206016, 69208064, 0x200002, 69206016, 0x0800, 2050, 69208066, 0x200800, 2, 67108864, 0x200800, 67108864, 0x200800, 0x200000, 67110914, 67110914, 69206018, 69206018, 2, 0x200002, 67108864, 67110912, 0x200000, 69208064, 2050, 2099202, 69208064, 2050, 67108866, 69208066, 69206016, 0x200800, 0, 2, 69208066, 0, 2099202, 69206016, 0x0800, 67108866, 67110912, 0x0800, 0x200002]; | |
protected var encKey:Array; | |
protected var key:ByteArray; | |
protected var decKey:Array; | |
public function DESKey(_arg1:ByteArray){ | |
this.key = _arg1; | |
this.encKey = generateWorkingKey(true, _arg1, 0); | |
this.decKey = generateWorkingKey(false, _arg1, 0); | |
} | |
protected function generateWorkingKey(_arg1:Boolean, _arg2:ByteArray, _arg3:uint):Array{ | |
var _local4:Array; | |
var _local5:ByteArray; | |
var _local6:ByteArray; | |
var _local7:uint; | |
var _local8:uint; | |
var _local9:uint; | |
var _local10:uint; | |
var _local11:uint; | |
var _local12:uint; | |
var _local13:uint; | |
_local4 = []; | |
_local5 = new ByteArray(); | |
_local6 = new ByteArray(); | |
_local8 = 0; | |
while (_local8 < 56) { | |
_local7 = pc1[_local8]; | |
_local5[_local8] = !(((_arg2[(_arg3 + (_local7 >>> 3))] & bytebit[(_local7 & 7)]) == 0)); | |
_local8++; | |
}; | |
_local9 = 0; | |
while (_local9 < 16) { | |
if (_arg1){ | |
_local10 = (_local9 << 1); | |
} else { | |
_local10 = ((15 - _local9) << 1); | |
}; | |
_local11 = (_local10 + 1); | |
_local4[_local10] = (_local4[_local11] = 0); | |
_local8 = 0; | |
while (_local8 < 28) { | |
_local7 = (_local8 + totrot[_local9]); | |
if (_local7 < 28){ | |
_local6[_local8] = _local5[_local7]; | |
} else { | |
_local6[_local8] = _local5[(_local7 - 28)]; | |
}; | |
_local8++; | |
}; | |
_local8 = 28; | |
while (_local8 < 56) { | |
_local7 = (_local8 + totrot[_local9]); | |
if (_local7 < 56){ | |
_local6[_local8] = _local5[_local7]; | |
} else { | |
_local6[_local8] = _local5[(_local7 - 28)]; | |
}; | |
_local8++; | |
}; | |
_local8 = 0; | |
while (_local8 < 24) { | |
if (_local6[pc2[_local8]]){ | |
_local4[_local10] = (_local4[_local10] | bigbyte[_local8]); | |
}; | |
if (_local6[pc2[(_local8 + 24)]]){ | |
_local4[_local11] = (_local4[_local11] | bigbyte[_local8]); | |
}; | |
_local8++; | |
}; | |
_local9++; | |
}; | |
_local9 = 0; | |
while (_local9 != 32) { | |
_local12 = _local4[_local9]; | |
_local13 = _local4[(_local9 + 1)]; | |
_local4[_local9] = (((((_local12 & 0xFC0000) << 6) | ((_local12 & 4032) << 10)) | ((_local13 & 0xFC0000) >>> 10)) | ((_local13 & 4032) >>> 6)); | |
_local4[(_local9 + 1)] = (((((_local12 & 258048) << 12) | ((_local12 & 63) << 16)) | ((_local13 & 258048) >>> 4)) | (_local13 & 63)); | |
_local9 = (_local9 + 2); | |
}; | |
return (_local4); | |
} | |
public function encrypt(_arg1:ByteArray, _arg2:uint=0):void{ | |
desFunc(encKey, _arg1, _arg2, _arg1, _arg2); | |
} | |
public function decrypt(_arg1:ByteArray, _arg2:uint=0):void{ | |
desFunc(decKey, _arg1, _arg2, _arg1, _arg2); | |
} | |
public function dispose():void{ | |
var _local1:uint; | |
_local1 = 0; | |
_local1 = 0; | |
while (_local1 < encKey.length) { | |
encKey[_local1] = 0; | |
_local1++; | |
}; | |
_local1 = 0; | |
while (_local1 < decKey.length) { | |
decKey[_local1] = 0; | |
_local1++; | |
}; | |
encKey = null; | |
decKey = null; | |
_local1 = 0; | |
while (_local1 < key.length) { | |
key[_local1] = 0; | |
_local1++; | |
}; | |
key.length = 0; | |
key = null; | |
Memory.gc(); | |
} | |
protected function desFunc(_arg1:Array, _arg2:ByteArray, _arg3:uint, _arg4:ByteArray, _arg5:uint):void{ | |
var _local6:uint; | |
var _local7:uint; | |
var _local8:uint; | |
var _local9:uint; | |
var _local10:uint; | |
_local8 = ((_arg2[(_arg3 + 0)] & 0xFF) << 24); | |
_local8 = (_local8 | ((_arg2[(_arg3 + 1)] & 0xFF) << 16)); | |
_local8 = (_local8 | ((_arg2[(_arg3 + 2)] & 0xFF) << 8)); | |
_local8 = (_local8 | (_arg2[(_arg3 + 3)] & 0xFF)); | |
_local7 = ((_arg2[(_arg3 + 4)] & 0xFF) << 24); | |
_local7 = (_local7 | ((_arg2[(_arg3 + 5)] & 0xFF) << 16)); | |
_local7 = (_local7 | ((_arg2[(_arg3 + 6)] & 0xFF) << 8)); | |
_local7 = (_local7 | (_arg2[(_arg3 + 7)] & 0xFF)); | |
_local6 = (((_local8 >>> 4) ^ _local7) & 252645135); | |
_local7 = (_local7 ^ _local6); | |
_local8 = (_local8 ^ (_local6 << 4)); | |
_local6 = (((_local8 >>> 16) ^ _local7) & 0xFFFF); | |
_local7 = (_local7 ^ _local6); | |
_local8 = (_local8 ^ (_local6 << 16)); | |
_local6 = (((_local7 >>> 2) ^ _local8) & 0x33333333); | |
_local8 = (_local8 ^ _local6); | |
_local7 = (_local7 ^ (_local6 << 2)); | |
_local6 = (((_local7 >>> 8) ^ _local8) & 0xFF00FF); | |
_local8 = (_local8 ^ _local6); | |
_local7 = (_local7 ^ (_local6 << 8)); | |
_local7 = (((_local7 << 1) | ((_local7 >>> 31) & 1)) & 0xFFFFFFFF); | |
_local6 = ((_local8 ^ _local7) & 0xAAAAAAAA); | |
_local8 = (_local8 ^ _local6); | |
_local7 = (_local7 ^ _local6); | |
_local8 = (((_local8 << 1) | ((_local8 >>> 31) & 1)) & 0xFFFFFFFF); | |
_local9 = 0; | |
while (_local9 < 8) { | |
_local6 = ((_local7 << 28) | (_local7 >>> 4)); | |
_local6 = (_local6 ^ _arg1[((_local9 * 4) + 0)]); | |
_local10 = SP7[(_local6 & 63)]; | |
_local10 = (_local10 | SP5[((_local6 >>> 8) & 63)]); | |
_local10 = (_local10 | SP3[((_local6 >>> 16) & 63)]); | |
_local10 = (_local10 | SP1[((_local6 >>> 24) & 63)]); | |
_local6 = (_local7 ^ _arg1[((_local9 * 4) + 1)]); | |
_local10 = (_local10 | SP8[(_local6 & 63)]); | |
_local10 = (_local10 | SP6[((_local6 >>> 8) & 63)]); | |
_local10 = (_local10 | SP4[((_local6 >>> 16) & 63)]); | |
_local10 = (_local10 | SP2[((_local6 >>> 24) & 63)]); | |
_local8 = (_local8 ^ _local10); | |
_local6 = ((_local8 << 28) | (_local8 >>> 4)); | |
_local6 = (_local6 ^ _arg1[((_local9 * 4) + 2)]); | |
_local10 = SP7[(_local6 & 63)]; | |
_local10 = (_local10 | SP5[((_local6 >>> 8) & 63)]); | |
_local10 = (_local10 | SP3[((_local6 >>> 16) & 63)]); | |
_local10 = (_local10 | SP1[((_local6 >>> 24) & 63)]); | |
_local6 = (_local8 ^ _arg1[((_local9 * 4) + 3)]); | |
_local10 = (_local10 | SP8[(_local6 & 63)]); | |
_local10 = (_local10 | SP6[((_local6 >>> 8) & 63)]); | |
_local10 = (_local10 | SP4[((_local6 >>> 16) & 63)]); | |
_local10 = (_local10 | SP2[((_local6 >>> 24) & 63)]); | |
_local7 = (_local7 ^ _local10); | |
_local9++; | |
}; | |
_local7 = ((_local7 << 31) | (_local7 >>> 1)); | |
_local6 = ((_local8 ^ _local7) & 0xAAAAAAAA); | |
_local8 = (_local8 ^ _local6); | |
_local7 = (_local7 ^ _local6); | |
_local8 = ((_local8 << 31) | (_local8 >>> 1)); | |
_local6 = (((_local8 >>> 8) ^ _local7) & 0xFF00FF); | |
_local7 = (_local7 ^ _local6); | |
_local8 = (_local8 ^ (_local6 << 8)); | |
_local6 = (((_local8 >>> 2) ^ _local7) & 0x33333333); | |
_local7 = (_local7 ^ _local6); | |
_local8 = (_local8 ^ (_local6 << 2)); | |
_local6 = (((_local7 >>> 16) ^ _local8) & 0xFFFF); | |
_local8 = (_local8 ^ _local6); | |
_local7 = (_local7 ^ (_local6 << 16)); | |
_local6 = (((_local7 >>> 4) ^ _local8) & 252645135); | |
_local8 = (_local8 ^ _local6); | |
_local7 = (_local7 ^ (_local6 << 4)); | |
_arg4[(_arg5 + 0)] = ((_local7 >>> 24) & 0xFF); | |
_arg4[(_arg5 + 1)] = ((_local7 >>> 16) & 0xFF); | |
_arg4[(_arg5 + 2)] = ((_local7 >>> 8) & 0xFF); | |
_arg4[(_arg5 + 3)] = (_local7 & 0xFF); | |
_arg4[(_arg5 + 4)] = ((_local8 >>> 24) & 0xFF); | |
_arg4[(_arg5 + 5)] = ((_local8 >>> 16) & 0xFF); | |
_arg4[(_arg5 + 6)] = ((_local8 >>> 8) & 0xFF); | |
_arg4[(_arg5 + 7)] = (_local8 & 0xFF); | |
} | |
public function toString():String{ | |
return ("des"); | |
} | |
public function getBlockSize():uint{ | |
return (8); | |
} | |
} | |
}//package com.hurlant.crypto.symmetric | |
package com.hurlant.crypto.symmetric { | |
import flash.utils.*; | |
public class CTRMode extends IVMode implements IMode { | |
public function CTRMode(_arg1:ISymmetricKey, _arg2:IPad=null){ | |
super(_arg1, _arg2); | |
} | |
public function toString():String{ | |
return ((key.toString() + "-ctr")); | |
} | |
private function core(_arg1:ByteArray, _arg2:ByteArray):void{ | |
var _local3:ByteArray; | |
var _local4:ByteArray; | |
var _local5:uint; | |
var _local6:uint; | |
_local3 = new ByteArray(); | |
_local4 = new ByteArray(); | |
_local3.writeBytes(_arg2); | |
_local5 = 0; | |
while (_local5 < _arg1.length) { | |
_local4.position = 0; | |
_local4.writeBytes(_local3); | |
key.encrypt(_local4); | |
_local6 = 0; | |
while (_local6 < blockSize) { | |
_arg1[(_local5 + _local6)] = (_arg1[(_local5 + _local6)] ^ _local4[_local6]); | |
_local6++; | |
}; | |
_local6 = (blockSize - 1); | |
while (_local6 >= 0) { | |
var _local7 = _local3; | |
var _local8 = _local6; | |
var _local9 = (_local7[_local8] + 1); | |
_local7[_local8] = _local9; | |
if (_local3[_local6] != 0){ | |
break; | |
}; | |
_local6--; | |
}; | |
_local5 = (_local5 + blockSize); | |
}; | |
} | |
public function decrypt(_arg1:ByteArray):void{ | |
var _local2:ByteArray; | |
_local2 = getIV4d(); | |
core(_arg1, _local2); | |
padding.unpad(_arg1); | |
} | |
public function encrypt(_arg1:ByteArray):void{ | |
var _local2:ByteArray; | |
padding.pad(_arg1); | |
_local2 = getIV4e(); | |
core(_arg1, _local2); | |
} | |
} | |
}//package com.hurlant.crypto.symmetric | |
package com.hurlant.crypto.symmetric { | |
import flash.utils.*; | |
import com.hurlant.util.*; | |
public class TripleDESKey extends DESKey { | |
protected var decKey2:Array; | |
protected var decKey3:Array; | |
protected var encKey2:Array; | |
protected var encKey3:Array; | |
public function TripleDESKey(_arg1:ByteArray){ | |
super(_arg1); | |
encKey2 = generateWorkingKey(false, _arg1, 8); | |
decKey2 = generateWorkingKey(true, _arg1, 8); | |
if (_arg1.length > 16){ | |
encKey3 = generateWorkingKey(true, _arg1, 16); | |
decKey3 = generateWorkingKey(false, _arg1, 16); | |
} else { | |
encKey3 = encKey; | |
decKey3 = decKey; | |
}; | |
} | |
override public function decrypt(_arg1:ByteArray, _arg2:uint=0):void{ | |
desFunc(decKey3, _arg1, _arg2, _arg1, _arg2); | |
desFunc(decKey2, _arg1, _arg2, _arg1, _arg2); | |
desFunc(decKey, _arg1, _arg2, _arg1, _arg2); | |
} | |
override public function encrypt(_arg1:ByteArray, _arg2:uint=0):void{ | |
desFunc(encKey, _arg1, _arg2, _arg1, _arg2); | |
desFunc(encKey2, _arg1, _arg2, _arg1, _arg2); | |
desFunc(encKey3, _arg1, _arg2, _arg1, _arg2); | |
} | |
override public function dispose():void{ | |
var _local1:uint; | |
super.dispose(); | |
_local1 = 0; | |
if (encKey2 != null){ | |
_local1 = 0; | |
while (_local1 < encKey2.length) { | |
encKey2[_local1] = 0; | |
_local1++; | |
}; | |
encKey2 = null; | |
}; | |
if (encKey3 != null){ | |
_local1 = 0; | |
while (_local1 < encKey3.length) { | |
encKey3[_local1] = 0; | |
_local1++; | |
}; | |
encKey3 = null; | |
}; | |
if (decKey2 != null){ | |
_local1 = 0; | |
while (_local1 < decKey2.length) { | |
decKey2[_local1] = 0; | |
_local1++; | |
}; | |
decKey2 = null; | |
}; | |
if (decKey3 != null){ | |
_local1 = 0; | |
while (_local1 < decKey3.length) { | |
decKey3[_local1] = 0; | |
_local1++; | |
}; | |
decKey3 = null; | |
}; | |
Memory.gc(); | |
} | |
override public function toString():String{ | |
return ("3des"); | |
} | |
} | |
}//package com.hurlant.crypto.symmetric | |
package com.hurlant.crypto.symmetric { | |
import flash.utils.*; | |
public class CFBMode extends IVMode implements IMode { | |
public function CFBMode(_arg1:ISymmetricKey, _arg2:IPad=null){ | |
super(_arg1, null); | |
} | |
public function toString():String{ | |
return ((key.toString() + "-cfb")); | |
} | |
public function decrypt(_arg1:ByteArray):void{ | |
var _local2:uint; | |
var _local3:ByteArray; | |
var _local4:ByteArray; | |
var _local5:uint; | |
var _local6:uint; | |
var _local7:uint; | |
_local2 = _arg1.length; | |
_local3 = getIV4d(); | |
_local4 = new ByteArray(); | |
_local5 = 0; | |
while (_local5 < _arg1.length) { | |
key.encrypt(_local3); | |
_local6 = (((_local5 + blockSize))<_local2) ? blockSize : (_local2 - _local5); | |
_local4.position = 0; | |
_local4.writeBytes(_arg1, _local5, _local6); | |
_local7 = 0; | |
while (_local7 < _local6) { | |
_arg1[(_local5 + _local7)] = (_arg1[(_local5 + _local7)] ^ _local3[_local7]); | |
_local7++; | |
}; | |
_local3.position = 0; | |
_local3.writeBytes(_local4); | |
_local5 = (_local5 + blockSize); | |
}; | |
} | |
public function encrypt(_arg1:ByteArray):void{ | |
var _local2:uint; | |
var _local3:ByteArray; | |
var _local4:uint; | |
var _local5:uint; | |
var _local6:uint; | |
_local2 = _arg1.length; | |
_local3 = getIV4e(); | |
_local4 = 0; | |
while (_local4 < _arg1.length) { | |
key.encrypt(_local3); | |
_local5 = (((_local4 + blockSize))<_local2) ? blockSize : (_local2 - _local4); | |
_local6 = 0; | |
while (_local6 < _local5) { | |
_arg1[(_local4 + _local6)] = (_arg1[(_local4 + _local6)] ^ _local3[_local6]); | |
_local6++; | |
}; | |
_local3.position = 0; | |
_local3.writeBytes(_arg1, _local4, _local5); | |
_local4 = (_local4 + blockSize); | |
}; | |
} | |
} | |
}//package com.hurlant.crypto.symmetric | |
package com.hurlant.crypto.symmetric { | |
import flash.utils.*; | |
import com.hurlant.crypto.prng.*; | |
import com.hurlant.util.*; | |
public class XTeaKey implements ISymmetricKey { | |
public const NUM_ROUNDS:uint = 64; | |
private var k:Array; | |
public function XTeaKey(_arg1:ByteArray){ | |
_arg1.position = 0; | |
k = [_arg1.readUnsignedInt(), _arg1.readUnsignedInt(), _arg1.readUnsignedInt(), _arg1.readUnsignedInt()]; | |
} | |
public static function parseKey(_arg1:String):XTeaKey{ | |
var _local2:ByteArray; | |
_local2 = new ByteArray(); | |
_local2.writeUnsignedInt(parseInt(_arg1.substr(0, 8), 16)); | |
_local2.writeUnsignedInt(parseInt(_arg1.substr(8, 8), 16)); | |
_local2.writeUnsignedInt(parseInt(_arg1.substr(16, 8), 16)); | |
_local2.writeUnsignedInt(parseInt(_arg1.substr(24, 8), 16)); | |
_local2.position = 0; | |
return (new XTeaKey(_local2)); | |
} | |
public function dispose():void{ | |
var _local1:Random; | |
var _local2:uint; | |
_local1 = new Random(); | |
_local2 = 0; | |
while (_local2 < k.length) { | |
k[_local2] = _local1.nextByte(); | |
delete k[_local2]; | |
_local2++; | |
}; | |
k = null; | |
Memory.gc(); | |
} | |
public function encrypt(_arg1:ByteArray, _arg2:uint=0):void{ | |
var _local3:uint; | |
var _local4:uint; | |
var _local5:uint; | |
var _local6:uint; | |
var _local7:uint; | |
_arg1.position = _arg2; | |
_local3 = _arg1.readUnsignedInt(); | |
_local4 = _arg1.readUnsignedInt(); | |
_local6 = 0; | |
_local7 = 2654435769; | |
_local5 = 0; | |
while (_local5 < NUM_ROUNDS) { | |
_local3 = (_local3 + ((((_local4 << 4) ^ (_local4 >> 5)) + _local4) ^ (_local6 + k[(_local6 & 3)]))); | |
_local6 = (_local6 + _local7); | |
_local4 = (_local4 + ((((_local3 << 4) ^ (_local3 >> 5)) + _local3) ^ (_local6 + k[((_local6 >> 11) & 3)]))); | |
_local5++; | |
}; | |
_arg1.position = (_arg1.position - 8); | |
_arg1.writeUnsignedInt(_local3); | |
_arg1.writeUnsignedInt(_local4); | |
} | |
public function decrypt(_arg1:ByteArray, _arg2:uint=0):void{ | |
var _local3:uint; | |
var _local4:uint; | |
var _local5:uint; | |
var _local6:uint; | |
var _local7:uint; | |
_arg1.position = _arg2; | |
_local3 = _arg1.readUnsignedInt(); | |
_local4 = _arg1.readUnsignedInt(); | |
_local6 = 2654435769; | |
_local7 = (_local6 * NUM_ROUNDS); | |
_local5 = 0; | |
while (_local5 < NUM_ROUNDS) { | |
_local4 = (_local4 - ((((_local3 << 4) ^ (_local3 >> 5)) + _local3) ^ (_local7 + k[((_local7 >> 11) & 3)]))); | |
_local7 = (_local7 - _local6); | |
_local3 = (_local3 - ((((_local4 << 4) ^ (_local4 >> 5)) + _local4) ^ (_local7 + k[(_local7 & 3)]))); | |
_local5++; | |
}; | |
_arg1.position = (_arg1.position - 8); | |
_arg1.writeUnsignedInt(_local3); | |
_arg1.writeUnsignedInt(_local4); | |
} | |
public function toString():String{ | |
return ("xtea"); | |
} | |
public function getBlockSize():uint{ | |
return (8); | |
} | |
} | |
}//package com.hurlant.crypto.symmetric | |
package com.hurlant.crypto.symmetric { | |
import flash.utils.*; | |
public interface ISymmetricKey { | |
function encrypt(_arg1:ByteArray, _arg2:uint=0):void; | |
function dispose():void; | |
function getBlockSize():uint; | |
function toString():String; | |
function decrypt(_arg1:ByteArray, _arg2:uint=0):void; | |
} | |
}//package com.hurlant.crypto.symmetric | |
package com.hurlant.crypto.symmetric { | |
import flash.utils.*; | |
public interface IPad { | |
function pad(_arg1:ByteArray):void; | |
function unpad(_arg1:ByteArray):void; | |
function setBlockSize(_arg1:uint):void; | |
} | |
}//package com.hurlant.crypto.symmetric | |
package com.hurlant.crypto.symmetric { | |
import flash.utils.*; | |
import com.hurlant.crypto.prng.*; | |
import com.hurlant.util.*; | |
public class IVMode { | |
protected var lastIV:ByteArray; | |
protected var iv:ByteArray; | |
protected var blockSize:uint; | |
protected var padding:IPad; | |
protected var prng:Random; | |
protected var key:ISymmetricKey; | |
public function IVMode(_arg1:ISymmetricKey, _arg2:IPad=null){ | |
this.key = _arg1; | |
blockSize = _arg1.getBlockSize(); | |
if (_arg2 == null){ | |
_arg2 = new PKCS5(blockSize); | |
} else { | |
_arg2.setBlockSize(blockSize); | |
}; | |
this.padding = _arg2; | |
prng = new Random(); | |
iv = null; | |
lastIV = new ByteArray(); | |
} | |
public function set IV(_arg1:ByteArray):void{ | |
iv = _arg1; | |
lastIV.length = 0; | |
lastIV.writeBytes(iv); | |
} | |
protected function getIV4d():ByteArray{ | |
var _local1:ByteArray; | |
_local1 = new ByteArray(); | |
if (iv){ | |
_local1.writeBytes(iv); | |
} else { | |
throw (new Error("an IV must be set before calling decrypt()")); | |
}; | |
return (_local1); | |
} | |
protected function getIV4e():ByteArray{ | |
var _local1:ByteArray; | |
_local1 = new ByteArray(); | |
if (iv){ | |
_local1.writeBytes(iv); | |
} else { | |
prng.nextBytes(_local1, blockSize); | |
}; | |
lastIV.length = 0; | |
lastIV.writeBytes(_local1); | |
return (_local1); | |
} | |
public function get IV():ByteArray{ | |
return (lastIV); | |
} | |
public function dispose():void{ | |
var _local1:uint; | |
if (iv != null){ | |
_local1 = 0; | |
while (_local1 < iv.length) { | |
iv[_local1] = prng.nextByte(); | |
_local1++; | |
}; | |
iv.length = 0; | |
iv = null; | |
}; | |
if (lastIV != null){ | |
_local1 = 0; | |
while (_local1 < iv.length) { | |
lastIV[_local1] = prng.nextByte(); | |
_local1++; | |
}; | |
lastIV.length = 0; | |
lastIV = null; | |
}; | |
key.dispose(); | |
key = null; | |
padding = null; | |
prng.dispose(); | |
prng = null; | |
Memory.gc(); | |
} | |
public function getBlockSize():uint{ | |
return (key.getBlockSize()); | |
} | |
} | |
}//package com.hurlant.crypto.symmetric | |
package com.hurlant.crypto.symmetric { | |
public interface IMode extends ICipher { | |
} | |
}//package com.hurlant.crypto.symmetric | |
package com.hurlant.crypto.symmetric { | |
import flash.utils.*; | |
public interface ICipher { | |
function encrypt(_arg1:ByteArray):void; | |
function dispose():void; | |
function getBlockSize():uint; | |
function toString():String; | |
function decrypt(_arg1:ByteArray):void; | |
} | |
}//package com.hurlant.crypto.symmetric | |
package com.hurlant.crypto.symmetric { | |
import flash.utils.*; | |
public class PKCS5 implements IPad { | |
private var blockSize:uint; | |
public function PKCS5(_arg1:uint=0){ | |
this.blockSize = _arg1; | |
} | |
public function unpad(_arg1:ByteArray):void{ | |
var _local2:uint; | |
var _local3:uint; | |
var _local4:uint; | |
_local2 = (_arg1.length % blockSize); | |
if (_local2 != 0){ | |
throw (new Error("PKCS#5::unpad: ByteArray.length isn't a multiple of the blockSize")); | |
}; | |
_local2 = _arg1[(_arg1.length - 1)]; | |
_local3 = _local2; | |
while (_local3 > 0) { | |
_local4 = _arg1[(_arg1.length - 1)]; | |
_arg1.length--; | |
if (_local2 != _local4){ | |
throw (new Error((((("PKCS#5:unpad: Invalid padding value. expected [" + _local2) + "], found [") + _local4) + "]"))); | |
}; | |
_local3--; | |
}; | |
} | |
public function pad(_arg1:ByteArray):void{ | |
var _local2:uint; | |
var _local3:uint; | |
_local2 = (blockSize - (_arg1.length % blockSize)); | |
_local3 = 0; | |
while (_local3 < _local2) { | |
_arg1[_arg1.length] = _local2; | |
_local3++; | |
}; | |
} | |
public function setBlockSize(_arg1:uint):void{ | |
blockSize = _arg1; | |
} | |
} | |
}//package com.hurlant.crypto.symmetric | |
package com.hurlant.crypto.symmetric { | |
public interface IStreamCipher extends ICipher { | |
} | |
}//package com.hurlant.crypto.symmetric | |
package com.hurlant.crypto.symmetric { | |
import flash.utils.*; | |
import com.hurlant.util.*; | |
public class BlowFishKey implements ISymmetricKey { | |
private static const KP:Array = [608135816, 2242054355, 320440878, 57701188, 2752067618, 698298832, 137296536, 3964562569, 1160258022, 953160567, 3193202383, 887688300, 3232508343, 3380367581, 1065670069, 3041331479, 2450970073, 2306472731]; | |
private static const KS0:Array = [3509652390, 2564797868, 805139163, 3491422135, 3101798381, 1780907670, 3128725573, 4046225305, 614570311, 3012652279, 134345442, 2240740374, 1667834072, 1901547113, 2757295779, 4103290238, 227898511, 1921955416, 1904987480, 2182433518, 2069144605, 3260701109, 2620446009, 720527379, 3318853667, 677414384, 3393288472, 3101374703, 2390351024, 1614419982, 1822297739, 2954791486, 3608508353, 3174124327, 2024746970, 1432378464, 3864339955, 2857741204, 1464375394, 1676153920, 1439316330, 715854006, 3033291828, 289532110, 2706671279, 2087905683, 3018724369, 1668267050, 732546397, 1947742710, 3462151702, 2609353502, 2950085171, 1814351708, 2050118529, 680887927, 999245976, 1800124847, 3300911131, 1713906067, 1641548236, 4213287313, 1216130144, 1575780402, 4018429277, 3917837745, 3693486850, 3949271944, 596196993, 3549867205, 258830323, 2213823033, 772490370, 2760122372, 1774776394, 2652871518, 566650946, 4142492826, 1728879713, 2882767088, 1783734482, 3629395816, 2517608232, 2874225571, 1861159788, 326777828, 3124490320, 2130389656, 2716951837, 967770486, 1724537150, 2185432712, 2364442137, 1164943284, 2105845187, 998989502, 3765401048, 2244026483, 1075463327, 1455516326, 1322494562, 910128902, 469688178, 1117454909, 936433444, 3490320968, 3675253459, 1240580251, 122909385, 2157517691, 634681816, 4142456567, 3825094682, 3061402683, 2540495037, 79693498, 3249098678, 1084186820, 1583128258, 426386531, 1761308591, 1047286709, 322548459, 995290223, 1845252383, 2603652396, 3431023940, 2942221577, 3202600964, 3727903485, 1712269319, 422464435, 3234572375, 1170764815, 3523960633, 3117677531, 1434042557, 442511882, 0xD6A100C6, 1076654713, 1738483198, 4213154764, 2393238008, 3677496056, 1014306527, 4251020053, 793779912, 2902807211, 842905082, 4246964064, 1395751752, 0x3E00DF82, 2656851899, 3396308128, 445077038, 3742853595, 3577915638, 679411651, 2892444358, 2354009459, 1767581616, 3150600392, 3791627101, 3102740896, 284835224, 4246832056, 1258075500, 768725851, 2589189241, 3069724005, 3532540348, 1274779536, 3789419226, 2764799539, 1660621633, 3471099624, 4011903706, 913787905, 3497959166, 737222580, 2514213453, 2928710040, 3937242737, 1804850592, 3499020752, 2949064160, 2386320175, 2390070455, 2415321851, 4061277028, 0x8888B812, 2416832540, 1336762016, 1754252060, 3520065937, 3014181293, 791618072, 3188594551, 3933548030, 2332172193, 3852520463, 3043980520, 413987798, 3465142937, 3030929376, 4245938359, 2093235073, 3534596313, 375366246, 2157278981, 2479649556, 555357303, 3870105701, 2008414854, 3344188149, 4221384143, 3956125452, 2067696032, 3594591187, 2921233993, 2428461, 544322398, 0x226800BB, 1471733935, 610547355, 4027169054, 1432588573, 1507829418, 2025931657, 3646575487, 545086370, 48609733, 2200306550, 1653985193, 298326376, 1316178497, 3007786442, 2064951626, 0x1B510052, 2589141269, 3591329599, 3164325604, 727753846, 0x81E67400, 146436021, 1461446943, 4069977195, 705550613, 3059967265, 3887724982, 4281599278, 3313849956, 1404054877, 2845806497, 146425753, 1854211946]; | |
private static const KS1:Array = [1266315497, 3048417604, 3681880366, 3289982499, 2909710000, 1235738493, 2632868024, 2414719590, 3970600049, 1771706367, 1449415276, 3266420449, 422970021, 1963543593, 2690192192, 3826793022, 1062508698, 1531092325, 1804592342, 2583117782, 2714934279, 4024971509, 1294809318, 4028980673, 1289560198, 2221992742, 1669523910, 35572830, 157838143, 1052438473, 1016535060, 1802137761, 1753167236, 1386275462, 3080475397, 2857371447, 1040679964, 2145300060, 2390574316, 1461121720, 2956646967, 4031777805, 4028374788, 33600511, 2920084762, 1018524850, 629373528, 3691585981, 3515945977, 2091462646, 2486323059, 586499841, 988145025, 935516892, 3367335476, 2599673255, 2839830854, 265290510, 3972581182, 2759138881, 3795373465, 1005194799, 847297441, 406762289, 1314163512, 1332590856, 1866599683, 4127851711, 750260880, 613907577, 1450815602, 3165620655, 3734664991, 3650291728, 3012275730, 3704569646, 1427272223, 778793252, 1343938022, 2676280711, 2052605720, 1946737175, 3164576444, 3914038668, 3967478842, 3682934266, 1661551462, 3294938066, 4011595847, 840292616, 3712170807, 616741398, 312560963, 711312465, 0x50940002, 322626781, 1910503582, 271666773, 2175563734, 1594956187, 70604529, 3617834859, 1007753275, 1495573769, 4069517037, 2549218298, 2663038764, 504708206, 2263041392, 3941167025, 2249088522, 1514023603, 1998579484, 1312622330, 694541497, 2582060303, 2151582166, 1382467621, 776784248, 2618340202, 3323268794, 2497899128, 2784771155, 503983604, 4076293799, 907881277, 423175695, 432175456, 1378068232, 4145222326, 3954048622, 3938656102, 3820766613, 2793130115, 2977904593, 26017576, 3274890735, 3194772133, 1700274565, 1756076034, 4006520079, 3677328699, 720338349, 1533947780, 354530856, 688349552, 3973924725, 1637815568, 332179504, 3949051286, 53804574, 2852348879, 3044236432, 1282449977, 3583942155, 3416972820, 4006381244, 1617046695, 2628476075, 3002303598, 1686838959, 431878346, 2686675385, 1700445008, 1080580658, 1009431731, 832498133, 3223435511, 2605976345, 2271191193, 2516031870, 1648197032, 4164389018, 2548247927, 300782431, 375919233, 238389289, 3353747414, 2531188641, 2019080857, 1475708069, 455242339, 2609103871, 448939670, 3451063019, 1395535956, 2413381860, 1841049896, 1491858159, 885456874, 4264095073, 4001119347, 1565136089, 3898914787, 1108368660, 540939232, 1173283510, 2745871338, 3681308437, 4207628240, 3343053890, 4016749493, 1699691293, 1103962373, 3625875870, 2256883143, 3830138730, 1031889488, 3479347698, 1535977030, 4236805024, 3251091107, 2132092099, 1774941330, 1199868427, 1452454533, 157007616, 2904115357, 342012276, 0x23820E00, 1480756522, 206960106, 497939518, 591360097, 863170706, 2375253569, 3596610801, 1814182875, 2094937945, 3421402208, 1082520231, 3463918190, 2785509508, 435703966, 3908032597, 1641649973, 2842273706, 3305899714, 1510255612, 2148256476, 2655287854, 3276092548, 4258621189, 236887753, 3681803219, 274041037, 1734335097, 3815195456, 3317970021, 1899903192, 1026095262, 4050517792, 356393447, 2410691914, 3873677099, 3682840055]; | |
private static const KS3:Array = [976866871, 3556439503, 2881648439, 1522871579, 1555064734, 1336096578, 3548522304, 2579274686, 3574697629, 3205460757, 3593280638, 0xC700C47B, 3079412587, 564236357, 2993598910, 1781952180, 1464380207, 3163844217, 3332601554, 1699332808, 1393555694, 1183702653, 3581086237, 1288719814, 691649499, 2847557200, 2895455976, 3193889540, 2717570544, 1781354906, 1676643554, 2592534050, 3230253752, 1126444790, 2770207658, 2633158820, 2210423226, 2615765581, 2414155088, 3127139286, 673620729, 2805611233, 1269405062, 4015350505, 3341807571, 4149409754, 1057255273, 2012875353, 2162469141, 2276492801, 2601117357, 993977747, 3918593370, 2654263191, 753973209, 36408145, 2530585658, 25011837, 3520020182, 2088578344, 530523599, 2918365339, 1524020338, 1518925132, 3760827505, 3759777254, 1202760957, 3985898139, 3906192525, 674977740, 4174734889, 2031300136, 2019492241, 3983892565, 4153806404, 3822280332, 352677332, 2297720250, 60907813, 90501309, 3286998549, 1016092578, 2535922412, 2839152426, 457141659, 509813237, 4120667899, 652014361, 1966332200, 2975202805, 55981186, 2327461051, 676427537, 3255491064, 2882294119, 3433927263, 1307055953, 942726286, 933058658, 2468411793, 3933900994, 4215176142, 1361170020, 2001714738, 2830558078, 3274259782, 1222529897, 1679025792, 2729314320, 3714953764, 1770335741, 151462246, 3013232138, 1682292957, 1483529935, 471910574, 1539241949, 458788160, 3436315007, 1807016891, 3718408830, 978976581, 1043663428, 3165965781, 1927990952, 4200891579, 2372276910, 3208408903, 3533431907, 1412390302, 2931980059, 4132332400, 1947078029, 3881505623, 4168226417, 2941484381, 1077988104, 1320477388, 886195818, 18198404, 3786409000, 2509781533, 112762804, 3463356488, 1866414978, 891333506, 18488651, 661792760, 1628790961, 3885187036, 3141171499, 876946877, 2693282273, 1372485963, 791857591, 2686433993, 3759982718, 3167212022, 3472953795, 2716379847, 445679433, 3561995674, 3504004811, 3574258232, 54117162, 3331405415, 2381918588, 3769707343, 4154350007, 1140177722, 4074052095, 668550556, 3214352940, 367459370, 261225585, 2610173221, 4209349473, 3468074219, 3265815641, 314222801, 3066103646, 3808782860, 282218597, 3406013506, 3773591054, 379116347, 1285071038, 846784868, 2669647154, 3771962079, 3550491691, 2305946142, 453669953, 1268987020, 3317592352, 3279303384, 3744833421, 2610507566, 3859509063, 266596637, 3847019092, 517658769, 3462560207, 3443424879, 370717030, 4247526661, 2224018117, 4143653529, 4112773975, 2788324899, 2477274417, 1456262402, 2901442914, 1517677493, 1846949527, 2295493580, 3734397586, 2176403920, 1280348187, 1908823572, 3871786941, 846861322, 1172426758, 3287448474, 3383383037, 0x62A80F00, 3139813346, 901632758, 1897031941, 2986607138, 3066810236, 3447102507, 1393639104, 373351379, 950779232, 625454576, 3124240540, 4148612726, 2007998917, 544563296, 2244738638, 2330496472, 2058025392, 1291430526, 424198748, 50039436, 29584100, 3605783033, 2429876329, 2791104160, 1057563949, 3255363231, 3075367218, 3463963227, 1469046755, 985887462]; | |
private static const ROUNDS:uint = 16; | |
private static const KS2:Array = [3913112168, 2491498743, 4132185628, 2489919796, 1091903735, 1979897079, 3170134830, 0xD4A20068, 3557303409, 857797738, 1136121015, 0x500061AF, 507115054, 2535736646, 337727348, 3213592640, 1301675037, 2528481711, 1895095763, 1721773893, 3216771564, 62756741, 2142006736, 835421444, 2531993523, 1442658625, 3659876326, 2882144922, 676362277, 1392781812, 170690266, 3921047035, 1759253602, 0xD7486900, 1745797284, 664899054, 1329594018, 3901205900, 3045908486, 2062866102, 2865634940, 3543621612, 3464012697, 1080764994, 553557557, 3656615353, 3996768171, 991055499, 499776247, 1265440854, 648242737, 3940784050, 980351604, 3713745714, 1749149687, 3396870395, 4211799374, 3640570775, 1161844396, 3125318951, 1431517754, 545492359, 4268468663, 3499529547, 1437099964, 2702547544, 3433638243, 2581715763, 2787789398, 1060185593, 1593081372, 2418618748, 4260947970, 69676912, 2159744348, 86519011, 2512459080, 3838209314, 1220612927, 3339683548, 133810670, 1090789135, 1078426020, 1569222167, 845107691, 3583754449, 4072456591, 1091646820, 628848692, 1613405280, 3757631651, 526609435, 236106946, 48312990, 2942717905, 3402727701, 1797494240, 859738849, 992217954, 4005476642, 2243076622, 3870952857, 3732016268, 765654824, 3490871365, 2511836413, 1685915746, 3888969200, 1414112111, 2273134842, 3281911079, 4080962846, 172450625, 2569994100, 980381355, 4109958455, 2819808352, 2716589560, 2568741196, 3681446669, 3329971472, 1835478071, 660984891, 3704678404, 4045999559, 0xCC00FFA3, 3040415634, 1762651403, 1719377915, 3470491036, 2693910283, 3642056355, 3138596744, 1364962596, 2073328063, 1983633131, 926494387, 3423689081, 2150032023, 4096667949, 1749200295, 3328846651, 309677260, 2016342300, 1779581495, 3079819751, 111262694, 1274766160, 443224088, 298511866, 1025883608, 3806446537, 1145181785, 168956806, 3641502830, 3584813610, 1689216846, 3666258015, 3200248200, 1692713982, 2646376535, 4042768518, 1618508792, 1610833997, 3523052358, 4130873264, 2001055236, 3610705100, 2202168115, 4028541809, 2961195399, 0x3C005E5F, 2006996926, 3186142756, 1430667929, 3210227297, 1314452623, 4074634658, 4101304120, 2273951170, 1399257539, 3367210612, 3027628629, 1190975929, 2062231137, 2333990788, 2221543033, 2438960610, 1181637006, 548689776, 2362791313, 3372408396, 3104550113, 3145860560, 296247880, 1970579870, 3078560182, 3769228297, 1714227617, 3291629107, 3898220290, 166772364, 1251581989, 493813264, 448347421, 195405023, 2709975567, 677966185, 3703036547, 1463355134, 2715995803, 1338867538, 1343315457, 2802222074, 2684532164, 233230375, 2599980071, 2000651841, 3277868038, 1638401717, 4028070440, 3237316320, 6314154, 819756386, 300326615, 590932579, 1405279636, 3267499572, 3150704214, 2428286686, 3959192993, 3461946742, 1862657033, 1266418056, 963775037, 2089974820, 2263052895, 1917689273, 448879540, 3550394620, 3981727096, 150775221, 3627908307, 1303187396, 508620638, 2975983352, 2726630617, 1817252668, 1876281319, 1457606340, 908771278, 3720792119, 3617206836, 2455994898, 1729034894, 0x406000E0]; | |
private static const BLOCK_SIZE:uint = 8; | |
private static const P_SZ:uint = (ROUNDS + 2); | |
private static const SBOX_SK:uint = 0x0100; | |
private var S3:Array; | |
private var S2:Array; | |
private var P:Array; | |
private var key:ByteArray = null; | |
private var S0:Array; | |
private var S1:Array; | |
public function BlowFishKey(_arg1:ByteArray){ | |
key = null; | |
super(); | |
this.key = _arg1; | |
setKey(_arg1); | |
} | |
private function F(_arg1:uint):uint{ | |
return ((((S0[(_arg1 >>> 24)] + S1[((_arg1 >>> 16) & 0xFF)]) ^ S2[((_arg1 >>> 8) & 0xFF)]) + S3[(_arg1 & 0xFF)])); | |
} | |
private function BytesTo32bits(_arg1:ByteArray, _arg2:uint):uint{ | |
return ((((((_arg1[_arg2] & 0xFF) << 24) | ((_arg1[(_arg2 + 1)] & 0xFF) << 16)) | ((_arg1[(_arg2 + 2)] & 0xFF) << 8)) | (_arg1[(_arg2 + 3)] & 0xFF))); | |
} | |
public function decrypt(_arg1:ByteArray, _arg2:uint=0):void{ | |
decryptBlock(_arg1, _arg2, _arg1, _arg2); | |
} | |
private function decryptBlock(_arg1:ByteArray, _arg2:uint, _arg3:ByteArray, _arg4:uint):void{ | |
var _local5:uint; | |
var _local6:uint; | |
var _local7:uint; | |
_local5 = BytesTo32bits(_arg1, _arg2); | |
_local6 = BytesTo32bits(_arg1, (_arg2 + 4)); | |
_local5 = (_local5 ^ P[(ROUNDS + 1)]); | |
_local7 = ROUNDS; | |
while (_local7 > 0) { | |
_local6 = (_local6 ^ (F(_local5) ^ P[_local7])); | |
_local5 = (_local5 ^ (F(_local6) ^ P[(_local7 - 1)])); | |
_local7 = (_local7 - 2); | |
}; | |
_local6 = (_local6 ^ P[0]); | |
Bits32ToBytes(_local6, _arg3, _arg4); | |
Bits32ToBytes(_local5, _arg3, (_arg4 + 4)); | |
} | |
private function setKey(_arg1:ByteArray):void{ | |
var _local2:uint; | |
var _local3:uint; | |
var _local4:uint; | |
var _local5:uint; | |
var _local6:uint; | |
S0 = KS0.concat(); | |
S1 = KS1.concat(); | |
S2 = KS2.concat(); | |
S3 = KS3.concat(); | |
P = KP.concat(); | |
_local2 = _arg1.length; | |
_local3 = 0; | |
_local4 = 0; | |
while (_local4 < P_SZ) { | |
_local5 = 0; | |
_local6 = 0; | |
while (_local6 < 4) { | |
var _temp1 = _local3; | |
_local3 = (_local3 + 1); | |
_local5 = ((_local5 << 8) | (_arg1[_temp1] & 0xFF)); | |
if (_local3 >= _local2){ | |
_local3 = 0; | |
}; | |
_local6++; | |
}; | |
P[_local4] = (P[_local4] ^ _local5); | |
_local4++; | |
}; | |
processTable(0, 0, P); | |
processTable(P[(P_SZ - 2)], P[(P_SZ - 1)], S0); | |
processTable(S0[(SBOX_SK - 2)], S0[(SBOX_SK - 1)], S1); | |
processTable(S1[(SBOX_SK - 2)], S1[(SBOX_SK - 1)], S2); | |
processTable(S2[(SBOX_SK - 2)], S2[(SBOX_SK - 1)], S3); | |
} | |
public function dispose():void{ | |
var _local1:uint; | |
_local1 = 0; | |
_local1 = 0; | |
while (_local1 < S0.length) { | |
S0[_local1] = 0; | |
_local1++; | |
}; | |
_local1 = 0; | |
while (_local1 < S1.length) { | |
S1[_local1] = 0; | |
_local1++; | |
}; | |
_local1 = 0; | |
while (_local1 < S2.length) { | |
S2[_local1] = 0; | |
_local1++; | |
}; | |
_local1 = 0; | |
while (_local1 < S3.length) { | |
S3[_local1] = 0; | |
_local1++; | |
}; | |
_local1 = 0; | |
while (_local1 < P.length) { | |
P[_local1] = 0; | |
_local1++; | |
}; | |
S0 = null; | |
S1 = null; | |
S2 = null; | |
S3 = null; | |
P = null; | |
_local1 = 0; | |
while (_local1 < key.length) { | |
key[_local1] = 0; | |
_local1++; | |
}; | |
key.length = 0; | |
key = null; | |
Memory.gc(); | |
} | |
private function encryptBlock(_arg1:ByteArray, _arg2:uint, _arg3:ByteArray, _arg4:uint):void{ | |
var _local5:uint; | |
var _local6:uint; | |
var _local7:uint; | |
_local5 = BytesTo32bits(_arg1, _arg2); | |
_local6 = BytesTo32bits(_arg1, (_arg2 + 4)); | |
_local5 = (_local5 ^ P[0]); | |
_local7 = 1; | |
while (_local7 < ROUNDS) { | |
_local6 = (_local6 ^ (F(_local5) ^ P[_local7])); | |
_local5 = (_local5 ^ (F(_local6) ^ P[(_local7 + 1)])); | |
_local7 = (_local7 + 2); | |
}; | |
_local6 = (_local6 ^ P[(ROUNDS + 1)]); | |
Bits32ToBytes(_local6, _arg3, _arg4); | |
Bits32ToBytes(_local5, _arg3, (_arg4 + 4)); | |
} | |
public function encrypt(_arg1:ByteArray, _arg2:uint=0):void{ | |
encryptBlock(_arg1, _arg2, _arg1, _arg2); | |
} | |
private function Bits32ToBytes(_arg1:uint, _arg2:ByteArray, _arg3:uint):void{ | |
_arg2[(_arg3 + 3)] = _arg1; | |
_arg2[(_arg3 + 2)] = (_arg1 >> 8); | |
_arg2[(_arg3 + 1)] = (_arg1 >> 16); | |
_arg2[_arg3] = (_arg1 >> 24); | |
} | |
private function processTable(_arg1:uint, _arg2:uint, _arg3:Array):void{ | |
var _local4:uint; | |
var _local5:uint; | |
var _local6:uint; | |
_local4 = _arg3.length; | |
_local5 = 0; | |
while (_local5 < _local4) { | |
_arg1 = (_arg1 ^ P[0]); | |
_local6 = 1; | |
while (_local6 < ROUNDS) { | |
_arg2 = (_arg2 ^ (F(_arg1) ^ P[_local6])); | |
_arg1 = (_arg1 ^ (F(_arg2) ^ P[(_local6 + 1)])); | |
_local6 = (_local6 + 2); | |
}; | |
_arg2 = (_arg2 ^ P[(ROUNDS + 1)]); | |
_arg3[_local5] = _arg2; | |
_arg3[(_local5 + 1)] = _arg1; | |
_arg2 = _arg1; | |
_arg1 = _arg3[_local5]; | |
_local5 = (_local5 + 2); | |
}; | |
} | |
public function toString():String{ | |
return ("blowfish"); | |
} | |
public function getBlockSize():uint{ | |
return (BLOCK_SIZE); | |
} | |
} | |
}//package com.hurlant.crypto.symmetric | |
package com.hurlant.util { | |
import flash.utils.*; | |
public class Hex { | |
public static function fromString(_arg1:String, _arg2:Boolean=false):String{ | |
var _local3:ByteArray; | |
_local3 = new ByteArray(); | |
_local3.writeUTFBytes(_arg1); | |
return (fromArray(_local3, _arg2)); | |
} | |
public static function toString(_arg1:String):String{ | |
var _local2:ByteArray; | |
_local2 = toArray(_arg1); | |
return (_local2.readUTFBytes(_local2.length)); | |
} | |
public static function toArray(_arg1:String):ByteArray{ | |
var _local2:ByteArray; | |
var _local3:uint; | |
_arg1 = _arg1.replace(/\s|:/gm, ""); | |
_local2 = new ByteArray(); | |
if ((_arg1.length & (1 == 1))){ | |
_arg1 = ("0" + _arg1); | |
}; | |
_local3 = 0; | |
while (_local3 < _arg1.length) { | |
_local2[(_local3 / 2)] = parseInt(_arg1.substr(_local3, 2), 16); | |
_local3 = (_local3 + 2); | |
}; | |
return (_local2); | |
} | |
public static function fromArray(_arg1:ByteArray, _arg2:Boolean=false):String{ | |
var _local3:String; | |
var _local4:uint; | |
_local3 = ""; | |
_local4 = 0; | |
while (_local4 < _arg1.length) { | |
_local3 = (_local3 + ("0" + _arg1[_local4].toString(16)).substr(-2, 2)); | |
if (_arg2){ | |
if (_local4 < (_arg1.length - 1)){ | |
_local3 = (_local3 + ":"); | |
}; | |
}; | |
_local4++; | |
}; | |
return (_local3); | |
} | |
} | |
}//package com.hurlant.util | |
package com.hurlant.util { | |
import flash.net.*; | |
import flash.system.*; | |
public class Memory { | |
public static function gc():void{ | |
try { | |
new LocalConnection().connect("foo"); | |
new LocalConnection().connect("foo"); | |
} catch(e) { | |
}; | |
} | |
public static function get used():uint{ | |
return (System.totalMemory); | |
} | |
} | |
}//package com.hurlant.util | |
package com.hurlant.util { | |
import flash.utils.*; | |
public class Base64 { | |
public static const version:String = "1.0.0"; | |
private static const BASE64_CHARS:String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; | |
public function Base64(){ | |
throw (new Error("Base64 class is static container only")); | |
} | |
public static function encode(_arg1:String):String{ | |
var _local2:ByteArray; | |
_local2 = new ByteArray(); | |
_local2.writeUTFBytes(_arg1); | |
return (encodeByteArray(_local2)); | |
} | |
public static function encodeByteArray(_arg1:ByteArray):String{ | |
var _local2:String; | |
var _local3:Array; | |
var _local4:Array; | |
var _local5:uint; | |
var _local6:uint; | |
var _local7:uint; | |
_local2 = ""; | |
_local4 = new Array(4); | |
_arg1.position = 0; | |
while (_arg1.bytesAvailable > 0) { | |
_local3 = new Array(); | |
_local5 = 0; | |
while ((((_local5 < 3)) && ((_arg1.bytesAvailable > 0)))) { | |
_local3[_local5] = _arg1.readUnsignedByte(); | |
_local5++; | |
}; | |
_local4[0] = ((_local3[0] & 252) >> 2); | |
_local4[1] = (((_local3[0] & 3) << 4) | (_local3[1] >> 4)); | |
_local4[2] = (((_local3[1] & 15) << 2) | (_local3[2] >> 6)); | |
_local4[3] = (_local3[2] & 63); | |
_local6 = _local3.length; | |
while (_local6 < 3) { | |
_local4[(_local6 + 1)] = 64; | |
_local6++; | |
}; | |
_local7 = 0; | |
while (_local7 < _local4.length) { | |
_local2 = (_local2 + BASE64_CHARS.charAt(_local4[_local7])); | |
_local7++; | |
}; | |
}; | |
return (_local2); | |
} | |
public static function decode(_arg1:String):String{ | |
var _local2:ByteArray; | |
_local2 = decodeToByteArray(_arg1); | |
return (_local2.readUTFBytes(_local2.length)); | |
} | |
public static function decodeToByteArray(_arg1:String):ByteArray{ | |
var _local2:ByteArray; | |
var _local3:Array; | |
var _local4:Array; | |
var _local5:uint; | |
var _local6:uint; | |
var _local7:uint; | |
_local2 = new ByteArray(); | |
_local3 = new Array(4); | |
_local4 = new Array(3); | |
_local5 = 0; | |
while (_local5 < _arg1.length) { | |
_local6 = 0; | |
while ((((_local6 < 4)) && (((_local5 + _local6) < _arg1.length)))) { | |
_local3[_local6] = BASE64_CHARS.indexOf(_arg1.charAt((_local5 + _local6))); | |
_local6++; | |
}; | |
_local4[0] = ((_local3[0] << 2) + ((_local3[1] & 48) >> 4)); | |
_local4[1] = (((_local3[1] & 15) << 4) + ((_local3[2] & 60) >> 2)); | |
_local4[2] = (((_local3[2] & 3) << 6) + _local3[3]); | |
_local7 = 0; | |
while (_local7 < _local4.length) { | |
if (_local3[(_local7 + 1)] == 64){ | |
break; | |
}; | |
_local2.writeByte(_local4[_local7]); | |
_local7++; | |
}; | |
_local5 = (_local5 + 4); | |
}; | |
_local2.position = 0; | |
return (_local2); | |
} | |
} | |
}//package com.hurlant.util | |
package com.hurlant.math { | |
import com.hurlant.math.*; | |
interface IReduction { | |
function convert(_arg1:BigInteger):BigInteger; | |
function revert(_arg1:BigInteger):BigInteger; | |
function reduce(_arg1:BigInteger):void; | |
function sqrTo(_arg1:BigInteger, _arg2:BigInteger):void; | |
function mulTo(_arg1:BigInteger, _arg2:BigInteger, _arg3:BigInteger):void; | |
} | |
}//package com.hurlant.math | |
package com.hurlant.math { | |
import com.hurlant.math.*; | |
class ClassicReduction implements IReduction { | |
private var m:BigInteger; | |
public function ClassicReduction(_arg1:BigInteger){ | |
this.m = _arg1; | |
} | |
public function revert(_arg1:BigInteger):BigInteger{ | |
return (_arg1); | |
} | |
public function reduce(_arg1:BigInteger):void{ | |
_arg1.divRemTo(m, null, _arg1); | |
} | |
public function convert(_arg1:BigInteger):BigInteger{ | |
if ((((_arg1.s < 0)) || ((_arg1.compareTo(m) >= 0)))){ | |
return (_arg1.mod(m)); | |
}; | |
return (_arg1); | |
} | |
public function sqrTo(_arg1:BigInteger, _arg2:BigInteger):void{ | |
_arg1.squareTo(_arg2); | |
reduce(_arg2); | |
} | |
public function mulTo(_arg1:BigInteger, _arg2:BigInteger, _arg3:BigInteger):void{ | |
_arg1.multiplyTo(_arg2, _arg3); | |
reduce(_arg3); | |
} | |
} | |
}//package com.hurlant.math | |
package com.hurlant.math { | |
public class NullReduction implements IReduction { | |
public function reduce(_arg1:BigInteger):void{ | |
} | |
public function revert(_arg1:BigInteger):BigInteger{ | |
return (_arg1); | |
} | |
public function mulTo(_arg1:BigInteger, _arg2:BigInteger, _arg3:BigInteger):void{ | |
_arg1.multiplyTo(_arg2, _arg3); | |
} | |
public function convert(_arg1:BigInteger):BigInteger{ | |
return (_arg1); | |
} | |
public function sqrTo(_arg1:BigInteger, _arg2:BigInteger):void{ | |
_arg1.squareTo(_arg2); | |
} | |
} | |
}//package com.hurlant.math | |
package com.hurlant.math { | |
public namespace bi_internal = "http://crypto.hurlant.com/BigInteger"; | |
}//package com.hurlant.math | |
package com.hurlant.math { | |
import com.hurlant.math.*; | |
class BarrettReduction implements IReduction { | |
private var r2:BigInteger; | |
private var q3:BigInteger; | |
private var mu:BigInteger; | |
private var m:BigInteger; | |
public function BarrettReduction(_arg1:BigInteger){ | |
r2 = new BigInteger(); | |
q3 = new BigInteger(); | |
BigInteger.ONE.dlShiftTo((2 * _arg1.t), r2); | |
mu = r2.divide(_arg1); | |
this.m = _arg1; | |
} | |
public function reduce(_arg1:BigInteger):void{ | |
var _local2:BigInteger; | |
_local2 = (_arg1 as BigInteger); | |
_local2.drShiftTo((m.t - 1), r2); | |
if (_local2.t > (m.t + 1)){ | |
_local2.t = (m.t + 1); | |
_local2.clamp(); | |
}; | |
mu.multiplyUpperTo(r2, (m.t + 1), q3); | |
m.multiplyLowerTo(q3, (m.t + 1), r2); | |
while (_local2.compareTo(r2) < 0) { | |
_local2.dAddOffset(1, (m.t + 1)); | |
}; | |
_local2.subTo(r2, _local2); | |
while (_local2.compareTo(m) >= 0) { | |
_local2.subTo(m, _local2); | |
}; | |
} | |
public function revert(_arg1:BigInteger):BigInteger{ | |
return (_arg1); | |
} | |
public function convert(_arg1:BigInteger):BigInteger{ | |
var _local2:BigInteger; | |
if ((((_arg1.s < 0)) || ((_arg1.t > (2 * m.t))))){ | |
return (_arg1.mod(m)); | |
}; | |
if (_arg1.compareTo(m) < 0){ | |
return (_arg1); | |
}; | |
_local2 = new BigInteger(); | |
_arg1.copyTo(_local2); | |
reduce(_local2); | |
return (_local2); | |
} | |
public function sqrTo(_arg1:BigInteger, _arg2:BigInteger):void{ | |
_arg1.squareTo(_arg2); | |
reduce(_arg2); | |
} | |
public function mulTo(_arg1:BigInteger, _arg2:BigInteger, _arg3:BigInteger):void{ | |
_arg1.multiplyTo(_arg2, _arg3); | |
reduce(_arg3); | |
} | |
} | |
}//package com.hurlant.math | |
package com.hurlant.math { | |
import flash.utils.*; | |
import com.hurlant.crypto.prng.*; | |
import com.hurlant.util.*; | |
public class BigInteger { | |
public static const ONE:BigInteger = nbv(1); | |
public static const ZERO:BigInteger = nbv(0); | |
public static const DM:int = (DV - 1); | |
public static const F1:int = 22; | |
public static const F2:int = 8; | |
public static const lplim:int = ((1 << 26) / lowprimes[(lowprimes.length - 1)]); | |
public static const lowprimes:Array = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 0x0101, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509]; | |
public static const FV:Number = Math.pow(2, BI_FP); | |
public static const BI_FP:int = 52; | |
public static const DV:int = (1 << DB); | |
public static const DB:int = 30; | |
bi_internal var a:Array; | |
bi_internal var s:int; | |
public var t:int; | |
public function BigInteger(_arg1=null, _arg2:int=0){ | |
var _local3:ByteArray; | |
var _local4:int; | |
super(); | |
a = new Array(); | |
if ((_arg1 is String)){ | |
_arg1 = Hex.toArray(_arg1); | |
_arg2 = 0; | |
}; | |
if ((_arg1 is ByteArray)){ | |
_local3 = (_arg1 as ByteArray); | |
_local4 = ((_arg2) || ((_local3.length - _local3.position))); | |
fromArray(_local3, _local4); | |
}; | |
} | |
public static function nbv(_arg1:int):BigInteger{ | |
var _local2:BigInteger; | |
_local2 = new (BigInteger)(); | |
_local2.fromInt(_arg1); | |
return (_local2); | |
} | |
public function clearBit(_arg1:int):BigInteger{ | |
return (changeBit(_arg1, op_andnot)); | |
} | |
public function negate():BigInteger{ | |
var _local1:BigInteger; | |
_local1 = nbi(); | |
ZERO.subTo(this, _local1); | |
return (_local1); | |
} | |
public function andNot(_arg1:BigInteger):BigInteger{ | |
var _local2:BigInteger; | |
_local2 = new BigInteger(); | |
bitwiseTo(_arg1, op_andnot, _local2); | |
return (_local2); | |
} | |
public function modPow(_arg1:BigInteger, _arg2:BigInteger):BigInteger{ | |
var _local3:int; | |
var _local4:int; | |
var _local5:BigInteger; | |
var _local6:IReduction; | |
var _local7:Array; | |
var _local8:int; | |
var _local9:int; | |
var _local10:int; | |
var _local11:int; | |
var _local12:int; | |
var _local13:Boolean; | |
var _local14:BigInteger; | |
var _local15:BigInteger; | |
var _local16:BigInteger; | |
_local3 = _arg1.bitLength(); | |
_local5 = nbv(1); | |
if (_local3 <= 0){ | |
return (_local5); | |
}; | |
if (_local3 < 18){ | |
_local4 = 1; | |
} else { | |
if (_local3 < 48){ | |
_local4 = 3; | |
} else { | |
if (_local3 < 144){ | |
_local4 = 4; | |
} else { | |
if (_local3 < 0x0300){ | |
_local4 = 5; | |
} else { | |
_local4 = 6; | |
}; | |
}; | |
}; | |
}; | |
if (_local3 < 8){ | |
_local6 = new ClassicReduction(_arg2); | |
} else { | |
if (_arg2.isEven()){ | |
_local6 = new BarrettReduction(_arg2); | |
} else { | |
_local6 = new MontgomeryReduction(_arg2); | |
}; | |
}; | |
_local7 = []; | |
_local8 = 3; | |
_local9 = (_local4 - 1); | |
_local10 = ((1 << _local4) - 1); | |
_local7[1] = _local6.convert(this); | |
if (_local4 > 1){ | |
_local16 = new BigInteger(); | |
_local6.sqrTo(_local7[1], _local16); | |
while (_local8 <= _local10) { | |
_local7[_local8] = new BigInteger(); | |
_local6.mulTo(_local16, _local7[(_local8 - 2)], _local7[_local8]); | |
_local8 = (_local8 + 2); | |
}; | |
}; | |
_local11 = (_arg1.t - 1); | |
_local13 = true; | |
_local14 = new BigInteger(); | |
_local3 = (nbits(_arg1.a[_local11]) - 1); | |
while (_local11 >= 0) { | |
if (_local3 >= _local9){ | |
_local12 = ((_arg1.a[_local11] >> (_local3 - _local9)) & _local10); | |
} else { | |
_local12 = ((_arg1.a[_local11] & ((1 << (_local3 + 1)) - 1)) << (_local9 - _local3)); | |
if (_local11 > 0){ | |
_local12 = (_local12 | (_arg1.a[(_local11 - 1)] >> ((DB + _local3) - _local9))); | |
}; | |
}; | |
_local8 = _local4; | |
while ((_local12 & 1) == 0) { | |
_local12 = (_local12 >> 1); | |
_local8--; | |
}; | |
_local3 = (_local3 - _local8); | |
if (_local3 < 0){ | |
_local3 = (_local3 + DB); | |
_local11--; | |
}; | |
if (_local13){ | |
_local7[_local12].copyTo(_local5); | |
_local13 = false; | |
} else { | |
while (_local8 > 1) { | |
_local6.sqrTo(_local5, _local14); | |
_local6.sqrTo(_local14, _local5); | |
_local8 = (_local8 - 2); | |
}; | |
if (_local8 > 0){ | |
_local6.sqrTo(_local5, _local14); | |
} else { | |
_local15 = _local5; | |
_local5 = _local14; | |
_local14 = _local15; | |
}; | |
_local6.mulTo(_local14, _local7[_local12], _local5); | |
}; | |
while ((((_local11 >= 0)) && (((_arg1.a[_local11] & (1 << _local3)) == 0)))) { | |
_local6.sqrTo(_local5, _local14); | |
_local15 = _local5; | |
_local5 = _local14; | |
_local14 = _local15; | |
--_local3; | |
if (_local3 < 0){ | |
_local3 = (DB - 1); | |
_local11--; | |
}; | |
}; | |
}; | |
return (_local6.revert(_local5)); | |
} | |
public function isProbablePrime(_arg1:int):Boolean{ | |
var _local2:int; | |
var _local3:BigInteger; | |
var _local4:int; | |
var _local5:int; | |
_local3 = abs(); | |
if ((((_local3.t == 1)) && ((_local3.a[0] <= lowprimes[(lowprimes.length - 1)])))){ | |
_local2 = 0; | |
while (_local2 < lowprimes.length) { | |
if (_local3[0] == lowprimes[_local2]){ | |
return (true); | |
}; | |
_local2++; | |
}; | |
return (false); | |
}; | |
if (_local3.isEven()){ | |
return (false); | |
}; | |
_local2 = 1; | |
while (_local2 < lowprimes.length) { | |
_local4 = lowprimes[_local2]; | |
_local5 = (_local2 + 1); | |
while ((((_local5 < lowprimes.length)) && ((_local4 < lplim)))) { | |
var _temp1 = _local5; | |
_local5 = (_local5 + 1); | |
_local4 = (_local4 * lowprimes[_temp1]); | |
}; | |
_local4 = _local3.modInt(_local4); | |
while (_local2 < _local5) { | |
var _temp2 = _local4; | |
var _temp3 = _local2; | |
_local2 = (_local2 + 1); | |
if ((_temp2 % lowprimes[_temp3]) == 0){ | |
return (false); | |
}; | |
}; | |
}; | |
return (_local3.millerRabin(_arg1)); | |
} | |
private function op_or(_arg1:int, _arg2:int):int{ | |
return ((_arg1 | _arg2)); | |
} | |
public function mod(_arg1:BigInteger):BigInteger{ | |
var _local2:BigInteger; | |
_local2 = nbi(); | |
abs().divRemTo(_arg1, null, _local2); | |
if ((((s < 0)) && ((_local2.compareTo(ZERO) > 0)))){ | |
_arg1.subTo(_local2, _local2); | |
}; | |
return (_local2); | |
} | |
protected function addTo(_arg1:BigInteger, _arg2:BigInteger):void{ | |
var _local3:int; | |
var _local4:int; | |
var _local5:int; | |
_local3 = 0; | |
_local4 = 0; | |
_local5 = Math.min(_arg1.t, t); | |
while (_local3 < _local5) { | |
_local4 = (_local4 + (this.a[_local3] + _arg1.a[_local3])); | |
var _temp1 = _local3; | |
_local3 = (_local3 + 1); | |
var _local6 = _temp1; | |
_arg2.a[_local6] = (_local4 & DM); | |
_local4 = (_local4 >> DB); | |
}; | |
if (_arg1.t < t){ | |
_local4 = (_local4 + _arg1.s); | |
while (_local3 < t) { | |
_local4 = (_local4 + this.a[_local3]); | |
var _temp2 = _local3; | |
_local3 = (_local3 + 1); | |
_local6 = _temp2; | |
_arg2.a[_local6] = (_local4 & DM); | |
_local4 = (_local4 >> DB); | |
}; | |
_local4 = (_local4 + s); | |
} else { | |
_local4 = (_local4 + s); | |
while (_local3 < _arg1.t) { | |
_local4 = (_local4 + _arg1.a[_local3]); | |
var _temp3 = _local3; | |
_local3 = (_local3 + 1); | |
_local6 = _temp3; | |
_arg2.a[_local6] = (_local4 & DM); | |
_local4 = (_local4 >> DB); | |
}; | |
_local4 = (_local4 + _arg1.s); | |
}; | |
_arg2.s = ((_local4)<0) ? -1 : 0; | |
if (_local4 > 0){ | |
var _temp4 = _local3; | |
_local3 = (_local3 + 1); | |
_local6 = _temp4; | |
_arg2.a[_local6] = _local4; | |
} else { | |
if (_local4 < -1){ | |
var _temp5 = _local3; | |
_local3 = (_local3 + 1); | |
_local6 = _temp5; | |
_arg2.a[_local6] = (DV + _local4); | |
}; | |
}; | |
_arg2.t = _local3; | |
_arg2.clamp(); | |
} | |
protected function bitwiseTo(_arg1:BigInteger, _arg2:Function, _arg3:BigInteger):void{ | |
var _local4:int; | |
var _local5:int; | |
var _local6:int; | |
_local6 = Math.min(_arg1.t, t); | |
_local4 = 0; | |
while (_local4 < _local6) { | |
_arg3.a[_local4] = _arg2(this.a[_local4], _arg1.a[_local4]); | |
_local4++; | |
}; | |
if (_arg1.t < t){ | |
_local5 = (_arg1.s & DM); | |
_local4 = _local6; | |
while (_local4 < t) { | |
_arg3.a[_local4] = _arg2(this.a[_local4], _local5); | |
_local4++; | |
}; | |
_arg3.t = t; | |
} else { | |
_local5 = (s & DM); | |
_local4 = _local6; | |
while (_local4 < _arg1.t) { | |
_arg3.a[_local4] = _arg2(_local5, _arg1.a[_local4]); | |
_local4++; | |
}; | |
_arg3.t = _arg1.t; | |
}; | |
_arg3.s = _arg2(s, _arg1.s); | |
_arg3.clamp(); | |
} | |
protected function modInt(_arg1:int):int{ | |
var _local2:int; | |
var _local3:int; | |
var _local4:int; | |
if (_arg1 <= 0){ | |
return (0); | |
}; | |
_local2 = (DV % _arg1); | |
_local3 = ((s)<0) ? (_arg1 - 1) : 0; | |
if (t > 0){ | |
if (_local2 == 0){ | |
_local3 = (a[0] % _arg1); | |
} else { | |
_local4 = (t - 1); | |
while (_local4 >= 0) { | |
_local3 = (((_local2 * _local3) + a[_local4]) % _arg1); | |
_local4--; | |
}; | |
}; | |
}; | |
return (_local3); | |
} | |
protected function chunkSize(_arg1:Number):int{ | |
return (Math.floor(((Math.LN2 * DB) / Math.log(_arg1)))); | |
} | |
bi_internal function dAddOffset(_arg1:int, _arg2:int):void{ | |
while (t <= _arg2) { | |
var _local3 = t++; | |
a[_local3] = 0; | |
}; | |
a[_arg2] = (a[_arg2] + _arg1); | |
while (a[_arg2] >= DV) { | |
a[_arg2] = (a[_arg2] - DV); | |
++_arg2; | |
if (_arg2 >= t){ | |
_local3 = t++; | |
a[_local3] = 0; | |
}; | |
_local3 = a; | |
var _local4 = _arg2; | |
var _local5 = (_local3[_local4] + 1); | |
_local3[_local4] = _local5; | |
}; | |
} | |
bi_internal function lShiftTo(_arg1:int, _arg2:BigInteger):void{ | |
var _local3:int; | |
var _local4:int; | |
var _local5:int; | |
var _local6:int; | |
var _local7:int; | |
var _local8:int; | |
_local3 = (_arg1 % DB); | |
_local4 = (DB - _local3); | |
_local5 = ((1 << _local4) - 1); | |
_local6 = (_arg1 / DB); | |
_local7 = ((s << _local3) & DM); | |
_local8 = (t - 1); | |
while (_local8 >= 0) { | |
_arg2.a[((_local8 + _local6) + 1)] = ((a[_local8] >> _local4) | _local7); | |
_local7 = ((a[_local8] & _local5) << _local3); | |
_local8--; | |
}; | |
_local8 = (_local6 - 1); | |
while (_local8 >= 0) { | |
_arg2.a[_local8] = 0; | |
_local8--; | |
}; | |
_arg2.a[_local6] = _local7; | |
_arg2.t = ((t + _local6) + 1); | |
_arg2.s = s; | |
_arg2.clamp(); | |
} | |
public function getLowestSetBit():int{ | |
var _local1:int; | |
_local1 = 0; | |
while (_local1 < t) { | |
if (a[_local1] != 0){ | |
return (((_local1 * DB) + lbit(a[_local1]))); | |
}; | |
_local1++; | |
}; | |
if (s < 0){ | |
return ((t * DB)); | |
}; | |
return (-1); | |
} | |
public function subtract(_arg1:BigInteger):BigInteger{ | |
var _local2:BigInteger; | |
_local2 = new BigInteger(); | |
subTo(_arg1, _local2); | |
return (_local2); | |
} | |
public function primify(_arg1:int, _arg2:int):void{ | |
if (!testBit((_arg1 - 1))){ | |
bitwiseTo(BigInteger.ONE.shiftLeft((_arg1 - 1)), op_or, this); | |
}; | |
if (isEven()){ | |
dAddOffset(1, 0); | |
}; | |
while (!(isProbablePrime(_arg2))) { | |
dAddOffset(2, 0); | |
while (bitLength() > _arg1) { | |
subTo(BigInteger.ONE.shiftLeft((_arg1 - 1)), this); | |
}; | |
}; | |
} | |
public function gcd(_arg1:BigInteger):BigInteger{ | |
var _local2:BigInteger; | |
var _local3:BigInteger; | |
var _local4:int; | |
var _local5:int; | |
var _local6:BigInteger; | |
_local2 = ((s)<0) ? negate() : clone(); | |
_local3 = ((_arg1.s)<0) ? _arg1.negate() : _arg1.clone(); | |
if (_local2.compareTo(_local3) < 0){ | |
_local6 = _local2; | |
_local2 = _local3; | |
_local3 = _local6; | |
}; | |
_local4 = _local2.getLowestSetBit(); | |
_local5 = _local3.getLowestSetBit(); | |
if (_local5 < 0){ | |
return (_local2); | |
}; | |
if (_local4 < _local5){ | |
_local5 = _local4; | |
}; | |
if (_local5 > 0){ | |
_local2.rShiftTo(_local5, _local2); | |
_local3.rShiftTo(_local5, _local3); | |
}; | |
while (_local2.sigNum() > 0) { | |
_local4 = _local2.getLowestSetBit(); | |
if (_local4 > 0){ | |
_local2.rShiftTo(_local4, _local2); | |
}; | |
_local4 = _local3.getLowestSetBit(); | |
if (_local4 > 0){ | |
_local3.rShiftTo(_local4, _local3); | |
}; | |
if (_local2.compareTo(_local3) >= 0){ | |
_local2.subTo(_local3, _local2); | |
_local2.rShiftTo(1, _local2); | |
} else { | |
_local3.subTo(_local2, _local3); | |
_local3.rShiftTo(1, _local3); | |
}; | |
}; | |
if (_local5 > 0){ | |
_local3.lShiftTo(_local5, _local3); | |
}; | |
return (_local3); | |
} | |
bi_internal function multiplyLowerTo(_arg1:BigInteger, _arg2:int, _arg3:BigInteger):void{ | |
var _local4:int; | |
var _local5:int; | |
_local4 = Math.min((t + _arg1.t), _arg2); | |
_arg3.s = 0; | |
_arg3.t = _local4; | |
while (_local4 > 0) { | |
--_local4; | |
var _local6 = _local4; | |
_arg3.a[_local6] = 0; | |
}; | |
_local5 = (_arg3.t - t); | |
while (_local4 < _local5) { | |
_arg3.a[(_local4 + t)] = am(0, _arg1.a[_local4], _arg3, _local4, 0, t); | |
_local4++; | |
}; | |
_local5 = Math.min(_arg1.t, _arg2); | |
while (_local4 < _local5) { | |
am(0, _arg1.a[_local4], _arg3, _local4, 0, (_arg2 - _local4)); | |
_local4++; | |
}; | |
_arg3.clamp(); | |
} | |
public function modPowInt(_arg1:int, _arg2:BigInteger):BigInteger{ | |
var _local3:IReduction; | |
if ((((_arg1 < 0x0100)) || (_arg2.isEven()))){ | |
_local3 = new ClassicReduction(_arg2); | |
} else { | |
_local3 = new MontgomeryReduction(_arg2); | |
}; | |
return (exp(_arg1, _local3)); | |
} | |
bi_internal function intAt(_arg1:String, _arg2:int):int{ | |
return (parseInt(_arg1.charAt(_arg2), 36)); | |
} | |
public function testBit(_arg1:int):Boolean{ | |
var _local2:int; | |
_local2 = Math.floor((_arg1 / DB)); | |
if (_local2 >= t){ | |
return (!((s == 0))); | |
}; | |
return (!(((a[_local2] & (1 << (_arg1 % DB))) == 0))); | |
} | |
bi_internal function exp(_arg1:int, _arg2:IReduction):BigInteger{ | |
var _local3:BigInteger; | |
var _local4:BigInteger; | |
var _local5:BigInteger; | |
var _local6:int; | |
var _local7:BigInteger; | |
if ((((_arg1 > 0xFFFFFFFF)) || ((_arg1 < 1)))){ | |
return (ONE); | |
}; | |
_local3 = nbi(); | |
_local4 = nbi(); | |
_local5 = _arg2.convert(this); | |
_local6 = (nbits(_arg1) - 1); | |
_local5.copyTo(_local3); | |
while (--_local6 >= 0) { | |
_arg2.sqrTo(_local3, _local4); | |
if ((_arg1 & (1 << _local6)) > 0){ | |
_arg2.mulTo(_local4, _local5, _local3); | |
} else { | |
_local7 = _local3; | |
_local3 = _local4; | |
_local4 = _local7; | |
}; | |
}; | |
return (_arg2.revert(_local3)); | |
} | |
public function toArray(_arg1:ByteArray):uint{ | |
var _local2:int; | |
var _local3:int; | |
var _local4:int; | |
var _local5:int; | |
var _local6:int; | |
var _local7:Boolean; | |
var _local8:int; | |
_local2 = 8; | |
_local3 = ((1 << 8) - 1); | |
_local4 = 0; | |
_local5 = t; | |
_local6 = (DB - ((_local5 * DB) % _local2)); | |
_local7 = false; | |
_local8 = 0; | |
var _temp1 = _local5; | |
_local5 = (_local5 - 1); | |
if (_temp1 > 0){ | |
if ((((_local6 < DB)) && (((_local4 = (a[_local5] >> _local6)) > 0)))){ | |
_local7 = true; | |
_arg1.writeByte(_local4); | |
_local8++; | |
}; | |
while (_local5 >= 0) { | |
if (_local6 < _local2){ | |
_local4 = ((a[_local5] & ((1 << _local6) - 1)) << (_local2 - _local6)); | |
var _temp2 = _local4; | |
_local5 = (_local5 - 1); | |
_local6 = (_local6 + (DB - _local2)); | |
_local4 = (_temp2 | (a[_local5] >> _local6)); | |
} else { | |
_local6 = (_local6 - _local2); | |
_local4 = ((a[_local5] >> _local6) & _local3); | |
if (_local6 <= 0){ | |
_local6 = (_local6 + DB); | |
_local5--; | |
}; | |
}; | |
if (_local4 > 0){ | |
_local7 = true; | |
}; | |
if (_local7){ | |
_arg1.writeByte(_local4); | |
_local8++; | |
}; | |
}; | |
}; | |
return (_local8); | |
} | |
public function dispose():void{ | |
var _local1:Random; | |
var _local2:uint; | |
_local1 = new Random(); | |
_local2 = 0; | |
while (_local2 < a.length) { | |
a[_local2] = _local1.nextByte(); | |
delete a[_local2]; | |
_local2++; | |
}; | |
a = null; | |
t = 0; | |
s = 0; | |
Memory.gc(); | |
} | |
private function lbit(_arg1:int):int{ | |
var _local2:int; | |
if (_arg1 == 0){ | |
return (-1); | |
}; | |
_local2 = 0; | |
if ((_arg1 & 0xFFFF) == 0){ | |
_arg1 = (_arg1 >> 16); | |
_local2 = (_local2 + 16); | |
}; | |
if ((_arg1 & 0xFF) == 0){ | |
_arg1 = (_arg1 >> 8); | |
_local2 = (_local2 + 8); | |
}; | |
if ((_arg1 & 15) == 0){ | |
_arg1 = (_arg1 >> 4); | |
_local2 = (_local2 + 4); | |
}; | |
if ((_arg1 & 3) == 0){ | |
_arg1 = (_arg1 >> 2); | |
_local2 = (_local2 + 2); | |
}; | |
if ((_arg1 & 1) == 0){ | |
_local2++; | |
}; | |
return (_local2); | |
} | |
bi_internal function divRemTo(_arg1:BigInteger, _arg2:BigInteger=null, _arg3:BigInteger=null):void{ | |
var pm:* = null; | |
var pt:* = null; | |
var y:* = null; | |
var ts:* = 0; | |
var ms:* = 0; | |
var nsh:* = 0; | |
var ys:* = 0; | |
var y0:* = 0; | |
var yt:* = NaN; | |
var d1:* = NaN; | |
var d2:* = NaN; | |
var e:* = NaN; | |
var i:* = 0; | |
var j:* = 0; | |
var t:* = null; | |
var qd:* = 0; | |
var m:* = _arg1; | |
var q = _arg2; | |
var r = _arg3; | |
pm = m.abs(); | |
if (pm.t <= 0){ | |
return; | |
}; | |
pt = abs(); | |
if (pt.t < pm.t){ | |
if (q != null){ | |
q.fromInt(0); | |
}; | |
if (r != null){ | |
copyTo(r); | |
}; | |
return; | |
}; | |
if (r == null){ | |
r = nbi(); | |
}; | |
y = nbi(); | |
ts = s; | |
ms = m.s; | |
nsh = (DB - nbits(pm.a[(pm.t - 1)])); | |
if (nsh > 0){ | |
pm.lShiftTo(nsh, y); | |
pt.lShiftTo(nsh, r); | |
} else { | |
pm.copyTo(y); | |
pt.copyTo(r); | |
}; | |
ys = y.t; | |
y0 = y.a[(ys - 1)]; | |
if (y0 == 0){ | |
return; | |
}; | |
yt = ((y0 * (1 << F1)) + ((ys)>1) ? (y.a[(ys - 2)] >> F2) : 0); | |
d1 = (FV / yt); | |
d2 = ((1 << F1) / yt); | |
e = (1 << F2); | |
i = r.t; | |
j = (i - ys); | |
t = ((q)==null) ? nbi() : q; | |
y.dlShiftTo(j, t); | |
if (r.compareTo(t) >= 0){ | |
var _local5 = r.t++; | |
r.a[_local5] = 1; | |
r.subTo(t, r); | |
}; | |
ONE.dlShiftTo(ys, t); | |
t.subTo(y, y); | |
while (y.t < ys) { | |
y.(y.t++); //not popped | |
}; | |
while ((j = (j - 1)), (j - 1) >= 0) { | |
i = (i - 1); | |
qd = ((r.a[(i - 1)])==y0) ? DM : ((Number(r.a[i]) * d1) + ((Number(r.a[(i - 1)]) + e) * d2)); | |
if ((r.a[i] = (r.a[i] + y.am(0, qd, r, j, 0, ys))) < qd){ | |
y.dlShiftTo(j, t); | |
r.subTo(t, r); | |
while ((qd = (qd - 1)), r.a[i] < (qd - 1)) { | |
r.subTo(t, r); | |
}; | |
}; | |
}; | |
if (q != null){ | |
r.drShiftTo(ys, q); | |
if (ts != ms){ | |
ZERO.subTo(q, q); | |
}; | |
}; | |
r.t = ys; | |
r.clamp(); | |
if (nsh > 0){ | |
r.rShiftTo(nsh, r); | |
}; | |
if (ts < 0){ | |
ZERO.subTo(r, r); | |
}; | |
} | |
public function remainder(_arg1:BigInteger):BigInteger{ | |
var _local2:BigInteger; | |
_local2 = new BigInteger(); | |
divRemTo(_arg1, null, _local2); | |
return (_local2); | |
} | |
public function divide(_arg1:BigInteger):BigInteger{ | |
var _local2:BigInteger; | |
_local2 = new BigInteger(); | |
divRemTo(_arg1, _local2, null); | |
return (_local2); | |
} | |
public function divideAndRemainder(_arg1:BigInteger):Array{ | |
var _local2:BigInteger; | |
var _local3:BigInteger; | |
_local2 = new BigInteger(); | |
_local3 = new BigInteger(); | |
divRemTo(_arg1, _local2, _local3); | |
return ([_local2, _local3]); | |
} | |
public function valueOf():Number{ | |
var _local1:Number; | |
var _local2:Number; | |
var _local3:uint; | |
_local1 = 1; | |
_local2 = 0; | |
_local3 = 0; | |
while (_local3 < t) { | |
_local2 = (_local2 + (a[_local3] * _local1)); | |
_local1 = (_local1 * DV); | |
_local3++; | |
}; | |
return (_local2); | |
} | |
public function shiftLeft(_arg1:int):BigInteger{ | |
var _local2:BigInteger; | |
_local2 = new BigInteger(); | |
if (_arg1 < 0){ | |
rShiftTo(-(_arg1), _local2); | |
} else { | |
lShiftTo(_arg1, _local2); | |
}; | |
return (_local2); | |
} | |
public function multiply(_arg1:BigInteger):BigInteger{ | |
var _local2:BigInteger; | |
_local2 = new BigInteger(); | |
multiplyTo(_arg1, _local2); | |
return (_local2); | |
} | |
bi_internal function am(_arg1:int, _arg2:int, _arg3:BigInteger, _arg4:int, _arg5:int, _arg6:int):int{ | |
var _local7:int; | |
var _local8:int; | |
var _local9:int; | |
var _local10:int; | |
var _local11:int; | |
_local7 = (_arg2 & 32767); | |
_local8 = (_arg2 >> 15); | |
while (--_arg6 >= 0) { | |
_local9 = (a[_arg1] & 32767); | |
var _temp1 = _arg1; | |
_arg1 = (_arg1 + 1); | |
_local10 = (a[_temp1] >> 15); | |
_local11 = ((_local8 * _local9) + (_local10 * _local7)); | |
_local9 = ((((_local7 * _local9) + ((_local11 & 32767) << 15)) + _arg3.a[_arg4]) + (_arg5 & 1073741823)); | |
_arg5 = ((((_local9 >>> 30) + (_local11 >>> 15)) + (_local8 * _local10)) + (_arg5 >>> 30)); | |
var _temp2 = _arg4; | |
_arg4 = (_arg4 + 1); | |
var _local12 = _temp2; | |
_arg3.a[_local12] = (_local9 & 1073741823); | |
}; | |
return (_arg5); | |
} | |
bi_internal function drShiftTo(_arg1:int, _arg2:BigInteger):void{ | |
var _local3:int; | |
_local3 = _arg1; | |
while (_local3 < t) { | |
_arg2.a[(_local3 - _arg1)] = a[_local3]; | |
_local3++; | |
}; | |
_arg2.t = Math.max((t - _arg1), 0); | |
_arg2.s = s; | |
} | |
public function add(_arg1:BigInteger):BigInteger{ | |
var _local2:BigInteger; | |
_local2 = new BigInteger(); | |
addTo(_arg1, _local2); | |
return (_local2); | |
} | |
bi_internal function multiplyUpperTo(_arg1:BigInteger, _arg2:int, _arg3:BigInteger):void{ | |
var _local4:int; | |
_arg2--; | |
_local4 = (_arg3.t = ((t + _arg1.t) - _arg2)); | |
_arg3.s = 0; | |
while (--_local4 >= 0) { | |
_arg3.a[_local4] = 0; | |
}; | |
_local4 = Math.max((_arg2 - t), 0); | |
while (_local4 < _arg1.t) { | |
_arg3.a[((t + _local4) - _arg2)] = am((_arg2 - _local4), _arg1.a[_local4], _arg3, 0, 0, ((t + _local4) - _arg2)); | |
_local4++; | |
}; | |
_arg3.clamp(); | |
_arg3.drShiftTo(1, _arg3); | |
} | |
protected function nbi(){ | |
return (new BigInteger()); | |
} | |
protected function millerRabin(_arg1:int):Boolean{ | |
var _local2:BigInteger; | |
var _local3:int; | |
var _local4:BigInteger; | |
var _local5:BigInteger; | |
var _local6:int; | |
var _local7:BigInteger; | |
var _local8:int; | |
_local2 = subtract(BigInteger.ONE); | |
_local3 = _local2.getLowestSetBit(); | |
if (_local3 <= 0){ | |
return (false); | |
}; | |
_local4 = _local2.shiftRight(_local3); | |
_arg1 = ((_arg1 + 1) >> 1); | |
if (_arg1 > lowprimes.length){ | |
_arg1 = lowprimes.length; | |
}; | |
_local5 = new BigInteger(); | |
_local6 = 0; | |
while (_local6 < _arg1) { | |
_local5.fromInt(lowprimes[_local6]); | |
_local7 = _local5.modPow(_local4, this); | |
if (((!((_local7.compareTo(BigInteger.ONE) == 0))) && (!((_local7.compareTo(_local2) == 0))))){ | |
_local8 = 1; | |
while ((((_local8++ < _local3)) && (!((_local7.compareTo(_local2) == 0))))) { | |
_local7 = _local7.modPowInt(2, this); | |
if (_local7.compareTo(BigInteger.ONE) == 0){ | |
return (false); | |
}; | |
}; | |
if (_local7.compareTo(_local2) != 0){ | |
return (false); | |
}; | |
}; | |
_local6++; | |
}; | |
return (true); | |
} | |
bi_internal function dMultiply(_arg1:int):void{ | |
a[t] = am(0, (_arg1 - 1), this, 0, 0, t); | |
t++; | |
clamp(); | |
} | |
private function op_andnot(_arg1:int, _arg2:int):int{ | |
return ((_arg1 & ~(_arg2))); | |
} | |
bi_internal function clamp():void{ | |
var _local1:int; | |
_local1 = (s & DM); | |
while ((((t > 0)) && ((a[(t - 1)] == _local1)))) { | |
t--; | |
}; | |
} | |
bi_internal function invDigit():int{ | |
var _local1:int; | |
var _local2:int; | |
if (t < 1){ | |
return (0); | |
}; | |
_local1 = a[0]; | |
if ((_local1 & 1) == 0){ | |
return (0); | |
}; | |
_local2 = (_local1 & 3); | |
_local2 = ((_local2 * (2 - ((_local1 & 15) * _local2))) & 15); | |
_local2 = ((_local2 * (2 - ((_local1 & 0xFF) * _local2))) & 0xFF); | |
_local2 = ((_local2 * (2 - (((_local1 & 0xFFFF) * _local2) & 0xFFFF))) & 0xFFFF); | |
_local2 = ((_local2 * (2 - ((_local1 * _local2) % DV))) % DV); | |
return (((_local2)>0) ? (DV - _local2) : -(_local2)); | |
} | |
protected function changeBit(_arg1:int, _arg2:Function):BigInteger{ | |
var _local3:BigInteger; | |
_local3 = BigInteger.ONE.shiftLeft(_arg1); | |
bitwiseTo(_local3, _arg2, _local3); | |
return (_local3); | |
} | |
public function equals(_arg1:BigInteger):Boolean{ | |
return ((compareTo(_arg1) == 0)); | |
} | |
public function compareTo(_arg1:BigInteger):int{ | |
var _local2:int; | |
var _local3:int; | |
_local2 = (s - _arg1.s); | |
if (_local2 != 0){ | |
return (_local2); | |
}; | |
_local3 = t; | |
_local2 = (_local3 - _arg1.t); | |
if (_local2 != 0){ | |
return (_local2); | |
}; | |
while (--_local3 >= 0) { | |
_local2 = (a[_local3] - _arg1.a[_local3]); | |
if (_local2 != 0){ | |
return (_local2); | |
}; | |
}; | |
return (0); | |
} | |
public function shiftRight(_arg1:int):BigInteger{ | |
var _local2:BigInteger; | |
_local2 = new BigInteger(); | |
if (_arg1 < 0){ | |
lShiftTo(-(_arg1), _local2); | |
} else { | |
rShiftTo(_arg1, _local2); | |
}; | |
return (_local2); | |
} | |
bi_internal function multiplyTo(_arg1:BigInteger, _arg2:BigInteger):void{ | |
var _local3:BigInteger; | |
var _local4:BigInteger; | |
var _local5:int; | |
_local3 = abs(); | |
_local4 = _arg1.abs(); | |
_local5 = _local3.t; | |
_arg2.t = (_local5 + _local4.t); | |
while (--_local5 >= 0) { | |
_arg2.a[_local5] = 0; | |
}; | |
_local5 = 0; | |
while (_local5 < _local4.t) { | |
_arg2.a[(_local5 + _local3.t)] = _local3.am(0, _local4.a[_local5], _arg2, _local5, 0, _local3.t); | |
_local5++; | |
}; | |
_arg2.s = 0; | |
_arg2.clamp(); | |
if (s != _arg1.s){ | |
ZERO.subTo(_arg2, _arg2); | |
}; | |
} | |
public function bitCount():int{ | |
var _local1:int; | |
var _local2:int; | |
var _local3:int; | |
_local1 = 0; | |
_local2 = (s & DM); | |
_local3 = 0; | |
while (_local3 < t) { | |
_local1 = (_local1 + cbit((a[_local3] ^ _local2))); | |
_local3++; | |
}; | |
return (_local1); | |
} | |
public function byteValue():int{ | |
return (((t)==0) ? s : ((a[0] << 24) >> 24)); | |
} | |
private function cbit(_arg1:int):int{ | |
var _local2:uint; | |
_local2 = 0; | |
while (_arg1 != 0) { | |
_arg1 = (_arg1 & (_arg1 - 1)); | |
_local2++; | |
}; | |
return (_local2); | |
} | |
bi_internal function rShiftTo(_arg1:int, _arg2:BigInteger):void{ | |
var _local3:int; | |
var _local4:int; | |
var _local5:int; | |
var _local6:int; | |
var _local7:int; | |
_arg2.s = s; | |
_local3 = (_arg1 / DB); | |
if (_local3 >= t){ | |
_arg2.t = 0; | |
return; | |
}; | |
_local4 = (_arg1 % DB); | |
_local5 = (DB - _local4); | |
_local6 = ((1 << _local4) - 1); | |
_arg2.a[0] = (a[_local3] >> _local4); | |
_local7 = (_local3 + 1); | |
while (_local7 < t) { | |
_arg2.a[((_local7 - _local3) - 1)] = (_arg2.a[((_local7 - _local3) - 1)] | ((a[_local7] & _local6) << _local5)); | |
_arg2.a[(_local7 - _local3)] = (a[_local7] >> _local4); | |
_local7++; | |
}; | |
if (_local4 > 0){ | |
_arg2.a[((t - _local3) - 1)] = (_arg2.a[((t - _local3) - 1)] | ((s & _local6) << _local5)); | |
}; | |
_arg2.t = (t - _local3); | |
_arg2.clamp(); | |
} | |
public function modInverse(_arg1:BigInteger):BigInteger{ | |
var _local2:Boolean; | |
var _local3:BigInteger; | |
var _local4:BigInteger; | |
var _local5:BigInteger; | |
var _local6:BigInteger; | |
var _local7:BigInteger; | |
var _local8:BigInteger; | |
_local2 = _arg1.isEven(); | |
if (((((isEven()) && (_local2))) || ((_arg1.sigNum() == 0)))){ | |
return (BigInteger.ZERO); | |
}; | |
_local3 = _arg1.clone(); | |
_local4 = clone(); | |
_local5 = nbv(1); | |
_local6 = nbv(0); | |
_local7 = nbv(0); | |
_local8 = nbv(1); | |
while (_local3.sigNum() != 0) { | |
while (_local3.isEven()) { | |
_local3.rShiftTo(1, _local3); | |
if (_local2){ | |
if (((!(_local5.isEven())) || (!(_local6.isEven())))){ | |
_local5.addTo(this, _local5); | |
_local6.subTo(_arg1, _local6); | |
}; | |
_local5.rShiftTo(1, _local5); | |
} else { | |
if (!_local6.isEven()){ | |
_local6.subTo(_arg1, _local6); | |
}; | |
}; | |
_local6.rShiftTo(1, _local6); | |
}; | |
while (_local4.isEven()) { | |
_local4.rShiftTo(1, _local4); | |
if (_local2){ | |
if (((!(_local7.isEven())) || (!(_local8.isEven())))){ | |
_local7.addTo(this, _local7); | |
_local8.subTo(_arg1, _local8); | |
}; | |
_local7.rShiftTo(1, _local7); | |
} else { | |
if (!_local8.isEven()){ | |
_local8.subTo(_arg1, _local8); | |
}; | |
}; | |
_local8.rShiftTo(1, _local8); | |
}; | |
if (_local3.compareTo(_local4) >= 0){ | |
_local3.subTo(_local4, _local3); | |
if (_local2){ | |
_local5.subTo(_local7, _local5); | |
}; | |
_local6.subTo(_local8, _local6); | |
} else { | |
_local4.subTo(_local3, _local4); | |
if (_local2){ | |
_local7.subTo(_local5, _local7); | |
}; | |
_local8.subTo(_local6, _local8); | |
}; | |
}; | |
if (_local4.compareTo(BigInteger.ONE) != 0){ | |
return (BigInteger.ZERO); | |
}; | |
if (_local8.compareTo(_arg1) >= 0){ | |
return (_local8.subtract(_arg1)); | |
}; | |
if (_local8.sigNum() < 0){ | |
_local8.addTo(_arg1, _local8); | |
} else { | |
return (_local8); | |
}; | |
if (_local8.sigNum() < 0){ | |
return (_local8.add(_arg1)); | |
}; | |
return (_local8); | |
} | |
bi_internal function fromArray(_arg1:ByteArray, _arg2:int):void{ | |
var _local3:int; | |
var _local4:int; | |
var _local5:int; | |
var _local6:int; | |
var _local7:int; | |
_local3 = _arg1.position; | |
_local4 = (_local3 + _arg2); | |
_local5 = 0; | |
_local6 = 8; | |
t = 0; | |
s = 0; | |
while (--_local4 >= _local3) { | |
_local7 = (((_local4 < _arg1.length)) ? _arg1[_local4] : 0); | |
if (_local5 == 0){ | |
var _local8 = t++; | |
a[_local8] = _local7; | |
} else { | |
if ((_local5 + _local6) > DB){ | |
a[(t - 1)] = (a[(t - 1)] | ((_local7 & ((1 << (DB - _local5)) - 1)) << _local5)); | |
_local8 = t++; | |
a[_local8] = (_local7 >> (DB - _local5)); | |
} else { | |
a[(t - 1)] = (a[(t - 1)] | (_local7 << _local5)); | |
}; | |
}; | |
_local5 = (_local5 + _local6); | |
if (_local5 >= DB){ | |
_local5 = (_local5 - DB); | |
}; | |
}; | |
clamp(); | |
_arg1.position = Math.min((_local3 + _arg2), _arg1.length); | |
} | |
bi_internal function copyTo(_arg1:BigInteger):void{ | |
var _local2:int; | |
_local2 = (t - 1); | |
while (_local2 >= 0) { | |
_arg1.a[_local2] = a[_local2]; | |
_local2--; | |
}; | |
_arg1.t = t; | |
_arg1.s = s; | |
} | |
public function intValue():int{ | |
if (s < 0){ | |
if (t == 1){ | |
return ((a[0] - DV)); | |
}; | |
if (t == 0){ | |
return (-1); | |
}; | |
} else { | |
if (t == 1){ | |
return (a[0]); | |
}; | |
if (t == 0){ | |
return (0); | |
}; | |
}; | |
return ((((a[1] & ((1 << (32 - DB)) - 1)) << DB) | a[0])); | |
} | |
public function min(_arg1:BigInteger):BigInteger{ | |
return (((compareTo(_arg1))<0) ? this : _arg1); | |
} | |
public function bitLength():int{ | |
if (t <= 0){ | |
return (0); | |
}; | |
return (((DB * (t - 1)) + nbits((a[(t - 1)] ^ (s & DM))))); | |
} | |
public function shortValue():int{ | |
return (((t)==0) ? s : ((a[0] << 16) >> 16)); | |
} | |
public function and(_arg1:BigInteger):BigInteger{ | |
var _local2:BigInteger; | |
_local2 = new BigInteger(); | |
bitwiseTo(_arg1, op_and, _local2); | |
return (_local2); | |
} | |
protected function toRadix(_arg1:uint=10):String{ | |
var _local2:int; | |
var _local3:Number; | |
var _local4:BigInteger; | |
var _local5:BigInteger; | |
var _local6:BigInteger; | |
var _local7:String; | |
if ((((((sigNum() == 0)) || ((_arg1 < 2)))) || ((_arg1 > 32)))){ | |
return ("0"); | |
}; | |
_local2 = chunkSize(_arg1); | |
_local3 = Math.pow(_arg1, _local2); | |
_local4 = nbv(_local3); | |
_local5 = nbi(); | |
_local6 = nbi(); | |
_local7 = ""; | |
divRemTo(_local4, _local5, _local6); | |
while (_local5.sigNum() > 0) { | |
_local7 = ((_local3 + _local6.intValue()).toString(_arg1).substr(1) + _local7); | |
_local5.divRemTo(_local4, _local5, _local6); | |
}; | |
return ((_local6.intValue().toString(_arg1) + _local7)); | |
} | |
public function not():BigInteger{ | |
var _local1:BigInteger; | |
var _local2:int; | |
_local1 = new BigInteger(); | |
_local2 = 0; | |
while (_local2 < t) { | |
_local1[_local2] = (DM & ~(a[_local2])); | |
_local2++; | |
}; | |
_local1.t = t; | |
_local1.s = ~(s); | |
return (_local1); | |
} | |
bi_internal function subTo(_arg1:BigInteger, _arg2:BigInteger):void{ | |
var _local3:int; | |
var _local4:int; | |
var _local5:int; | |
_local3 = 0; | |
_local4 = 0; | |
_local5 = Math.min(_arg1.t, t); | |
while (_local3 < _local5) { | |
_local4 = (_local4 + (a[_local3] - _arg1.a[_local3])); | |
var _temp1 = _local3; | |
_local3 = (_local3 + 1); | |
var _local6 = _temp1; | |
_arg2.a[_local6] = (_local4 & DM); | |
_local4 = (_local4 >> DB); | |
}; | |
if (_arg1.t < t){ | |
_local4 = (_local4 - _arg1.s); | |
while (_local3 < t) { | |
_local4 = (_local4 + a[_local3]); | |
var _temp2 = _local3; | |
_local3 = (_local3 + 1); | |
_local6 = _temp2; | |
_arg2.a[_local6] = (_local4 & DM); | |
_local4 = (_local4 >> DB); | |
}; | |
_local4 = (_local4 + s); | |
} else { | |
_local4 = (_local4 + s); | |
while (_local3 < _arg1.t) { | |
_local4 = (_local4 - _arg1.a[_local3]); | |
var _temp3 = _local3; | |
_local3 = (_local3 + 1); | |
_local6 = _temp3; | |
_arg2.a[_local6] = (_local4 & DM); | |
_local4 = (_local4 >> DB); | |
}; | |
_local4 = (_local4 - _arg1.s); | |
}; | |
_arg2.s = ((_local4)<0) ? -1 : 0; | |
if (_local4 < -1){ | |
var _temp4 = _local3; | |
_local3 = (_local3 + 1); | |
_local6 = _temp4; | |
_arg2.a[_local6] = (DV + _local4); | |
} else { | |
if (_local4 > 0){ | |
var _temp5 = _local3; | |
_local3 = (_local3 + 1); | |
_local6 = _temp5; | |
_arg2.a[_local6] = _local4; | |
}; | |
}; | |
_arg2.t = _local3; | |
_arg2.clamp(); | |
} | |
public function clone():BigInteger{ | |
var _local1:BigInteger; | |
_local1 = new BigInteger(); | |
this.copyTo(_local1); | |
return (_local1); | |
} | |
public function pow(_arg1:int):BigInteger{ | |
return (exp(_arg1, new NullReduction())); | |
} | |
public function flipBit(_arg1:int):BigInteger{ | |
return (changeBit(_arg1, op_xor)); | |
} | |
public function xor(_arg1:BigInteger):BigInteger{ | |
var _local2:BigInteger; | |
_local2 = new BigInteger(); | |
bitwiseTo(_arg1, op_xor, _local2); | |
return (_local2); | |
} | |
public function or(_arg1:BigInteger):BigInteger{ | |
var _local2:BigInteger; | |
_local2 = new BigInteger(); | |
bitwiseTo(_arg1, op_or, _local2); | |
return (_local2); | |
} | |
public function max(_arg1:BigInteger):BigInteger{ | |
return (((compareTo(_arg1))>0) ? this : _arg1); | |
} | |
bi_internal function fromInt(_arg1:int):void{ | |
t = 1; | |
s = ((_arg1)<0) ? -1 : 0; | |
if (_arg1 > 0){ | |
a[0] = _arg1; | |
} else { | |
if (_arg1 < -1){ | |
a[0] = (_arg1 + DV); | |
} else { | |
t = 0; | |
}; | |
}; | |
} | |
bi_internal function isEven():Boolean{ | |
return ((((t)>0) ? (a[0] & 1) : s == 0)); | |
} | |
public function toString(_arg1:Number=16):String{ | |
var _local2:int; | |
var _local3:int; | |
var _local4:int; | |
var _local5:Boolean; | |
var _local6:String; | |
var _local7:int; | |
var _local8:int; | |
if (s < 0){ | |
return (("-" + negate().toString(_arg1))); | |
}; | |
switch (_arg1){ | |
case 2: | |
_local2 = 1; | |
break; | |
case 4: | |
_local2 = 2; | |
break; | |
case 8: | |
_local2 = 3; | |
break; | |
case 16: | |
_local2 = 4; | |
break; | |
case 32: | |
_local2 = 5; | |
break; | |
}; | |
_local3 = ((1 << _local2) - 1); | |
_local4 = 0; | |
_local5 = false; | |
_local6 = ""; | |
_local7 = t; | |
_local8 = (DB - ((_local7 * DB) % _local2)); | |
var _temp1 = _local7; | |
_local7 = (_local7 - 1); | |
if (_temp1 > 0){ | |
if ((((_local8 < DB)) && (((_local4 = (a[_local7] >> _local8)) > 0)))){ | |
_local5 = true; | |
_local6 = _local4.toString(36); | |
}; | |
while (_local7 >= 0) { | |
if (_local8 < _local2){ | |
_local4 = ((a[_local7] & ((1 << _local8) - 1)) << (_local2 - _local8)); | |
var _temp2 = _local4; | |
_local7 = (_local7 - 1); | |
_local8 = (_local8 + (DB - _local2)); | |
_local4 = (_temp2 | (a[_local7] >> _local8)); | |
} else { | |
_local8 = (_local8 - _local2); | |
_local4 = ((a[_local7] >> _local8) & _local3); | |
if (_local8 <= 0){ | |
_local8 = (_local8 + DB); | |
_local7--; | |
}; | |
}; | |
if (_local4 > 0){ | |
_local5 = true; | |
}; | |
if (_local5){ | |
_local6 = (_local6 + _local4.toString(36)); | |
}; | |
}; | |
}; | |
return (((_local5) ? _local6 : "0")); | |
} | |
public function setBit(_arg1:int):BigInteger{ | |
return (changeBit(_arg1, op_or)); | |
} | |
public function abs():BigInteger{ | |
return (((s)<0) ? negate() : this); | |
} | |
bi_internal function nbits(_arg1:int):int{ | |
var _local2:int; | |
var _local3:int; | |
_local2 = 1; | |
_local3 = (_arg1 >>> 16); | |
if (_local3 != 0){ | |
_arg1 = _local3; | |
_local2 = (_local2 + 16); | |
}; | |
_local3 = (_arg1 >> 8); | |
if (_local3 != 0){ | |
_arg1 = _local3; | |
_local2 = (_local2 + 8); | |
}; | |
_local3 = (_arg1 >> 4); | |
if (_local3 != 0){ | |
_arg1 = _local3; | |
_local2 = (_local2 + 4); | |
}; | |
_local3 = (_arg1 >> 2); | |
if (_local3 != 0){ | |
_arg1 = _local3; | |
_local2 = (_local2 + 2); | |
}; | |
_local3 = (_arg1 >> 1); | |
if (_local3 != 0){ | |
_arg1 = _local3; | |
_local2 = (_local2 + 1); | |
}; | |
return (_local2); | |
} | |
public function sigNum():int{ | |
if (s < 0){ | |
return (-1); | |
}; | |
if ((((t <= 0)) || ((((t == 1)) && ((a[0] <= 0)))))){ | |
return (0); | |
}; | |
return (1); | |
} | |
public function toByteArray():ByteArray{ | |
var _local1:int; | |
var _local2:ByteArray; | |
var _local3:int; | |
var _local4:int; | |
var _local5:int; | |
_local1 = t; | |
_local2 = new ByteArray(); | |
_local2[0] = s; | |
_local3 = (DB - ((_local1 * DB) % 8)); | |
_local5 = 0; | |
var _temp1 = _local1; | |
_local1 = (_local1 - 1); | |
if (_temp1 > 0){ | |
if ((((_local3 < DB)) && (!(((_local4 = (a[_local1] >> _local3)) == ((s & DM) >> _local3)))))){ | |
var _temp2 = _local5; | |
_local5 = (_local5 + 1); | |
var _local6 = _temp2; | |
_local2[_local6] = (_local4 | (s << (DB - _local3))); | |
}; | |
while (_local1 >= 0) { | |
if (_local3 < 8){ | |
_local4 = ((a[_local1] & ((1 << _local3) - 1)) << (8 - _local3)); | |
var _temp3 = _local4; | |
_local1 = (_local1 - 1); | |
_local3 = (_local3 + (DB - 8)); | |
_local4 = (_temp3 | (a[_local1] >> _local3)); | |
} else { | |
_local3 = (_local3 - 8); | |
_local4 = ((a[_local1] >> _local3) & 0xFF); | |
if (_local3 <= 0){ | |
_local3 = (_local3 + DB); | |
_local1--; | |
}; | |
}; | |
if ((_local4 & 128) != 0){ | |
_local4 = (_local4 | -256); | |
}; | |
if ((((_local5 == 0)) && (!(((s & 128) == (_local4 & 128)))))){ | |
_local5++; | |
}; | |
if ((((_local5 > 0)) || (!((_local4 == s))))){ | |
var _temp4 = _local5; | |
_local5 = (_local5 + 1); | |
_local6 = _temp4; | |
_local2[_local6] = _local4; | |
}; | |
}; | |
}; | |
return (_local2); | |
} | |
bi_internal function squareTo(_arg1:BigInteger):void{ | |
var _local2:BigInteger; | |
var _local3:int; | |
var _local4:int; | |
_local2 = abs(); | |
_local3 = (_arg1.t = (2 * _local2.t)); | |
while (--_local3 >= 0) { | |
_arg1.a[_local3] = 0; | |
}; | |
_local3 = 0; | |
while (_local3 < (_local2.t - 1)) { | |
_local4 = _local2.am(_local3, _local2.a[_local3], _arg1, (2 * _local3), 0, 1); | |
if ((_arg1.a[(_local3 + _local2.t)] = (_arg1.a[(_local3 + _local2.t)] + _local2.am((_local3 + 1), (2 * _local2.a[_local3]), _arg1, ((2 * _local3) + 1), _local4, ((_local2.t - _local3) - 1)))) >= DV){ | |
_arg1.a[(_local3 + _local2.t)] = (_arg1.a[(_local3 + _local2.t)] - DV); | |
_arg1.a[((_local3 + _local2.t) + 1)] = 1; | |
}; | |
_local3++; | |
}; | |
if (_arg1.t > 0){ | |
_arg1.a[(_arg1.t - 1)] = (_arg1.a[(_arg1.t - 1)] + _local2.am(_local3, _local2.a[_local3], _arg1, (2 * _local3), 0, 1)); | |
}; | |
_arg1.s = 0; | |
_arg1.clamp(); | |
} | |
private function op_and(_arg1:int, _arg2:int):int{ | |
return ((_arg1 & _arg2)); | |
} | |
protected function fromRadix(_arg1:String, _arg2:int=10):void{ | |
var _local3:int; | |
var _local4:Number; | |
var _local5:Boolean; | |
var _local6:int; | |
var _local7:int; | |
var _local8:int; | |
var _local9:int; | |
fromInt(0); | |
_local3 = chunkSize(_arg2); | |
_local4 = Math.pow(_arg2, _local3); | |
_local5 = false; | |
_local6 = 0; | |
_local7 = 0; | |
_local8 = 0; | |
while (_local8 < _arg1.length) { | |
_local9 = intAt(_arg1, _local8); | |
if (_local9 < 0){ | |
if ((((_arg1.charAt(_local8) == "-")) && ((sigNum() == 0)))){ | |
_local5 = true; | |
}; | |
} else { | |
_local7 = ((_arg2 * _local7) + _local9); | |
++_local6; | |
if (_local6 >= _local3){ | |
dMultiply(_local4); | |
dAddOffset(_local7, 0); | |
_local6 = 0; | |
_local7 = 0; | |
}; | |
}; | |
_local8++; | |
}; | |
if (_local6 > 0){ | |
dMultiply(Math.pow(_arg2, _local6)); | |
dAddOffset(_local7, 0); | |
}; | |
if (_local5){ | |
BigInteger.ZERO.subTo(this, this); | |
}; | |
} | |
bi_internal function dlShiftTo(_arg1:int, _arg2:BigInteger):void{ | |
var _local3:int; | |
_local3 = (t - 1); | |
while (_local3 >= 0) { | |
_arg2.a[(_local3 + _arg1)] = a[_local3]; | |
_local3--; | |
}; | |
_local3 = (_arg1 - 1); | |
while (_local3 >= 0) { | |
_arg2.a[_local3] = 0; | |
_local3--; | |
}; | |
_arg2.t = (t + _arg1); | |
_arg2.s = s; | |
} | |
private function op_xor(_arg1:int, _arg2:int):int{ | |
return ((_arg1 ^ _arg2)); | |
} | |
} | |
}//package com.hurlant.math | |
package com.hurlant.math { | |
import com.hurlant.math.*; | |
class MontgomeryReduction implements IReduction { | |
private var um:int; | |
private var mp:int; | |
private var mph:int; | |
private var mpl:int; | |
private var mt2:int; | |
private var m:BigInteger; | |
public function MontgomeryReduction(_arg1:BigInteger){ | |
this.m = _arg1; | |
mp = _arg1.invDigit(); | |
mpl = (mp & 32767); | |
mph = (mp >> 15); | |
um = ((1 << (BigInteger.DB - 15)) - 1); | |
mt2 = (2 * _arg1.t); | |
} | |
public function mulTo(_arg1:BigInteger, _arg2:BigInteger, _arg3:BigInteger):void{ | |
_arg1.multiplyTo(_arg2, _arg3); | |
reduce(_arg3); | |
} | |
public function revert(_arg1:BigInteger):BigInteger{ | |
var _local2:BigInteger; | |
_local2 = new BigInteger(); | |
_arg1.copyTo(_local2); | |
reduce(_local2); | |
return (_local2); | |
} | |
public function convert(_arg1:BigInteger):BigInteger{ | |
var _local2:BigInteger; | |
_local2 = new BigInteger(); | |
_arg1.abs().dlShiftTo(m.t, _local2); | |
_local2.divRemTo(m, null, _local2); | |
if ((((_arg1.s < 0)) && ((_local2.compareTo(BigInteger.ZERO) > 0)))){ | |
m.subTo(_local2, _local2); | |
}; | |
return (_local2); | |
} | |
public function reduce(_arg1:BigInteger):void{ | |
var _local2:int; | |
var _local3:int; | |
var _local4:int; | |
while (_arg1.t <= mt2) { | |
var _local5 = _arg1.t++; | |
_arg1.a[_local5] = 0; | |
}; | |
_local2 = 0; | |
while (_local2 < m.t) { | |
_local3 = (_arg1.a[_local2] & 32767); | |
_local4 = (((_local3 * mpl) + ((((_local3 * mph) + ((_arg1.a[_local2] >> 15) * mpl)) & um) << 15)) & BigInteger.DM); | |
_local3 = (_local2 + m.t); | |
_arg1.a[_local3] = (_arg1.a[_local3] + m.am(0, _local4, _arg1, _local2, 0, m.t)); | |
while (_arg1.a[_local3] >= BigInteger.DV) { | |
_arg1.a[_local3] = (_arg1.a[_local3] - BigInteger.DV); | |
_local5 = _arg1.a; | |
++_local3; | |
var _local6 = _local3; | |
var _local7 = (_local5[_local6] + 1); | |
_local5[_local6] = _local7; | |
}; | |
_local2++; | |
}; | |
_arg1.clamp(); | |
_arg1.drShiftTo(m.t, _arg1); | |
if (_arg1.compareTo(m) >= 0){ | |
_arg1.subTo(m, _arg1); | |
}; | |
} | |
public function sqrTo(_arg1:BigInteger, _arg2:BigInteger):void{ | |
_arg1.squareTo(_arg2); | |
reduce(_arg2); | |
} | |
} | |
}//package com.hurlant.math | |
package com.google.analytics.v4 { | |
import com.google.analytics.core.*; | |
import com.google.analytics.debug.*; | |
import com.google.analytics.utils.*; | |
import com.google.analytics.campaign.*; | |
public class Configuration { | |
public var serverMode:ServerOperationMode; | |
public var detectFlash:Boolean = true; | |
public var hasSiteOverlay:Boolean = false; | |
public var allowLocalTracking:Boolean = true; | |
public var secureRemoteGIFpath:String = "https://ssl.google-analytics.com/__utm.gif"; | |
private var _version:String = "4.3as"; | |
public var allowDomainHash:Boolean = true; | |
public var detectClientInfo:Boolean = true; | |
public var idleLoop:Number = 30; | |
public var isTrackOutboundSubdomains:Boolean = false; | |
public var cookiePath:String = "/"; | |
public var transactionFieldDelim:String = "|"; | |
private var _organic:Organic; | |
private var _cookieName:String = "analytics"; | |
public var campaignKey:CampaignKey; | |
public var google:String = "google"; | |
public var googleCsePath:String = "cse"; | |
public var bucketCapacity:Number = 10; | |
private var _sampleRate:Number = 1; | |
public var remoteGIFpath:String = "http://www.google-analytics.com/__utm.gif"; | |
public var googleSearchParam:String = "q"; | |
public var allowLinker:Boolean = false; | |
public var maxOutboundLinkExamined:Number = 1000; | |
private var _debug:DebugConfiguration; | |
public var allowAnchor:Boolean = false; | |
private var _domain:Domain; | |
private var _trackingLimitPerSession:int = 500; | |
public var tokenCliff:int = 10; | |
public var sessionTimeout:Number; | |
public var idleTimeout:Number = 60; | |
public var campaignTracking:Boolean = true; | |
public var domainName:String = ""; | |
public var detectTitle:Boolean = true; | |
public var tokenRate:Number = 0.2; | |
public var conversionTimeout:Number; | |
public var localGIFpath:String = "/__utm.gif"; | |
public function Configuration(_arg1:DebugConfiguration=null){ | |
_organic = new Organic(); | |
conversionTimeout = Timespan.sixmonths; | |
sessionTimeout = Timespan.thirtyminutes; | |
campaignKey = new CampaignKey(); | |
serverMode = ServerOperationMode.remote; | |
super(); | |
_debug = _arg1; | |
_domain = new Domain(DomainNameMode.auto, "", _debug); | |
serverMode = ServerOperationMode.remote; | |
_initOrganicSources(); | |
} | |
public function get organic():Organic{ | |
return (_organic); | |
} | |
public function get cookieName():String{ | |
return (_cookieName); | |
} | |
public function get trackingLimitPerSession():int{ | |
return (_trackingLimitPerSession); | |
} | |
private function _initOrganicSources():void{ | |
addOrganicSource(google, googleSearchParam); | |
addOrganicSource("yahoo", "p"); | |
addOrganicSource("msn", "q"); | |
addOrganicSource("aol", "query"); | |
addOrganicSource("aol", "encquery"); | |
addOrganicSource("lycos", "query"); | |
addOrganicSource("ask", "q"); | |
addOrganicSource("altavista", "q"); | |
addOrganicSource("netscape", "query"); | |
addOrganicSource("cnn", "query"); | |
addOrganicSource("looksmart", "qt"); | |
addOrganicSource("about", "terms"); | |
addOrganicSource("mamma", "query"); | |
addOrganicSource("alltheweb", "q"); | |
addOrganicSource("gigablast", "q"); | |
addOrganicSource("voila", "rdata"); | |
addOrganicSource("virgilio", "qs"); | |
addOrganicSource("live", "q"); | |
addOrganicSource("baidu", "wd"); | |
addOrganicSource("alice", "qs"); | |
addOrganicSource("yandex", "text"); | |
addOrganicSource("najdi", "q"); | |
addOrganicSource("aol", "q"); | |
addOrganicSource("club-internet", "q"); | |
addOrganicSource("mama", "query"); | |
addOrganicSource("seznam", "q"); | |
addOrganicSource("search", "q"); | |
addOrganicSource("wp", "szukaj"); | |
addOrganicSource("onet", "qt"); | |
addOrganicSource("netsprint", "q"); | |
addOrganicSource("google.interia", "q"); | |
addOrganicSource("szukacz", "q"); | |
addOrganicSource("yam", "k"); | |
addOrganicSource("pchome", "q"); | |
addOrganicSource("kvasir", "searchExpr"); | |
addOrganicSource("sesam", "q"); | |
addOrganicSource("ozu", "q"); | |
addOrganicSource("terra", "query"); | |
addOrganicSource("nostrum", "query"); | |
addOrganicSource("mynet", "q"); | |
addOrganicSource("ekolay", "q"); | |
addOrganicSource("search.ilse", "search_for"); | |
} | |
public function get sampleRate():Number{ | |
return (_sampleRate); | |
} | |
public function addOrganicSource(_arg1:String, _arg2:String):void{ | |
var engine:* = _arg1; | |
var keyword:* = _arg2; | |
try { | |
_organic.addSource(engine, keyword); | |
} catch(e:Error) { | |
if (((_debug) && (_debug.active))){ | |
_debug.warning(e.message); | |
}; | |
}; | |
} | |
public function get domain():Domain{ | |
return (_domain); | |
} | |
public function set sampleRate(_arg1:Number):void{ | |
if (_arg1 <= 0){ | |
_arg1 = 0.1; | |
}; | |
if (_arg1 > 1){ | |
_arg1 = 1; | |
}; | |
_arg1 = Number(_arg1.toFixed(2)); | |
_sampleRate = _arg1; | |
} | |
public function get version():String{ | |
return (_version); | |
} | |
} | |
}//package com.google.analytics.v4 | |
package com.google.analytics.v4 { | |
import com.google.analytics.core.*; | |
public interface GoogleAnalyticsAPI { | |
function setCampSourceKey(_arg1:String):void; | |
function getServiceMode():ServerOperationMode; | |
function resetSession():void; | |
function setLocalServerMode():void; | |
function setCampContentKey(_arg1:String):void; | |
function addOrganic(_arg1:String, _arg2:String):void; | |
function setDetectFlash(_arg1:Boolean):void; | |
function addTrans(_arg1:String, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:String, _arg7:String, _arg8:String):Object; | |
function trackEvent(_arg1:String, _arg2:String, _arg3:String=null, _arg4:Number=NaN):Boolean; | |
function setCampTermKey(_arg1:String):void; | |
function setCampNameKey(_arg1:String):void; | |
function addIgnoredOrganic(_arg1:String):void; | |
function addItem(_arg1:String, _arg2:String, _arg3:String, _arg4:String, _arg5:Number, _arg6:int):void; | |
function setAllowLinker(_arg1:Boolean):void; | |
function getClientInfo():Boolean; | |
function getDetectFlash():Boolean; | |
function setCampaignTrack(_arg1:Boolean):void; | |
function createEventTracker(_arg1:String):EventTracker; | |
function setCookieTimeout(_arg1:int):void; | |
function setAllowAnchor(_arg1:Boolean):void; | |
function trackTrans():void; | |
function clearOrganic():void; | |
function trackPageview(_arg1:String=""):void; | |
function setLocalGifPath(_arg1:String):void; | |
function getVersion():String; | |
function getLocalGifPath():String; | |
function setVar(_arg1:String):void; | |
function clearIgnoredOrganic():void; | |
function setCampMediumKey(_arg1:String):void; | |
function addIgnoredRef(_arg1:String):void; | |
function setClientInfo(_arg1:Boolean):void; | |
function setCookiePath(_arg1:String):void; | |
function setSampleRate(_arg1:Number):void; | |
function setSessionTimeout(_arg1:int):void; | |
function setRemoteServerMode():void; | |
function clearIgnoredRef():void; | |
function setDomainName(_arg1:String):void; | |
function setDetectTitle(_arg1:Boolean):void; | |
function setAllowHash(_arg1:Boolean):void; | |
function getAccount():String; | |
function linkByPost(_arg1:Object, _arg2:Boolean=false):void; | |
function link(_arg1:String, _arg2:Boolean=false):void; | |
function setCampNOKey(_arg1:String):void; | |
function setLocalRemoteServerMode():void; | |
function cookiePathCopy(_arg1:String):void; | |
function getDetectTitle():Boolean; | |
} | |
}//package com.google.analytics.v4 | |
package com.google.analytics.v4 { | |
import com.google.analytics.core.*; | |
import com.google.analytics.debug.*; | |
import com.google.analytics.external.*; | |
public class Bridge implements GoogleAnalyticsAPI { | |
private static var _linkTrackingObject_js:XML = <script> | |
<![CDATA[ | |
function( container , target ) | |
{ | |
var targets ; | |
var name ; | |
if( target.indexOf(".") > 0 ) | |
{ | |
targets = target.split("."); | |
name = targets.pop(); | |
} | |
else | |
{ | |
targets = []; | |
name = target; | |
} | |
var ref = window; | |
var depth = targets.length; | |
for( var j = 0 ; j < depth ; j++ ) | |
{ | |
ref = ref[ targets[j] ] ; | |
} | |
window[container][target] = ref[name] ; | |
} | |
]]> | |
</script> | |
; | |
private static var _createTrackingObject_js:XML = <script> | |
<![CDATA[ | |
function( acct ) | |
{ | |
_GATracker[acct] = _gat._getTracker(acct); | |
} | |
]]> | |
</script> | |
; | |
private static var _injectTrackingObject_js:XML = <script> | |
<![CDATA[ | |
function() | |
{ | |
try | |
{ | |
_GATracker | |
} | |
catch(e) | |
{ | |
_GATracker = {}; | |
} | |
} | |
]]> | |
</script> | |
; | |
private static var _checkGAJS_js:XML = <script> | |
<![CDATA[ | |
function() | |
{ | |
if( _gat && _gat._getTracker ) | |
{ | |
return true; | |
} | |
return false; | |
} | |
]]> | |
</script> | |
; | |
private static var _checkValidTrackingObject_js:XML = <script> | |
<![CDATA[ | |
function(acct) | |
{ | |
if( _GATracker[acct] && (_GATracker[acct]._getAccount) ) | |
{ | |
return true ; | |
} | |
else | |
{ | |
return false; | |
} | |
} | |
]]> | |
</script> | |
; | |
private var _debug:DebugConfiguration; | |
private var _proxy:JavascriptProxy; | |
private var _jsContainer:String = "_GATracker"; | |
private var _hasGATracker:Boolean = false; | |
private var _account:String; | |
public function Bridge(_arg1:String, _arg2:DebugConfiguration, _arg3:JavascriptProxy){ | |
var _local4:String; | |
var _local5:String; | |
var _local6:String; | |
super(); | |
_account = _arg1; | |
_debug = _arg2; | |
_proxy = _arg3; | |
if (!_checkGAJS()){ | |
_local4 = ""; | |
_local4 = (_local4 + "ga.js not found, be sure to check if\n"); | |
_local4 = (_local4 + "<script src=\"http://www.google-analytics.com/ga.js\"></script>\n"); | |
_local4 = (_local4 + "is included in the HTML."); | |
_debug.warning(_local4); | |
throw (new Error(_local4)); | |
}; | |
if (!_hasGATracker){ | |
if (((_debug.javascript) && (_debug.verbose))){ | |
_local5 = ""; | |
_local5 = (_local5 + "The Google Analytics tracking code was not found on the container page\n"); | |
_local5 = (_local5 + "we create it"); | |
_debug.info(_local5, VisualDebugMode.advanced); | |
}; | |
_injectTrackingObject(); | |
}; | |
if (Utils.validateAccount(_arg1)){ | |
_createTrackingObject(_arg1); | |
} else { | |
if (_checkTrackingObject(_arg1)){ | |
_linkTrackingObject(_arg1); | |
} else { | |
_local6 = ""; | |
_local6 = (_local6 + (("JS Object \"" + _arg1) + "\" doesn't exist in DOM\n")); | |
_local6 = (_local6 + "Bridge object not created."); | |
_debug.warning(_local6); | |
throw (new Error(_local6)); | |
}; | |
}; | |
} | |
public function link(_arg1:String, _arg2:Boolean=false):void{ | |
_debug.info((((("link( " + _arg1) + ", ") + _arg2) + " )")); | |
_call("_link", _arg1, _arg2); | |
} | |
public function addOrganic(_arg1:String, _arg2:String):void{ | |
_debug.info((("addOrganic( " + [_arg1, _arg2].join(", ")) + " )")); | |
_call("_addOrganic", _arg1); | |
} | |
public function setAllowLinker(_arg1:Boolean):void{ | |
_debug.info((("setAllowLinker( " + _arg1) + " )")); | |
_call("_setAllowLinker", _arg1); | |
} | |
private function _linkTrackingObject(_arg1:String):void{ | |
_proxy.call(_linkTrackingObject_js, _jsContainer, _arg1); | |
} | |
public function trackEvent(_arg1:String, _arg2:String, _arg3:String=null, _arg4:Number=NaN):Boolean{ | |
var _local5 = 2; | |
if (((_arg3) && (!((_arg3 == ""))))){ | |
_local5 = 3; | |
}; | |
if ((((_local5 == 3)) && (!(isNaN(_arg4))))){ | |
_local5 = 4; | |
}; | |
switch (_local5){ | |
case 4: | |
_debug.info((("trackEvent( " + [_arg1, _arg2, _arg3, _arg4].join(", ")) + " )")); | |
return (_call("_trackEvent", _arg1, _arg2, _arg3, _arg4)); | |
case 3: | |
_debug.info((("trackEvent( " + [_arg1, _arg2, _arg3].join(", ")) + " )")); | |
return (_call("_trackEvent", _arg1, _arg2, _arg3)); | |
case 2: | |
default: | |
_debug.info((("trackEvent( " + [_arg1, _arg2].join(", ")) + " )")); | |
return (_call("_trackEvent", _arg1, _arg2)); | |
}; | |
} | |
public function setClientInfo(_arg1:Boolean):void{ | |
_debug.info((("setClientInfo( " + _arg1) + " )")); | |
_call("_setClientInfo", _arg1); | |
} | |
public function trackTrans():void{ | |
_debug.info("trackTrans()"); | |
_call("_trackTrans"); | |
} | |
public function setCookieTimeout(_arg1:int):void{ | |
_debug.info((("setCookieTimeout( " + _arg1) + " )")); | |
_call("_setCookieTimeout", _arg1); | |
} | |
public function trackPageview(_arg1:String=""):void{ | |
_debug.info((("trackPageview( " + _arg1) + " )")); | |
_call("_trackPageview", _arg1); | |
} | |
public function getClientInfo():Boolean{ | |
_debug.info("getClientInfo()"); | |
return (_call("_getClientInfo")); | |
} | |
private function _checkValidTrackingObject(_arg1:String):Boolean{ | |
return (_proxy.call(_checkValidTrackingObject_js, _arg1)); | |
} | |
private function _checkGAJS():Boolean{ | |
return (_proxy.call(_checkGAJS_js)); | |
} | |
public function linkByPost(_arg1:Object, _arg2:Boolean=false):void{ | |
_debug.warning((((("linkByPost( " + _arg1) + ", ") + _arg2) + " ) not implemented")); | |
} | |
private function _call(_arg1:String, ... _args){ | |
_args.unshift(((((("window." + _jsContainer) + "[\"") + _account) + "\"].") + _arg1)); | |
return (_proxy.call.apply(_proxy, _args)); | |
} | |
public function hasGAJS():Boolean{ | |
return (_checkGAJS()); | |
} | |
private function _checkTrackingObject(_arg1:String):Boolean{ | |
var _local2:Boolean = _proxy.hasProperty(_arg1); | |
var _local3:Boolean = _proxy.hasProperty((_arg1 + "._getAccount")); | |
return (((_local2) && (_local3))); | |
} | |
public function resetSession():void{ | |
_debug.warning("resetSession() not implemented"); | |
} | |
public function getDetectTitle():Boolean{ | |
_debug.info("getDetectTitle()"); | |
return (_call("_getDetectTitle")); | |
} | |
public function setCampNameKey(_arg1:String):void{ | |
_debug.info((("setCampNameKey( " + _arg1) + " )")); | |
_call("_setCampNameKey", _arg1); | |
} | |
public function setDetectFlash(_arg1:Boolean):void{ | |
_debug.info((("setDetectFlash( " + _arg1) + " )")); | |
_call("_setDetectFlash", _arg1); | |
} | |
public function createEventTracker(_arg1:String):EventTracker{ | |
_debug.info((("createEventTracker( " + _arg1) + " )")); | |
return (new EventTracker(_arg1, this)); | |
} | |
public function addItem(_arg1:String, _arg2:String, _arg3:String, _arg4:String, _arg5:Number, _arg6:int):void{ | |
_debug.info((("addItem( " + [_arg1, _arg2, _arg3, _arg4, _arg5, _arg6].join(", ")) + " )")); | |
_call("_addItem", _arg1, _arg2, _arg3, _arg4, _arg5, _arg6); | |
} | |
public function clearIgnoredOrganic():void{ | |
_debug.info("clearIgnoredOrganic()"); | |
_call("_clearIgnoreOrganic"); | |
} | |
public function setVar(_arg1:String):void{ | |
_debug.info((("setVar( " + _arg1) + " )")); | |
_call("_setVar", _arg1); | |
} | |
public function setDomainName(_arg1:String):void{ | |
_debug.info((("setDomainName( " + _arg1) + " )")); | |
_call("_setDomainName", _arg1); | |
} | |
public function hasTrackingAccount(_arg1:String):Boolean{ | |
if (Utils.validateAccount(_arg1)){ | |
return (_checkValidTrackingObject(_arg1)); | |
}; | |
return (_checkTrackingObject(_arg1)); | |
} | |
public function setCampSourceKey(_arg1:String):void{ | |
_debug.info((("setCampSourceKey( " + _arg1) + " )")); | |
_call("_setCampSourceKey", _arg1); | |
} | |
public function addTrans(_arg1:String, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:String, _arg7:String, _arg8:String):Object{ | |
_debug.info((("addTrans( " + [_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8].join(", ")) + " )")); | |
_call("_addTrans", _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8); | |
return (null); | |
} | |
public function setCampContentKey(_arg1:String):void{ | |
_debug.info((("setCampContentKey( " + _arg1) + " )")); | |
_call("_setCampContentKey", _arg1); | |
} | |
public function setLocalServerMode():void{ | |
_debug.info("setLocalServerMode()"); | |
_call("_setLocalServerMode"); | |
} | |
public function getLocalGifPath():String{ | |
_debug.info("getLocalGifPath()"); | |
return (_call("_getLocalGifPath")); | |
} | |
public function clearIgnoredRef():void{ | |
_debug.info("clearIgnoredRef()"); | |
_call("_clearIgnoreRef"); | |
} | |
public function setAllowAnchor(_arg1:Boolean):void{ | |
_debug.info((("setAllowAnchor( " + _arg1) + " )")); | |
_call("_setAllowAnchor", _arg1); | |
} | |
public function setLocalGifPath(_arg1:String):void{ | |
_debug.info((("setLocalGifPath( " + _arg1) + " )")); | |
_call("_setLocalGifPath", _arg1); | |
} | |
public function getVersion():String{ | |
_debug.info("getVersion()"); | |
return (_call("_getVersion")); | |
} | |
private function _injectTrackingObject():void{ | |
_proxy.executeBlock(_injectTrackingObject_js); | |
_hasGATracker = true; | |
} | |
public function setCookiePath(_arg1:String):void{ | |
_debug.info((("setCookiePath( " + _arg1) + " )")); | |
_call("_setCookiePath", _arg1); | |
} | |
public function setSampleRate(_arg1:Number):void{ | |
_debug.info((("setSampleRate( " + _arg1) + " )")); | |
_call("_setSampleRate", _arg1); | |
} | |
public function setAllowHash(_arg1:Boolean):void{ | |
_debug.info((("setAllowHash( " + _arg1) + " )")); | |
_call("_setAllowHash", _arg1); | |
} | |
public function addIgnoredOrganic(_arg1:String):void{ | |
_debug.info((("addIgnoredOrganic( " + _arg1) + " )")); | |
_call("_addIgnoredOrganic", _arg1); | |
} | |
public function setCampNOKey(_arg1:String):void{ | |
_debug.info((("setCampNOKey( " + _arg1) + " )")); | |
_call("_setCampNOKey", _arg1); | |
} | |
public function cookiePathCopy(_arg1:String):void{ | |
_debug.info((("cookiePathCopy( " + _arg1) + " )")); | |
_call("_cookiePathCopy", _arg1); | |
} | |
public function setLocalRemoteServerMode():void{ | |
_debug.info("setLocalRemoteServerMode()"); | |
_call("_setLocalRemoteServerMode"); | |
} | |
public function getServiceMode():ServerOperationMode{ | |
_debug.info("getServiceMode()"); | |
return (_call("_getServiceMode")); | |
} | |
public function setDetectTitle(_arg1:Boolean):void{ | |
_debug.info((("setDetectTitle( " + _arg1) + " )")); | |
_call("_setDetectTitle", _arg1); | |
} | |
private function _createTrackingObject(_arg1:String):void{ | |
_proxy.call(_createTrackingObject_js, _arg1); | |
} | |
public function setCampaignTrack(_arg1:Boolean):void{ | |
_debug.info((("setCampaignTrack( " + _arg1) + " )")); | |
_call("_setCampaignTrack", _arg1); | |
} | |
public function clearOrganic():void{ | |
_debug.info("clearOrganic()"); | |
_call("_clearOrganic"); | |
} | |
public function setCampTermKey(_arg1:String):void{ | |
_debug.info((("setCampTermKey( " + _arg1) + " )")); | |
_call("_setCampTermKey", _arg1); | |
} | |
public function getDetectFlash():Boolean{ | |
_debug.info("getDetectFlash()"); | |
return (_call("_getDetectFlash")); | |
} | |
public function setCampMediumKey(_arg1:String):void{ | |
_debug.info((("setCampMediumKey( " + _arg1) + " )")); | |
_call("_setCampMediumKey", _arg1); | |
} | |
public function addIgnoredRef(_arg1:String):void{ | |
_debug.info((("addIgnoredRef( " + _arg1) + " )")); | |
_call("_addIgnoredRef", _arg1); | |
} | |
public function setSessionTimeout(_arg1:int):void{ | |
_debug.info((("setSessionTimeout( " + _arg1) + " )")); | |
_call("_setSessionTimeout", _arg1); | |
} | |
public function setRemoteServerMode():void{ | |
_debug.info("setRemoteServerMode()"); | |
_call("_setRemoteServerMode"); | |
} | |
public function getAccount():String{ | |
_debug.info("getAccount()"); | |
return (_call("_getAccount")); | |
} | |
} | |
}//package com.google.analytics.v4 | |
package com.google.analytics.v4 { | |
import com.google.analytics.core.*; | |
import com.google.analytics.debug.*; | |
import com.google.analytics.external.*; | |
import com.google.analytics.utils.*; | |
import com.google.analytics.data.*; | |
import com.google.analytics.campaign.*; | |
public class Tracker implements GoogleAnalyticsAPI { | |
private const EVENT_TRACKER_LABEL_KEY_NUM:int = 3; | |
private const EVENT_TRACKER_VALUE_VALUE_NUM:int = 1; | |
private const EVENT_TRACKER_PROJECT_ID:int = 5; | |
private const EVENT_TRACKER_OBJECT_NAME_KEY_NUM:int = 1; | |
private const EVENT_TRACKER_TYPE_KEY_NUM:int = 2; | |
private var _adSense:AdSenseGlobals; | |
private var _eventTracker:X10; | |
private var _noSessionInformation:Boolean = false; | |
private var _browserInfo:BrowserInfo; | |
private var _debug:DebugConfiguration; | |
private var _isNewVisitor:Boolean = false; | |
private var _buffer:Buffer; | |
private var _config:Configuration; | |
private var _x10Module:X10; | |
private var _campaign:CampaignManager; | |
private var _formatedReferrer:String; | |
private var _timeStamp:Number; | |
private var _info:Environment; | |
private var _domainHash:Number; | |
private var _campaignInfo:CampaignInfo; | |
private var _gifRequest:GIFRequest; | |
private var _hasInitData:Boolean = false; | |
private var _account:String; | |
public function Tracker(_arg1:String, _arg2:Configuration, _arg3:DebugConfiguration, _arg4:Environment, _arg5:Buffer, _arg6:GIFRequest, _arg7:AdSenseGlobals){ | |
var _local8:String; | |
super(); | |
_account = _arg1; | |
_config = _arg2; | |
_debug = _arg3; | |
_info = _arg4; | |
_buffer = _arg5; | |
_gifRequest = _arg6; | |
_adSense = _arg7; | |
if (!Utils.validateAccount(_arg1)){ | |
_local8 = (("Account \"" + _arg1) + "\" is not valid."); | |
_debug.warning(_local8); | |
throw (new Error(_local8)); | |
}; | |
_initData(); | |
} | |
private function _doTracking():Boolean{ | |
if (((((!((_info.protocol == Protocols.file))) && (!((_info.protocol == Protocols.none))))) && (_isNotGoogleSearch()))){ | |
return (true); | |
}; | |
if (_config.allowLocalTracking){ | |
return (true); | |
}; | |
return (false); | |
} | |
public function addOrganic(_arg1:String, _arg2:String):void{ | |
_debug.info((("addOrganic( " + [_arg1, _arg2].join(", ")) + " )")); | |
_config.organic.addSource(_arg1, _arg2); | |
} | |
public function setAllowLinker(_arg1:Boolean):void{ | |
_config.allowLinker = _arg1; | |
_debug.info((("setAllowLinker( " + _config.allowLinker) + " )")); | |
} | |
public function trackEvent(_arg1:String, _arg2:String, _arg3:String=null, _arg4:Number=NaN):Boolean{ | |
var _local5:Boolean; | |
var _local6 = 2; | |
if (((!((_arg1 == ""))) && (!((_arg2 == ""))))){ | |
_eventTracker.clearKey(EVENT_TRACKER_PROJECT_ID); | |
_eventTracker.clearValue(EVENT_TRACKER_PROJECT_ID); | |
_local5 = _eventTracker.setKey(EVENT_TRACKER_PROJECT_ID, EVENT_TRACKER_OBJECT_NAME_KEY_NUM, _arg1); | |
_local5 = _eventTracker.setKey(EVENT_TRACKER_PROJECT_ID, EVENT_TRACKER_TYPE_KEY_NUM, _arg2); | |
if (((_arg3) && (!((_arg3 == ""))))){ | |
_local5 = _eventTracker.setKey(EVENT_TRACKER_PROJECT_ID, EVENT_TRACKER_LABEL_KEY_NUM, _arg3); | |
_local6 = 3; | |
if (!isNaN(_arg4)){ | |
_local5 = _eventTracker.setValue(EVENT_TRACKER_PROJECT_ID, EVENT_TRACKER_VALUE_VALUE_NUM, _arg4); | |
_local6 = 4; | |
}; | |
}; | |
if (_local5){ | |
_debug.info(((("valid event tracking call\ncategory: " + _arg1) + "\naction: ") + _arg2), VisualDebugMode.geek); | |
_sendXEvent(_eventTracker); | |
}; | |
} else { | |
_debug.warning(((("event tracking call is not valid, failed!\ncategory: " + _arg1) + "\naction: ") + _arg2), VisualDebugMode.geek); | |
_local5 = false; | |
}; | |
switch (_local6){ | |
case 4: | |
_debug.info((("trackEvent( " + [_arg1, _arg2, _arg3, _arg4].join(", ")) + " )")); | |
break; | |
case 3: | |
_debug.info((("trackEvent( " + [_arg1, _arg2, _arg3].join(", ")) + " )")); | |
break; | |
case 2: | |
default: | |
_debug.info((("trackEvent( " + [_arg1, _arg2].join(", ")) + " )")); | |
}; | |
return (_local5); | |
} | |
public function trackPageview(_arg1:String=""):void{ | |
_debug.info((("trackPageview( " + _arg1) + " )")); | |
if (_doTracking()){ | |
_initData(); | |
_trackMetrics(_arg1); | |
_noSessionInformation = false; | |
} else { | |
_debug.warning((("trackPageview( " + _arg1) + " ) failed")); | |
}; | |
} | |
public function setCookieTimeout(_arg1:int):void{ | |
_config.conversionTimeout = _arg1; | |
_debug.info((("setCookieTimeout( " + _config.conversionTimeout) + " )")); | |
} | |
public function trackTrans():void{ | |
_debug.warning("trackTrans() not implemented"); | |
} | |
public function setClientInfo(_arg1:Boolean):void{ | |
_config.detectClientInfo = _arg1; | |
_debug.info((("setClientInfo( " + _config.detectClientInfo) + " )")); | |
} | |
public function linkByPost(_arg1:Object, _arg2:Boolean=false):void{ | |
_debug.warning((("linkByPost( " + [_arg1, _arg2].join(", ")) + " ) not implemented")); | |
} | |
private function _initData():void{ | |
var _local1:String; | |
var _local2:String; | |
if (!_hasInitData){ | |
_updateDomainName(); | |
_domainHash = _getDomainHash(); | |
_timeStamp = Math.round((new Date().getTime() / 1000)); | |
if (_debug.verbose){ | |
_local1 = ""; | |
_local1 = (_local1 + "_initData 0"); | |
_local1 = (_local1 + ("\ndomain name: " + _config.domainName)); | |
_local1 = (_local1 + ("\ndomain hash: " + _domainHash)); | |
_local1 = (_local1 + (((("\ntimestamp: " + _timeStamp) + " (") + new Date((_timeStamp * 1000))) + ")")); | |
_debug.info(_local1, VisualDebugMode.geek); | |
}; | |
}; | |
if (_doTracking()){ | |
_handleCookie(); | |
}; | |
if (!_hasInitData){ | |
if (_doTracking()){ | |
_formatedReferrer = _formatReferrer(); | |
_browserInfo = new BrowserInfo(_config, _info); | |
_debug.info(("browserInfo: " + _browserInfo.toURLString()), VisualDebugMode.advanced); | |
if (_config.campaignTracking){ | |
_campaign = new CampaignManager(_config, _debug, _buffer, _domainHash, _formatedReferrer, _timeStamp); | |
_campaignInfo = _campaign.getCampaignInformation(_info.locationSearch, _noSessionInformation); | |
_debug.info(("campaignInfo: " + _campaignInfo.toURLString()), VisualDebugMode.advanced); | |
}; | |
}; | |
_x10Module = new X10(); | |
_eventTracker = new X10(); | |
_hasInitData = true; | |
}; | |
if (_config.hasSiteOverlay){ | |
_debug.warning("Site Overlay is not supported"); | |
}; | |
if (_debug.verbose){ | |
_local2 = ""; | |
_local2 = (_local2 + "_initData (misc)"); | |
_local2 = (_local2 + ("\nflash version: " + _info.flashVersion.toString(4))); | |
_local2 = (_local2 + ("\nprotocol: " + _info.protocol)); | |
_local2 = (_local2 + (("\ndefault domain name (auto): \"" + _info.domainName) + "\"")); | |
_local2 = (_local2 + ("\nlanguage: " + _info.language)); | |
_local2 = (_local2 + ("\ndomain hash: " + _getDomainHash())); | |
_local2 = (_local2 + ("\nuser-agent: " + _info.userAgent)); | |
_debug.info(_local2, VisualDebugMode.geek); | |
}; | |
} | |
public function getDetectTitle():Boolean{ | |
_debug.info("getDetectTitle()"); | |
return (_config.detectTitle); | |
} | |
public function resetSession():void{ | |
_debug.info("resetSession()"); | |
_buffer.resetCurrentSession(); | |
} | |
public function getClientInfo():Boolean{ | |
_debug.info("getClientInfo()"); | |
return (_config.detectClientInfo); | |
} | |
private function _sendXEvent(_arg1:X10=null):void{ | |
var _local2:Variables; | |
var _local3:EventInfo; | |
var _local4:Variables; | |
var _local5:Variables; | |
_initData(); | |
if (_takeSample()){ | |
_local2 = new Variables(); | |
_local2.URIencode = true; | |
_local3 = new EventInfo(true, _x10Module, _arg1); | |
_local4 = _local3.toVariables(); | |
_local5 = _renderMetricsSearchVariables(); | |
_local2.join(_local4, _local5); | |
_gifRequest.send(_account, _local2, false, true); | |
}; | |
} | |
public function setDetectFlash(_arg1:Boolean):void{ | |
_config.detectFlash = _arg1; | |
_debug.info((("setDetectFlash( " + _config.detectFlash) + " )")); | |
} | |
public function setCampNameKey(_arg1:String):void{ | |
_config.campaignKey.UCCN = _arg1; | |
var _local2 = (("setCampNameKey( " + _config.campaignKey.UCCN) + " )"); | |
if (_debug.mode == VisualDebugMode.geek){ | |
_debug.info((_local2 + " [UCCN]")); | |
} else { | |
_debug.info(_local2); | |
}; | |
} | |
private function _formatReferrer():String{ | |
var _local2:String; | |
var _local3:URL; | |
var _local4:URL; | |
var _local1:String = _info.referrer; | |
if ((((_local1 == "")) || ((_local1 == "localhost")))){ | |
_local1 = "-"; | |
} else { | |
_local2 = _info.domainName; | |
_local3 = new URL(_local1); | |
_local4 = new URL(("http://" + _local2)); | |
if (_local3.hostName == _local2){ | |
return ("-"); | |
}; | |
if (_local4.domain == _local3.domain){ | |
if (_local4.subDomain != _local3.subDomain){ | |
_local1 = "0"; | |
}; | |
}; | |
if ((((_local1.charAt(0) == "[")) && (_local1.charAt((_local1.length - 1))))){ | |
_local1 = "-"; | |
}; | |
}; | |
_debug.info(("formated referrer: " + _local1), VisualDebugMode.advanced); | |
return (_local1); | |
} | |
private function _visitCode():Number{ | |
if (_debug.verbose){ | |
_debug.info(("visitCode: " + _buffer.utma.sessionId), VisualDebugMode.geek); | |
}; | |
return (_buffer.utma.sessionId); | |
} | |
public function createEventTracker(_arg1:String):EventTracker{ | |
_debug.info((("createEventTracker( " + _arg1) + " )")); | |
return (new EventTracker(_arg1, this)); | |
} | |
public function addItem(_arg1:String, _arg2:String, _arg3:String, _arg4:String, _arg5:Number, _arg6:int):void{ | |
_debug.warning((("addItem( " + [_arg1, _arg2, _arg3, _arg4, _arg5, _arg6].join(", ")) + " ) not implemented")); | |
} | |
public function clearIgnoredOrganic():void{ | |
_debug.info("clearIgnoredOrganic()"); | |
_config.organic.clearIgnoredKeywords(); | |
} | |
public function setVar(_arg1:String):void{ | |
var _local2:Variables; | |
if (((!((_arg1 == ""))) && (_isNotGoogleSearch()))){ | |
_initData(); | |
_buffer.utmv.domainHash = _domainHash; | |
_buffer.utmv.value = _arg1; | |
if (_debug.verbose){ | |
_debug.info(_buffer.utmv.toString(), VisualDebugMode.geek); | |
}; | |
_debug.info((("setVar( " + _arg1) + " )")); | |
if (_takeSample()){ | |
_local2 = new Variables(); | |
_local2.utmt = "var"; | |
_gifRequest.send(_account, _local2); | |
}; | |
} else { | |
_debug.warning((("setVar \"" + _arg1) + "\" is ignored")); | |
}; | |
} | |
public function setDomainName(_arg1:String):void{ | |
if (_arg1 == "auto"){ | |
_config.domain.mode = DomainNameMode.auto; | |
} else { | |
if (_arg1 == "none"){ | |
_config.domain.mode = DomainNameMode.none; | |
} else { | |
_config.domain.mode = DomainNameMode.custom; | |
_config.domain.name = _arg1; | |
}; | |
}; | |
_updateDomainName(); | |
_debug.info((("setDomainName( " + _config.domainName) + " )")); | |
} | |
private function _updateDomainName():void{ | |
var _local1:String; | |
if (_config.domain.mode == DomainNameMode.auto){ | |
_local1 = _info.domainName; | |
if (_local1.substring(0, 4) == "www."){ | |
_local1 = _local1.substring(4); | |
}; | |
_config.domain.name = _local1; | |
}; | |
_config.domainName = _config.domain.name.toLowerCase(); | |
_debug.info(("domain name: " + _config.domainName), VisualDebugMode.advanced); | |
} | |
public function addTrans(_arg1:String, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:String, _arg7:String, _arg8:String):Object{ | |
_debug.warning((("addTrans( " + [_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8].join(", ")) + " ) not implemented")); | |
return (null); | |
} | |
private function _renderMetricsSearchVariables(_arg1:String=""):Variables{ | |
var _local4:Variables; | |
var _local2:Variables = new Variables(); | |
_local2.URIencode = true; | |
var _local3:DocumentInfo = new DocumentInfo(_config, _info, _formatedReferrer, _arg1, _adSense); | |
_debug.info(("docInfo: " + _local3.toURLString()), VisualDebugMode.geek); | |
if (_config.campaignTracking){ | |
_local4 = _campaignInfo.toVariables(); | |
}; | |
var _local5:Variables = _browserInfo.toVariables(); | |
_local2.join(_local3.toVariables(), _local5, _local4); | |
return (_local2); | |
} | |
public function setCampContentKey(_arg1:String):void{ | |
_config.campaignKey.UCCT = _arg1; | |
var _local2 = (("setCampContentKey( " + _config.campaignKey.UCCT) + " )"); | |
if (_debug.mode == VisualDebugMode.geek){ | |
_debug.info((_local2 + " [UCCT]")); | |
} else { | |
_debug.info(_local2); | |
}; | |
} | |
private function _handleCookie():void{ | |
var _local1:String; | |
var _local2:String; | |
var _local3:Array; | |
var _local4:String; | |
if (_config.allowLinker){ | |
}; | |
if (((_buffer.hasUTMA()) && (!(_buffer.utma.isEmpty())))){ | |
if (((!(_buffer.hasUTMB())) || (!(_buffer.hasUTMC())))){ | |
_buffer.updateUTMA(_timeStamp); | |
_noSessionInformation = true; | |
}; | |
if (_debug.verbose){ | |
_debug.info(("from cookie " + _buffer.utma.toString()), VisualDebugMode.geek); | |
}; | |
} else { | |
_debug.info("create a new utma", VisualDebugMode.advanced); | |
_buffer.utma.domainHash = _domainHash; | |
_buffer.utma.sessionId = _getUniqueSessionId(); | |
_buffer.utma.firstTime = _timeStamp; | |
_buffer.utma.lastTime = _timeStamp; | |
_buffer.utma.currentTime = _timeStamp; | |
_buffer.utma.sessionCount = 1; | |
if (_debug.verbose){ | |
_debug.info(_buffer.utma.toString(), VisualDebugMode.geek); | |
}; | |
_noSessionInformation = true; | |
_isNewVisitor = true; | |
}; | |
if (((_adSense.gaGlobal) && ((_adSense.dh == String(_domainHash))))){ | |
if (_adSense.sid){ | |
_buffer.utma.currentTime = Number(_adSense.sid); | |
if (_debug.verbose){ | |
_local1 = ""; | |
_local1 = (_local1 + "AdSense sid found\n"); | |
_local1 = (_local1 + (((("Override currentTime(" + _buffer.utma.currentTime) + ") from AdSense sid(") + Number(_adSense.sid)) + ")")); | |
_debug.info(_local1, VisualDebugMode.geek); | |
}; | |
}; | |
if (_isNewVisitor){ | |
if (_adSense.sid){ | |
_buffer.utma.lastTime = Number(_adSense.sid); | |
if (_debug.verbose){ | |
_local2 = ""; | |
_local2 = (_local2 + "AdSense sid found (new visitor)\n"); | |
_local2 = (_local2 + (((("Override lastTime(" + _buffer.utma.lastTime) + ") from AdSense sid(") + Number(_adSense.sid)) + ")")); | |
_debug.info(_local2, VisualDebugMode.geek); | |
}; | |
}; | |
if (_adSense.vid){ | |
_local3 = _adSense.vid.split("."); | |
_buffer.utma.sessionId = Number(_local3[0]); | |
_buffer.utma.firstTime = Number(_local3[1]); | |
if (_debug.verbose){ | |
_local4 = ""; | |
_local4 = (_local4 + "AdSense vid found (new visitor)\n"); | |
_local4 = (_local4 + (((("Override sessionId(" + _buffer.utma.sessionId) + ") from AdSense vid(") + Number(_local3[0])) + ")\n")); | |
_local4 = (_local4 + (((("Override firstTime(" + _buffer.utma.firstTime) + ") from AdSense vid(") + Number(_local3[1])) + ")")); | |
_debug.info(_local4, VisualDebugMode.geek); | |
}; | |
}; | |
if (_debug.verbose){ | |
_debug.info(("AdSense modified : " + _buffer.utma.toString()), VisualDebugMode.geek); | |
}; | |
}; | |
}; | |
_buffer.utmb.domainHash = _domainHash; | |
if (isNaN(_buffer.utmb.trackCount)){ | |
_buffer.utmb.trackCount = 0; | |
}; | |
if (isNaN(_buffer.utmb.token)){ | |
_buffer.utmb.token = _config.tokenCliff; | |
}; | |
if (isNaN(_buffer.utmb.lastTime)){ | |
_buffer.utmb.lastTime = _buffer.utma.currentTime; | |
}; | |
_buffer.utmc.domainHash = _domainHash; | |
if (_debug.verbose){ | |
_debug.info(_buffer.utmb.toString(), VisualDebugMode.advanced); | |
_debug.info(_buffer.utmc.toString(), VisualDebugMode.advanced); | |
}; | |
} | |
public function setLocalServerMode():void{ | |
_config.serverMode = ServerOperationMode.local; | |
_debug.info("setLocalServerMode()"); | |
} | |
public function clearIgnoredRef():void{ | |
_debug.info("clearIgnoredRef()"); | |
_config.organic.clearIgnoredReferrals(); | |
} | |
public function setCampSourceKey(_arg1:String):void{ | |
_config.campaignKey.UCSR = _arg1; | |
var _local2 = (("setCampSourceKey( " + _config.campaignKey.UCSR) + " )"); | |
if (_debug.mode == VisualDebugMode.geek){ | |
_debug.info((_local2 + " [UCSR]")); | |
} else { | |
_debug.info(_local2); | |
}; | |
} | |
public function getLocalGifPath():String{ | |
_debug.info("getLocalGifPath()"); | |
return (_config.localGIFpath); | |
} | |
public function setLocalGifPath(_arg1:String):void{ | |
_config.localGIFpath = _arg1; | |
_debug.info((("setLocalGifPath( " + _config.localGIFpath) + " )")); | |
} | |
public function getVersion():String{ | |
_debug.info("getVersion()"); | |
return (_config.version); | |
} | |
public function setAllowAnchor(_arg1:Boolean):void{ | |
_config.allowAnchor = _arg1; | |
_debug.info((("setAllowAnchor( " + _config.allowAnchor) + " )")); | |
} | |
private function _isNotGoogleSearch():Boolean{ | |
var _local1:String = _config.domainName; | |
var _local2 = (_local1.indexOf("www.google.") < 0); | |
var _local3 = (_local1.indexOf(".google.") < 0); | |
var _local4 = (_local1.indexOf("google.") < 0); | |
var _local5 = (_local1.indexOf("google.org") > -1); | |
return (((((((((_local2) || (_local3))) || (_local4))) || (!((_config.cookiePath == "/"))))) || (_local5))); | |
} | |
public function setSampleRate(_arg1:Number):void{ | |
if (_arg1 < 0){ | |
_debug.warning("sample rate can not be negative, ignoring value."); | |
} else { | |
_config.sampleRate = _arg1; | |
}; | |
_debug.info((("setSampleRate( " + _config.sampleRate) + " )")); | |
} | |
private function _takeSample():Boolean{ | |
if (_debug.verbose){ | |
_debug.info((((("takeSample: (" + (_visitCode() % 10000)) + ") < (") + (_config.sampleRate * 10000)) + ")"), VisualDebugMode.geek); | |
}; | |
return (((_visitCode() % 10000) < (_config.sampleRate * 10000))); | |
} | |
public function setCookiePath(_arg1:String):void{ | |
_config.cookiePath = _arg1; | |
_debug.info((("setCookiePath( " + _config.cookiePath) + " )")); | |
} | |
public function setAllowHash(_arg1:Boolean):void{ | |
_config.allowDomainHash = _arg1; | |
_debug.info((("setAllowHash( " + _config.allowDomainHash) + " )")); | |
} | |
private function _generateUserDataHash():Number{ | |
var _local1 = ""; | |
_local1 = (_local1 + _info.appName); | |
_local1 = (_local1 + _info.appVersion); | |
_local1 = (_local1 + _info.language); | |
_local1 = (_local1 + _info.platform); | |
_local1 = (_local1 + _info.userAgent.toString()); | |
_local1 = (_local1 + (((_info.screenWidth + "x") + _info.screenHeight) + _info.screenColorDepth)); | |
_local1 = (_local1 + _info.referrer); | |
return (Utils.generateHash(_local1)); | |
} | |
public function setCampNOKey(_arg1:String):void{ | |
_config.campaignKey.UCNO = _arg1; | |
var _local2 = (("setCampNOKey( " + _config.campaignKey.UCNO) + " )"); | |
if (_debug.mode == VisualDebugMode.geek){ | |
_debug.info((_local2 + " [UCNO]")); | |
} else { | |
_debug.info(_local2); | |
}; | |
} | |
public function addIgnoredOrganic(_arg1:String):void{ | |
_debug.info((("addIgnoredOrganic( " + _arg1) + " )")); | |
_config.organic.addIgnoredKeyword(_arg1); | |
} | |
public function setLocalRemoteServerMode():void{ | |
_config.serverMode = ServerOperationMode.both; | |
_debug.info("setLocalRemoteServerMode()"); | |
} | |
public function cookiePathCopy(_arg1:String):void{ | |
_debug.warning((("cookiePathCopy( " + _arg1) + " ) not implemented")); | |
} | |
public function setDetectTitle(_arg1:Boolean):void{ | |
_config.detectTitle = _arg1; | |
_debug.info((("setDetectTitle( " + _config.detectTitle) + " )")); | |
} | |
public function setCampTermKey(_arg1:String):void{ | |
_config.campaignKey.UCTR = _arg1; | |
var _local2 = (("setCampTermKey( " + _config.campaignKey.UCTR) + " )"); | |
if (_debug.mode == VisualDebugMode.geek){ | |
_debug.info((_local2 + " [UCTR]")); | |
} else { | |
_debug.info(_local2); | |
}; | |
} | |
public function getServiceMode():ServerOperationMode{ | |
_debug.info("getServiceMode()"); | |
return (_config.serverMode); | |
} | |
private function _trackMetrics(_arg1:String=""):void{ | |
var _local2:Variables; | |
var _local3:Variables; | |
var _local4:Variables; | |
var _local5:EventInfo; | |
if (_takeSample()){ | |
_local2 = new Variables(); | |
_local2.URIencode = true; | |
if (((_x10Module) && (_x10Module.hasData()))){ | |
_local5 = new EventInfo(false, _x10Module); | |
_local3 = _local5.toVariables(); | |
}; | |
_local4 = _renderMetricsSearchVariables(_arg1); | |
_local2.join(_local3, _local4); | |
_gifRequest.send(_account, _local2); | |
}; | |
} | |
public function setCampaignTrack(_arg1:Boolean):void{ | |
_config.campaignTracking = _arg1; | |
_debug.info((("setCampaignTrack( " + _config.campaignTracking) + " )")); | |
} | |
public function addIgnoredRef(_arg1:String):void{ | |
_debug.info((("addIgnoredRef( " + _arg1) + " )")); | |
_config.organic.addIgnoredReferral(_arg1); | |
} | |
public function clearOrganic():void{ | |
_debug.info("clearOrganic()"); | |
_config.organic.clearEngines(); | |
} | |
public function getDetectFlash():Boolean{ | |
_debug.info("getDetectFlash()"); | |
return (_config.detectFlash); | |
} | |
public function setCampMediumKey(_arg1:String):void{ | |
_config.campaignKey.UCMD = _arg1; | |
var _local2 = (("setCampMediumKey( " + _config.campaignKey.UCMD) + " )"); | |
if (_debug.mode == VisualDebugMode.geek){ | |
_debug.info((_local2 + " [UCMD]")); | |
} else { | |
_debug.info(_local2); | |
}; | |
} | |
private function _getUniqueSessionId():Number{ | |
var _local1:Number = ((Utils.generate32bitRandom() ^ _generateUserDataHash()) * 2147483647); | |
_debug.info(("Session ID: " + _local1), VisualDebugMode.geek); | |
return (_local1); | |
} | |
private function _getDomainHash():Number{ | |
if (((((!(_config.domainName)) || ((_config.domainName == "")))) || ((_config.domain.mode == DomainNameMode.none)))){ | |
_config.domainName = ""; | |
return (1); | |
}; | |
_updateDomainName(); | |
if (_config.allowDomainHash){ | |
return (Utils.generateHash(_config.domainName)); | |
}; | |
return (1); | |
} | |
public function setSessionTimeout(_arg1:int):void{ | |
_config.sessionTimeout = _arg1; | |
_debug.info((("setSessionTimeout( " + _config.sessionTimeout) + " )")); | |
} | |
public function getAccount():String{ | |
_debug.info("getAccount()"); | |
return (_account); | |
} | |
public function link(_arg1:String, _arg2:Boolean=false):void{ | |
_debug.warning((("link( " + [_arg1, _arg2].join(", ")) + " ) not implemented")); | |
} | |
public function setRemoteServerMode():void{ | |
_config.serverMode = ServerOperationMode.remote; | |
_debug.info("setRemoteServerMode()"); | |
} | |
} | |
}//package com.google.analytics.v4 | |
package com.google.analytics.campaign { | |
import com.google.analytics.core.*; | |
import com.google.analytics.v4.*; | |
import com.google.analytics.debug.*; | |
import com.google.analytics.utils.*; | |
public class CampaignManager { | |
public static const trackingDelimiter:String = "|"; | |
private var _config:Configuration; | |
private var _domainHash:Number; | |
private var _debug:DebugConfiguration; | |
private var _timeStamp:Number; | |
private var _referrer:String; | |
private var _buffer:Buffer; | |
public function CampaignManager(_arg1:Configuration, _arg2:DebugConfiguration, _arg3:Buffer, _arg4:Number, _arg5:String, _arg6:Number){ | |
_config = _arg1; | |
_debug = _arg2; | |
_buffer = _arg3; | |
_domainHash = _arg4; | |
_referrer = _arg5; | |
_timeStamp = _arg6; | |
} | |
public static function isInvalidReferrer(_arg1:String):Boolean{ | |
var _local2:URL; | |
if ((((((_arg1 == "")) || ((_arg1 == "-")))) || ((_arg1 == "0")))){ | |
return (true); | |
}; | |
if (_arg1.indexOf("://") > -1){ | |
_local2 = new URL(_arg1); | |
if ((((_local2.protocol == Protocols.file)) || ((_local2.protocol == Protocols.none)))){ | |
return (true); | |
}; | |
}; | |
return (false); | |
} | |
public static function isFromGoogleCSE(_arg1:String, _arg2:Configuration):Boolean{ | |
var _local3:URL = new URL(_arg1); | |
if (_local3.hostName.indexOf(_arg2.google) > -1){ | |
if (_local3.search.indexOf((_arg2.googleSearchParam + "=")) > -1){ | |
if (_local3.path == ("/" + _arg2.googleCsePath)){ | |
return (true); | |
}; | |
}; | |
}; | |
return (false); | |
} | |
public function getCampaignInformation(_arg1:String, _arg2:Boolean):CampaignInfo{ | |
var _local4:CampaignTracker; | |
var _local8:CampaignTracker; | |
var _local9:int; | |
var _local3:CampaignInfo = new CampaignInfo(); | |
var _local5:Boolean; | |
var _local6:Boolean; | |
var _local7:int; | |
if (((_config.allowLinker) && (_buffer.isGenuine()))){ | |
if (!_buffer.hasUTMZ()){ | |
return (_local3); | |
}; | |
}; | |
_local4 = getTrackerFromSearchString(_arg1); | |
if (isValid(_local4)){ | |
_local6 = hasNoOverride(_arg1); | |
if (((_local6) && (!(_buffer.hasUTMZ())))){ | |
return (_local3); | |
}; | |
}; | |
if (!isValid(_local4)){ | |
_local4 = getOrganicCampaign(); | |
if (((!(_buffer.hasUTMZ())) && (isIgnoredKeyword(_local4)))){ | |
return (_local3); | |
}; | |
}; | |
if (((!(isValid(_local4))) && (_arg2))){ | |
_local4 = getReferrerCampaign(); | |
if (((!(_buffer.hasUTMZ())) && (isIgnoredReferral(_local4)))){ | |
return (_local3); | |
}; | |
}; | |
if (!isValid(_local4)){ | |
if (((!(_buffer.hasUTMZ())) && (_arg2))){ | |
_local4 = getDirectCampaign(); | |
}; | |
}; | |
if (!isValid(_local4)){ | |
return (_local3); | |
}; | |
if (((_buffer.hasUTMZ()) && (!(_buffer.utmz.isEmpty())))){ | |
_local8 = new CampaignTracker(); | |
_local8.fromTrackerString(_buffer.utmz.campaignTracking); | |
_local5 = (_local8.toTrackerString() == _local4.toTrackerString()); | |
_local7 = _buffer.utmz.responseCount; | |
}; | |
if (((!(_local5)) || (_arg2))){ | |
_local9 = _buffer.utma.sessionCount; | |
_local7++; | |
if (_local9 == 0){ | |
_local9 = 1; | |
}; | |
_buffer.utmz.domainHash = _domainHash; | |
_buffer.utmz.campaignCreation = _timeStamp; | |
_buffer.utmz.campaignSessions = _local9; | |
_buffer.utmz.responseCount = _local7; | |
_buffer.utmz.campaignTracking = _local4.toTrackerString(); | |
_debug.info(_buffer.utmz.toString(), VisualDebugMode.geek); | |
_local3 = new CampaignInfo(false, true); | |
} else { | |
_local3 = new CampaignInfo(false, false); | |
}; | |
return (_local3); | |
} | |
public function hasNoOverride(_arg1:String):Boolean{ | |
var _local2:CampaignKey = _config.campaignKey; | |
if (_arg1 == ""){ | |
return (false); | |
}; | |
var _local3:Variables = new Variables(_arg1); | |
var _local4 = ""; | |
if (_local3.hasOwnProperty(_local2.UCNO)){ | |
_local4 = _local3[_local2.UCNO]; | |
switch (_local4){ | |
case "1": | |
return (true); | |
case "": | |
case "0": | |
default: | |
return (false); | |
}; | |
}; | |
return (false); | |
} | |
public function getTrackerFromSearchString(_arg1:String):CampaignTracker{ | |
var _local2:CampaignTracker = getOrganicCampaign(); | |
var _local3:CampaignTracker = new CampaignTracker(); | |
var _local4:CampaignKey = _config.campaignKey; | |
if (_arg1 == ""){ | |
return (_local3); | |
}; | |
var _local5:Variables = new Variables(_arg1); | |
if (_local5.hasOwnProperty(_local4.UCID)){ | |
_local3.id = _local5[_local4.UCID]; | |
}; | |
if (_local5.hasOwnProperty(_local4.UCSR)){ | |
_local3.source = _local5[_local4.UCSR]; | |
}; | |
if (_local5.hasOwnProperty(_local4.UGCLID)){ | |
_local3.clickId = _local5[_local4.UGCLID]; | |
}; | |
if (_local5.hasOwnProperty(_local4.UCCN)){ | |
_local3.name = _local5[_local4.UCCN]; | |
} else { | |
_local3.name = "(not set)"; | |
}; | |
if (_local5.hasOwnProperty(_local4.UCMD)){ | |
_local3.medium = _local5[_local4.UCMD]; | |
} else { | |
_local3.medium = "(not set)"; | |
}; | |
if (_local5.hasOwnProperty(_local4.UCTR)){ | |
_local3.term = _local5[_local4.UCTR]; | |
} else { | |
if (((_local2) && (!((_local2.term == ""))))){ | |
_local3.term = _local2.term; | |
}; | |
}; | |
if (_local5.hasOwnProperty(_local4.UCCT)){ | |
_local3.content = _local5[_local4.UCCT]; | |
}; | |
return (_local3); | |
} | |
public function getOrganicCampaign():CampaignTracker{ | |
var _local1:CampaignTracker; | |
var _local4:Array; | |
var _local5:OrganicReferrer; | |
var _local6:String; | |
if (((isInvalidReferrer(_referrer)) || (isFromGoogleCSE(_referrer, _config)))){ | |
return (_local1); | |
}; | |
var _local2:URL = new URL(_referrer); | |
var _local3 = ""; | |
if (_local2.hostName != ""){ | |
if (_local2.hostName.indexOf(".") > -1){ | |
_local4 = _local2.hostName.split("."); | |
switch (_local4.length){ | |
case 2: | |
_local3 = _local4[0]; | |
break; | |
case 3: | |
_local3 = _local4[1]; | |
break; | |
}; | |
}; | |
}; | |
if (_config.organic.match(_local3)){ | |
_local5 = _config.organic.getReferrerByName(_local3); | |
_local6 = _config.organic.getKeywordValue(_local5, _local2.search); | |
_local1 = new CampaignTracker(); | |
_local1.source = _local5.engine; | |
_local1.name = "(organic)"; | |
_local1.medium = "organic"; | |
_local1.term = _local6; | |
}; | |
return (_local1); | |
} | |
public function getDirectCampaign():CampaignTracker{ | |
var _local1:CampaignTracker = new CampaignTracker(); | |
_local1.source = "(direct)"; | |
_local1.name = "(direct)"; | |
_local1.medium = "(none)"; | |
return (_local1); | |
} | |
public function isIgnoredKeyword(_arg1:CampaignTracker):Boolean{ | |
if (((_arg1) && ((_arg1.medium == "organic")))){ | |
return (_config.organic.isIgnoredKeyword(_arg1.term)); | |
}; | |
return (false); | |
} | |
public function isIgnoredReferral(_arg1:CampaignTracker):Boolean{ | |
if (((_arg1) && ((_arg1.medium == "referral")))){ | |
return (_config.organic.isIgnoredReferral(_arg1.source)); | |
}; | |
return (false); | |
} | |
public function isValid(_arg1:CampaignTracker):Boolean{ | |
if (((_arg1) && (_arg1.isValid()))){ | |
return (true); | |
}; | |
return (false); | |
} | |
public function getReferrerCampaign():CampaignTracker{ | |
var _local1:CampaignTracker; | |
if (((isInvalidReferrer(_referrer)) || (isFromGoogleCSE(_referrer, _config)))){ | |
return (_local1); | |
}; | |
var _local2:URL = new URL(_referrer); | |
var _local3:String = _local2.hostName; | |
var _local4:String = _local2.path; | |
if (_local3.indexOf("www.") == 0){ | |
_local3 = _local3.substr(4); | |
}; | |
_local1 = new CampaignTracker(); | |
_local1.source = _local3; | |
_local1.name = "(referral)"; | |
_local1.medium = "referral"; | |
_local1.content = _local4; | |
return (_local1); | |
} | |
} | |
}//package com.google.analytics.campaign | |
package com.google.analytics.campaign { | |
import com.google.analytics.utils.*; | |
public class CampaignTracker { | |
public var content:String; | |
public var source:String; | |
public var clickId:String; | |
public var name:String; | |
public var term:String; | |
public var medium:String; | |
public var id:String; | |
public function CampaignTracker(_arg1:String="", _arg2:String="", _arg3:String="", _arg4:String="", _arg5:String="", _arg6:String="", _arg7:String=""){ | |
this.id = _arg1; | |
this.source = _arg2; | |
this.clickId = _arg3; | |
this.name = _arg4; | |
this.medium = _arg5; | |
this.term = _arg6; | |
this.content = _arg7; | |
} | |
public function isValid():Boolean{ | |
if (((((!((id == ""))) || (!((source == ""))))) || (!((clickId == ""))))){ | |
return (true); | |
}; | |
return (false); | |
} | |
public function toTrackerString():String{ | |
var _local1:Array = []; | |
_addIfNotEmpty(_local1, "utmcsr=", source); | |
_addIfNotEmpty(_local1, "utmccn=", name); | |
_addIfNotEmpty(_local1, "utmcmd=", medium); | |
_addIfNotEmpty(_local1, "utmctr=", term); | |
_addIfNotEmpty(_local1, "utmcct=", content); | |
_addIfNotEmpty(_local1, "utmcid=", id); | |
_addIfNotEmpty(_local1, "utmgclid=", clickId); | |
return (_local1.join(CampaignManager.trackingDelimiter)); | |
} | |
private function _addIfNotEmpty(_arg1:Array, _arg2:String, _arg3:String):void{ | |
if (_arg3 != ""){ | |
_arg3 = _arg3.split("+").join("%20"); | |
_arg3 = _arg3.split(" ").join("%20"); | |
_arg1.push((_arg2 + _arg3)); | |
}; | |
} | |
public function fromTrackerString(_arg1:String):void{ | |
var _local2:String = _arg1.split(CampaignManager.trackingDelimiter).join("&"); | |
var _local3:Variables = new Variables(_local2); | |
if (_local3.hasOwnProperty("utmcid")){ | |
this.id = _local3["utmcid"]; | |
}; | |
if (_local3.hasOwnProperty("utmcsr")){ | |
this.source = _local3["utmcsr"]; | |
}; | |
if (_local3.hasOwnProperty("utmccn")){ | |
this.name = _local3["utmccn"]; | |
}; | |
if (_local3.hasOwnProperty("utmcmd")){ | |
this.medium = _local3["utmcmd"]; | |
}; | |
if (_local3.hasOwnProperty("utmctr")){ | |
this.term = _local3["utmctr"]; | |
}; | |
if (_local3.hasOwnProperty("utmcct")){ | |
this.content = _local3["utmcct"]; | |
}; | |
if (_local3.hasOwnProperty("utmgclid")){ | |
this.clickId = _local3["utmgclid"]; | |
}; | |
} | |
} | |
}//package com.google.analytics.campaign | |
package com.google.analytics.campaign { | |
public class CampaignKey { | |
public var UCMD:String = "utm_medium"; | |
public var UCID:String = "utm_id"; | |
public var UCTR:String = "utm_term"; | |
public var UCSR:String = "utm_source"; | |
public var UCNO:String = "utm_nooverride"; | |
public var UCCN:String = "utm_campaign"; | |
public var UGCLID:String = "gclid"; | |
public var UCCT:String = "utm_content"; | |
} | |
}//package com.google.analytics.campaign | |
package com.google.analytics.campaign { | |
import com.google.analytics.utils.*; | |
public class CampaignInfo { | |
private var _new:Boolean; | |
private var _empty:Boolean; | |
public function CampaignInfo(_arg1:Boolean=true, _arg2:Boolean=false){ | |
_empty = _arg1; | |
_new = _arg2; | |
} | |
public function toURLString():String{ | |
var _local1:Variables = toVariables(); | |
return (_local1.toString()); | |
} | |
public function isNew():Boolean{ | |
return (_new); | |
} | |
public function get utmcn():String{ | |
return ("1"); | |
} | |
public function isEmpty():Boolean{ | |
return (_empty); | |
} | |
public function toVariables():Variables{ | |
var _local1:Variables = new Variables(); | |
_local1.URIencode = true; | |
if (((!(isEmpty())) && (isNew()))){ | |
_local1.utmcn = utmcn; | |
}; | |
if (((!(isEmpty())) && (!(isNew())))){ | |
_local1.utmcr = utmcr; | |
}; | |
return (_local1); | |
} | |
public function get utmcr():String{ | |
return ("1"); | |
} | |
} | |
}//package com.google.analytics.campaign | |
package com.google.analytics { | |
import com.google.analytics.utils.*; | |
public class API { | |
public static var version:Version = new Version(); | |
version.major = 1; | |
version.minor = 0; | |
version.build = 1; | |
version.revision = "$Rev: 319 $ ".split(" ")[1]; | |
} | |
}//package com.google.analytics | |
package com.google.analytics.external { | |
import com.google.analytics.debug.*; | |
public class AdSenseGlobals extends JavascriptProxy { | |
public static var gaGlobal_js:XML = <script> | |
<![CDATA[ | |
function() | |
{ | |
try | |
{ | |
gaGlobal | |
} | |
catch(e) | |
{ | |
gaGlobal = {} ; | |
} | |
} | |
]]> | |
</script> | |
; | |
private var _gaGlobalVerified:Boolean = false; | |
public function AdSenseGlobals(_arg1:DebugConfiguration){ | |
super(_arg1); | |
} | |
public function set vid(_arg1:String):void{ | |
if (!isAvailable()){ | |
return; | |
}; | |
_verify(); | |
setProperty("gaGlobal.vid", _arg1); | |
} | |
public function get hid():String{ | |
if (!isAvailable()){ | |
return (null); | |
}; | |
_verify(); | |
return (getProperty("gaGlobal.hid")); | |
} | |
public function set hid(_arg1:String):void{ | |
if (!isAvailable()){ | |
return; | |
}; | |
_verify(); | |
setProperty("gaGlobal.hid", _arg1); | |
} | |
public function get dh():String{ | |
if (!isAvailable()){ | |
return (null); | |
}; | |
_verify(); | |
return (getProperty("gaGlobal.dh")); | |
} | |
public function get sid():String{ | |
if (!isAvailable()){ | |
return (null); | |
}; | |
_verify(); | |
return (getProperty("gaGlobal.sid")); | |
} | |
public function get vid():String{ | |
if (!isAvailable()){ | |
return (null); | |
}; | |
_verify(); | |
return (getProperty("gaGlobal.vid")); | |
} | |
private function _verify():void{ | |
if (!_gaGlobalVerified){ | |
executeBlock(gaGlobal_js); | |
_gaGlobalVerified = true; | |
}; | |
} | |
public function set sid(_arg1:String):void{ | |
if (!isAvailable()){ | |
return; | |
}; | |
_verify(); | |
setProperty("gaGlobal.sid", _arg1); | |
} | |
public function get gaGlobal():Object{ | |
if (!isAvailable()){ | |
return (null); | |
}; | |
_verify(); | |
return (getProperty("gaGlobal")); | |
} | |
} | |
}//package com.google.analytics.external | |
package com.google.analytics.external { | |
import com.google.analytics.debug.*; | |
public class HTMLDOM extends JavascriptProxy { | |
public static var cache_properties_js:XML = <script> | |
<![CDATA[ | |
function() | |
{ | |
var obj = {}; | |
obj.host = document.location.host; | |
obj.language = navigator.language ? navigator.language : navigator.browserLanguage; | |
obj.characterSet = document.characterSet ? document.characterSet : document.charset; | |
obj.colorDepth = window.screen.colorDepth; | |
obj.location = document.location.toString(); | |
obj.pathname = document.location.pathname; | |
obj.protocol = document.location.protocol; | |
obj.search = document.location.search; | |
obj.referrer = document.referrer; | |
obj.title = document.title; | |
return obj; | |
} | |
]]> | |
</script> | |
; | |
private var _referrer:String; | |
private var _language:String; | |
private var _host:String; | |
private var _pathname:String; | |
private var _location:String; | |
private var _search:String; | |
private var _characterSet:String; | |
private var _title:String; | |
private var _protocol:String; | |
private var _colorDepth:String; | |
public function HTMLDOM(_arg1:DebugConfiguration){ | |
super(_arg1); | |
} | |
public function get search():String{ | |
if (_search){ | |
return (_search); | |
}; | |
if (!isAvailable()){ | |
return (null); | |
}; | |
_search = getProperty("document.location.search"); | |
return (_search); | |
} | |
public function get location():String{ | |
if (_location){ | |
return (_location); | |
}; | |
if (!isAvailable()){ | |
return (null); | |
}; | |
_location = getPropertyString("document.location"); | |
return (_location); | |
} | |
public function get pathname():String{ | |
if (_pathname){ | |
return (_pathname); | |
}; | |
if (!isAvailable()){ | |
return (null); | |
}; | |
_pathname = getProperty("document.location.pathname"); | |
return (_pathname); | |
} | |
public function cacheProperties():void{ | |
if (!isAvailable()){ | |
return; | |
}; | |
var _local1:Object = call(cache_properties_js); | |
if (_local1){ | |
_host = _local1.host; | |
_language = _local1.language; | |
_characterSet = _local1.characterSet; | |
_colorDepth = _local1.colorDepth; | |
_location = _local1.location; | |
_pathname = _local1.pathname; | |
_protocol = _local1.protocol; | |
_search = _local1.search; | |
_referrer = _local1.referrer; | |
_title = _local1.title; | |
}; | |
} | |
public function get language():String{ | |
if (_language){ | |
return (_language); | |
}; | |
if (!isAvailable()){ | |
return (null); | |
}; | |
var _local1:String = getProperty("navigator.language"); | |
if (_local1 == null){ | |
_local1 = getProperty("navigator.browserLanguage"); | |
}; | |
_language = _local1; | |
return (_language); | |
} | |
public function get colorDepth():String{ | |
if (_colorDepth){ | |
return (_colorDepth); | |
}; | |
if (!isAvailable()){ | |
return (null); | |
}; | |
_colorDepth = getProperty("window.screen.colorDepth"); | |
return (_colorDepth); | |
} | |
public function get referrer():String{ | |
if (_referrer){ | |
return (_referrer); | |
}; | |
if (!isAvailable()){ | |
return (null); | |
}; | |
_referrer = getProperty("document.referrer"); | |
return (_referrer); | |
} | |
public function get protocol():String{ | |
if (_protocol){ | |
return (_protocol); | |
}; | |
if (!isAvailable()){ | |
return (null); | |
}; | |
_protocol = getProperty("document.location.protocol"); | |
return (_protocol); | |
} | |
public function get host():String{ | |
if (_host){ | |
return (_host); | |
}; | |
if (!isAvailable()){ | |
return (null); | |
}; | |
_host = getProperty("document.location.host"); | |
return (_host); | |
} | |
public function get characterSet():String{ | |
if (_characterSet){ | |
return (_characterSet); | |
}; | |
if (!isAvailable()){ | |
return (null); | |
}; | |
var _local1:String = getProperty("document.characterSet"); | |
if (_local1 == null){ | |
_local1 = getProperty("document.charset"); | |
}; | |
_characterSet = _local1; | |
return (_characterSet); | |
} | |
public function get title():String{ | |
if (_title){ | |
return (_title); | |
}; | |
if (!isAvailable()){ | |
return (null); | |
}; | |
_title = getProperty("document.title"); | |
return (_title); | |
} | |
} | |
}//package com.google.analytics.external | |
package com.google.analytics.external { | |
import com.google.analytics.debug.*; | |
import flash.system.*; | |
import flash.external.*; | |
public class JavascriptProxy { | |
public static var setProperty_js:XML = <script> | |
<![CDATA[ | |
function( path , value ) | |
{ | |
var paths; | |
var prop; | |
if( path.indexOf(".") > 0 ) | |
{ | |
paths = path.split("."); | |
prop = paths.pop() ; | |
} | |
else | |
{ | |
paths = []; | |
prop = path; | |
} | |
var target = window ; | |
var len = paths.length ; | |
for( var i = 0 ; i < len ; i++ ) | |
{ | |
target = target[ paths[i] ] ; | |
} | |
target[ prop ] = value ; | |
} | |
]]> | |
</script> | |
; | |
public static var hasProperty_js:XML = <script> | |
<![CDATA[ | |
function( path ) | |
{ | |
var paths; | |
if( path.indexOf(".") > 0 ) | |
{ | |
paths = path.split("."); | |
} | |
else | |
{ | |
paths = [path]; | |
} | |
var target = window ; | |
var len = paths.length ; | |
for( var i = 0 ; i < len ; i++ ) | |
{ | |
target = target[ paths[i] ] ; | |
} | |
if( target ) | |
{ | |
return true; | |
} | |
else | |
{ | |
return false; | |
} | |
} | |
]]> | |
</script> | |
; | |
public static var setPropertyRef_js:XML = <script> | |
<![CDATA[ | |
function( path , target ) | |
{ | |
var paths; | |
var prop; | |
if( path.indexOf(".") > 0 ) | |
{ | |
paths = path.split("."); | |
prop = paths.pop() ; | |
} | |
else | |
{ | |
paths = []; | |
prop = path; | |
} | |
alert( "paths:"+paths.length+", prop:"+prop ); | |
var targets; | |
var name; | |
if( target.indexOf(".") > 0 ) | |
{ | |
targets = target.split("."); | |
name = targets.pop(); | |
} | |
else | |
{ | |
targets = []; | |
name = target; | |
} | |
alert( "targets:"+targets.length+", name:"+name ); | |
var root = window; | |
var len = paths.length; | |
for( var i = 0 ; i < len ; i++ ) | |
{ | |
root = root[ paths[i] ] ; | |
} | |
var ref = window; | |
var depth = targets.length; | |
for( var j = 0 ; j < depth ; j++ ) | |
{ | |
ref = ref[ targets[j] ] ; | |
} | |
root[ prop ] = ref[name] ; | |
} | |
]]> | |
</script> | |
; | |
private var _notAvailableWarning:Boolean = true; | |
private var _debug:DebugConfiguration; | |
public function JavascriptProxy(_arg1:DebugConfiguration){ | |
_debug = _arg1; | |
} | |
public function getProperty(_arg1:String){ | |
return (call((_arg1 + ".valueOf"))); | |
} | |
public function hasProperty(_arg1:String):Boolean{ | |
return (call(hasProperty_js, _arg1)); | |
} | |
public function setProperty(_arg1:String, _arg2):void{ | |
call(setProperty_js, _arg1, _arg2); | |
} | |
public function executeBlock(_arg1:String):void{ | |
var data:* = _arg1; | |
if (isAvailable()){ | |
try { | |
ExternalInterface.call(data); | |
} catch(e:SecurityError) { | |
if (_debug.javascript){ | |
_debug.warning("ExternalInterface is not allowed.\nEnsure that allowScriptAccess is set to \"always\" in the Flash embed HTML."); | |
}; | |
} catch(e:Error) { | |
if (_debug.javascript){ | |
_debug.warning(("ExternalInterface failed to make the call\nreason: " + e.message)); | |
}; | |
}; | |
}; | |
} | |
public function getPropertyString(_arg1:String):String{ | |
return (call((_arg1 + ".toString"))); | |
} | |
public function setPropertyByReference(_arg1:String, _arg2:String):void{ | |
call(setPropertyRef_js, _arg1, _arg2); | |
} | |
public function call(_arg1:String, ... _args){ | |
var output:* = null; | |
var functionName:* = _arg1; | |
var args:* = _args; | |
if (isAvailable()){ | |
try { | |
if (((_debug.javascript) && (_debug.verbose))){ | |
output = ""; | |
output = ("Flash->JS: " + functionName); | |
output = (output + "( "); | |
if (args.length > 0){ | |
output = (output + args.join(",")); | |
}; | |
output = (output + " )"); | |
_debug.info(output); | |
}; | |
args.unshift(functionName); | |
return (ExternalInterface.call.apply(ExternalInterface, args)); | |
} catch(e:SecurityError) { | |
if (_debug.javascript){ | |
_debug.warning("ExternalInterface is not allowed.\nEnsure that allowScriptAccess is set to \"always\" in the Flash embed HTML."); | |
}; | |
} catch(e:Error) { | |
if (_debug.javascript){ | |
_debug.warning(("ExternalInterface failed to make the call\nreason: " + e.message)); | |
}; | |
}; | |
}; | |
return (null); | |
} | |
public function isAvailable():Boolean{ | |
var _local1:Boolean = ExternalInterface.available; | |
if (((_local1) && ((Capabilities.playerType == "External")))){ | |
_local1 = false; | |
}; | |
if (((((!(_local1)) && (_debug.javascript))) && (_notAvailableWarning))){ | |
_debug.warning("ExternalInterface is not available."); | |
_notAvailableWarning = false; | |
}; | |
return (_local1); | |
} | |
} | |
}//package com.google.analytics.external | |
package com.google.analytics.core { | |
public namespace ga_internal; | |
}//package com.google.analytics.core | |
package com.google.analytics.core { | |
import com.google.analytics.debug.*; | |
public class Domain { | |
private var _mode:DomainNameMode; | |
private var _debug:DebugConfiguration; | |
private var _name:String; | |
public function Domain(_arg1:DomainNameMode=null, _arg2:String="", _arg3:DebugConfiguration=null){ | |
_debug = _arg3; | |
if (_arg1 == null){ | |
_arg1 = DomainNameMode.auto; | |
}; | |
_mode = _arg1; | |
if (_arg1 == DomainNameMode.custom){ | |
this.name = _arg2; | |
} else { | |
_name = _arg2; | |
}; | |
} | |
public function get mode():DomainNameMode{ | |
return (_mode); | |
} | |
public function set mode(_arg1:DomainNameMode):void{ | |
_mode = _arg1; | |
if (_mode == DomainNameMode.none){ | |
_name = ""; | |
}; | |
} | |
public function get name():String{ | |
return (_name); | |
} | |
public function set name(_arg1:String):void{ | |
if (((!((_arg1.charAt(0) == "."))) && (_debug))){ | |
_debug.warning(("missing leading period \".\", cookie will only be accessible on " + _arg1), VisualDebugMode.geek); | |
}; | |
_name = _arg1; | |
} | |
} | |
}//package com.google.analytics.core | |
package com.google.analytics.core { | |
import com.google.analytics.utils.*; | |
public class Organic { | |
public static var throwErrors:Boolean = false; | |
private var _sourcesCache:Array; | |
private var _sourcesEngine:Array; | |
private var _ignoredKeywords:Array; | |
private var _ignoredReferralsCache:Object; | |
private var _ignoredReferrals:Array; | |
private var _ignoredKeywordsCache:Object; | |
private var _sources:Array; | |
public function Organic(){ | |
_sources = []; | |
_sourcesCache = []; | |
_sourcesEngine = []; | |
_ignoredReferrals = []; | |
_ignoredReferralsCache = {}; | |
_ignoredKeywords = []; | |
_ignoredKeywordsCache = {}; | |
} | |
public static function getKeywordValueFromPath(_arg1:String, _arg2:String):String{ | |
var _local3:String; | |
var _local4:Variables; | |
if (_arg2.indexOf((_arg1 + "=")) > -1){ | |
if (_arg2.charAt(0) == "?"){ | |
_arg2 = _arg2.substr(1); | |
}; | |
_arg2 = _arg2.split("+").join("%20"); | |
_local4 = new Variables(_arg2); | |
_local3 = _local4[_arg1]; | |
}; | |
return (_local3); | |
} | |
public function isIgnoredKeyword(_arg1:String):Boolean{ | |
if (_ignoredKeywordsCache.hasOwnProperty(_arg1)){ | |
return (true); | |
}; | |
return (false); | |
} | |
public function getKeywordValue(_arg1:OrganicReferrer, _arg2:String):String{ | |
var _local3:String = _arg1.keyword; | |
return (getKeywordValueFromPath(_local3, _arg2)); | |
} | |
public function isIgnoredReferral(_arg1:String):Boolean{ | |
if (_ignoredReferralsCache.hasOwnProperty(_arg1)){ | |
return (true); | |
}; | |
return (false); | |
} | |
public function clear():void{ | |
clearEngines(); | |
clearIgnoredReferrals(); | |
clearIgnoredKeywords(); | |
} | |
public function get count():int{ | |
return (_sources.length); | |
} | |
public function get ignoredKeywordsCount():int{ | |
return (_ignoredKeywords.length); | |
} | |
public function match(_arg1:String):Boolean{ | |
if (_arg1 == ""){ | |
return (false); | |
}; | |
_arg1 = _arg1.toLowerCase(); | |
if (_sourcesEngine[_arg1] != undefined){ | |
return (true); | |
}; | |
return (false); | |
} | |
public function clearIgnoredKeywords():void{ | |
_ignoredKeywords = []; | |
_ignoredKeywordsCache = {}; | |
} | |
public function addSource(_arg1:String, _arg2:String):void{ | |
var _local3:OrganicReferrer = new OrganicReferrer(_arg1, _arg2); | |
if (_sourcesCache[_local3.toString()] == undefined){ | |
_sources.push(_local3); | |
_sourcesCache[_local3.toString()] = (_sources.length - 1); | |
if (_sourcesEngine[_local3.engine] == undefined){ | |
_sourcesEngine[_local3.engine] = [(_sources.length - 1)]; | |
} else { | |
_sourcesEngine[_local3.engine].push((_sources.length - 1)); | |
}; | |
} else { | |
if (throwErrors){ | |
throw (new Error((_local3.toString() + " already exists, we don't add it."))); | |
}; | |
}; | |
} | |
public function clearEngines():void{ | |
_sources = []; | |
_sourcesCache = []; | |
_sourcesEngine = []; | |
} | |
public function get ignoredReferralsCount():int{ | |
return (_ignoredReferrals.length); | |
} | |
public function addIgnoredReferral(_arg1:String):void{ | |
if (_ignoredReferralsCache[_arg1] == undefined){ | |
_ignoredReferrals.push(_arg1); | |
_ignoredReferralsCache[_arg1] = (_ignoredReferrals.length - 1); | |
} else { | |
if (throwErrors){ | |
throw (new Error((("\"" + _arg1) + "\" already exists, we don't add it."))); | |
}; | |
}; | |
} | |
public function clearIgnoredReferrals():void{ | |
_ignoredReferrals = []; | |
_ignoredReferralsCache = {}; | |
} | |
public function getReferrerByName(_arg1:String):OrganicReferrer{ | |
var _local2:int; | |
if (match(_arg1)){ | |
_local2 = _sourcesEngine[_arg1][0]; | |
return (_sources[_local2]); | |
}; | |
return (null); | |
} | |
public function addIgnoredKeyword(_arg1:String):void{ | |
if (_ignoredKeywordsCache[_arg1] == undefined){ | |
_ignoredKeywords.push(_arg1); | |
_ignoredKeywordsCache[_arg1] = (_ignoredKeywords.length - 1); | |
} else { | |
if (throwErrors){ | |
throw (new Error((("\"" + _arg1) + "\" already exists, we don't add it."))); | |
}; | |
}; | |
} | |
public function get sources():Array{ | |
return (_sources); | |
} | |
} | |
}//package com.google.analytics.core | |
package com.google.analytics.core { | |
import flash.events.*; | |
import flash.net.*; | |
import com.google.analytics.v4.*; | |
import com.google.analytics.debug.*; | |
import com.google.analytics.data.*; | |
public dynamic class Buffer { | |
private var _SO:SharedObject; | |
private var _OBJ:Object; | |
private var _utma:UTMA; | |
private var _utmb:UTMB; | |
private var _utmc:UTMC; | |
private var _debug:DebugConfiguration; | |
private var _utmk:UTMK; | |
private var _config:Configuration; | |
private var _utmv:UTMV; | |
private var _utmz:UTMZ; | |
private var _volatile:Boolean; | |
public function Buffer(_arg1:Configuration, _arg2:DebugConfiguration, _arg3:Boolean=false, _arg4:Object=null){ | |
var _local5:Boolean; | |
var _local6:String; | |
super(); | |
_config = _arg1; | |
_debug = _arg2; | |
UTMB.defaultTimespan = _config.sessionTimeout; | |
UTMZ.defaultTimespan = _config.conversionTimeout; | |
if (!_arg3){ | |
_SO = SharedObject.getLocal(_config.cookieName, _config.cookiePath); | |
_local5 = false; | |
if (_SO.data.utma){ | |
if (!hasUTMA()){ | |
_createUMTA(); | |
}; | |
_utma.fromSharedObject(_SO.data.utma); | |
if (_debug.verbose){ | |
_debug.info(("found: " + _utma.toString(true)), VisualDebugMode.geek); | |
}; | |
if (_utma.isExpired()){ | |
if (_debug.verbose){ | |
_debug.warning("UTMA has expired", VisualDebugMode.advanced); | |
}; | |
_clearUTMA(); | |
_local5 = true; | |
}; | |
}; | |
if (_SO.data.utmb){ | |
if (!hasUTMB()){ | |
_createUMTB(); | |
}; | |
_utmb.fromSharedObject(_SO.data.utmb); | |
if (_debug.verbose){ | |
_debug.info(("found: " + _utmb.toString(true)), VisualDebugMode.geek); | |
}; | |
if (_utmb.isExpired()){ | |
if (_debug.verbose){ | |
_debug.warning("UTMB has expired", VisualDebugMode.advanced); | |
}; | |
_clearUTMB(); | |
_local5 = true; | |
}; | |
}; | |
if (_SO.data.utmc){ | |
delete _SO.data.utmc; | |
_local5 = true; | |
}; | |
if (_SO.data.utmk){ | |
if (!hasUTMK()){ | |
_createUMTK(); | |
}; | |
_utmk.fromSharedObject(_SO.data.utmk); | |
if (_debug.verbose){ | |
_debug.info(("found: " + _utmk.toString()), VisualDebugMode.geek); | |
}; | |
}; | |
if (_SO.data.utmv){ | |
if (!hasUTMV()){ | |
_createUMTV(); | |
}; | |
_utmv.fromSharedObject(_SO.data.utmv); | |
if (_debug.verbose){ | |
_debug.info(("found: " + _utmv.toString(true)), VisualDebugMode.geek); | |
}; | |
if (_utmv.isExpired()){ | |
if (_debug.verbose){ | |
_debug.warning("UTMV has expired", VisualDebugMode.advanced); | |
}; | |
_clearUTMV(); | |
_local5 = true; | |
}; | |
}; | |
if (_SO.data.utmz){ | |
if (!hasUTMZ()){ | |
_createUMTZ(); | |
}; | |
_utmz.fromSharedObject(_SO.data.utmz); | |
if (_debug.verbose){ | |
_debug.info(("found: " + _utmz.toString(true)), VisualDebugMode.geek); | |
}; | |
if (_utmz.isExpired()){ | |
if (_debug.verbose){ | |
_debug.warning("UTMZ has expired", VisualDebugMode.advanced); | |
}; | |
_clearUTMZ(); | |
_local5 = true; | |
}; | |
}; | |
if (_local5){ | |
save(); | |
}; | |
} else { | |
_OBJ = new Object(); | |
if (_arg4){ | |
for (_local6 in _arg4) { | |
_OBJ[_local6] = _arg4[_local6]; | |
}; | |
}; | |
}; | |
_volatile = _arg3; | |
} | |
public function clearCookies():void{ | |
utma.reset(); | |
utmb.reset(); | |
utmc.reset(); | |
utmz.reset(); | |
utmv.reset(); | |
utmk.reset(); | |
} | |
public function save():void{ | |
var flushStatus:* = null; | |
if (!isVolatile()){ | |
flushStatus = null; | |
try { | |
flushStatus = _SO.flush(); | |
} catch(e:Error) { | |
_debug.warning("Error...Could not write SharedObject to disk"); | |
}; | |
switch (flushStatus){ | |
case SharedObjectFlushStatus.PENDING: | |
_debug.info("Requesting permission to save object..."); | |
_SO.addEventListener(NetStatusEvent.NET_STATUS, _onFlushStatus); | |
break; | |
case SharedObjectFlushStatus.FLUSHED: | |
_debug.info("Value flushed to disk."); | |
break; | |
}; | |
}; | |
} | |
public function get utmv():UTMV{ | |
if (!hasUTMV()){ | |
_createUMTV(); | |
}; | |
return (_utmv); | |
} | |
public function get utmz():UTMZ{ | |
if (!hasUTMZ()){ | |
_createUMTZ(); | |
}; | |
return (_utmz); | |
} | |
public function hasUTMA():Boolean{ | |
if (_utma){ | |
return (true); | |
}; | |
return (false); | |
} | |
public function hasUTMB():Boolean{ | |
if (_utmb){ | |
return (true); | |
}; | |
return (false); | |
} | |
public function hasUTMC():Boolean{ | |
if (_utmc){ | |
return (true); | |
}; | |
return (false); | |
} | |
public function isGenuine():Boolean{ | |
if (!hasUTMK()){ | |
return (true); | |
}; | |
return ((utmk.hash == generateCookiesHash())); | |
} | |
public function resetCurrentSession():void{ | |
_clearUTMB(); | |
_clearUTMC(); | |
save(); | |
} | |
public function hasUTMK():Boolean{ | |
if (_utmk){ | |
return (true); | |
}; | |
return (false); | |
} | |
public function generateCookiesHash():Number{ | |
var _local1 = ""; | |
_local1 = (_local1 + utma.valueOf()); | |
_local1 = (_local1 + utmb.valueOf()); | |
_local1 = (_local1 + utmc.valueOf()); | |
_local1 = (_local1 + utmz.valueOf()); | |
_local1 = (_local1 + utmv.valueOf()); | |
return (Utils.generateHash(_local1)); | |
} | |
private function _createUMTB():void{ | |
_utmb = new UTMB(); | |
_utmb.proxy = this; | |
} | |
private function _createUMTC():void{ | |
_utmc = new UTMC(); | |
} | |
private function _createUMTA():void{ | |
_utma = new UTMA(); | |
_utma.proxy = this; | |
} | |
public function hasUTMV():Boolean{ | |
if (_utmv){ | |
return (true); | |
}; | |
return (false); | |
} | |
private function _createUMTK():void{ | |
_utmk = new UTMK(); | |
_utmk.proxy = this; | |
} | |
public function hasUTMZ():Boolean{ | |
if (_utmz){ | |
return (true); | |
}; | |
return (false); | |
} | |
private function _createUMTV():void{ | |
_utmv = new UTMV(); | |
_utmv.proxy = this; | |
} | |
private function _onFlushStatus(_arg1:NetStatusEvent):void{ | |
_debug.info("User closed permission dialog..."); | |
switch (_arg1.info.code){ | |
case "SharedObject.Flush.Success": | |
_debug.info("User granted permission -- value saved."); | |
break; | |
case "SharedObject.Flush.Failed": | |
_debug.info("User denied permission -- value not saved."); | |
break; | |
}; | |
_SO.removeEventListener(NetStatusEvent.NET_STATUS, _onFlushStatus); | |
} | |
private function _createUMTZ():void{ | |
_utmz = new UTMZ(); | |
_utmz.proxy = this; | |
} | |
public function updateUTMA(_arg1:Number):void{ | |
if (_debug.verbose){ | |
_debug.info((("updateUTMA( " + _arg1) + " )"), VisualDebugMode.advanced); | |
}; | |
if (!utma.isEmpty()){ | |
if (isNaN(utma.sessionCount)){ | |
utma.sessionCount = 1; | |
} else { | |
utma.sessionCount = (utma.sessionCount + 1); | |
}; | |
utma.lastTime = utma.currentTime; | |
utma.currentTime = _arg1; | |
}; | |
} | |
private function _clearUTMA():void{ | |
_utma = null; | |
if (!isVolatile()){ | |
_SO.data.utma = null; | |
delete _SO.data.utma; | |
}; | |
} | |
private function _clearUTMC():void{ | |
_utmc = null; | |
} | |
private function _clearUTMB():void{ | |
_utmb = null; | |
if (!isVolatile()){ | |
_SO.data.utmb = null; | |
delete _SO.data.utmb; | |
}; | |
} | |
public function update(_arg1:String, _arg2):void{ | |
if (isVolatile()){ | |
_OBJ[_arg1] = _arg2; | |
} else { | |
_SO.data[_arg1] = _arg2; | |
}; | |
} | |
private function _clearUTMZ():void{ | |
_utmz = null; | |
if (!isVolatile()){ | |
_SO.data.utmz = null; | |
delete _SO.data.utmz; | |
}; | |
} | |
private function _clearUTMV():void{ | |
_utmv = null; | |
if (!isVolatile()){ | |
_SO.data.utmv = null; | |
delete _SO.data.utmv; | |
}; | |
} | |
public function isVolatile():Boolean{ | |
return (_volatile); | |
} | |
public function get utma():UTMA{ | |
if (!hasUTMA()){ | |
_createUMTA(); | |
}; | |
return (_utma); | |
} | |
public function get utmb():UTMB{ | |
if (!hasUTMB()){ | |
_createUMTB(); | |
}; | |
return (_utmb); | |
} | |
public function get utmc():UTMC{ | |
if (!hasUTMC()){ | |
_createUMTC(); | |
}; | |
return (_utmc); | |
} | |
public function get utmk():UTMK{ | |
if (!hasUTMK()){ | |
_createUMTK(); | |
}; | |
return (_utmk); | |
} | |
} | |
}//package com.google.analytics.core | |
package com.google.analytics.core { | |
import com.google.analytics.v4.*; | |
public class EventTracker { | |
private var _parent:GoogleAnalyticsAPI; | |
public var name:String; | |
public function EventTracker(_arg1:String, _arg2:GoogleAnalyticsAPI){ | |
this.name = _arg1; | |
_parent = _arg2; | |
} | |
public function trackEvent(_arg1:String, _arg2:String=null, _arg3:Number=NaN):Boolean{ | |
return (_parent.trackEvent(name, _arg1, _arg2, _arg3)); | |
} | |
} | |
}//package com.google.analytics.core | |
package com.google.analytics.core { | |
public class Utils { | |
public static function trim(_arg1:String, _arg2:Boolean=false):String{ | |
var _local5:int; | |
var _local6:int; | |
var _local7:int; | |
if (_arg1 == ""){ | |
return (""); | |
}; | |
var _local3:Array = [" ", "\n", "\r", "\t"]; | |
var _local4:String = _arg1; | |
if (_arg2){ | |
_local5 = 0; | |
while ((((_local5 < _local3.length)) && ((_local4.indexOf(_local3[_local5]) > -1)))) { | |
_local4 = _local4.split(_local3[_local5]).join(""); | |
_local5++; | |
}; | |
} else { | |
_local6 = 0; | |
while ((((_local6 < _local4.length)) && ((_local3.indexOf(_local4.charAt(_local6)) > -1)))) { | |
_local6++; | |
}; | |
_local4 = _local4.substr(_local6); | |
_local7 = (_local4.length - 1); | |
while ((((_local7 >= 0)) && ((_local3.indexOf(_local4.charAt(_local7)) > -1)))) { | |
_local7--; | |
}; | |
_local4 = _local4.substring(0, (_local7 + 1)); | |
}; | |
return (_local4); | |
} | |
public static function generateHash(_arg1:String):int{ | |
var _local4:int; | |
var _local5:int; | |
var _local2 = 1; | |
var _local3:int; | |
if (((!((_arg1 == null))) && (!((_arg1 == ""))))){ | |
_local2 = 0; | |
_local4 = (_arg1.length - 1); | |
while (_local4 >= 0) { | |
_local5 = _arg1.charCodeAt(_local4); | |
_local2 = ((((_local2 << 6) & 268435455) + _local5) + (_local5 << 14)); | |
_local3 = (_local2 & 266338304); | |
if (_local3 != 0){ | |
_local2 = (_local2 ^ (_local3 >> 21)); | |
}; | |
_local4--; | |
}; | |
}; | |
return (_local2); | |
} | |
public static function generate32bitRandom():int{ | |
return (Math.round((Math.random() * 2147483647))); | |
} | |
public static function validateAccount(_arg1:String):Boolean{ | |
var _local2:RegExp = /^UA-[0-9]*-[0-9]*$/; | |
return (_local2.test(_arg1)); | |
} | |
} | |
}//package com.google.analytics.core | |
package com.google.analytics.core { | |
import flash.net.*; | |
import flash.utils.*; | |
public class RequestObject { | |
public var start:int; | |
public var end:int; | |
public var request:URLRequest; | |
public function RequestObject(_arg1:URLRequest){ | |
start = getTimer(); | |
this.request = _arg1; | |
} | |
public function hasCompleted():Boolean{ | |
return ((end > 0)); | |
} | |
public function toString():String{ | |
var _local1:Array = []; | |
_local1.push((("duration: " + duration) + "ms")); | |
_local1.push(("url: " + request.url)); | |
return ((("{ " + _local1.join(", ")) + " }")); | |
} | |
public function complete():void{ | |
end = getTimer(); | |
} | |
public function get duration():int{ | |
if (!hasCompleted()){ | |
return (0); | |
}; | |
return ((end - start)); | |
} | |
} | |
}//package com.google.analytics.core | |
package com.google.analytics.core { | |
public class OrganicReferrer { | |
private var _engine:String; | |
private var _keyword:String; | |
public function OrganicReferrer(_arg1:String, _arg2:String){ | |
this.engine = _arg1; | |
this.keyword = _arg2; | |
} | |
public function get keyword():String{ | |
return (_keyword); | |
} | |
public function get engine():String{ | |
return (_engine); | |
} | |
public function set engine(_arg1:String):void{ | |
_engine = _arg1.toLowerCase(); | |
} | |
public function toString():String{ | |
return (((engine + "?") + keyword)); | |
} | |
public function set keyword(_arg1:String):void{ | |
_keyword = _arg1.toLowerCase(); | |
} | |
} | |
}//package com.google.analytics.core | |
package com.google.analytics.core { | |
public class DomainNameMode { | |
public static const custom:DomainNameMode = new DomainNameMode(2, "custom"); | |
; | |
public static const none:DomainNameMode = new DomainNameMode(0, "none"); | |
; | |
public static const auto:DomainNameMode = new DomainNameMode(1, "auto"); | |
; | |
private var _value:int; | |
private var _name:String; | |
public function DomainNameMode(_arg1:int=0, _arg2:String=""){ | |
_value = _arg1; | |
_name = _arg2; | |
} | |
public function valueOf():int{ | |
return (_value); | |
} | |
public function toString():String{ | |
return (_name); | |
} | |
} | |
}//package com.google.analytics.core | |
package com.google.analytics.core { | |
import com.google.analytics.utils.*; | |
import com.google.analytics.data.*; | |
public class EventInfo { | |
private var _ext10:X10; | |
private var _isEventHit:Boolean; | |
private var _x10:X10; | |
public function EventInfo(_arg1:Boolean, _arg2:X10, _arg3:X10=null){ | |
_isEventHit = _arg1; | |
_x10 = _arg2; | |
_ext10 = _arg3; | |
} | |
public function toURLString():String{ | |
var _local1:Variables = toVariables(); | |
return (_local1.toString()); | |
} | |
public function get utmt():String{ | |
return ("event"); | |
} | |
public function get utme():String{ | |
return (_x10.renderMergedUrlString(_ext10)); | |
} | |
public function toVariables():Variables{ | |
var _local1:Variables = new Variables(); | |
_local1.URIencode = true; | |
if (_isEventHit){ | |
_local1.utmt = utmt; | |
}; | |
_local1.utme = utme; | |
return (_local1); | |
} | |
} | |
}//package com.google.analytics.core | |
package com.google.analytics.core { | |
import flash.events.*; | |
import flash.display.*; | |
import flash.net.*; | |
import com.google.analytics.v4.*; | |
import com.google.analytics.debug.*; | |
import com.google.analytics.utils.*; | |
import flash.system.*; | |
public class GIFRequest { | |
private var _info:Environment; | |
private var _count:int; | |
private var _utmac:String; | |
private var _alertcount:int; | |
private var _debug:DebugConfiguration; | |
private var _lastRequest:URLRequest; | |
private var _buffer:Buffer; | |
private var _config:Configuration; | |
private var _requests:Array; | |
public function GIFRequest(_arg1:Configuration, _arg2:DebugConfiguration, _arg3:Buffer, _arg4:Environment){ | |
_config = _arg1; | |
_debug = _arg2; | |
_buffer = _arg3; | |
_info = _arg4; | |
_count = 0; | |
_alertcount = 0; | |
_requests = []; | |
} | |
public function get utmn():String{ | |
return ((Utils.generate32bitRandom() as String)); | |
} | |
public function onIOError(_arg1:IOErrorEvent):void{ | |
var _local2:String = _lastRequest.url; | |
var _local3:String = String((_requests.length - 1)); | |
var _local4 = (("Gif Request #" + _local3) + " failed"); | |
if (_debug.GIFRequests){ | |
if (!_debug.verbose){ | |
if (_local2.indexOf("?") > -1){ | |
_local2 = _local2.split("?")[0]; | |
}; | |
_local2 = _shortenURL(_local2); | |
}; | |
if (int(_debug.mode) > int(VisualDebugMode.basic)){ | |
_local4 = (_local4 + ((" \"" + _local2) + "\" does not exists or is unreachable")); | |
}; | |
_debug.failure(_local4); | |
} else { | |
_debug.warning(_local4); | |
}; | |
_removeListeners(_arg1.target); | |
} | |
public function send(_arg1:String, _arg2:Variables=null, _arg3:Boolean=false, _arg4:Boolean=false):void{ | |
var _local5:String; | |
var _local6:URLRequest; | |
var _local7:URLRequest; | |
_utmac = _arg1; | |
if (!_arg2){ | |
_arg2 = new Variables(); | |
}; | |
_arg2.URIencode = false; | |
_arg2.pre = ["utmwv", "utmn", "utmhn", "utmt", "utme", "utmcs", "utmsr", "utmsc", "utmul", "utmje", "utmfl", "utmdt", "utmhid", "utmr", "utmp"]; | |
_arg2.post = ["utmcc"]; | |
if (_debug.verbose){ | |
_debug.info(((("tracking: " + _buffer.utmb.trackCount) + "/") + _config.trackingLimitPerSession), VisualDebugMode.geek); | |
}; | |
if ((((_buffer.utmb.trackCount < _config.trackingLimitPerSession)) || (_arg3))){ | |
if (_arg4){ | |
updateToken(); | |
}; | |
if (((((_arg3) || (!(_arg4)))) || ((_buffer.utmb.token >= 1)))){ | |
if (((!(_arg3)) && (_arg4))){ | |
_buffer.utmb.token = (_buffer.utmb.token - 1); | |
}; | |
_buffer.utmb.trackCount = (_buffer.utmb.trackCount + 1); | |
if (_debug.verbose){ | |
_debug.info(_buffer.utmb.toString(), VisualDebugMode.geek); | |
}; | |
_arg2.utmwv = utmwv; | |
_arg2.utmn = Utils.generate32bitRandom(); | |
if (_info.domainName != ""){ | |
_arg2.utmhn = _info.domainName; | |
}; | |
if (_config.sampleRate < 1){ | |
_arg2.utmsp = (_config.sampleRate * 100); | |
}; | |
if ((((_config.serverMode == ServerOperationMode.local)) || ((_config.serverMode == ServerOperationMode.both)))){ | |
_local5 = _info.locationSWFPath; | |
if (_local5.lastIndexOf("/") > 0){ | |
_local5 = _local5.substring(0, _local5.lastIndexOf("/")); | |
}; | |
_local6 = new URLRequest(); | |
if (_config.localGIFpath.indexOf("http") == 0){ | |
_local6.url = _config.localGIFpath; | |
} else { | |
_local6.url = (_local5 + _config.localGIFpath); | |
}; | |
_local6.url = (_local6.url + ("?" + _arg2.toString())); | |
if (((_debug.active) && (_debug.GIFRequests))){ | |
_debugSend(_local6); | |
} else { | |
sendRequest(_local6); | |
}; | |
}; | |
if ((((_config.serverMode == ServerOperationMode.remote)) || ((_config.serverMode == ServerOperationMode.both)))){ | |
_local7 = new URLRequest(); | |
if (_info.protocol == Protocols.HTTPS){ | |
_local7.url = _config.secureRemoteGIFpath; | |
} else { | |
if (_info.protocol == Protocols.HTTP){ | |
_local7.url = _config.remoteGIFpath; | |
} else { | |
_local7.url = _config.remoteGIFpath; | |
}; | |
}; | |
_arg2.utmac = utmac; | |
_arg2.utmcc = encodeURIComponent(utmcc); | |
_local7.url = (_local7.url + ("?" + _arg2.toString())); | |
if (((_debug.active) && (_debug.GIFRequests))){ | |
_debugSend(_local7); | |
} else { | |
sendRequest(_local7); | |
}; | |
}; | |
}; | |
}; | |
} | |
public function onSecurityError(_arg1:SecurityErrorEvent):void{ | |
if (_debug.GIFRequests){ | |
_debug.failure(_arg1.text); | |
}; | |
} | |
public function get utmsp():String{ | |
return (((_config.sampleRate * 100) as String)); | |
} | |
public function get utmcc():String{ | |
var _local1:Array = []; | |
if (_buffer.hasUTMA()){ | |
_local1.push((_buffer.utma.toURLString() + ";")); | |
}; | |
if (_buffer.hasUTMZ()){ | |
_local1.push((_buffer.utmz.toURLString() + ";")); | |
}; | |
if (_buffer.hasUTMV()){ | |
_local1.push((_buffer.utmv.toURLString() + ";")); | |
}; | |
return (_local1.join("+")); | |
} | |
public function get utmac():String{ | |
return (_utmac); | |
} | |
public function get utmwv():String{ | |
return (_config.version); | |
} | |
public function sendRequest(_arg1:URLRequest):void{ | |
var request:* = _arg1; | |
var loader:* = new Loader(); | |
loader.name = String(_count++); | |
var context:* = new LoaderContext(false); | |
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onIOError); | |
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete); | |
_lastRequest = request; | |
_requests[loader.name] = new RequestObject(request); | |
try { | |
loader.load(request, context); | |
} catch(e:Error) { | |
_debug.failure("\"Loader.load()\" could not instanciate Gif Request"); | |
}; | |
} | |
private function _removeListeners(_arg1:Object):void{ | |
_arg1.removeEventListener(IOErrorEvent.IO_ERROR, onIOError); | |
_arg1.removeEventListener(Event.COMPLETE, onComplete); | |
} | |
public function updateToken():void{ | |
var _local2:Number; | |
var _local1:Number = new Date().getTime(); | |
_local2 = ((_local1 - _buffer.utmb.lastTime) * (_config.tokenRate / 1000)); | |
if (_debug.verbose){ | |
_debug.info(("tokenDelta: " + _local2), VisualDebugMode.geek); | |
}; | |
if (_local2 >= 1){ | |
_buffer.utmb.token = Math.min(Math.floor((_buffer.utmb.token + _local2)), _config.bucketCapacity); | |
_buffer.utmb.lastTime = _local1; | |
if (_debug.verbose){ | |
_debug.info(_buffer.utmb.toString(), VisualDebugMode.geek); | |
}; | |
}; | |
} | |
public function get utmhn():String{ | |
return (_info.domainName); | |
} | |
private function _shortenURL(_arg1:String):String{ | |
var _local2:Array; | |
if (_arg1.length > 60){ | |
_local2 = _arg1.split("/"); | |
while (_arg1.length > 60) { | |
_local2.shift(); | |
_arg1 = ("../" + _local2.join("/")); | |
}; | |
}; | |
return (_arg1); | |
} | |
private function _debugSend(_arg1:URLRequest):void{ | |
var _local3:String; | |
var _local2 = ""; | |
switch (_debug.mode){ | |
case VisualDebugMode.geek: | |
_local2 = ((("Gif Request #" + _alertcount) + ":\n") + _arg1.url); | |
break; | |
case VisualDebugMode.advanced: | |
_local3 = _arg1.url; | |
if (_local3.indexOf("?") > -1){ | |
_local3 = _local3.split("?")[0]; | |
}; | |
_local3 = _shortenURL(_local3); | |
_local2 = (((("Send Gif Request #" + _alertcount) + ":\n") + _local3) + " ?"); | |
break; | |
case VisualDebugMode.basic: | |
default: | |
_local2 = (((("Send " + _config.serverMode.toString()) + " Gif Request #") + _alertcount) + " ?"); | |
}; | |
_debug.alertGifRequest(_local2, _arg1, this); | |
_alertcount++; | |
} | |
public function onComplete(_arg1:Event):void{ | |
var _local2:String = _arg1.target.loader.name; | |
_requests[_local2].complete(); | |
var _local3 = (("Gif Request #" + _local2) + " sent"); | |
var _local4:String = _requests[_local2].request.url; | |
if (_debug.GIFRequests){ | |
if (!_debug.verbose){ | |
if (_local4.indexOf("?") > -1){ | |
_local4 = _local4.split("?")[0]; | |
}; | |
_local4 = _shortenURL(_local4); | |
}; | |
if (int(_debug.mode) > int(VisualDebugMode.basic)){ | |
_local3 = (_local3 + ((" to \"" + _local4) + "\"")); | |
}; | |
_debug.success(_local3); | |
} else { | |
_debug.info(_local3); | |
}; | |
_removeListeners(_arg1.target); | |
} | |
} | |
}//package com.google.analytics.core | |
package com.google.analytics.core { | |
public class TrackerMode { | |
public static const BRIDGE:String = "Bridge"; | |
public static const AS3:String = "AS3"; | |
} | |
}//package com.google.analytics.core | |
package com.google.analytics.core { | |
import com.google.analytics.v4.*; | |
import com.google.analytics.external.*; | |
import com.google.analytics.utils.*; | |
public class DocumentInfo { | |
private var _pageURL:String; | |
private var _utmr:String; | |
private var _config:Configuration; | |
private var _adSense:AdSenseGlobals; | |
private var _info:Environment; | |
public function DocumentInfo(_arg1:Configuration, _arg2:Environment, _arg3:String, _arg4:String=null, _arg5:AdSenseGlobals=null){ | |
_config = _arg1; | |
_info = _arg2; | |
_utmr = _arg3; | |
_pageURL = _arg4; | |
_adSense = _arg5; | |
} | |
public function get utmr():String{ | |
if (!_utmr){ | |
return ("-"); | |
}; | |
return (_utmr); | |
} | |
public function toURLString():String{ | |
var _local1:Variables = toVariables(); | |
return (_local1.toString()); | |
} | |
private function _renderPageURL(_arg1:String=""):String{ | |
var _local2:String = _info.locationPath; | |
var _local3:String = _info.locationSearch; | |
if (((!(_arg1)) || ((_arg1 == "")))){ | |
_arg1 = (_local2 + unescape(_local3)); | |
}; | |
return (_arg1); | |
} | |
public function get utmp():String{ | |
return (_renderPageURL(_pageURL)); | |
} | |
public function get utmhid():String{ | |
return (String(_generateHitId())); | |
} | |
private function _generateHitId():Number{ | |
var _local1:Number; | |
if (((_adSense.hid) && (!((_adSense.hid == ""))))){ | |
_local1 = Number(_adSense.hid); | |
} else { | |
_local1 = Math.round((Math.random() * 2147483647)); | |
_adSense.hid = String(_local1); | |
}; | |
return (_local1); | |
} | |
public function toVariables():Variables{ | |
var _local1:Variables = new Variables(); | |
_local1.URIencode = true; | |
if (((_config.detectTitle) && (!((utmdt == ""))))){ | |
_local1.utmdt = utmdt; | |
}; | |
_local1.utmhid = utmhid; | |
_local1.utmr = utmr; | |
_local1.utmp = utmp; | |
return (_local1); | |
} | |
public function get utmdt():String{ | |
return (_info.documentTitle); | |
} | |
} | |
}//package com.google.analytics.core | |
package com.google.analytics.core { | |
import com.google.analytics.v4.*; | |
import com.google.analytics.utils.*; | |
public class BrowserInfo { | |
private var _config:Configuration; | |
private var _info:Environment; | |
public function BrowserInfo(_arg1:Configuration, _arg2:Environment){ | |
_config = _arg1; | |
_info = _arg2; | |
} | |
public function get utmul():String{ | |
return (_info.language.toLowerCase()); | |
} | |
public function get utmje():String{ | |
return ("0"); | |
} | |
public function toURLString():String{ | |
var _local1:Variables = toVariables(); | |
return (_local1.toString()); | |
} | |
public function get utmsr():String{ | |
return (((_info.screenWidth + "x") + _info.screenHeight)); | |
} | |
public function get utmfl():String{ | |
var _local1:Version; | |
if (_config.detectFlash){ | |
_local1 = _info.flashVersion; | |
return (((((_local1.major + ".") + _local1.minor) + " r") + _local1.build)); | |
}; | |
return ("-"); | |
} | |
public function get utmcs():String{ | |
return (_info.languageEncoding); | |
} | |
public function toVariables():Variables{ | |
var _local1:Variables = new Variables(); | |
_local1.URIencode = true; | |
_local1.utmcs = utmcs; | |
_local1.utmsr = utmsr; | |
_local1.utmsc = utmsc; | |
_local1.utmul = utmul; | |
_local1.utmje = utmje; | |
_local1.utmfl = utmfl; | |
return (_local1); | |
} | |
public function get utmsc():String{ | |
return ((_info.screenColorDepth + "-bit")); | |
} | |
} | |
}//package com.google.analytics.core | |
package com.google.analytics.core { | |
public class ServerOperationMode { | |
public static const both:ServerOperationMode = new ServerOperationMode(2, "both"); | |
; | |
public static const remote:ServerOperationMode = new ServerOperationMode(1, "remote"); | |
; | |
public static const local:ServerOperationMode = new ServerOperationMode(0, "local"); | |
; | |
private var _value:int; | |
private var _name:String; | |
public function ServerOperationMode(_arg1:int=0, _arg2:String=""){ | |
_value = _arg1; | |
_name = _arg2; | |
} | |
public function valueOf():int{ | |
return (_value); | |
} | |
public function toString():String{ | |
return (_name); | |
} | |
} | |
}//package com.google.analytics.core | |
package com.google.analytics.core { | |
import com.google.analytics.v4.*; | |
import flash.errors.*; | |
public class TrackerCache implements GoogleAnalyticsAPI { | |
public static var CACHE_THROW_ERROR:Boolean; | |
public var tracker:GoogleAnalyticsAPI; | |
private var _ar:Array; | |
public function TrackerCache(_arg1:GoogleAnalyticsAPI=null){ | |
this.tracker = _arg1; | |
_ar = []; | |
} | |
public function size():uint{ | |
return (_ar.length); | |
} | |
public function flush():void{ | |
var _local1:Object; | |
var _local2:String; | |
var _local3:Array; | |
var _local4:int; | |
var _local5:int; | |
if (tracker == null){ | |
return; | |
}; | |
if (size() > 0){ | |
_local4 = _ar.length; | |
while (_local5 < _local4) { | |
_local1 = _ar.shift(); | |
_local2 = (_local1.name as String); | |
_local3 = (_local1.args as Array); | |
if (((!((_local2 == null))) && ((_local2 in tracker)))){ | |
(tracker[_local2] as Function).apply(tracker, _local3); | |
}; | |
_local5++; | |
}; | |
}; | |
} | |
public function enqueue(_arg1:String, ... _args):Boolean{ | |
if (_arg1 == null){ | |
return (false); | |
}; | |
_ar.push({ | |
name:_arg1, | |
args:_args | |
}); | |
return (true); | |
} | |
public function link(_arg1:String, _arg2:Boolean=false):void{ | |
enqueue("link", _arg1, _arg2); | |
} | |
public function addOrganic(_arg1:String, _arg2:String):void{ | |
enqueue("addOrganic", _arg1, _arg2); | |
} | |
public function setAllowLinker(_arg1:Boolean):void{ | |
enqueue("setAllowLinker", _arg1); | |
} | |
public function trackEvent(_arg1:String, _arg2:String, _arg3:String=null, _arg4:Number=NaN):Boolean{ | |
enqueue("trackEvent", _arg1, _arg2, _arg3, _arg4); | |
return (true); | |
} | |
public function getClientInfo():Boolean{ | |
if (CACHE_THROW_ERROR){ | |
throw (new IllegalOperationError("The tracker is not ready and you can use the 'getClientInfo' method for the moment.")); | |
}; | |
return (false); | |
} | |
public function trackTrans():void{ | |
enqueue("trackTrans"); | |
} | |
public function trackPageview(_arg1:String=""):void{ | |
enqueue("trackPageview", _arg1); | |
} | |
public function setClientInfo(_arg1:Boolean):void{ | |
enqueue("setClientInfo", _arg1); | |
} | |
public function linkByPost(_arg1:Object, _arg2:Boolean=false):void{ | |
enqueue("linkByPost", _arg1, _arg2); | |
} | |
public function setCookieTimeout(_arg1:int):void{ | |
enqueue("setCookieTimeout", _arg1); | |
} | |
public function isEmpty():Boolean{ | |
return ((_ar.length == 0)); | |
} | |
public function getDetectTitle():Boolean{ | |
if (CACHE_THROW_ERROR){ | |
throw (new IllegalOperationError("The tracker is not ready and you can use the 'getDetectTitle' method for the moment.")); | |
}; | |
return (false); | |
} | |
public function resetSession():void{ | |
enqueue("resetSession"); | |
} | |
public function setDetectFlash(_arg1:Boolean):void{ | |
enqueue("setDetectFlash", _arg1); | |
} | |
public function clear():void{ | |
_ar = []; | |
} | |
public function setCampNameKey(_arg1:String):void{ | |
enqueue("setCampNameKey", _arg1); | |
} | |
public function addItem(_arg1:String, _arg2:String, _arg3:String, _arg4:String, _arg5:Number, _arg6:int):void{ | |
enqueue("addItem", _arg1, _arg2, _arg3, _arg4, _arg5, _arg6); | |
} | |
public function createEventTracker(_arg1:String):EventTracker{ | |
if (CACHE_THROW_ERROR){ | |
throw (new IllegalOperationError("The tracker is not ready and you can use the 'createEventTracker' method for the moment.")); | |
}; | |
return (null); | |
} | |
public function setVar(_arg1:String):void{ | |
enqueue("setVar", _arg1); | |
} | |
public function clearIgnoredOrganic():void{ | |
enqueue("clearIgnoredOrganic"); | |
} | |
public function setDomainName(_arg1:String):void{ | |
enqueue("setDomainName", _arg1); | |
} | |
public function setCampSourceKey(_arg1:String):void{ | |
enqueue("setCampSourceKey", _arg1); | |
} | |
public function addTrans(_arg1:String, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:String, _arg7:String, _arg8:String):Object{ | |
if (CACHE_THROW_ERROR){ | |
throw (new IllegalOperationError("The tracker is not ready and you can use the 'addTrans' method for the moment.")); | |
}; | |
return (null); | |
} | |
public function setCampContentKey(_arg1:String):void{ | |
enqueue("setCampContentKey", _arg1); | |
} | |
public function setLocalServerMode():void{ | |
enqueue("setLocalServerMode"); | |
} | |
public function getLocalGifPath():String{ | |
if (CACHE_THROW_ERROR){ | |
throw (new IllegalOperationError("The tracker is not ready and you can use the 'getLocalGifPath' method for the moment.")); | |
}; | |
return (""); | |
} | |
public function setAllowAnchor(_arg1:Boolean):void{ | |
enqueue("setAllowAnchor", _arg1); | |
} | |
public function clearIgnoredRef():void{ | |
enqueue("clearIgnoredRef"); | |
} | |
public function setLocalGifPath(_arg1:String):void{ | |
enqueue("setLocalGifPath", _arg1); | |
} | |
public function getVersion():String{ | |
if (CACHE_THROW_ERROR){ | |
throw (new IllegalOperationError("The tracker is not ready and you can use the 'getVersion' method for the moment.")); | |
}; | |
return (""); | |
} | |
public function setCookiePath(_arg1:String):void{ | |
enqueue("setCookiePath", _arg1); | |
} | |
public function setSampleRate(_arg1:Number):void{ | |
enqueue("setSampleRate", _arg1); | |
} | |
public function setDetectTitle(_arg1:Boolean):void{ | |
enqueue("setDetectTitle", _arg1); | |
} | |
public function setAllowHash(_arg1:Boolean):void{ | |
enqueue("setAllowHash", _arg1); | |
} | |
public function addIgnoredOrganic(_arg1:String):void{ | |
enqueue("addIgnoredOrganic", _arg1); | |
} | |
public function setCampNOKey(_arg1:String):void{ | |
enqueue("setCampNOKey", _arg1); | |
} | |
public function getServiceMode():ServerOperationMode{ | |
if (CACHE_THROW_ERROR){ | |
throw (new IllegalOperationError("The tracker is not ready and you can use the 'getServiceMode' method for the moment.")); | |
}; | |
return (null); | |
} | |
public function setLocalRemoteServerMode():void{ | |
enqueue("setLocalRemoteServerMode"); | |
} | |
public function cookiePathCopy(_arg1:String):void{ | |
enqueue("cookiePathCopy", _arg1); | |
} | |
public function getDetectFlash():Boolean{ | |
if (CACHE_THROW_ERROR){ | |
throw (new IllegalOperationError("The tracker is not ready and you can use the 'getDetectFlash' method for the moment.")); | |
}; | |
return (false); | |
} | |
public function setCampaignTrack(_arg1:Boolean):void{ | |
enqueue("setCampaignTrack", _arg1); | |
} | |
public function clearOrganic():void{ | |
enqueue("clearOrganic"); | |
} | |
public function setCampTermKey(_arg1:String):void{ | |
enqueue("setCampTermKey", _arg1); | |
} | |
public function addIgnoredRef(_arg1:String):void{ | |
enqueue("addIgnoredRef", _arg1); | |
} | |
public function setCampMediumKey(_arg1:String):void{ | |
enqueue("setCampMediumKey", _arg1); | |
} | |
public function setSessionTimeout(_arg1:int):void{ | |
enqueue("setSessionTimeout", _arg1); | |
} | |
public function setRemoteServerMode():void{ | |
enqueue("setRemoteServerMode"); | |
} | |
public function element(){ | |
return (_ar[0]); | |
} | |
public function getAccount():String{ | |
if (CACHE_THROW_ERROR){ | |
throw (new IllegalOperationError("The tracker is not ready and you can use the 'getAccount' method for the moment.")); | |
}; | |
return (""); | |
} | |
} | |
}//package com.google.analytics.core | |
package com.google.analytics.core { | |
import flash.events.*; | |
import flash.display.*; | |
import com.google.analytics.v4.*; | |
import com.google.analytics.debug.*; | |
import flash.utils.*; | |
public class IdleTimer { | |
private var _stage:Stage; | |
private var _loop:Timer; | |
private var _lastMove:int; | |
private var _inactivity:Number; | |
private var _debug:DebugConfiguration; | |
private var _session:Timer; | |
private var _buffer:Buffer; | |
public function IdleTimer(_arg1:Configuration, _arg2:DebugConfiguration, _arg3:DisplayObject, _arg4:Buffer){ | |
var _local5:Number = _arg1.idleLoop; | |
var _local6:Number = _arg1.idleTimeout; | |
var _local7:Number = _arg1.sessionTimeout; | |
_loop = new Timer((_local5 * 1000)); | |
_session = new Timer((_local7 * 1000), 1); | |
_debug = _arg2; | |
_stage = _arg3.stage; | |
_buffer = _arg4; | |
_lastMove = getTimer(); | |
_inactivity = (_local6 * 1000); | |
_loop.addEventListener(TimerEvent.TIMER, checkForIdle); | |
_session.addEventListener(TimerEvent.TIMER_COMPLETE, endSession); | |
_stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove); | |
_debug.info(((((("delay: " + _local5) + "sec , inactivity: ") + _local6) + "sec, sessionTimeout: ") + _local7), VisualDebugMode.geek); | |
_loop.start(); | |
} | |
private function onMouseMove(_arg1:MouseEvent):void{ | |
_lastMove = getTimer(); | |
if (_session.running){ | |
_debug.info("session timer reset", VisualDebugMode.geek); | |
_session.reset(); | |
}; | |
} | |
public function endSession(_arg1:TimerEvent):void{ | |
_session.removeEventListener(TimerEvent.TIMER_COMPLETE, endSession); | |
_debug.info("session timer end session", VisualDebugMode.geek); | |
_session.reset(); | |
_buffer.resetCurrentSession(); | |
_debug.info(_buffer.utmb.toString(), VisualDebugMode.geek); | |
_debug.info(_buffer.utmc.toString(), VisualDebugMode.geek); | |
_session.addEventListener(TimerEvent.TIMER_COMPLETE, endSession); | |
} | |
public function checkForIdle(_arg1:TimerEvent):void{ | |
var _local2:int = getTimer(); | |
if ((_local2 - _lastMove) >= _inactivity){ | |
if (!_session.running){ | |
_debug.info("session timer start", VisualDebugMode.geek); | |
_session.start(); | |
}; | |
}; | |
} | |
} | |
}//package com.google.analytics.core | |
package com.google.analytics { | |
import flash.events.*; | |
import flash.display.*; | |
import com.google.analytics.core.*; | |
import com.google.analytics.v4.*; | |
import com.google.analytics.debug.*; | |
import com.google.analytics.external.*; | |
import com.google.analytics.utils.*; | |
import com.google.analytics.events.*; | |
public class GATracker implements AnalyticsTracker { | |
public static var version:Version = API.version; | |
public static var autobuild:Boolean = true; | |
private var _adSense:AdSenseGlobals; | |
private var _env:Environment; | |
private var _visualDebug:Boolean; | |
private var _idleTimer:IdleTimer; | |
private var _debug:DebugConfiguration; | |
private var _buffer:Buffer; | |
private var _config:Configuration; | |
private var _mode:String; | |
private var _display:DisplayObject; | |
private var _jsproxy:JavascriptProxy; | |
private var _dom:HTMLDOM; | |
private var _eventDispatcher:EventDispatcher; | |
private var _ready:Boolean = false; | |
private var _gifRequest:GIFRequest; | |
private var _account:String; | |
private var _tracker:GoogleAnalyticsAPI; | |
public function GATracker(_arg1:DisplayObject, _arg2:String, _arg3:String="AS3", _arg4:Boolean=false, _arg5:Configuration=null, _arg6:DebugConfiguration=null){ | |
_display = _arg1; | |
_eventDispatcher = new EventDispatcher(this); | |
_tracker = new TrackerCache(); | |
this.account = _arg2; | |
this.mode = _arg3; | |
this.visualDebug = _arg4; | |
if (!_arg6){ | |
this.debug = new DebugConfiguration(); | |
}; | |
if (!_arg5){ | |
this.config = new Configuration(_arg6); | |
}; | |
if (autobuild){ | |
_factory(); | |
}; | |
} | |
public function link(_arg1:String, _arg2:Boolean=false):void{ | |
_tracker.link(_arg1, _arg2); | |
} | |
public function addOrganic(_arg1:String, _arg2:String):void{ | |
_tracker.addOrganic(_arg1, _arg2); | |
} | |
public function setAllowLinker(_arg1:Boolean):void{ | |
_tracker.setAllowLinker(_arg1); | |
} | |
public function trackEvent(_arg1:String, _arg2:String, _arg3:String=null, _arg4:Number=NaN):Boolean{ | |
return (_tracker.trackEvent(_arg1, _arg2, _arg3, _arg4)); | |
} | |
public function setCookieTimeout(_arg1:int):void{ | |
_tracker.setCookieTimeout(_arg1); | |
} | |
public function trackTrans():void{ | |
_tracker.trackTrans(); | |
} | |
public function getClientInfo():Boolean{ | |
return (_tracker.getClientInfo()); | |
} | |
public function trackPageview(_arg1:String=""):void{ | |
_tracker.trackPageview(_arg1); | |
} | |
public function setClientInfo(_arg1:Boolean):void{ | |
_tracker.setClientInfo(_arg1); | |
} | |
public function get account():String{ | |
return (_account); | |
} | |
public function linkByPost(_arg1:Object, _arg2:Boolean=false):void{ | |
_tracker.linkByPost(_arg1, _arg2); | |
} | |
public function getDetectTitle():Boolean{ | |
return (_tracker.getDetectTitle()); | |
} | |
public function dispatchEvent(_arg1:Event):Boolean{ | |
return (_eventDispatcher.dispatchEvent(_arg1)); | |
} | |
public function get config():Configuration{ | |
return (_config); | |
} | |
public function set mode(_arg1:String):void{ | |
_mode = _arg1; | |
} | |
public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{ | |
_eventDispatcher.removeEventListener(_arg1, _arg2, _arg3); | |
} | |
public function setDetectFlash(_arg1:Boolean):void{ | |
_tracker.setDetectFlash(_arg1); | |
} | |
public function resetSession():void{ | |
_tracker.resetSession(); | |
} | |
public function setCampNameKey(_arg1:String):void{ | |
_tracker.setCampNameKey(_arg1); | |
} | |
public function get debug():DebugConfiguration{ | |
return (_debug); | |
} | |
public function addItem(_arg1:String, _arg2:String, _arg3:String, _arg4:String, _arg5:Number, _arg6:int):void{ | |
_tracker.addItem(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6); | |
} | |
private function _bridgeFactory():GoogleAnalyticsAPI{ | |
debug.info(((("GATracker (Bridge) v" + version) + "\naccount: ") + account)); | |
return (new Bridge(account, _debug, _jsproxy)); | |
} | |
public function clearIgnoredOrganic():void{ | |
_tracker.clearIgnoredOrganic(); | |
} | |
public function set account(_arg1:String):void{ | |
_account = _arg1; | |
} | |
public function setVar(_arg1:String):void{ | |
_tracker.setVar(_arg1); | |
} | |
public function build():void{ | |
if (!isReady()){ | |
_factory(); | |
}; | |
} | |
public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{ | |
_eventDispatcher.addEventListener(_arg1, _arg2, _arg3, _arg4, _arg5); | |
} | |
public function setDomainName(_arg1:String):void{ | |
_tracker.setDomainName(_arg1); | |
} | |
public function createEventTracker(_arg1:String):EventTracker{ | |
return (_tracker.createEventTracker(_arg1)); | |
} | |
public function setCampSourceKey(_arg1:String):void{ | |
_tracker.setCampSourceKey(_arg1); | |
} | |
public function set config(_arg1:Configuration):void{ | |
_config = _arg1; | |
} | |
public function addTrans(_arg1:String, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:String, _arg7:String, _arg8:String):Object{ | |
return (_tracker.addTrans(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8)); | |
} | |
public function setCampContentKey(_arg1:String):void{ | |
_tracker.setCampContentKey(_arg1); | |
} | |
public function willTrigger(_arg1:String):Boolean{ | |
return (_eventDispatcher.willTrigger(_arg1)); | |
} | |
public function setLocalServerMode():void{ | |
_tracker.setLocalServerMode(); | |
} | |
public function getLocalGifPath():String{ | |
return (_tracker.getLocalGifPath()); | |
} | |
public function setAllowAnchor(_arg1:Boolean):void{ | |
_tracker.setAllowAnchor(_arg1); | |
} | |
public function clearIgnoredRef():void{ | |
_tracker.clearIgnoredRef(); | |
} | |
public function isReady():Boolean{ | |
return (_ready); | |
} | |
public function get mode():String{ | |
return (_mode); | |
} | |
public function set debug(_arg1:DebugConfiguration):void{ | |
_debug = _arg1; | |
} | |
public function setLocalGifPath(_arg1:String):void{ | |
_tracker.setLocalGifPath(_arg1); | |
} | |
public function getVersion():String{ | |
return (_tracker.getVersion()); | |
} | |
public function setSampleRate(_arg1:Number):void{ | |
_tracker.setSampleRate(_arg1); | |
} | |
public function setCookiePath(_arg1:String):void{ | |
_tracker.setCookiePath(_arg1); | |
} | |
public function setAllowHash(_arg1:Boolean):void{ | |
_tracker.setAllowHash(_arg1); | |
} | |
public function addIgnoredOrganic(_arg1:String):void{ | |
_tracker.addIgnoredOrganic(_arg1); | |
} | |
public function setLocalRemoteServerMode():void{ | |
_tracker.setLocalRemoteServerMode(); | |
} | |
public function cookiePathCopy(_arg1:String):void{ | |
_tracker.cookiePathCopy(_arg1); | |
} | |
private function _factory():void{ | |
var _local1:GoogleAnalyticsAPI; | |
_jsproxy = new JavascriptProxy(debug); | |
if (visualDebug){ | |
debug.layout = new Layout(debug, _display); | |
debug.active = visualDebug; | |
}; | |
var _local2:TrackerCache = (_tracker as TrackerCache); | |
switch (mode){ | |
case TrackerMode.BRIDGE: | |
_local1 = _bridgeFactory(); | |
break; | |
case TrackerMode.AS3: | |
default: | |
_local1 = _trackerFactory(); | |
}; | |
if (!_local2.isEmpty()){ | |
_local2.tracker = _local1; | |
_local2.flush(); | |
}; | |
_tracker = _local1; | |
_ready = true; | |
dispatchEvent(new AnalyticsEvent(AnalyticsEvent.READY, this)); | |
} | |
public function setCampTermKey(_arg1:String):void{ | |
_tracker.setCampTermKey(_arg1); | |
} | |
private function _trackerFactory():GoogleAnalyticsAPI{ | |
debug.info(((("GATracker (AS3) v" + version) + "\naccount: ") + account)); | |
_adSense = new AdSenseGlobals(debug); | |
_dom = new HTMLDOM(debug); | |
_dom.cacheProperties(); | |
_env = new Environment("", "", "", debug, _dom); | |
_buffer = new Buffer(config, debug, false); | |
_gifRequest = new GIFRequest(config, debug, _buffer, _env); | |
_idleTimer = new IdleTimer(config, debug, _display, _buffer); | |
_env.ga_internal::url = _display.stage.loaderInfo.url; | |
return (new Tracker(account, config, debug, _env, _buffer, _gifRequest, _adSense)); | |
} | |
public function setCampNOKey(_arg1:String):void{ | |
_tracker.setCampNOKey(_arg1); | |
} | |
public function setDetectTitle(_arg1:Boolean):void{ | |
_tracker.setDetectTitle(_arg1); | |
} | |
public function getServiceMode():ServerOperationMode{ | |
return (_tracker.getServiceMode()); | |
} | |
public function clearOrganic():void{ | |
_tracker.clearOrganic(); | |
} | |
public function setCampaignTrack(_arg1:Boolean):void{ | |
_tracker.setCampaignTrack(_arg1); | |
} | |
public function addIgnoredRef(_arg1:String):void{ | |
_tracker.addIgnoredRef(_arg1); | |
} | |
public function set visualDebug(_arg1:Boolean):void{ | |
_visualDebug = _arg1; | |
} | |
public function setCampMediumKey(_arg1:String):void{ | |
_tracker.setCampMediumKey(_arg1); | |
} | |
public function getDetectFlash():Boolean{ | |
return (_tracker.getDetectFlash()); | |
} | |
public function get visualDebug():Boolean{ | |
return (_visualDebug); | |
} | |
public function hasEventListener(_arg1:String):Boolean{ | |
return (_eventDispatcher.hasEventListener(_arg1)); | |
} | |
public function getAccount():String{ | |
return (_tracker.getAccount()); | |
} | |
public function setSessionTimeout(_arg1:int):void{ | |
_tracker.setSessionTimeout(_arg1); | |
} | |
public function setRemoteServerMode():void{ | |
_tracker.setRemoteServerMode(); | |
} | |
} | |
var _local1:* = ServerOperationMode; | |
return (_local1); | |
}//package com.google.analytics | |
package com.google.analytics { | |
import flash.events.*; | |
import com.google.analytics.v4.*; | |
import com.google.analytics.debug.*; | |
public interface AnalyticsTracker extends GoogleAnalyticsAPI, IEventDispatcher { | |
function set account(_arg1:String):void; | |
function get config():Configuration; | |
function get mode():String; | |
function set config(_arg1:Configuration):void; | |
function set mode(_arg1:String):void; | |
function set debug(_arg1:DebugConfiguration):void; | |
function get visualDebug():Boolean; | |
function get account():String; | |
function set visualDebug(_arg1:Boolean):void; | |
function isReady():Boolean; | |
function get debug():DebugConfiguration; | |
} | |
}//package com.google.analytics | |
package com.google.analytics.data { | |
public interface Cookie { | |
function fromSharedObject(_arg1:Object):void; | |
function toURLString():String; | |
function get creation():Date; | |
function toSharedObject():Object; | |
function isExpired():Boolean; | |
function set creation(_arg1:Date):void; | |
function set expiration(_arg1:Date):void; | |
function get expiration():Date; | |
} | |
}//package com.google.analytics.data | |
package com.google.analytics.data { | |
public class X10 { | |
private var _delimEnd:String = ")"; | |
private var _minimum:int; | |
private var _delimSet:String = "*"; | |
private var _escapeChar:String = "'"; | |
private var _delimBegin:String = "("; | |
private var _delimNumValue:String = "!"; | |
private var _key:String = "k"; | |
private var _set:Array; | |
private var _hasData:int; | |
private var _escapeCharMap:Object; | |
private var _projectData:Object; | |
private var _value:String = "v"; | |
public function X10(){ | |
_set = [_key, _value]; | |
super(); | |
_projectData = {}; | |
_escapeCharMap = {}; | |
_escapeCharMap[_escapeChar] = "'0"; | |
_escapeCharMap[_delimEnd] = "'1"; | |
_escapeCharMap[_delimSet] = "'2"; | |
_escapeCharMap[_delimNumValue] = "'3"; | |
_minimum = 1; | |
} | |
private function _setInternal(_arg1:Number, _arg2:String, _arg3:Number, _arg4:String):void{ | |
if (!hasProject(_arg1)){ | |
_projectData[_arg1] = {}; | |
}; | |
if (_projectData[_arg1][_arg2] == undefined){ | |
_projectData[_arg1][_arg2] = []; | |
}; | |
_projectData[_arg1][_arg2][_arg3] = _arg4; | |
_hasData = (_hasData + 1); | |
} | |
private function _renderProject(_arg1:Object):String{ | |
var _local4:int; | |
var _local5:Array; | |
var _local2 = ""; | |
var _local3:Boolean; | |
var _local6:int = _set.length; | |
_local4 = 0; | |
while (_local4 < _local6) { | |
_local5 = _arg1[_set[_local4]]; | |
if (_local5){ | |
if (_local3){ | |
_local2 = (_local2 + _set[_local4]); | |
}; | |
_local2 = (_local2 + _renderDataType(_local5)); | |
_local3 = false; | |
} else { | |
_local3 = true; | |
}; | |
_local4++; | |
}; | |
return (_local2); | |
} | |
public function hasProject(_arg1:Number):Boolean{ | |
return (_projectData[_arg1]); | |
} | |
public function clearKey(_arg1:Number):void{ | |
_clearInternal(_arg1, _key); | |
} | |
private function _renderDataType(_arg1:Array):String{ | |
var _local3:String; | |
var _local4:int; | |
var _local2:Array = []; | |
_local4 = 0; | |
while (_local4 < _arg1.length) { | |
if (_arg1[_local4] != undefined){ | |
_local3 = ""; | |
if (((!((_local4 == _minimum))) && ((_arg1[(_local4 - 1)] == undefined)))){ | |
_local3 = (_local3 + _local4.toString()); | |
_local3 = (_local3 + _delimNumValue); | |
}; | |
_local3 = (_local3 + _escapeExtensibleValue(_arg1[_local4])); | |
_local2.push(_local3); | |
}; | |
_local4++; | |
}; | |
return (((_delimBegin + _local2.join(_delimSet)) + _delimEnd)); | |
} | |
public function getKey(_arg1:Number, _arg2:Number):String{ | |
return ((_getInternal(_arg1, _key, _arg2) as String)); | |
} | |
public function hasData():Boolean{ | |
return ((_hasData > 0)); | |
} | |
public function renderMergedUrlString(_arg1:X10=null):String{ | |
var _local3:String; | |
if (!_arg1){ | |
return (renderUrlString()); | |
}; | |
var _local2:Array = [_arg1.renderUrlString()]; | |
for (_local3 in _projectData) { | |
if (((hasProject(Number(_local3))) && (!(_arg1.hasProject(Number(_local3)))))){ | |
_local2.push((_local3 + _renderProject(_projectData[_local3]))); | |
}; | |
}; | |
return (_local2.join("")); | |
} | |
public function setValue(_arg1:Number, _arg2:Number, _arg3:Number):Boolean{ | |
if (((((!((Math.round(_arg3) == _arg3))) || (isNaN(_arg3)))) || ((_arg3 == Infinity)))){ | |
return (false); | |
}; | |
_setInternal(_arg1, _value, _arg2, _arg3.toString()); | |
return (true); | |
} | |
public function renderUrlString():String{ | |
var _local2:String; | |
var _local1:Array = []; | |
for (_local2 in _projectData) { | |
if (hasProject(Number(_local2))){ | |
_local1.push((_local2 + _renderProject(_projectData[_local2]))); | |
}; | |
}; | |
return (_local1.join("")); | |
} | |
private function _getInternal(_arg1:Number, _arg2:String, _arg3:Number):Object{ | |
if (((hasProject(_arg1)) && (!((_projectData[_arg1][_arg2] == undefined))))){ | |
return (_projectData[_arg1][_arg2][_arg3]); | |
}; | |
return (undefined); | |
} | |
public function setKey(_arg1:Number, _arg2:Number, _arg3:String):Boolean{ | |
_setInternal(_arg1, _key, _arg2, _arg3); | |
return (true); | |
} | |
public function clearValue(_arg1:Number):void{ | |
_clearInternal(_arg1, _value); | |
} | |
private function _clearInternal(_arg1:Number, _arg2:String):void{ | |
var _local3:Boolean; | |
var _local4:int; | |
var _local5:int; | |
if (((hasProject(_arg1)) && (!((_projectData[_arg1][_arg2] == undefined))))){ | |
_projectData[_arg1][_arg2] = undefined; | |
_local3 = true; | |
_local5 = _set.length; | |
_local4 = 0; | |
while (_local4 < _local5) { | |
if (_projectData[_arg1][_set[_local4]] != undefined){ | |
_local3 = false; | |
break; | |
}; | |
_local4++; | |
}; | |
if (_local3){ | |
_projectData[_arg1] = undefined; | |
_hasData = (_hasData - 1); | |
}; | |
}; | |
} | |
public function getValue(_arg1:Number, _arg2:Number){ | |
var _local3:* = _getInternal(_arg1, _value, _arg2); | |
if (_local3 == null){ | |
return (null); | |
}; | |
return (Number(_local3)); | |
} | |
private function _escapeExtensibleValue(_arg1:String):String{ | |
var _local3:int; | |
var _local4:String; | |
var _local5:String; | |
var _local2 = ""; | |
_local3 = 0; | |
while (_local3 < _arg1.length) { | |
_local4 = _arg1.charAt(_local3); | |
_local5 = _escapeCharMap[_local4]; | |
if (_local5){ | |
_local2 = (_local2 + _local5); | |
} else { | |
_local2 = (_local2 + _local4); | |
}; | |
_local3++; | |
}; | |
return (_local2); | |
} | |
} | |
}//package com.google.analytics.data | |
package com.google.analytics.data { | |
import com.google.analytics.utils.*; | |
public class UTMZ extends UTMCookie { | |
public static var defaultTimespan:Number = Timespan.sixmonths; | |
private var _campaignTracking:String; | |
private var _campaignCreation:Number; | |
private var _responseCount:Number; | |
private var _domainHash:Number; | |
private var _campaignSessions:Number; | |
public function UTMZ(_arg1:Number=NaN, _arg2:Number=NaN, _arg3:Number=NaN, _arg4:Number=NaN, _arg5:String=""){ | |
super("utmz", "__utmz", ["domainHash", "campaignCreation", "campaignSessions", "responseCount", "campaignTracking"], (defaultTimespan * 1000)); | |
this.domainHash = _arg1; | |
this.campaignCreation = _arg2; | |
this.campaignSessions = _arg3; | |
this.responseCount = _arg4; | |
this.campaignTracking = _arg5; | |
} | |
public function set responseCount(_arg1:Number):void{ | |
_responseCount = _arg1; | |
update(); | |
} | |
public function set domainHash(_arg1:Number):void{ | |
_domainHash = _arg1; | |
update(); | |
} | |
public function set campaignCreation(_arg1:Number):void{ | |
_campaignCreation = _arg1; | |
update(); | |
} | |
public function get campaignTracking():String{ | |
return (_campaignTracking); | |
} | |
public function get campaignSessions():Number{ | |
return (_campaignSessions); | |
} | |
public function get domainHash():Number{ | |
return (_domainHash); | |
} | |
public function get responseCount():Number{ | |
return (_responseCount); | |
} | |
public function get campaignCreation():Number{ | |
return (_campaignCreation); | |
} | |
public function set campaignSessions(_arg1:Number):void{ | |
_campaignSessions = _arg1; | |
update(); | |
} | |
public function set campaignTracking(_arg1:String):void{ | |
_campaignTracking = _arg1; | |
update(); | |
} | |
} | |
}//package com.google.analytics.data | |
package com.google.analytics.data { | |
import com.google.analytics.utils.*; | |
public class UTMV extends UTMCookie { | |
private var _domainHash:Number; | |
private var _value:String; | |
public function UTMV(_arg1:Number=NaN, _arg2:String=""){ | |
super("utmv", "__utmv", ["domainHash", "value"], (Timespan.twoyears * 1000)); | |
this.domainHash = _arg1; | |
this.value = _arg2; | |
} | |
override public function toURLString():String{ | |
return (((inURL + "=") + encodeURI(valueOf()))); | |
} | |
public function get value():String{ | |
return (_value); | |
} | |
public function get domainHash():Number{ | |
return (_domainHash); | |
} | |
public function set domainHash(_arg1:Number):void{ | |
_domainHash = _arg1; | |
update(); | |
} | |
public function set value(_arg1:String):void{ | |
_value = _arg1; | |
update(); | |
} | |
} | |
}//package com.google.analytics.data | |
package com.google.analytics.data { | |
import com.google.analytics.utils.*; | |
public class UTMA extends UTMCookie { | |
private var _sessionId:Number; | |
private var _domainHash:Number; | |
private var _firstTime:Number; | |
private var _currentTime:Number; | |
private var _lastTime:Number; | |
private var _sessionCount:Number; | |
public function UTMA(_arg1:Number=NaN, _arg2:Number=NaN, _arg3:Number=NaN, _arg4:Number=NaN, _arg5:Number=NaN, _arg6:Number=NaN){ | |
super("utma", "__utma", ["domainHash", "sessionId", "firstTime", "lastTime", "currentTime", "sessionCount"], (Timespan.twoyears * 1000)); | |
this.domainHash = _arg1; | |
this.sessionId = _arg2; | |
this.firstTime = _arg3; | |
this.lastTime = _arg4; | |
this.currentTime = _arg5; | |
this.sessionCount = _arg6; | |
} | |
public function get lastTime():Number{ | |
return (_lastTime); | |
} | |
public function set lastTime(_arg1:Number):void{ | |
_lastTime = _arg1; | |
update(); | |
} | |
public function set currentTime(_arg1:Number):void{ | |
_currentTime = _arg1; | |
update(); | |
} | |
public function get sessionId():Number{ | |
return (_sessionId); | |
} | |
public function get sessionCount():Number{ | |
return (_sessionCount); | |
} | |
public function get firstTime():Number{ | |
return (_firstTime); | |
} | |
public function get currentTime():Number{ | |
return (_currentTime); | |
} | |
public function set domainHash(_arg1:Number):void{ | |
_domainHash = _arg1; | |
update(); | |
} | |
public function set sessionId(_arg1:Number):void{ | |
_sessionId = _arg1; | |
update(); | |
} | |
public function set sessionCount(_arg1:Number):void{ | |
_sessionCount = _arg1; | |
update(); | |
} | |
public function get domainHash():Number{ | |
return (_domainHash); | |
} | |
public function set firstTime(_arg1:Number):void{ | |
_firstTime = _arg1; | |
update(); | |
} | |
} | |
}//package com.google.analytics.data | |
package com.google.analytics.data { | |
public class UTMK extends UTMCookie { | |
private var _hash:Number; | |
public function UTMK(_arg1:Number=NaN){ | |
super("utmk", "__utmk", ["hash"]); | |
this.hash = _arg1; | |
} | |
public function set hash(_arg1:Number):void{ | |
_hash = _arg1; | |
update(); | |
} | |
public function get hash():Number{ | |
return (_hash); | |
} | |
} | |
}//package com.google.analytics.data | |
package com.google.analytics.data { | |
import com.google.analytics.core.*; | |
public class UTMCookie implements Cookie { | |
protected var inURL:String; | |
protected var name:String; | |
private var _creation:Date; | |
private var _expiration:Date; | |
public var proxy:Buffer; | |
protected var fields:Array; | |
private var _timespan:Number; | |
public function UTMCookie(_arg1:String, _arg2:String, _arg3:Array, _arg4:Number=0){ | |
this.name = _arg1; | |
this.inURL = _arg2; | |
this.fields = _arg3; | |
_timestamp(_arg4); | |
} | |
public function isEmpty():Boolean{ | |
var _local2:String; | |
var _local1:int; | |
var _local3:int; | |
while (_local3 < fields.length) { | |
_local2 = fields[_local3]; | |
if ((((this[_local2] is Number)) && (isNaN(this[_local2])))){ | |
_local1++; | |
} else { | |
if ((((this[_local2] is String)) && ((this[_local2] == "")))){ | |
_local1++; | |
}; | |
}; | |
_local3++; | |
}; | |
if (_local1 == fields.length){ | |
return (true); | |
}; | |
return (false); | |
} | |
public function resetTimestamp(_arg1:Number=NaN):void{ | |
if (!isNaN(_arg1)){ | |
_timespan = _arg1; | |
}; | |
_creation = null; | |
_expiration = null; | |
_timestamp(_timespan); | |
} | |
protected function update():void{ | |
resetTimestamp(); | |
if (proxy){ | |
proxy.update(name, toSharedObject()); | |
}; | |
} | |
public function reset():void{ | |
var _local1:String; | |
var _local2:int; | |
while (_local2 < fields.length) { | |
_local1 = fields[_local2]; | |
if ((this[_local1] is Number)){ | |
this[_local1] = NaN; | |
} else { | |
if ((this[_local1] is String)){ | |
this[_local1] = ""; | |
}; | |
}; | |
_local2++; | |
}; | |
resetTimestamp(); | |
update(); | |
} | |
public function fromSharedObject(_arg1:Object):void{ | |
var _local2:String; | |
var _local3:int = fields.length; | |
var _local4:int; | |
while (_local4 < _local3) { | |
_local2 = fields[_local4]; | |
if (_arg1[_local2]){ | |
this[_local2] = _arg1[_local2]; | |
}; | |
_local4++; | |
}; | |
if (_arg1.creation){ | |
this.creation = _arg1.creation; | |
}; | |
if (_arg1.expiration){ | |
this.expiration = _arg1.expiration; | |
}; | |
} | |
private function _timestamp(_arg1:Number):void{ | |
creation = new Date(); | |
_timespan = _arg1; | |
if (_arg1 > 0){ | |
expiration = new Date((creation.valueOf() + _arg1)); | |
}; | |
} | |
public function isExpired():Boolean{ | |
var _local1:Date = new Date(); | |
var _local2:Number = (expiration.valueOf() - _local1.valueOf()); | |
if (_local2 <= 0){ | |
return (true); | |
}; | |
return (false); | |
} | |
public function set expiration(_arg1:Date):void{ | |
_expiration = _arg1; | |
} | |
public function get creation():Date{ | |
return (_creation); | |
} | |
public function valueOf():String{ | |
var _local2:String; | |
var _local3:*; | |
var _local1:Array = []; | |
var _local4:int; | |
while (_local4 < fields.length) { | |
_local2 = fields[_local4]; | |
_local3 = this[_local2]; | |
if ((_local3 is String)){ | |
if (_local3 == ""){ | |
_local3 = "-"; | |
_local1.push(_local3); | |
} else { | |
_local1.push(_local3); | |
}; | |
} else { | |
if ((_local3 is Number)){ | |
if (_local3 == 0){ | |
_local1.push(_local3); | |
} else { | |
if (isNaN(_local3)){ | |
_local3 = "-"; | |
_local1.push(_local3); | |
} else { | |
_local1.push(_local3); | |
}; | |
}; | |
}; | |
}; | |
_local4++; | |
}; | |
return (("" + _local1.join("."))); | |
} | |
public function toURLString():String{ | |
return (((inURL + "=") + valueOf())); | |
} | |
public function get expiration():Date{ | |
if (_expiration){ | |
return (_expiration); | |
}; | |
return (new Date((new Date().valueOf() + 1000))); | |
} | |
public function toSharedObject():Object{ | |
var _local2:String; | |
var _local3:*; | |
var _local1:Object = {}; | |
var _local4:int; | |
while (_local4 < fields.length) { | |
_local2 = fields[_local4]; | |
_local3 = this[_local2]; | |
if ((_local3 is String)){ | |
_local1[_local2] = _local3; | |
} else { | |
if (_local3 == 0){ | |
_local1[_local2] = _local3; | |
} else { | |
if (isNaN(_local3)){ | |
} else { | |
_local1[_local2] = _local3; | |
}; | |
}; | |
}; | |
_local4++; | |
}; | |
_local1.creation = creation; | |
_local1.expiration = expiration; | |
return (_local1); | |
} | |
public function toString(_arg1:Boolean=false):String{ | |
var _local3:String; | |
var _local4:*; | |
var _local2:Array = []; | |
var _local5:int = fields.length; | |
var _local6:int; | |
while (_local6 < _local5) { | |
_local3 = fields[_local6]; | |
_local4 = this[_local3]; | |
if ((_local4 is String)){ | |
_local2.push((((_local3 + ": \"") + _local4) + "\"")); | |
} else { | |
if (_local4 == 0){ | |
_local2.push(((_local3 + ": ") + _local4)); | |
} else { | |
if (isNaN(_local4)){ | |
} else { | |
_local2.push(((_local3 + ": ") + _local4)); | |
}; | |
}; | |
}; | |
_local6++; | |
}; | |
var _local7 = (((name.toUpperCase() + " {") + _local2.join(", ")) + "}"); | |
if (_arg1){ | |
_local7 = (_local7 + (((" creation:" + creation) + ", expiration:") + expiration)); | |
}; | |
return (_local7); | |
} | |
public function set creation(_arg1:Date):void{ | |
_creation = _arg1; | |
} | |
} | |
}//package com.google.analytics.data | |
package com.google.analytics.data { | |
import com.google.analytics.utils.*; | |
public class UTMB extends UTMCookie { | |
public static var defaultTimespan:Number = Timespan.thirtyminutes; | |
private var _trackCount:Number; | |
private var _lastTime:Number; | |
private var _domainHash:Number; | |
private var _token:Number; | |
public function UTMB(_arg1:Number=NaN, _arg2:Number=NaN, _arg3:Number=NaN, _arg4:Number=NaN){ | |
super("utmb", "__utmb", ["domainHash", "trackCount", "token", "lastTime"], (defaultTimespan * 1000)); | |
this.domainHash = _arg1; | |
this.trackCount = _arg2; | |
this.token = _arg3; | |
this.lastTime = _arg4; | |
} | |
public function set token(_arg1:Number):void{ | |
_token = _arg1; | |
update(); | |
} | |
public function set trackCount(_arg1:Number):void{ | |
_trackCount = _arg1; | |
update(); | |
} | |
public function get lastTime():Number{ | |
return (_lastTime); | |
} | |
public function set domainHash(_arg1:Number):void{ | |
_domainHash = _arg1; | |
update(); | |
} | |
public function set lastTime(_arg1:Number):void{ | |
_lastTime = _arg1; | |
update(); | |
} | |
public function get domainHash():Number{ | |
return (_domainHash); | |
} | |
public function get token():Number{ | |
return (_token); | |
} | |
public function get trackCount():Number{ | |
return (_trackCount); | |
} | |
} | |
}//package com.google.analytics.data | |
package com.google.analytics.data { | |
public class UTMC extends UTMCookie { | |
private var _domainHash:Number; | |
public function UTMC(_arg1:Number=NaN){ | |
super("utmc", "__utmc", ["domainHash"]); | |
this.domainHash = _arg1; | |
} | |
public function get domainHash():Number{ | |
return (_domainHash); | |
} | |
public function set domainHash(_arg1:Number):void{ | |
_domainHash = _arg1; | |
update(); | |
} | |
} | |
}//package com.google.analytics.data | |
package com.google.analytics.events { | |
import flash.events.*; | |
import com.google.analytics.*; | |
public class AnalyticsEvent extends Event { | |
public static const READY:String = "ready"; | |
public var tracker:AnalyticsTracker; | |
public function AnalyticsEvent(_arg1:String, _arg2:AnalyticsTracker, _arg3:Boolean=false, _arg4:Boolean=false){ | |
super(_arg1, _arg3, _arg4); | |
this.tracker = _arg2; | |
} | |
override public function clone():Event{ | |
return (new AnalyticsEvent(type, tracker, bubbles, cancelable)); | |
} | |
} | |
}//package com.google.analytics.events | |
package com.google.analytics.utils { | |
import com.google.analytics.core.*; | |
import flash.system.*; | |
public class UserAgent { | |
public static var minimal:Boolean = false; | |
private var _localInfo:Environment; | |
private var _applicationProduct:String; | |
private var _version:Version; | |
public function UserAgent(_arg1:Environment, _arg2:String="", _arg3:String=""){ | |
_localInfo = _arg1; | |
applicationProduct = _arg2; | |
_version = Version.fromString(_arg3); | |
} | |
public function get tamarinProductToken():String{ | |
if (UserAgent.minimal){ | |
return (""); | |
}; | |
if (System.vmVersion){ | |
return (("Tamarin/" + Utils.trim(System.vmVersion, true))); | |
}; | |
return (""); | |
} | |
public function get applicationVersion():String{ | |
return (_version.toString(2)); | |
} | |
public function get vendorProductToken():String{ | |
var _local1 = ""; | |
if (_localInfo.isAIR()){ | |
_local1 = (_local1 + "AIR"); | |
} else { | |
_local1 = (_local1 + "FlashPlayer"); | |
}; | |
_local1 = (_local1 + "/"); | |
_local1 = (_local1 + _version.toString(3)); | |
return (_local1); | |
} | |
public function toString():String{ | |
var _local1 = ""; | |
_local1 = (_local1 + applicationProductToken); | |
if (applicationComment != ""){ | |
_local1 = (_local1 + (" " + applicationComment)); | |
}; | |
if (tamarinProductToken != ""){ | |
_local1 = (_local1 + (" " + tamarinProductToken)); | |
}; | |
if (vendorProductToken != ""){ | |
_local1 = (_local1 + (" " + vendorProductToken)); | |
}; | |
return (_local1); | |
} | |
public function get applicationComment():String{ | |
var _local1:Array = []; | |
_local1.push(_localInfo.platform); | |
_local1.push(_localInfo.playerType); | |
if (!UserAgent.minimal){ | |
_local1.push(_localInfo.operatingSystem); | |
_local1.push(_localInfo.language); | |
}; | |
if (Capabilities.isDebugger){ | |
_local1.push("DEBUG"); | |
}; | |
if (_local1.length > 0){ | |
return ((("(" + _local1.join("; ")) + ")")); | |
}; | |
return (""); | |
} | |
public function set applicationVersion(_arg1:String):void{ | |
_version = Version.fromString(_arg1); | |
} | |
public function get applicationProductToken():String{ | |
var _local1:String = applicationProduct; | |
if (applicationVersion != ""){ | |
_local1 = (_local1 + ("/" + applicationVersion)); | |
}; | |
return (_local1); | |
} | |
public function set applicationProduct(_arg1:String):void{ | |
_applicationProduct = _arg1; | |
} | |
public function get applicationProduct():String{ | |
return (_applicationProduct); | |
} | |
} | |
}//package com.google.analytics.utils | |
package com.google.analytics.utils { | |
public class URL { | |
private var _url:String; | |
public function URL(_arg1:String=""){ | |
_url = _arg1.toLowerCase(); | |
} | |
public function get domain():String{ | |
var _local1:Array; | |
if (((!((hostName == ""))) && ((hostName.indexOf(".") > -1)))){ | |
_local1 = hostName.split("."); | |
switch (_local1.length){ | |
case 2: | |
return (hostName); | |
case 3: | |
if (_local1[1] == "co"){ | |
return (hostName); | |
}; | |
_local1.shift(); | |
return (_local1.join(".")); | |
case 4: | |
_local1.shift(); | |
return (_local1.join(".")); | |
}; | |
}; | |
return (""); | |
} | |
public function get path():String{ | |
var _local1:String = _url; | |
if (_local1.indexOf("://") > -1){ | |
_local1 = _local1.split("://")[1]; | |
}; | |
if (_local1.indexOf(hostName) == 0){ | |
_local1 = _local1.substr(hostName.length); | |
}; | |
if (_local1.indexOf("?") > -1){ | |
_local1 = _local1.split("?")[0]; | |
}; | |
if (_local1.charAt(0) != "/"){ | |
_local1 = ("/" + _local1); | |
}; | |
return (_local1); | |
} | |
public function get protocol():Protocols{ | |
var _local1:String = _url.split("://")[0]; | |
switch (_local1){ | |
case "file": | |
return (Protocols.file); | |
case "http": | |
return (Protocols.HTTP); | |
case "https": | |
return (Protocols.HTTPS); | |
default: | |
return (Protocols.none); | |
}; | |
} | |
public function get hostName():String{ | |
var _local1:String = _url; | |
if (_local1.indexOf("://") > -1){ | |
_local1 = _local1.split("://")[1]; | |
}; | |
if (_local1.indexOf("/") > -1){ | |
_local1 = _local1.split("/")[0]; | |
}; | |
if (_local1.indexOf("?") > -1){ | |
_local1 = _local1.split("?")[0]; | |
}; | |
if ((((protocol == Protocols.file)) || ((protocol == Protocols.none)))){ | |
return (""); | |
}; | |
return (_local1); | |
} | |
public function get subDomain():String{ | |
if (((!((domain == ""))) && (!((domain == hostName))))){ | |
return (hostName.split(("." + domain)).join("")); | |
}; | |
return (""); | |
} | |
public function get search():String{ | |
var _local1:String = _url; | |
if (_local1.indexOf("://") > -1){ | |
_local1 = _local1.split("://")[1]; | |
}; | |
if (_local1.indexOf(hostName) == 0){ | |
_local1 = _local1.substr(hostName.length); | |
}; | |
if (_local1.indexOf("?") > -1){ | |
_local1 = _local1.split("?")[1]; | |
} else { | |
_local1 = ""; | |
}; | |
return (_local1); | |
} | |
} | |
}//package com.google.analytics.utils | |
package com.google.analytics.utils { | |
public class Timespan { | |
public static var sixmonths:Number = 15768000; | |
public static var twoyears:Number = 63072000; | |
public static var thirtyminutes:Number = 1800; | |
} | |
}//package com.google.analytics.utils | |
package com.google.analytics.utils { | |
public class Protocols { | |
public static const none:Protocols = new Protocols(0, "none"); | |
; | |
public static const HTTPS:Protocols = new Protocols(3, "HTTPS"); | |
; | |
public static const file:Protocols = new Protocols(1, "file"); | |
; | |
public static const HTTP:Protocols = new Protocols(2, "HTTP"); | |
; | |
private var _value:int; | |
private var _name:String; | |
public function Protocols(_arg1:int=0, _arg2:String=""){ | |
_value = _arg1; | |
_name = _arg2; | |
} | |
public function valueOf():int{ | |
return (_value); | |
} | |
public function toString():String{ | |
return (_name); | |
} | |
} | |
}//package com.google.analytics.utils | |
package com.google.analytics.utils { | |
public class Version { | |
private var _revision:uint; | |
private var _maxBuild:uint = 0xFF; | |
private var _maxMinor:uint = 15; | |
private var _maxMajor:uint = 15; | |
private var _separator:String = "."; | |
private var _maxRevision:uint = 0xFFFF; | |
private var _build:uint; | |
private var _major:uint; | |
private var _minor:uint; | |
public function Version(_arg1:uint=0, _arg2:uint=0, _arg3:uint=0, _arg4:uint=0){ | |
var _local5:Version; | |
super(); | |
if ((((((((_arg1 > _maxMajor)) && ((_arg2 == 0)))) && ((_arg3 == 0)))) && ((_arg4 == 0)))){ | |
_local5 = Version.fromNumber(_arg1); | |
_arg1 = _local5.major; | |
_arg2 = _local5.minor; | |
_arg3 = _local5.build; | |
_arg4 = _local5.revision; | |
}; | |
this.major = _arg1; | |
this.minor = _arg2; | |
this.build = _arg3; | |
this.revision = _arg4; | |
} | |
public static function fromString(_arg1:String="", _arg2:String="."):Version{ | |
var _local4:Array; | |
var _local3:Version = new (Version)(); | |
if ((((_arg1 == "")) || ((_arg1 == null)))){ | |
return (_local3); | |
}; | |
if (_arg1.indexOf(_arg2) > -1){ | |
_local4 = _arg1.split(_arg2); | |
_local3.major = parseInt(_local4[0]); | |
_local3.minor = parseInt(_local4[1]); | |
_local3.build = parseInt(_local4[2]); | |
_local3.revision = parseInt(_local4[3]); | |
} else { | |
_local3.major = parseInt(_arg1); | |
}; | |
return (_local3); | |
} | |
public static function fromNumber(_arg1:Number=0):Version{ | |
var _local2:Version = new (Version)(); | |
if (((((((((((isNaN(_arg1)) || ((_arg1 == 0)))) || ((_arg1 < 0)))) || ((_arg1 == Number.MAX_VALUE)))) || ((_arg1 == Number.POSITIVE_INFINITY)))) || ((_arg1 == Number.NEGATIVE_INFINITY)))){ | |
return (_local2); | |
}; | |
_local2.major = (_arg1 >>> 28); | |
_local2.minor = ((_arg1 & 251658240) >>> 24); | |
_local2.build = ((_arg1 & 0xFF0000) >>> 16); | |
_local2.revision = (_arg1 & 0xFFFF); | |
return (_local2); | |
} | |
public function toString(_arg1:int=0):String{ | |
var _local2:Array; | |
if ((((_arg1 <= 0)) || ((_arg1 > 4)))){ | |
_arg1 = getFields(); | |
}; | |
switch (_arg1){ | |
case 1: | |
_local2 = [major]; | |
break; | |
case 2: | |
_local2 = [major, minor]; | |
break; | |
case 3: | |
_local2 = [major, minor, build]; | |
break; | |
case 4: | |
default: | |
_local2 = [major, minor, build, revision]; | |
}; | |
return (_local2.join(_separator)); | |
} | |
public function set revision(_arg1:uint):void{ | |
_revision = Math.min(_arg1, _maxRevision); | |
} | |
public function get revision():uint{ | |
return (_revision); | |
} | |
public function set build(_arg1:uint):void{ | |
_build = Math.min(_arg1, _maxBuild); | |
} | |
public function set minor(_arg1:uint):void{ | |
_minor = Math.min(_arg1, _maxMinor); | |
} | |
public function get build():uint{ | |
return (_build); | |
} | |
public function set major(_arg1:uint):void{ | |
_major = Math.min(_arg1, _maxMajor); | |
} | |
public function get minor():uint{ | |
return (_minor); | |
} | |
private function getFields():int{ | |
var _local1 = 4; | |
if (revision == 0){ | |
_local1--; | |
}; | |
if ((((_local1 == 3)) && ((build == 0)))){ | |
_local1--; | |
}; | |
if ((((_local1 == 2)) && ((minor == 0)))){ | |
_local1--; | |
}; | |
return (_local1); | |
} | |
public function valueOf():uint{ | |
return (((((major << 28) | (minor << 24)) | (build << 16)) | revision)); | |
} | |
public function get major():uint{ | |
return (_major); | |
} | |
public function equals(_arg1):Boolean{ | |
if (!(_arg1 is Version)){ | |
return (false); | |
}; | |
if ((((((((_arg1.major == major)) && ((_arg1.minor == minor)))) && ((_arg1.build == build)))) && ((_arg1.revision == revision)))){ | |
return (true); | |
}; | |
return (false); | |
} | |
} | |
}//package com.google.analytics.utils | |
package com.google.analytics.utils { | |
import flash.net.*; | |
public dynamic class Variables { | |
public var post:Array; | |
public var URIencode:Boolean; | |
public var pre:Array; | |
public var sort:Boolean = true; | |
public function Variables(_arg1:String=null, _arg2:Array=null, _arg3:Array=null){ | |
pre = []; | |
post = []; | |
super(); | |
if (_arg1){ | |
decode(_arg1); | |
}; | |
if (_arg2){ | |
this.pre = _arg2; | |
}; | |
if (_arg3){ | |
this.post = _arg3; | |
}; | |
} | |
private function _join(_arg1:Variables):void{ | |
var _local2:String; | |
if (!_arg1){ | |
return; | |
}; | |
for (_local2 in _arg1) { | |
this[_local2] = _arg1[_local2]; | |
}; | |
} | |
public function join(... _args):void{ | |
var _local2:int = _args.length; | |
var _local3:int; | |
while (_local3 < _local2) { | |
if (!(_args[_local3] is Variables)){ | |
} else { | |
_join(_args[_local3]); | |
}; | |
_local3++; | |
}; | |
} | |
public function toString():String{ | |
var _local2:String; | |
var _local3:String; | |
var _local4:String; | |
var _local5:int; | |
var _local6:int; | |
var _local7:String; | |
var _local8:String; | |
var _local1:Array = []; | |
for (_local3 in this) { | |
_local2 = this[_local3]; | |
if (URIencode){ | |
_local2 = encodeURI(_local2); | |
}; | |
_local1.push(((_local3 + "=") + _local2)); | |
}; | |
if (sort){ | |
_local1.sort(); | |
}; | |
if (pre.length > 0){ | |
pre.reverse(); | |
_local5 = 0; | |
while (_local5 < pre.length) { | |
_local7 = pre[_local5]; | |
_local6 = 0; | |
while (_local6 < _local1.length) { | |
_local4 = _local1[_local6]; | |
if (_local4.indexOf(_local7) == 0){ | |
_local1.unshift(_local1.splice(_local6, 1)[0]); | |
}; | |
_local6++; | |
}; | |
_local5++; | |
}; | |
pre.reverse(); | |
}; | |
if (post.length > 0){ | |
_local5 = 0; | |
while (_local5 < post.length) { | |
_local8 = post[_local5]; | |
_local6 = 0; | |
while (_local6 < _local1.length) { | |
_local4 = _local1[_local6]; | |
if (_local4.indexOf(_local8) == 0){ | |
_local1.push(_local1.splice(_local6, 1)[0]); | |
}; | |
_local6++; | |
}; | |
_local5++; | |
}; | |
}; | |
return (_local1.join("&")); | |
} | |
public function decode(_arg1:String):void{ | |
var _local2:Array; | |
var _local3:String; | |
var _local4:String; | |
var _local5:String; | |
var _local6:Array; | |
if (_arg1 == ""){ | |
return; | |
}; | |
if (_arg1.indexOf("&") > -1){ | |
_local2 = _arg1.split("&"); | |
} else { | |
_local2 = [_arg1]; | |
}; | |
var _local7:int; | |
while (_local7 < _local2.length) { | |
_local3 = _local2[_local7]; | |
if (_local3.indexOf("=") > -1){ | |
_local6 = _local3.split("="); | |
_local4 = _local6[0]; | |
_local5 = decodeURI(_local6[1]); | |
this[_local4] = _local5; | |
}; | |
_local7++; | |
}; | |
} | |
public function toURLVariables():URLVariables{ | |
var _local2:String; | |
var _local1:URLVariables = new URLVariables(); | |
for (_local2 in this) { | |
_local1[_local2] = this[_local2]; | |
}; | |
return (_local1); | |
} | |
} | |
}//package com.google.analytics.utils | |
package com.google.analytics.utils { | |
import com.google.analytics.core.*; | |
import com.google.analytics.debug.*; | |
import com.google.analytics.external.*; | |
import flash.system.*; | |
public class Environment { | |
private var _dom:HTMLDOM; | |
private var _appName:String; | |
private var _debug:DebugConfiguration; | |
private var _appVersion:Version; | |
private var _url:String; | |
private var _protocol:Protocols; | |
private var _userAgent:UserAgent; | |
public function Environment(_arg1:String="", _arg2:String="", _arg3:String="", _arg4:DebugConfiguration=null, _arg5:HTMLDOM=null){ | |
var _local6:Version; | |
super(); | |
if (_arg2 == ""){ | |
if (isAIR()){ | |
_arg2 = "AIR"; | |
} else { | |
_arg2 = "Flash"; | |
}; | |
}; | |
if (_arg3 == ""){ | |
_local6 = flashVersion; | |
} else { | |
_local6 = Version.fromString(_arg3); | |
}; | |
_url = _arg1; | |
_appName = _arg2; | |
_appVersion = _local6; | |
_debug = _arg4; | |
_dom = _arg5; | |
} | |
public function isAIR():Boolean{ | |
return ((((playerType == "Desktop")) && ((Security.sandboxType.toString() == "application")))); | |
} | |
public function get screenWidth():Number{ | |
return (Capabilities.screenResolutionX); | |
} | |
public function get playerType():String{ | |
return (Capabilities.playerType); | |
} | |
public function get locationSearch():String{ | |
var _local1:String = _dom.search; | |
if (_local1){ | |
return (_local1); | |
}; | |
return (""); | |
} | |
public function get protocol():Protocols{ | |
if (!_protocol){ | |
_findProtocol(); | |
}; | |
return (_protocol); | |
} | |
public function get flashVersion():Version{ | |
var _local1:Version = Version.fromString(Capabilities.version.split(" ")[1], ","); | |
return (_local1); | |
} | |
public function get userAgent():UserAgent{ | |
if (!_userAgent){ | |
_userAgent = new UserAgent(this, appName, appVersion.toString(4)); | |
}; | |
return (_userAgent); | |
} | |
public function get languageEncoding():String{ | |
var _local1:String; | |
if (System.useCodePage){ | |
_local1 = _dom.characterSet; | |
if (_local1){ | |
return (_local1); | |
}; | |
return ("-"); | |
}; | |
return ("UTF-8"); | |
} | |
public function get appName():String{ | |
return (_appName); | |
} | |
public function get screenColorDepth():String{ | |
var _local1:String; | |
switch (Capabilities.screenColor){ | |
case "bw": | |
_local1 = "1"; | |
break; | |
case "gray": | |
_local1 = "2"; | |
break; | |
case "color": | |
default: | |
_local1 = "24"; | |
}; | |
var _local2:String = _dom.colorDepth; | |
if (_local2){ | |
_local1 = _local2; | |
}; | |
return (_local1); | |
} | |
private function _findProtocol():void{ | |
var _local4:String; | |
var _local5:String; | |
var _local1:Protocols = Protocols.none; | |
if (_url != ""){ | |
_local4 = _url.toLowerCase(); | |
_local5 = _local4.substr(0, 5); | |
switch (_local5){ | |
case "file:": | |
_local1 = Protocols.file; | |
break; | |
case "http:": | |
_local1 = Protocols.HTTP; | |
break; | |
case "https": | |
if (_local4.charAt(5) == ":"){ | |
_local1 = Protocols.HTTPS; | |
}; | |
break; | |
default: | |
_protocol = Protocols.none; | |
}; | |
}; | |
var _local2:String = _dom.protocol; | |
var _local3:String = (_local1.toString() + ":").toLowerCase(); | |
if (((((_local2) && (!((_local2 == _local3))))) && (_debug))){ | |
_debug.warning(((("Protocol mismatch: SWF=" + _local3) + ", DOM=") + _local2)); | |
}; | |
_protocol = _local1; | |
} | |
public function get locationSWFPath():String{ | |
return (_url); | |
} | |
public function get platform():String{ | |
var _local1:String = Capabilities.manufacturer; | |
return (_local1.split("Adobe ")[1]); | |
} | |
public function get operatingSystem():String{ | |
return (Capabilities.os); | |
} | |
public function set appName(_arg1:String):void{ | |
_appName = _arg1; | |
userAgent.applicationProduct = _arg1; | |
} | |
ga_internal function set url(_arg1:String):void{ | |
_url = _arg1; | |
} | |
public function get referrer():String{ | |
var _local1:String = _dom.referrer; | |
if (_local1){ | |
return (_local1); | |
}; | |
if (protocol == Protocols.file){ | |
return ("localhost"); | |
}; | |
return (""); | |
} | |
public function isInHTML():Boolean{ | |
return ((Capabilities.playerType == "PlugIn")); | |
} | |
public function get language():String{ | |
var _local1:String = _dom.language; | |
var _local2:String = Capabilities.language; | |
if (_local1){ | |
if ((((_local1.length > _local2.length)) && ((_local1.substr(0, _local2.length) == _local2)))){ | |
_local2 = _local1; | |
}; | |
}; | |
return (_local2); | |
} | |
public function get domainName():String{ | |
var _local1:String; | |
var _local2:String; | |
var _local3:int; | |
if ((((protocol == Protocols.HTTP)) || ((protocol == Protocols.HTTPS)))){ | |
_local1 = _url.toLowerCase(); | |
if (protocol == Protocols.HTTP){ | |
_local2 = _local1.split("http://").join(""); | |
} else { | |
if (protocol == Protocols.HTTPS){ | |
_local2 = _local1.split("https://").join(""); | |
}; | |
}; | |
_local3 = _local2.indexOf("/"); | |
if (_local3 > -1){ | |
_local2 = _local2.substring(0, _local3); | |
}; | |
return (_local2); | |
}; | |
if (protocol == Protocols.file){ | |
return ("localhost"); | |
}; | |
return (""); | |
} | |
public function set userAgent(_arg1:UserAgent):void{ | |
_userAgent = _arg1; | |
} | |
public function set appVersion(_arg1:Version):void{ | |
_appVersion = _arg1; | |
userAgent.applicationVersion = _arg1.toString(4); | |
} | |
public function get screenHeight():Number{ | |
return (Capabilities.screenResolutionY); | |
} | |
public function get locationPath():String{ | |
var _local1:String = _dom.pathname; | |
if (_local1){ | |
return (_local1); | |
}; | |
return (""); | |
} | |
public function get documentTitle():String{ | |
var _local1:String = _dom.title; | |
if (_local1){ | |
return (_local1); | |
}; | |
return (""); | |
} | |
public function get appVersion():Version{ | |
return (_appVersion); | |
} | |
} | |
}//package com.google.analytics.utils | |
package com.google.analytics.debug { | |
public class Margin { | |
public var top:int; | |
public var left:int; | |
public var bottom:int; | |
public var right:int; | |
public function Margin(_arg1:int=0, _arg2:int=0, _arg3:int=0, _arg4:int=0){ | |
this.top = _arg1; | |
this.bottom = _arg2; | |
this.left = _arg3; | |
this.right = _arg4; | |
} | |
} | |
}//package com.google.analytics.debug | |
package com.google.analytics.debug { | |
import flash.net.*; | |
import com.google.analytics.core.*; | |
import flash.utils.*; | |
import flash.ui.*; | |
public class DebugConfiguration { | |
public var showHideKey:Number; | |
private var _mode:VisualDebugMode; | |
private var _verbose:Boolean = false; | |
public var destroyKey:Number; | |
public var GIFRequests:Boolean = false; | |
public var showInfos:Boolean = true; | |
public var infoTimeout:Number = 1000; | |
public var minimizedOnStart:Boolean = false; | |
private var _active:Boolean = false; | |
public var traceOutput:Boolean = false; | |
public var layout:ILayout; | |
public var warningTimeout:Number = 1500; | |
public var javascript:Boolean = false; | |
public var showWarnings:Boolean = true; | |
private var _visualInitialized:Boolean = false; | |
public function DebugConfiguration(){ | |
_mode = VisualDebugMode.basic; | |
showHideKey = Keyboard.SPACE; | |
destroyKey = Keyboard.BACKSPACE; | |
super(); | |
} | |
public function get verbose():Boolean{ | |
return (_verbose); | |
} | |
public function set verbose(_arg1:Boolean):void{ | |
_verbose = _arg1; | |
} | |
public function set mode(_arg1):void{ | |
if ((_arg1 is String)){ | |
switch (_arg1){ | |
case "geek": | |
_arg1 = VisualDebugMode.geek; | |
break; | |
case "advanced": | |
_arg1 = VisualDebugMode.advanced; | |
break; | |
case "basic": | |
default: | |
_arg1 = VisualDebugMode.basic; | |
}; | |
}; | |
_mode = _arg1; | |
} | |
public function success(_arg1:String):void{ | |
if (layout){ | |
layout.createSuccessAlert(_arg1); | |
}; | |
if (traceOutput){ | |
trace((("[+] " + _arg1) + " !!")); | |
}; | |
} | |
public function get active():Boolean{ | |
return (_active); | |
} | |
private function _initializeVisual():void{ | |
if (layout){ | |
layout.init(); | |
_visualInitialized = true; | |
}; | |
} | |
private function _destroyVisual():void{ | |
if (((layout) && (_visualInitialized))){ | |
layout.destroy(); | |
}; | |
} | |
public function warning(_arg1:String, _arg2:VisualDebugMode=null):void{ | |
if (_filter(_arg2)){ | |
return; | |
}; | |
if (((layout) && (showWarnings))){ | |
layout.createWarning(_arg1); | |
}; | |
if (traceOutput){ | |
trace((("## " + _arg1) + " ##")); | |
}; | |
} | |
private function _filter(_arg1:VisualDebugMode=null):Boolean{ | |
return (((_arg1) && ((int(_arg1) >= int(this.mode))))); | |
} | |
public function failure(_arg1:String):void{ | |
if (layout){ | |
layout.createFailureAlert(_arg1); | |
}; | |
if (traceOutput){ | |
trace((("[-] " + _arg1) + " !!")); | |
}; | |
} | |
public function get mode(){ | |
return (_mode); | |
} | |
public function set active(_arg1:Boolean):void{ | |
_active = _arg1; | |
if (_active){ | |
_initializeVisual(); | |
} else { | |
_destroyVisual(); | |
}; | |
} | |
protected function trace(_arg1:String):void{ | |
var _local7:Array; | |
var _local8:int; | |
var _local2:Array = []; | |
var _local3 = ""; | |
var _local4 = ""; | |
if (this.mode == VisualDebugMode.geek){ | |
_local3 = (getTimer() + " - "); | |
_local4 = (new Array(_local3.length).join(" ") + " "); | |
}; | |
if (_arg1.indexOf("\n") > -1){ | |
_local7 = _arg1.split("\n"); | |
_local8 = 0; | |
while (_local8 < _local7.length) { | |
if (_local7[_local8] == ""){ | |
} else { | |
if (_local8 == 0){ | |
_local2.push((_local3 + _local7[_local8])); | |
} else { | |
_local2.push((_local4 + _local7[_local8])); | |
}; | |
}; | |
_local8++; | |
}; | |
} else { | |
_local2.push((_local3 + _arg1)); | |
}; | |
var _local5:int = _local2.length; | |
var _local6:int; | |
while (_local6 < _local5) { | |
trace(_local2[_local6]); | |
_local6++; | |
}; | |
} | |
public function alert(_arg1:String):void{ | |
if (layout){ | |
layout.createAlert(_arg1); | |
}; | |
if (traceOutput){ | |
trace((("!! " + _arg1) + " !!")); | |
}; | |
} | |
public function info(_arg1:String, _arg2:VisualDebugMode=null):void{ | |
if (_filter(_arg2)){ | |
return; | |
}; | |
if (((layout) && (showInfos))){ | |
layout.createInfo(_arg1); | |
}; | |
if (traceOutput){ | |
trace(_arg1); | |
}; | |
} | |
public function alertGifRequest(_arg1:String, _arg2:URLRequest, _arg3:GIFRequest):void{ | |
if (layout){ | |
layout.createGIFRequestAlert(_arg1, _arg2, _arg3); | |
}; | |
if (traceOutput){ | |
trace(((">> " + _arg1) + " <<")); | |
}; | |
} | |
} | |
}//package com.google.analytics.debug | |
package com.google.analytics.debug { | |
public class Align { | |
public static const bottomRight:Align = new Align(18, "bottomRight"); | |
; | |
public static const right:Align = new Align(16, "right"); | |
; | |
public static const left:Align = new Align(32, "left"); | |
; | |
public static const topRight:Align = new Align(17, "topRight"); | |
; | |
public static const bottom:Align = new Align(2, "bottom"); | |
; | |
public static const bottomLeft:Align = new Align(34, "bottomLeft"); | |
; | |
public static const topLeft:Align = new Align(33, "topLeft"); | |
; | |
public static const center:Align = new Align(0x0100, "center"); | |
; | |
public static const none:Align = new Align(0, "none"); | |
; | |
public static const top:Align = new Align(1, "top"); | |
; | |
private var _value:int; | |
private var _name:String; | |
public function Align(_arg1:int=0, _arg2:String=""){ | |
_value = _arg1; | |
_name = _arg2; | |
} | |
public function valueOf():int{ | |
return (_value); | |
} | |
public function toString():String{ | |
return (_name); | |
} | |
} | |
}//package com.google.analytics.debug | |
package com.google.analytics.debug { | |
public const Style:_Style = new _Style(); | |
}//package com.google.analytics.debug | |
package com.google.analytics.debug { | |
import flash.events.*; | |
import flash.utils.*; | |
public class Warning extends Label { | |
private var _timer:Timer; | |
public function Warning(_arg1:String="", _arg2:uint=3000){ | |
super(_arg1, "uiWarning", Style.warningColor, Align.top, false); | |
margin.top = 32; | |
if (_arg2 > 0){ | |
_timer = new Timer(_arg2, 1); | |
_timer.start(); | |
_timer.addEventListener(TimerEvent.TIMER_COMPLETE, onComplete, false, 0, true); | |
}; | |
} | |
public function close():void{ | |
if (parent != null){ | |
parent.removeChild(this); | |
}; | |
} | |
override public function onLink(_arg1:TextEvent):void{ | |
switch (_arg1.text){ | |
case "hide": | |
close(); | |
break; | |
}; | |
} | |
public function onComplete(_arg1:TimerEvent):void{ | |
close(); | |
} | |
} | |
}//package com.google.analytics.debug | |
package com.google.analytics.debug { | |
import flash.events.*; | |
import flash.display.*; | |
import flash.text.*; | |
public class Label extends UISprite { | |
public static var count:uint = 0; | |
private var _color:uint; | |
private var _background:Shape; | |
private var _textField:TextField; | |
public var stickToEdge:Boolean; | |
private var _text:String; | |
protected var selectable:Boolean; | |
private var _tag:String; | |
public function Label(_arg1:String="", _arg2:String="uiLabel", _arg3:uint=0, _arg4:Align=null, _arg5:Boolean=false){ | |
this.name = ("Label" + count++); | |
selectable = false; | |
_background = new Shape(); | |
_textField = new TextField(); | |
_text = _arg1; | |
_tag = _arg2; | |
if (_arg4 == null){ | |
_arg4 = Align.none; | |
}; | |
this.alignement = _arg4; | |
this.stickToEdge = _arg5; | |
if (_arg3 == 0){ | |
_arg3 = Style.backgroundColor; | |
}; | |
_color = _arg3; | |
_textField.addEventListener(TextEvent.LINK, onLink); | |
} | |
public function get tag():String{ | |
return (_tag); | |
} | |
private function _draw():void{ | |
var _local1:Graphics = _background.graphics; | |
_local1.clear(); | |
_local1.beginFill(_color); | |
var _local2:uint = _textField.width; | |
var _local3:uint = _textField.height; | |
if (forcedWidth > 0){ | |
_local2 = forcedWidth; | |
}; | |
Background.drawRounded(this, _local1, _local2, _local3); | |
_local1.endFill(); | |
} | |
public function get text():String{ | |
return (_textField.text); | |
} | |
public function appendText(_arg1:String, _arg2:String=""):void{ | |
if (_arg1 == ""){ | |
return; | |
}; | |
if (_arg2 == ""){ | |
_arg2 = tag; | |
}; | |
_textField.htmlText = (_textField.htmlText + (((("<span class=\"" + _arg2) + "\">") + _arg1) + "</span>")); | |
_text = (_text + _arg1); | |
_draw(); | |
resize(); | |
} | |
public function set text(_arg1:String):void{ | |
if (_arg1 == ""){ | |
_arg1 = _text; | |
}; | |
_textField.htmlText = (((("<span class=\"" + tag) + "\">") + _arg1) + "</span>"); | |
_text = _arg1; | |
_draw(); | |
resize(); | |
} | |
override protected function layout():void{ | |
_textField.type = TextFieldType.DYNAMIC; | |
_textField.autoSize = TextFieldAutoSize.LEFT; | |
_textField.background = false; | |
_textField.selectable = selectable; | |
_textField.multiline = true; | |
_textField.styleSheet = Style.sheet; | |
this.text = _text; | |
addChild(_background); | |
addChild(_textField); | |
} | |
public function set tag(_arg1:String):void{ | |
_tag = _arg1; | |
text = ""; | |
} | |
public function onLink(_arg1:TextEvent):void{ | |
} | |
override protected function dispose():void{ | |
_textField.removeEventListener(TextEvent.LINK, onLink); | |
super.dispose(); | |
} | |
} | |
}//package com.google.analytics.debug | |
package com.google.analytics.debug { | |
import flash.display.*; | |
public class Background { | |
public static function drawRounded(_arg1, _arg2:Graphics, _arg3:uint=0, _arg4:uint=0):void{ | |
var _local5:uint; | |
var _local6:uint; | |
var _local7:uint = Style.roundedCorner; | |
if ((((_arg3 > 0)) && ((_arg4 > 0)))){ | |
_local5 = _arg3; | |
_local6 = _arg4; | |
} else { | |
_local5 = _arg1.width; | |
_local6 = _arg1.height; | |
}; | |
if (((_arg1.stickToEdge) && (!((_arg1.alignement == Align.none))))){ | |
switch (_arg1.alignement){ | |
case Align.top: | |
_arg2.drawRoundRectComplex(0, 0, _local5, _local6, 0, 0, _local7, _local7); | |
break; | |
case Align.topLeft: | |
_arg2.drawRoundRectComplex(0, 0, _local5, _local6, 0, 0, 0, _local7); | |
break; | |
case Align.topRight: | |
_arg2.drawRoundRectComplex(0, 0, _local5, _local6, 0, 0, _local7, 0); | |
break; | |
case Align.bottom: | |
_arg2.drawRoundRectComplex(0, 0, _local5, _local6, _local7, _local7, 0, 0); | |
break; | |
case Align.bottomLeft: | |
_arg2.drawRoundRectComplex(0, 0, _local5, _local6, 0, _local7, 0, 0); | |
break; | |
case Align.bottomRight: | |
_arg2.drawRoundRectComplex(0, 0, _local5, _local6, _local7, 0, 0, 0); | |
break; | |
case Align.left: | |
_arg2.drawRoundRectComplex(0, 0, _local5, _local6, 0, _local7, 0, _local7); | |
break; | |
case Align.right: | |
_arg2.drawRoundRectComplex(0, 0, _local5, _local6, _local7, 0, _local7, 0); | |
break; | |
case Align.center: | |
_arg2.drawRoundRect(0, 0, _local5, _local6, _local7, _local7); | |
break; | |
}; | |
} else { | |
_arg2.drawRoundRect(0, 0, _local5, _local6, _local7, _local7); | |
}; | |
} | |
} | |
}//package com.google.analytics.debug | |
package com.google.analytics.debug { | |
public class GIFRequestAlert extends Alert { | |
public function GIFRequestAlert(_arg1:String, _arg2:Array){ | |
super(_arg1, _arg2); | |
} | |
} | |
}//package com.google.analytics.debug | |
package com.google.analytics.debug { | |
import flash.events.*; | |
import flash.display.*; | |
public class Panel extends UISprite { | |
private var _savedH:uint; | |
private var _data:UISprite; | |
private var _mask:Sprite; | |
private var _background:Shape; | |
private var _savedW:uint; | |
private var _stickToEdge:Boolean; | |
private var _border:Shape; | |
private var _borderColor:uint; | |
protected var baseAlpha:Number; | |
private var _backgroundColor:uint; | |
private var _title:Label; | |
private var _colapsed:Boolean; | |
private var _name:String; | |
public function Panel(_arg1:String, _arg2:uint, _arg3:uint, _arg4:uint=0, _arg5:uint=0, _arg6:Number=0.3, _arg7:Align=null, _arg8:Boolean=false){ | |
_name = _arg1; | |
this.name = _arg1; | |
this.mouseEnabled = false; | |
_colapsed = false; | |
forcedWidth = _arg2; | |
forcedHeight = _arg3; | |
this.baseAlpha = _arg6; | |
_background = new Shape(); | |
_data = new UISprite(); | |
_data.forcedWidth = _arg2; | |
_data.forcedHeight = _arg3; | |
_data.mouseEnabled = false; | |
_title = new Label(_arg1, "uiLabel", 0xFFFFFF, Align.topLeft, _arg8); | |
_title.buttonMode = true; | |
_title.margin.top = 0.6; | |
_title.margin.left = 0.6; | |
_title.addEventListener(MouseEvent.CLICK, onToggle); | |
_title.mouseChildren = false; | |
_border = new Shape(); | |
_mask = new Sprite(); | |
_mask.useHandCursor = false; | |
_mask.mouseEnabled = false; | |
_mask.mouseChildren = false; | |
if (_arg7 == null){ | |
_arg7 = Align.none; | |
}; | |
this.alignement = _arg7; | |
this.stickToEdge = _arg8; | |
if (_arg4 == 0){ | |
_arg4 = Style.backgroundColor; | |
}; | |
_backgroundColor = _arg4; | |
if (_arg5 == 0){ | |
_arg5 = Style.borderColor; | |
}; | |
_borderColor = _arg5; | |
} | |
public function get stickToEdge():Boolean{ | |
return (_stickToEdge); | |
} | |
public function onToggle(_arg1:MouseEvent=null):void{ | |
if (_colapsed){ | |
_data.visible = true; | |
} else { | |
_data.visible = false; | |
}; | |
_colapsed = !(_colapsed); | |
_update(); | |
resize(); | |
} | |
public function set stickToEdge(_arg1:Boolean):void{ | |
_stickToEdge = _arg1; | |
_title.stickToEdge = _arg1; | |
} | |
override protected function dispose():void{ | |
_title.removeEventListener(MouseEvent.CLICK, onToggle); | |
super.dispose(); | |
} | |
private function _draw():void{ | |
var _local1:uint; | |
var _local2:uint; | |
if (((_savedW) && (_savedH))){ | |
forcedWidth = _savedW; | |
forcedHeight = _savedH; | |
}; | |
if (!_colapsed){ | |
_local1 = forcedWidth; | |
_local2 = forcedHeight; | |
} else { | |
_local1 = _title.width; | |
_local2 = _title.height; | |
_savedW = forcedWidth; | |
_savedH = forcedHeight; | |
forcedWidth = _local1; | |
forcedHeight = _local2; | |
}; | |
var _local3:Graphics = _background.graphics; | |
_local3.clear(); | |
_local3.beginFill(_backgroundColor); | |
Background.drawRounded(this, _local3, _local1, _local2); | |
_local3.endFill(); | |
var _local4:Graphics = _data.graphics; | |
_local4.clear(); | |
_local4.beginFill(_backgroundColor, 0); | |
Background.drawRounded(this, _local4, _local1, _local2); | |
_local4.endFill(); | |
var _local5:Graphics = _border.graphics; | |
_local5.clear(); | |
_local5.lineStyle(0.1, _borderColor); | |
Background.drawRounded(this, _local5, _local1, _local2); | |
_local5.endFill(); | |
var _local6:Graphics = _mask.graphics; | |
_local6.clear(); | |
_local6.beginFill(_backgroundColor); | |
Background.drawRounded(this, _local6, (_local1 + 1), (_local2 + 1)); | |
_local6.endFill(); | |
} | |
public function get title():String{ | |
return (_title.text); | |
} | |
private function _update():void{ | |
_draw(); | |
if (baseAlpha < 1){ | |
_background.alpha = baseAlpha; | |
_border.alpha = baseAlpha; | |
}; | |
} | |
public function addData(_arg1:DisplayObject):void{ | |
_data.addChild(_arg1); | |
} | |
override protected function layout():void{ | |
_update(); | |
addChild(_background); | |
addChild(_data); | |
addChild(_title); | |
addChild(_border); | |
addChild(_mask); | |
mask = _mask; | |
} | |
public function set title(_arg1:String):void{ | |
_title.text = _arg1; | |
} | |
public function close():void{ | |
dispose(); | |
if (parent != null){ | |
parent.removeChild(this); | |
}; | |
} | |
} | |
}//package com.google.analytics.debug | |
package com.google.analytics.debug { | |
import flash.display.*; | |
import flash.net.*; | |
import com.google.analytics.core.*; | |
public interface ILayout { | |
function createAlert(_arg1:String):void; | |
function addToStage(_arg1:DisplayObject):void; | |
function createGIFRequestAlert(_arg1:String, _arg2:URLRequest, _arg3:GIFRequest):void; | |
function createWarning(_arg1:String):void; | |
function createPanel(_arg1:String, _arg2:uint, _arg3:uint):void; | |
function createInfo(_arg1:String):void; | |
function createFailureAlert(_arg1:String):void; | |
function addToPanel(_arg1:String, _arg2:DisplayObject):void; | |
function init():void; | |
function createSuccessAlert(_arg1:String):void; | |
function createVisualDebug():void; | |
function destroy():void; | |
function bringToFront(_arg1:DisplayObject):void; | |
function isAvailable():Boolean; | |
} | |
}//package com.google.analytics.debug | |
package com.google.analytics.debug { | |
import flash.events.*; | |
import flash.display.*; | |
public class UISprite extends Sprite { | |
private var _forcedWidth:uint; | |
public var margin:Margin; | |
protected var alignTarget:DisplayObject; | |
protected var listenResize:Boolean; | |
public var alignement:Align; | |
private var _forcedHeight:uint; | |
public function UISprite(_arg1:DisplayObject=null){ | |
listenResize = false; | |
alignement = Align.none; | |
this.alignTarget = _arg1; | |
margin = new Margin(); | |
addEventListener(Event.ADDED_TO_STAGE, _onAddedToStage); | |
addEventListener(Event.REMOVED_FROM_STAGE, _onRemovedFromStage); | |
} | |
public function get forcedHeight():uint{ | |
if (_forcedHeight){ | |
return (_forcedHeight); | |
}; | |
return (height); | |
} | |
private function _onAddedToStage(_arg1:Event):void{ | |
layout(); | |
resize(); | |
} | |
protected function dispose():void{ | |
var _local1:DisplayObject; | |
var _local2:int; | |
while (_local2 < numChildren) { | |
_local1 = getChildAt(_local2); | |
if (_local1){ | |
removeChild(_local1); | |
}; | |
_local2++; | |
}; | |
} | |
public function set forcedHeight(_arg1:uint):void{ | |
_forcedHeight = _arg1; | |
} | |
public function set forcedWidth(_arg1:uint):void{ | |
_forcedWidth = _arg1; | |
} | |
protected function layout():void{ | |
} | |
public function get forcedWidth():uint{ | |
if (_forcedWidth){ | |
return (_forcedWidth); | |
}; | |
return (width); | |
} | |
public function alignTo(_arg1:Align, _arg2:DisplayObject=null):void{ | |
var _local3:uint; | |
var _local4:uint; | |
var _local5:uint; | |
var _local6:uint; | |
var _local7:UISprite; | |
if (_arg2 == null){ | |
if ((parent is Stage)){ | |
_arg2 = this.stage; | |
} else { | |
_arg2 = parent; | |
}; | |
}; | |
if (_arg2 == this.stage){ | |
if (this.stage == null){ | |
return; | |
}; | |
_local3 = this.stage.stageHeight; | |
_local4 = this.stage.stageWidth; | |
_local5 = 0; | |
_local6 = 0; | |
} else { | |
_local7 = (_arg2 as UISprite); | |
if (_local7.forcedHeight){ | |
_local3 = _local7.forcedHeight; | |
} else { | |
_local3 = _local7.height; | |
}; | |
if (_local7.forcedWidth){ | |
_local4 = _local7.forcedWidth; | |
} else { | |
_local4 = _local7.width; | |
}; | |
_local5 = 0; | |
_local6 = 0; | |
}; | |
switch (_arg1){ | |
case Align.top: | |
x = ((_local4 / 2) - (forcedWidth / 2)); | |
y = (_local6 + margin.top); | |
break; | |
case Align.bottom: | |
x = ((_local4 / 2) - (forcedWidth / 2)); | |
y = (((_local6 + _local3) - forcedHeight) - margin.bottom); | |
break; | |
case Align.left: | |
x = (_local5 + margin.left); | |
y = ((_local3 / 2) - (forcedHeight / 2)); | |
break; | |
case Align.right: | |
x = (((_local5 + _local4) - forcedWidth) - margin.right); | |
y = ((_local3 / 2) - (forcedHeight / 2)); | |
break; | |
case Align.center: | |
x = ((_local4 / 2) - (forcedWidth / 2)); | |
y = ((_local3 / 2) - (forcedHeight / 2)); | |
break; | |
case Align.topLeft: | |
x = (_local5 + margin.left); | |
y = (_local6 + margin.top); | |
break; | |
case Align.topRight: | |
x = (((_local5 + _local4) - forcedWidth) - margin.right); | |
y = (_local6 + margin.top); | |
break; | |
case Align.bottomLeft: | |
x = (_local5 + margin.left); | |
y = (((_local6 + _local3) - forcedHeight) - margin.bottom); | |
break; | |
case Align.bottomRight: | |
x = (((_local5 + _local4) - forcedWidth) - margin.right); | |
y = (((_local6 + _local3) - forcedHeight) - margin.bottom); | |
break; | |
}; | |
if (((!(listenResize)) && (!((_arg1 == Align.none))))){ | |
_arg2.addEventListener(Event.RESIZE, onResize, false, 0, true); | |
listenResize = true; | |
}; | |
this.alignement = _arg1; | |
this.alignTarget = _arg2; | |
} | |
private function _onRemovedFromStage(_arg1:Event):void{ | |
removeEventListener(Event.ADDED_TO_STAGE, _onAddedToStage); | |
removeEventListener(Event.REMOVED_FROM_STAGE, _onRemovedFromStage); | |
dispose(); | |
} | |
public function resize():void{ | |
if (alignement != Align.none){ | |
alignTo(alignement, alignTarget); | |
}; | |
} | |
protected function onResize(_arg1:Event):void{ | |
resize(); | |
} | |
} | |
}//package com.google.analytics.debug | |
package com.google.analytics.debug { | |
import flash.net.*; | |
import flash.text.*; | |
public class _Style { | |
public var failureColor:uint; | |
public var borderColor:uint; | |
public var backgroundColor:uint; | |
private var _sheet:StyleSheet; | |
public var roundedCorner:uint; | |
public var warningColor:uint; | |
public var infoColor:uint; | |
public var alertColor:uint; | |
public var successColor:uint; | |
private var _loader:URLLoader; | |
private var _defaultSheet:String; | |
public function _Style(){ | |
_sheet = new StyleSheet(); | |
_loader = new URLLoader(); | |
_init(); | |
} | |
private function _parseSheet(_arg1:String):void{ | |
_sheet.parseCSS(_arg1); | |
} | |
public function get sheet():StyleSheet{ | |
return (_sheet); | |
} | |
private function _init():void{ | |
_defaultSheet = ""; | |
_defaultSheet = (_defaultSheet + "a{text-decoration: underline;}\n"); | |
_defaultSheet = (_defaultSheet + ".uiLabel{color: #000000;font-family: Arial;font-size: 12;margin-left: 2;margin-right: 2;}\n"); | |
_defaultSheet = (_defaultSheet + ".uiWarning{color: #ffffff;font-family: Arial;font-size: 14;font-weight: bold;margin-left: 6;margin-right: 6;}\n"); | |
_defaultSheet = (_defaultSheet + ".uiAlert{color: #ffffff;font-family: Arial;font-size: 14;font-weight: bold;margin-left: 6;margin-right: 6;}\n"); | |
_defaultSheet = (_defaultSheet + ".uiInfo{color: #000000;font-family: Arial;font-size: 14;font-weight: bold;margin-left: 6;margin-right: 6;}\n"); | |
_defaultSheet = (_defaultSheet + ".uiSuccess{color: #ffffff;font-family: Arial;font-size: 12;font-weight: bold;margin-left: 6;margin-right: 6;}\n"); | |
_defaultSheet = (_defaultSheet + ".uiFailure{color: #ffffff;font-family: Arial;font-size: 12;font-weight: bold;margin-left: 6;margin-right: 6;}\n"); | |
_defaultSheet = (_defaultSheet + ".uiAlertAction{color: #ffffff;text-align: center;font-family: Arial;font-size: 12;font-weight: bold;margin-left: 6;margin-right: 6;}\n"); | |
_defaultSheet = (_defaultSheet + ".uiAlertTitle{color: #ffffff;font-family: Arial;font-size: 16;font-weight: bold;margin-left: 6;margin-right: 6;}\n"); | |
_defaultSheet = (_defaultSheet + "\n"); | |
roundedCorner = 6; | |
backgroundColor = 0xCCCCCC; | |
borderColor = 0x555555; | |
infoColor = 16777113; | |
alertColor = 0xFFCC00; | |
warningColor = 0xCC0000; | |
successColor = 0xFF00; | |
failureColor = 0xFF0000; | |
_parseSheet(_defaultSheet); | |
} | |
} | |
}//package com.google.analytics.debug | |
package com.google.analytics.debug { | |
public class AlertAction { | |
public var container:Alert; | |
private var _callback; | |
public var activator:String; | |
public var name:String; | |
public function AlertAction(_arg1:String, _arg2:String, _arg3){ | |
this.name = _arg1; | |
this.activator = _arg2; | |
_callback = _arg3; | |
} | |
public function execute():void{ | |
if (_callback){ | |
if ((_callback is Function)){ | |
(_callback as Function)(); | |
} else { | |
if ((_callback is String)){ | |
var _local1 = container; | |
_local1[_callback](); | |
}; | |
}; | |
}; | |
} | |
} | |
}//package com.google.analytics.debug | |
package com.google.analytics.debug { | |
public class FailureAlert extends Alert { | |
public function FailureAlert(_arg1:DebugConfiguration, _arg2:String, _arg3:Array){ | |
var _local4:Align = Align.bottomLeft; | |
var _local5:Boolean; | |
var _local6:Boolean; | |
if (_arg1.verbose){ | |
_arg2 = ((("<u><span class=\"uiAlertTitle\">Failure</span>" + spaces(18)) + "</u>\n\n") + _arg2); | |
_local4 = Align.center; | |
_local5 = false; | |
_local6 = true; | |
}; | |
super(_arg2, _arg3, "uiFailure", Style.failureColor, _local4, _local5, _local6); | |
} | |
} | |
}//package com.google.analytics.debug | |
package com.google.analytics.debug { | |
public class SuccessAlert extends Alert { | |
public function SuccessAlert(_arg1:DebugConfiguration, _arg2:String, _arg3:Array){ | |
var _local4:Align = Align.bottomLeft; | |
var _local5:Boolean; | |
var _local6:Boolean; | |
if (_arg1.verbose){ | |
_arg2 = ((("<u><span class=\"uiAlertTitle\">Success</span>" + spaces(18)) + "</u>\n\n") + _arg2); | |
_local4 = Align.center; | |
_local5 = false; | |
_local6 = true; | |
}; | |
super(_arg2, _arg3, "uiSuccess", Style.successColor, _local4, _local5, _local6); | |
} | |
} | |
}//package com.google.analytics.debug | |
package com.google.analytics.debug { | |
import flash.events.*; | |
import flash.display.*; | |
import flash.net.*; | |
import com.google.analytics.core.*; | |
import com.google.analytics.*; | |
public class Layout implements ILayout { | |
private var _display:DisplayObject; | |
private var _infoQueue:Array; | |
private var _maxCharPerLine:int = 85; | |
private var _hasInfo:Boolean; | |
private var _warningQueue:Array; | |
private var _hasDebug:Boolean; | |
private var _hasWarning:Boolean; | |
private var _mainPanel:Panel; | |
private var _GRAlertQueue:Array; | |
private var _debug:DebugConfiguration; | |
public var visualDebug:Debug; | |
private var _hasGRAlert:Boolean; | |
public function Layout(_arg1:DebugConfiguration, _arg2:DisplayObject){ | |
_display = _arg2; | |
_debug = _arg1; | |
_hasWarning = false; | |
_hasInfo = false; | |
_hasDebug = false; | |
_hasGRAlert = false; | |
_warningQueue = []; | |
_infoQueue = []; | |
_GRAlertQueue = []; | |
} | |
private function onKey(_arg1:KeyboardEvent=null):void{ | |
switch (_arg1.keyCode){ | |
case _debug.showHideKey: | |
_mainPanel.visible = !(_mainPanel.visible); | |
break; | |
case _debug.destroyKey: | |
destroy(); | |
break; | |
}; | |
} | |
public function createWarning(_arg1:String):void{ | |
if (((_hasWarning) || (!(isAvailable())))){ | |
_warningQueue.push(_arg1); | |
return; | |
}; | |
_arg1 = _filterMaxChars(_arg1); | |
_hasWarning = true; | |
var _local2:Warning = new Warning(_arg1, _debug.warningTimeout); | |
addToPanel("analytics", _local2); | |
_local2.addEventListener(Event.REMOVED_FROM_STAGE, _clearWarning, false, 0, true); | |
if (_hasDebug){ | |
visualDebug.writeBold(_arg1); | |
}; | |
} | |
public function bringToFront(_arg1:DisplayObject):void{ | |
_display.stage.setChildIndex(_arg1, (_display.stage.numChildren - 1)); | |
} | |
public function createFailureAlert(_arg1:String):void{ | |
var _local2:AlertAction; | |
if (_debug.verbose){ | |
_arg1 = _filterMaxChars(_arg1); | |
_local2 = new AlertAction("Close", "close", "close"); | |
} else { | |
_local2 = new AlertAction("X", "close", "close"); | |
}; | |
var _local3:Alert = new FailureAlert(_debug, _arg1, [_local2]); | |
addToPanel("analytics", _local3); | |
if (_hasDebug){ | |
if (_debug.verbose){ | |
_arg1 = _arg1.split("\n").join(""); | |
_arg1 = _filterMaxChars(_arg1, 66); | |
}; | |
visualDebug.writeBold(_arg1); | |
}; | |
} | |
public function init():void{ | |
var _local1 = 10; | |
var _local2:uint = (_display.stage.stageWidth - (_local1 * 2)); | |
var _local3:uint = (_display.stage.stageHeight - (_local1 * 2)); | |
var _local4:Panel = new Panel("analytics", _local2, _local3); | |
_local4.alignement = Align.top; | |
_local4.stickToEdge = false; | |
_local4.title = ("Google Analytics v" + GATracker.version); | |
_mainPanel = _local4; | |
addToStage(_local4); | |
bringToFront(_local4); | |
if (_debug.minimizedOnStart){ | |
_mainPanel.onToggle(); | |
}; | |
createVisualDebug(); | |
_display.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKey, false, 0, true); | |
} | |
public function addToPanel(_arg1:String, _arg2:DisplayObject):void{ | |
var _local4:Panel; | |
var _local3:DisplayObject = _display.stage.getChildByName(_arg1); | |
if (_local3){ | |
_local4 = (_local3 as Panel); | |
_local4.addData(_arg2); | |
} else { | |
trace((("panel \"" + _arg1) + "\" not found")); | |
}; | |
} | |
private function _clearInfo(_arg1:Event):void{ | |
_hasInfo = false; | |
if (_infoQueue.length > 0){ | |
createInfo(_infoQueue.shift()); | |
}; | |
} | |
private function _filterMaxChars(_arg1:String, _arg2:int=0):String{ | |
var _local6:String; | |
var _local3 = "\n"; | |
var _local4:Array = []; | |
var _local5:Array = _arg1.split(_local3); | |
if (_arg2 == 0){ | |
_arg2 = _maxCharPerLine; | |
}; | |
var _local7:int; | |
while (_local7 < _local5.length) { | |
_local6 = _local5[_local7]; | |
while (_local6.length > _arg2) { | |
_local4.push(_local6.substr(0, _arg2)); | |
_local6 = _local6.substring(_arg2); | |
}; | |
_local4.push(_local6); | |
_local7++; | |
}; | |
return (_local4.join(_local3)); | |
} | |
private function _clearGRAlert(_arg1:Event):void{ | |
_hasGRAlert = false; | |
if (_GRAlertQueue.length > 0){ | |
createGIFRequestAlert.apply(this, _GRAlertQueue.shift()); | |
}; | |
} | |
public function createSuccessAlert(_arg1:String):void{ | |
var _local2:AlertAction; | |
if (_debug.verbose){ | |
_arg1 = _filterMaxChars(_arg1); | |
_local2 = new AlertAction("Close", "close", "close"); | |
} else { | |
_local2 = new AlertAction("X", "close", "close"); | |
}; | |
var _local3:Alert = new SuccessAlert(_debug, _arg1, [_local2]); | |
addToPanel("analytics", _local3); | |
if (_hasDebug){ | |
if (_debug.verbose){ | |
_arg1 = _arg1.split("\n").join(""); | |
_arg1 = _filterMaxChars(_arg1, 66); | |
}; | |
visualDebug.writeBold(_arg1); | |
}; | |
} | |
public function isAvailable():Boolean{ | |
return (!((_display.stage == null))); | |
} | |
public function createAlert(_arg1:String):void{ | |
_arg1 = _filterMaxChars(_arg1); | |
var _local2:Alert = new Alert(_arg1, [new AlertAction("Close", "close", "close")]); | |
addToPanel("analytics", _local2); | |
if (_hasDebug){ | |
visualDebug.writeBold(_arg1); | |
}; | |
} | |
public function createInfo(_arg1:String):void{ | |
if (((_hasInfo) || (!(isAvailable())))){ | |
_infoQueue.push(_arg1); | |
return; | |
}; | |
_arg1 = _filterMaxChars(_arg1); | |
_hasInfo = true; | |
var _local2:Info = new Info(_arg1, _debug.infoTimeout); | |
addToPanel("analytics", _local2); | |
_local2.addEventListener(Event.REMOVED_FROM_STAGE, _clearInfo, false, 0, true); | |
if (_hasDebug){ | |
visualDebug.write(_arg1); | |
}; | |
} | |
public function createGIFRequestAlert(_arg1:String, _arg2:URLRequest, _arg3:GIFRequest):void{ | |
var message:* = _arg1; | |
var request:* = _arg2; | |
var ref:* = _arg3; | |
if (_hasGRAlert){ | |
_GRAlertQueue.push([message, request, ref]); | |
return; | |
}; | |
_hasGRAlert = true; | |
var f:* = function ():void{ | |
ref.sendRequest(request); | |
}; | |
message = _filterMaxChars(message); | |
var gra:* = new GIFRequestAlert(message, [new AlertAction("OK", "ok", f), new AlertAction("Cancel", "cancel", "close")]); | |
addToPanel("analytics", gra); | |
gra.addEventListener(Event.REMOVED_FROM_STAGE, _clearGRAlert, false, 0, true); | |
if (_hasDebug){ | |
if (_debug.verbose){ | |
message = message.split("\n").join(""); | |
message = _filterMaxChars(message, 66); | |
}; | |
visualDebug.write(message); | |
}; | |
} | |
public function createVisualDebug():void{ | |
if (!visualDebug){ | |
visualDebug = new Debug(); | |
visualDebug.alignement = Align.bottom; | |
visualDebug.stickToEdge = true; | |
addToPanel("analytics", visualDebug); | |
_hasDebug = true; | |
}; | |
} | |
public function addToStage(_arg1:DisplayObject):void{ | |
_display.stage.addChild(_arg1); | |
} | |
private function _clearWarning(_arg1:Event):void{ | |
_hasWarning = false; | |
if (_warningQueue.length > 0){ | |
createWarning(_warningQueue.shift()); | |
}; | |
} | |
public function createPanel(_arg1:String, _arg2:uint, _arg3:uint):void{ | |
var _local4:Panel = new Panel(_arg1, _arg2, _arg3); | |
_local4.alignement = Align.center; | |
_local4.stickToEdge = false; | |
addToStage(_local4); | |
bringToFront(_local4); | |
} | |
public function destroy():void{ | |
_mainPanel.close(); | |
_debug.layout = null; | |
} | |
} | |
}//package com.google.analytics.debug | |
package com.google.analytics.debug { | |
import flash.events.*; | |
import flash.ui.*; | |
public class Debug extends Label { | |
public static var count:uint = 0; | |
private var _lines:Array; | |
private var _preferredForcedWidth:uint = 540; | |
private var _linediff:int = 0; | |
public var maxLines:uint = 16; | |
public function Debug(_arg1:uint=0, _arg2:Align=null, _arg3:Boolean=false){ | |
if (_arg2 == null){ | |
_arg2 = Align.bottom; | |
}; | |
super("", "uiLabel", _arg1, _arg2, _arg3); | |
this.name = ("Debug" + count++); | |
_lines = []; | |
selectable = true; | |
addEventListener(KeyboardEvent.KEY_DOWN, onKey); | |
} | |
public function writeBold(_arg1:String):void{ | |
write(_arg1, true); | |
} | |
private function _getLinesToDisplay(_arg1:int=0):Array{ | |
var _local2:Array; | |
var _local3:uint; | |
var _local4:uint; | |
if ((_lines.length - 1) > maxLines){ | |
if ((_linediff <= 0)){ | |
_linediff = (_linediff + _arg1); | |
} else { | |
if ((((_linediff > 0)) && ((_arg1 < 0)))){ | |
_linediff = (_linediff + _arg1); | |
}; | |
}; | |
_local3 = ((_lines.length - maxLines) + _linediff); | |
_local4 = (_local3 + maxLines); | |
_local2 = _lines.slice(_local3, _local4); | |
} else { | |
_local2 = _lines; | |
}; | |
return (_local2); | |
} | |
private function onKey(_arg1:KeyboardEvent=null):void{ | |
var _local2:Array; | |
switch (_arg1.keyCode){ | |
case Keyboard.DOWN: | |
_local2 = _getLinesToDisplay(1); | |
break; | |
case Keyboard.UP: | |
_local2 = _getLinesToDisplay(-1); | |
break; | |
default: | |
_local2 = null; | |
}; | |
if (_local2 == null){ | |
return; | |
}; | |
text = _local2.join("\n"); | |
} | |
override public function get forcedWidth():uint{ | |
if (this.parent){ | |
if (UISprite(this.parent).forcedWidth > _preferredForcedWidth){ | |
return (_preferredForcedWidth); | |
}; | |
return (UISprite(this.parent).forcedWidth); | |
}; | |
return (super.forcedWidth); | |
} | |
public function write(_arg1:String, _arg2:Boolean=false):void{ | |
var _local3:Array; | |
if (_arg1.indexOf("") > -1){ | |
_local3 = _arg1.split("\n"); | |
} else { | |
_local3 = [_arg1]; | |
}; | |
var _local4 = ""; | |
var _local5 = ""; | |
if (_arg2){ | |
_local4 = "<b>"; | |
_local5 = "</b>"; | |
}; | |
var _local6:int; | |
while (_local6 < _local3.length) { | |
_lines.push(((_local4 + _local3[_local6]) + _local5)); | |
_local6++; | |
}; | |
var _local7:Array = _getLinesToDisplay(); | |
text = _local7.join("\n"); | |
} | |
public function close():void{ | |
dispose(); | |
} | |
override protected function dispose():void{ | |
removeEventListener(KeyboardEvent.KEY_DOWN, onKey); | |
super.dispose(); | |
} | |
} | |
}//package com.google.analytics.debug | |
package com.google.analytics.debug { | |
import flash.events.*; | |
public class Alert extends Label { | |
public var autoClose:Boolean = true; | |
public var actionOnNextLine:Boolean = true; | |
private var _actions:Array; | |
public function Alert(_arg1:String, _arg2:Array, _arg3:String="uiAlert", _arg4:uint=0, _arg5:Align=null, _arg6:Boolean=false, _arg7:Boolean=true){ | |
if (_arg4 == 0){ | |
_arg4 = Style.alertColor; | |
}; | |
if (_arg5 == null){ | |
_arg5 = Align.center; | |
}; | |
super(_arg1, _arg3, _arg4, _arg5, _arg6); | |
this.selectable = true; | |
super.mouseChildren = true; | |
this.buttonMode = true; | |
this.mouseEnabled = true; | |
this.useHandCursor = true; | |
this.actionOnNextLine = _arg7; | |
_actions = []; | |
var _local8:int; | |
while (_local8 < _arg2.length) { | |
_arg2[_local8].container = this; | |
_actions.push(_arg2[_local8]); | |
_local8++; | |
}; | |
} | |
private function _defineActions():void{ | |
var _local3:AlertAction; | |
var _local1 = ""; | |
if (actionOnNextLine){ | |
_local1 = (_local1 + "\n"); | |
} else { | |
_local1 = (_local1 + " |"); | |
}; | |
_local1 = (_local1 + " "); | |
var _local2:Array = []; | |
var _local4:int; | |
while (_local4 < _actions.length) { | |
_local3 = _actions[_local4]; | |
_local2.push((((("<a href=\"event:" + _local3.activator) + "\">") + _local3.name) + "</a>")); | |
_local4++; | |
}; | |
_local1 = (_local1 + _local2.join(" | ")); | |
appendText(_local1, "uiAlertAction"); | |
} | |
protected function isValidAction(_arg1:String):Boolean{ | |
var _local2:int; | |
while (_local2 < _actions.length) { | |
if (_arg1 == _actions[_local2].activator){ | |
return (true); | |
}; | |
_local2++; | |
}; | |
return (false); | |
} | |
override protected function layout():void{ | |
super.layout(); | |
_defineActions(); | |
} | |
protected function getAction(_arg1:String):AlertAction{ | |
var _local2:int; | |
while (_local2 < _actions.length) { | |
if (_arg1 == _actions[_local2].activator){ | |
return (_actions[_local2]); | |
}; | |
_local2++; | |
}; | |
return (null); | |
} | |
protected function spaces(_arg1:int):String{ | |
var _local2 = ""; | |
var _local3 = " "; | |
var _local4:int; | |
while (_local4 < (_arg1 + 1)) { | |
_local2 = (_local2 + _local3); | |
_local4++; | |
}; | |
return (_local2); | |
} | |
override public function onLink(_arg1:TextEvent):void{ | |
var _local2:AlertAction; | |
if (isValidAction(_arg1.text)){ | |
_local2 = getAction(_arg1.text); | |
if (_local2){ | |
_local2.execute(); | |
}; | |
}; | |
if (autoClose){ | |
close(); | |
}; | |
} | |
public function close():void{ | |
if (parent != null){ | |
parent.removeChild(this); | |
}; | |
} | |
} | |
}//package com.google.analytics.debug | |
package com.google.analytics.debug { | |
public class VisualDebugMode { | |
public static const advanced:VisualDebugMode = new VisualDebugMode(1, "advanced"); | |
; | |
public static const geek:VisualDebugMode = new VisualDebugMode(2, "geek"); | |
; | |
public static const basic:VisualDebugMode = new VisualDebugMode(0, "basic"); | |
; | |
private var _value:int; | |
private var _name:String; | |
public function VisualDebugMode(_arg1:int=0, _arg2:String=""){ | |
_value = _arg1; | |
_name = _arg2; | |
} | |
public function valueOf():int{ | |
return (_value); | |
} | |
public function toString():String{ | |
return (_name); | |
} | |
} | |
}//package com.google.analytics.debug | |
package com.google.analytics.debug { | |
import flash.events.*; | |
import flash.utils.*; | |
public class Info extends Label { | |
private var _timer:Timer; | |
public function Info(_arg1:String="", _arg2:uint=3000){ | |
super(_arg1, "uiInfo", Style.infoColor, Align.top, true); | |
if (_arg2 > 0){ | |
_timer = new Timer(_arg2, 1); | |
_timer.start(); | |
_timer.addEventListener(TimerEvent.TIMER_COMPLETE, onComplete, false, 0, true); | |
}; | |
} | |
public function close():void{ | |
if (parent != null){ | |
parent.removeChild(this); | |
}; | |
} | |
override public function onLink(_arg1:TextEvent):void{ | |
switch (_arg1.text){ | |
case "hide": | |
close(); | |
break; | |
}; | |
} | |
public function onComplete(_arg1:TimerEvent):void{ | |
close(); | |
} | |
} | |
}//package com.google.analytics.debug | |
package { | |
import flash.display.*; | |
public dynamic class StatusListBtnBg extends MovieClip { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class StatusListBg extends MovieClip { | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class Loading extends MovieClip { | |
} | |
}//package | |
package { | |
import flash.events.*; | |
import flash.display.*; | |
import flash.text.*; | |
public dynamic class AboutHistoryTip extends MovieClip { | |
public var txt:TextField; | |
public var bt:SimpleButton; | |
public var noBt:SimpleButton; | |
public var tipsTxt:TextField; | |
public var line:MovieClip; | |
public var yesBt:SimpleButton; | |
public var time:TextField; | |
public function AboutHistoryTip(){ | |
addFrameScript(0, this.frame1, 200, this.frame201); | |
} | |
function frame1(){ | |
visible = true; | |
this.bt.addEventListener(MouseEvent.CLICK, function (_arg1){ | |
gotoAndStop("end"); | |
}); | |
} | |
function frame201(){ | |
stop(); | |
this.visible = false; | |
} | |
} | |
}//package | |
package { | |
import flash.display.*; | |
public dynamic class historyPanel extends MovieClip { | |
public var line4:historyLine2; | |
public var line2:historyLine2; | |
public var clearBtn:clearHistoryBtn; | |
public var historyCloseBtn:closeBtn; | |
public var line0:historyLine2; | |
public var line1:historyLine2; | |
public var line3:historyLine2; | |
} | |
}//package | |
package caurina.transitions { | |
public class Equations { | |
public static function init():void{ | |
Tweener.registerTransition("easenone", easeNone); | |
Tweener.registerTransition("linear", easeNone); | |
Tweener.registerTransition("easeinquad", easeInQuad); | |
Tweener.registerTransition("easeoutquad", easeOutQuad); | |
Tweener.registerTransition("easeinoutquad", easeInOutQuad); | |
Tweener.registerTransition("easeoutinquad", easeOutInQuad); | |
Tweener.registerTransition("easeincubic", easeInCubic); | |
Tweener.registerTransition("easeoutcubic", easeOutCubic); | |
Tweener.registerTransition("easeinoutcubic", easeInOutCubic); | |
Tweener.registerTransition("easeoutincubic", easeOutInCubic); | |
Tweener.registerTransition("easeinquart", easeInQuart); | |
Tweener.registerTransition("easeoutquart", easeOutQuart); | |
Tweener.registerTransition("easeinoutquart", easeInOutQuart); | |
Tweener.registerTransition("easeoutinquart", easeOutInQuart); | |
Tweener.registerTransition("easeinquint", easeInQuint); | |
Tweener.registerTransition("easeoutquint", easeOutQuint); | |
Tweener.registerTransition("easeinoutquint", easeInOutQuint); | |
Tweener.registerTransition("easeoutinquint", easeOutInQuint); | |
Tweener.registerTransition("easeinsine", easeInSine); | |
Tweener.registerTransition("easeoutsine", easeOutSine); | |
Tweener.registerTransition("easeinoutsine", easeInOutSine); | |
Tweener.registerTransition("easeoutinsine", easeOutInSine); | |
Tweener.registerTransition("easeincirc", easeInCirc); | |
Tweener.registerTransition("easeoutcirc", easeOutCirc); | |
Tweener.registerTransition("easeinoutcirc", easeInOutCirc); | |
Tweener.registerTransition("easeoutincirc", easeOutInCirc); | |
Tweener.registerTransition("easeinexpo", easeInExpo); | |
Tweener.registerTransition("easeoutexpo", easeOutExpo); | |
Tweener.registerTransition("easeinoutexpo", easeInOutExpo); | |
Tweener.registerTransition("easeoutinexpo", easeOutInExpo); | |
Tweener.registerTransition("easeinelastic", easeInElastic); | |
Tweener.registerTransition("easeoutelastic", easeOutElastic); | |
Tweener.registerTransition("easeinoutelastic", easeInOutElastic); | |
Tweener.registerTransition("easeoutinelastic", easeOutInElastic); | |
Tweener.registerTransition("easeinback", easeInBack); | |
Tweener.registerTransition("easeoutback", easeOutBack); | |
Tweener.registerTransition("easeinoutback", easeInOutBack); | |
Tweener.registerTransition("easeoutinback", easeOutInBack); | |
Tweener.registerTransition("easeinbounce", easeInBounce); | |
Tweener.registerTransition("easeoutbounce", easeOutBounce); | |
Tweener.registerTransition("easeinoutbounce", easeInOutBounce); | |
Tweener.registerTransition("easeoutinbounce", easeOutInBounce); | |
} | |
public static function easeNone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
return ((((_arg3 * _arg1) / _arg4) + _arg2)); | |
} | |
public static function easeInQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
_arg1 = (_arg1 / _arg4); | |
return ((((_arg3 * _arg1) * _arg1) + _arg2)); | |
} | |
public static function easeOutQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
_arg1 = (_arg1 / _arg4); | |
return ((((-(_arg3) * _arg1) * (_arg1 - 2)) + _arg2)); | |
} | |
public static function easeInOutQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
_arg1 = (_arg1 / (_arg4 / 2)); | |
if (_arg1 < 1){ | |
return (((((_arg3 / 2) * _arg1) * _arg1) + _arg2)); | |
}; | |
--_arg1; | |
return ((((-(_arg3) / 2) * ((_arg1 * (_arg1 - 2)) - 1)) + _arg2)); | |
} | |
public static function easeOutInQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
if (_arg1 < (_arg4 / 2)){ | |
return (easeOutQuad((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5)); | |
}; | |
return (easeInQuad(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5)); | |
} | |
public static function easeInCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
_arg1 = (_arg1 / _arg4); | |
return (((((_arg3 * _arg1) * _arg1) * _arg1) + _arg2)); | |
} | |
public static function easeOutCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
_arg1 = ((_arg1 / _arg4) - 1); | |
return (((_arg3 * (((_arg1 * _arg1) * _arg1) + 1)) + _arg2)); | |
} | |
public static function easeInOutCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
_arg1 = (_arg1 / (_arg4 / 2)); | |
if (_arg1 < 1){ | |
return ((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) + _arg2)); | |
}; | |
_arg1 = (_arg1 - 2); | |
return ((((_arg3 / 2) * (((_arg1 * _arg1) * _arg1) + 2)) + _arg2)); | |
} | |
public static function easeOutInCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
if (_arg1 < (_arg4 / 2)){ | |
return (easeOutCubic((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5)); | |
}; | |
return (easeInCubic(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5)); | |
} | |
public static function easeInQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
_arg1 = (_arg1 / _arg4); | |
return ((((((_arg3 * _arg1) * _arg1) * _arg1) * _arg1) + _arg2)); | |
} | |
public static function easeOutQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
_arg1 = ((_arg1 / _arg4) - 1); | |
return (((-(_arg3) * ((((_arg1 * _arg1) * _arg1) * _arg1) - 1)) + _arg2)); | |
} | |
public static function easeInOutQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
_arg1 = (_arg1 / (_arg4 / 2)); | |
if (_arg1 < 1){ | |
return (((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2)); | |
}; | |
_arg1 = (_arg1 - 2); | |
return ((((-(_arg3) / 2) * ((((_arg1 * _arg1) * _arg1) * _arg1) - 2)) + _arg2)); | |
} | |
public static function easeOutInQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
if (_arg1 < (_arg4 / 2)){ | |
return (easeOutQuart((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5)); | |
}; | |
return (easeInQuart(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5)); | |
} | |
public static function easeInQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
_arg1 = (_arg1 / _arg4); | |
return (((((((_arg3 * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2)); | |
} | |
public static function easeOutQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
_arg1 = ((_arg1 / _arg4) - 1); | |
return (((_arg3 * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 1)) + _arg2)); | |
} | |
public static function easeInOutQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
_arg1 = (_arg1 / (_arg4 / 2)); | |
if (_arg1 < 1){ | |
return ((((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2)); | |
}; | |
_arg1 = (_arg1 - 2); | |
return ((((_arg3 / 2) * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 2)) + _arg2)); | |
} | |
public static function easeOutInQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
if (_arg1 < (_arg4 / 2)){ | |
return (easeOutQuint((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5)); | |
}; | |
return (easeInQuint(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5)); | |
} | |
public static function easeInSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
return ((((-(_arg3) * Math.cos(((_arg1 / _arg4) * (Math.PI / 2)))) + _arg3) + _arg2)); | |
} | |
public static function easeOutSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
return (((_arg3 * Math.sin(((_arg1 / _arg4) * (Math.PI / 2)))) + _arg2)); | |
} | |
public static function easeInOutSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
return ((((-(_arg3) / 2) * (Math.cos(((Math.PI * _arg1) / _arg4)) - 1)) + _arg2)); | |
} | |
public static function easeOutInSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
if (_arg1 < (_arg4 / 2)){ | |
return (easeOutSine((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5)); | |
}; | |
return (easeInSine(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5)); | |
} | |
public static function easeInExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
return (((_arg1)==0) ? _arg2 : (((_arg3 * Math.pow(2, (10 * ((_arg1 / _arg4) - 1)))) + _arg2) - (_arg3 * 0.001))); | |
} | |
public static function easeOutExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
return (((_arg1)==_arg4) ? (_arg2 + _arg3) : (((_arg3 * 1.001) * (-(Math.pow(2, ((-10 * _arg1) / _arg4))) + 1)) + _arg2)); | |
} | |
public static function easeInOutExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
if (_arg1 == 0){ | |
return (_arg2); | |
}; | |
if (_arg1 == _arg4){ | |
return ((_arg2 + _arg3)); | |
}; | |
_arg1 = (_arg1 / (_arg4 / 2)); | |
if (_arg1 < 1){ | |
return (((((_arg3 / 2) * Math.pow(2, (10 * (_arg1 - 1)))) + _arg2) - (_arg3 * 0.0005))); | |
}; | |
--_arg1; | |
return (((((_arg3 / 2) * 1.0005) * (-(Math.pow(2, (-10 * _arg1))) + 2)) + _arg2)); | |
} | |
public static function easeOutInExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
if (_arg1 < (_arg4 / 2)){ | |
return (easeOutExpo((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5)); | |
}; | |
return (easeInExpo(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5)); | |
} | |
public static function easeInCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
_arg1 = (_arg1 / _arg4); | |
return (((-(_arg3) * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) + _arg2)); | |
} | |
public static function easeOutCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
_arg1 = ((_arg1 / _arg4) - 1); | |
return (((_arg3 * Math.sqrt((1 - (_arg1 * _arg1)))) + _arg2)); | |
} | |
public static function easeInOutCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
_arg1 = (_arg1 / (_arg4 / 2)); | |
if (_arg1 < 1){ | |
return ((((-(_arg3) / 2) * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) + _arg2)); | |
}; | |
_arg1 = (_arg1 - 2); | |
return ((((_arg3 / 2) * (Math.sqrt((1 - (_arg1 * _arg1))) + 1)) + _arg2)); | |
} | |
public static function easeOutInCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
if (_arg1 < (_arg4 / 2)){ | |
return (easeOutCirc((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5)); | |
}; | |
return (easeInCirc(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5)); | |
} | |
public static function easeInElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
var _local7:Number; | |
if (_arg1 == 0){ | |
return (_arg2); | |
}; | |
_arg1 = (_arg1 / _arg4); | |
if (_arg1 == 1){ | |
return ((_arg2 + _arg3)); | |
}; | |
var _local6:Number = ((((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * 0.3) : _arg5.period); | |
var _local8:Number = ((((!(Boolean(_arg5))) || (isNaN(_arg5.amplitude)))) ? 0 : _arg5.amplitude); | |
if (((!(Boolean(_local8))) || ((_local8 < Math.abs(_arg3))))){ | |
_local8 = _arg3; | |
_local7 = (_local6 / 4); | |
} else { | |
_local7 = ((_local6 / (2 * Math.PI)) * Math.asin((_arg3 / _local8))); | |
}; | |
--_arg1; | |
return ((-(((_local8 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6)))) + _arg2)); | |
} | |
public static function easeOutElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
var _local7:Number; | |
if (_arg1 == 0){ | |
return (_arg2); | |
}; | |
_arg1 = (_arg1 / _arg4); | |
if (_arg1 == 1){ | |
return ((_arg2 + _arg3)); | |
}; | |
var _local6:Number = ((((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * 0.3) : _arg5.period); | |
var _local8:Number = ((((!(Boolean(_arg5))) || (isNaN(_arg5.amplitude)))) ? 0 : _arg5.amplitude); | |
if (((!(Boolean(_local8))) || ((_local8 < Math.abs(_arg3))))){ | |
_local8 = _arg3; | |
_local7 = (_local6 / 4); | |
} else { | |
_local7 = ((_local6 / (2 * Math.PI)) * Math.asin((_arg3 / _local8))); | |
}; | |
return (((((_local8 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6))) + _arg3) + _arg2)); | |
} | |
public static function easeInOutElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
var _local7:Number; | |
if (_arg1 == 0){ | |
return (_arg2); | |
}; | |
_arg1 = (_arg1 / (_arg4 / 2)); | |
if (_arg1 == 2){ | |
return ((_arg2 + _arg3)); | |
}; | |
var _local6:Number = ((((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * (0.3 * 1.5)) : _arg5.period); | |
var _local8:Number = ((((!(Boolean(_arg5))) || (isNaN(_arg5.amplitude)))) ? 0 : _arg5.amplitude); | |
if (((!(Boolean(_local8))) || ((_local8 < Math.abs(_arg3))))){ | |
_local8 = _arg3; | |
_local7 = (_local6 / 4); | |
} else { | |
_local7 = ((_local6 / (2 * Math.PI)) * Math.asin((_arg3 / _local8))); | |
}; | |
if (_arg1 < 1){ | |
--_arg1; | |
return (((-0.5 * ((_local8 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6)))) + _arg2)); | |
}; | |
--_arg1; | |
return ((((((_local8 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6))) * 0.5) + _arg3) + _arg2)); | |
} | |
public static function easeOutInElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
if (_arg1 < (_arg4 / 2)){ | |
return (easeOutElastic((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5)); | |
}; | |
return (easeInElastic(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5)); | |
} | |
public static function easeInBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
var _local6:Number = ((((!(Boolean(_arg5))) || (isNaN(_arg5.overshoot)))) ? 1.70158 : _arg5.overshoot); | |
_arg1 = (_arg1 / _arg4); | |
return (((((_arg3 * _arg1) * _arg1) * (((_local6 + 1) * _arg1) - _local6)) + _arg2)); | |
} | |
public static function easeOutBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
var _local6:Number = ((((!(Boolean(_arg5))) || (isNaN(_arg5.overshoot)))) ? 1.70158 : _arg5.overshoot); | |
_arg1 = ((_arg1 / _arg4) - 1); | |
return (((_arg3 * (((_arg1 * _arg1) * (((_local6 + 1) * _arg1) + _local6)) + 1)) + _arg2)); | |
} | |
public static function easeInOutBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
var _local6:Number = ((((!(Boolean(_arg5))) || (isNaN(_arg5.overshoot)))) ? 1.70158 : _arg5.overshoot); | |
_arg1 = (_arg1 / (_arg4 / 2)); | |
if (_arg1 < 1){ | |
_local6 = (_local6 * 1.525); | |
return ((((_arg3 / 2) * ((_arg1 * _arg1) * (((_local6 + 1) * _arg1) - _local6))) + _arg2)); | |
}; | |
_arg1 = (_arg1 - 2); | |
_local6 = (_local6 * 1.525); | |
return ((((_arg3 / 2) * (((_arg1 * _arg1) * (((_local6 + 1) * _arg1) + _local6)) + 2)) + _arg2)); | |
} | |
public static function easeOutInBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
if (_arg1 < (_arg4 / 2)){ | |
return (easeOutBack((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5)); | |
}; | |
return (easeInBack(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5)); | |
} | |
public static function easeInBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
return (((_arg3 - easeOutBounce((_arg4 - _arg1), 0, _arg3, _arg4)) + _arg2)); | |
} | |
public static function easeOutBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
_arg1 = (_arg1 / _arg4); | |
if (_arg1 < (1 / 2.75)){ | |
return (((_arg3 * ((7.5625 * _arg1) * _arg1)) + _arg2)); | |
}; | |
if (_arg1 < (2 / 2.75)){ | |
_arg1 = (_arg1 - (1.5 / 2.75)); | |
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.75)) + _arg2)); | |
}; | |
if (_arg1 < (2.5 / 2.75)){ | |
_arg1 = (_arg1 - (2.25 / 2.75)); | |
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.9375)) + _arg2)); | |
}; | |
_arg1 = (_arg1 - (2.625 / 2.75)); | |
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.984375)) + _arg2)); | |
} | |
public static function easeInOutBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
if (_arg1 < (_arg4 / 2)){ | |
return (((easeInBounce((_arg1 * 2), 0, _arg3, _arg4) * 0.5) + _arg2)); | |
}; | |
return ((((easeOutBounce(((_arg1 * 2) - _arg4), 0, _arg3, _arg4) * 0.5) + (_arg3 * 0.5)) + _arg2)); | |
} | |
public static function easeOutInBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ | |
if (_arg1 < (_arg4 / 2)){ | |
return (easeOutBounce((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5)); | |
}; | |
return (easeInBounce(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5)); | |
} | |
} | |
}//package caurina.transitions | |
package caurina.transitions { | |
public class SpecialPropertySplitter { | |
public var parameters:Array; | |
public var splitValues:Function; | |
public function SpecialPropertySplitter(_arg1:Function, _arg2:Array){ | |
this.splitValues = _arg1; | |
this.parameters = _arg2; | |
} | |
public function toString():String{ | |
var _local1 = ""; | |
_local1 = (_local1 + "[SpecialPropertySplitter "); | |
_local1 = (_local1 + ("splitValues:" + String(this.splitValues))); | |
_local1 = (_local1 + ", "); | |
_local1 = (_local1 + ("parameters:" + String(this.parameters))); | |
_local1 = (_local1 + "]"); | |
return (_local1); | |
} | |
} | |
}//package caurina.transitions | |
package caurina.transitions { | |
public class SpecialProperty { | |
public var getValue:Function; | |
public var setValue:Function; | |
public var parameters:Array; | |
public var preProcess:Function; | |
public function SpecialProperty(_arg1:Function, _arg2:Function, _arg3:Array=null, _arg4:Function=null){ | |
this.getValue = _arg1; | |
this.setValue = _arg2; | |
this.parameters = _arg3; | |
this.preProcess = _arg4; | |
} | |
public function toString():String{ | |
var _local1 = ""; | |
_local1 = (_local1 + "[SpecialProperty "); | |
_local1 = (_local1 + ("getValue:" + String(this.getValue))); | |
_local1 = (_local1 + ", "); | |
_local1 = (_local1 + ("setValue:" + String(this.setValue))); | |
_local1 = (_local1 + ", "); | |
_local1 = (_local1 + ("parameters:" + String(this.parameters))); | |
_local1 = (_local1 + ", "); | |
_local1 = (_local1 + ("preProcess:" + String(this.preProcess))); | |
_local1 = (_local1 + "]"); | |
return (_local1); | |
} | |
} | |
}//package caurina.transitions | |
package caurina.transitions { | |
public class SpecialPropertyModifier { | |
public var modifyValues:Function; | |
public var getValue:Function; | |
public function SpecialPropertyModifier(_arg1:Function, _arg2:Function){ | |
this.modifyValues = _arg1; | |
this.getValue = _arg2; | |
} | |
public function toString():String{ | |
var _local1 = ""; | |
_local1 = (_local1 + "[SpecialPropertyModifier "); | |
_local1 = (_local1 + ("modifyValues:" + String(this.modifyValues))); | |
_local1 = (_local1 + ", "); | |
_local1 = (_local1 + ("getValue:" + String(this.getValue))); | |
_local1 = (_local1 + "]"); | |
return (_local1); | |
} | |
} | |
}//package caurina.transitions | |
package caurina.transitions { | |
import flash.events.*; | |
import flash.display.*; | |
import flash.utils.*; | |
public class Tweener { | |
private static var __tweener_controller__:MovieClip; | |
private static var _engineExists:Boolean = false; | |
private static var _inited:Boolean = false; | |
private static var _currentTime:Number; | |
private static var _currentTimeFrame:Number; | |
private static var _tweenList:Array; | |
private static var _timeScale:Number = 1; | |
private static var _transitionList:Object; | |
private static var _specialPropertyList:Object; | |
private static var _specialPropertyModifierList:Object; | |
private static var _specialPropertySplitterList:Object; | |
public static var autoOverwrite:Boolean = true; | |
public static function addTween(_arg1:Object=null, _arg2:Object=null):Boolean{ | |
var _local3:Number; | |
var _local4:Number; | |
var _local5:String; | |
var _local6:Array; | |
var _local13:Function; | |
var _local14:Object; | |
var _local15:TweenListObj; | |
var _local16:Number; | |
var _local17:Array; | |
var _local18:Array; | |
var _local19:Array; | |
var _local20:String; | |
if (!Boolean(_arg1)){ | |
return (false); | |
}; | |
if ((_arg1 is Array)){ | |
_local6 = _arg1.concat(); | |
} else { | |
_local6 = [_arg1]; | |
}; | |
var _local7:Object = TweenListObj.makePropertiesChain(_arg2); | |
if (!_inited){ | |
init(); | |
}; | |
if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){ | |
startEngine(); | |
}; | |
var _local8:Number = ((isNaN(_local7.time)) ? 0 : _local7.time); | |
var _local9:Number = ((isNaN(_local7.delay)) ? 0 : _local7.delay); | |
var _local10:Array = new Array(); | |
var _local11:Object = { | |
overwrite:true, | |
time:true, | |
delay:true, | |
useFrames:true, | |
skipUpdates:true, | |
transition:true, | |
transitionParams:true, | |
onStart:true, | |
onUpdate:true, | |
onComplete:true, | |
onOverwrite:true, | |
onError:true, | |
rounded:true, | |
onStartParams:true, | |
onUpdateParams:true, | |
onCompleteParams:true, | |
onOverwriteParams:true, | |
onStartScope:true, | |
onUpdateScope:true, | |
onCompleteScope:true, | |
onOverwriteScope:true, | |
onErrorScope:true | |
}; | |
var _local12:Object = new Object(); | |
for (_local5 in _local7) { | |
if (!_local11[_local5]){ | |
if (_specialPropertySplitterList[_local5]){ | |
_local17 = _specialPropertySplitterList[_local5].splitValues(_local7[_local5], _specialPropertySplitterList[_local5].parameters); | |
_local3 = 0; | |
while (_local3 < _local17.length) { | |
if (_specialPropertySplitterList[_local17[_local3].name]){ | |
_local18 = _specialPropertySplitterList[_local17[_local3].name].splitValues(_local17[_local3].value, _specialPropertySplitterList[_local17[_local3].name].parameters); | |
_local4 = 0; | |
while (_local4 < _local18.length) { | |
_local10[_local18[_local4].name] = { | |
valueStart:undefined, | |
valueComplete:_local18[_local4].value, | |
arrayIndex:_local18[_local4].arrayIndex, | |
isSpecialProperty:false | |
}; | |
_local4++; | |
}; | |
} else { | |
_local10[_local17[_local3].name] = { | |
valueStart:undefined, | |
valueComplete:_local17[_local3].value, | |
arrayIndex:_local17[_local3].arrayIndex, | |
isSpecialProperty:false | |
}; | |
}; | |
_local3++; | |
}; | |
} else { | |
if (_specialPropertyModifierList[_local5] != undefined){ | |
_local19 = _specialPropertyModifierList[_local5].modifyValues(_local7[_local5]); | |
_local3 = 0; | |
while (_local3 < _local19.length) { | |
_local12[_local19[_local3].name] = { | |
modifierParameters:_local19[_local3].parameters, | |
modifierFunction:_specialPropertyModifierList[_local5].getValue | |
}; | |
_local3++; | |
}; | |
} else { | |
_local10[_local5] = { | |
valueStart:undefined, | |
valueComplete:_local7[_local5] | |
}; | |
}; | |
}; | |
}; | |
}; | |
for (_local5 in _local10) { | |
if (_specialPropertyList[_local5] != undefined){ | |
_local10[_local5].isSpecialProperty = true; | |
} else { | |
if (_local6[0][_local5] == undefined){ | |
printError((((("The property '" + _local5) + "' doesn't seem to be a normal object property of ") + String(_local6[0])) + " or a registered special property.")); | |
}; | |
}; | |
}; | |
for (_local5 in _local12) { | |
if (_local10[_local5] != undefined){ | |
_local10[_local5].modifierParameters = _local12[_local5].modifierParameters; | |
_local10[_local5].modifierFunction = _local12[_local5].modifierFunction; | |
}; | |
}; | |
if (typeof(_local7.transition) == "string"){ | |
_local20 = _local7.transition.toLowerCase(); | |
_local13 = _transitionList[_local20]; | |
} else { | |
_local13 = _local7.transition; | |
}; | |
if (!Boolean(_local13)){ | |
_local13 = _transitionList["easeoutexpo"]; | |
}; | |
_local3 = 0; | |
while (_local3 < _local6.length) { | |
_local14 = new Object(); | |
for (_local5 in _local10) { | |
_local14[_local5] = new PropertyInfoObj(_local10[_local5].valueStart, _local10[_local5].valueComplete, _local10[_local5].valueComplete, _local10[_local5].arrayIndex, {}, _local10[_local5].isSpecialProperty, _local10[_local5].modifierFunction, _local10[_local5].modifierParameters); | |
}; | |
if (_local7.useFrames == true){ | |
_local15 = new TweenListObj(_local6[_local3], (_currentTimeFrame + (_local9 / _timeScale)), (_currentTimeFrame + ((_local9 + _local8) / _timeScale)), true, _local13, _local7.transitionParams); | |
} else { | |
_local15 = new TweenListObj(_local6[_local3], (_currentTime + ((_local9 * 1000) / _timeScale)), (_currentTime + (((_local9 * 1000) + (_local8 * 1000)) / _timeScale)), false, _local13, _local7.transitionParams); | |
}; | |
_local15.properties = _local14; | |
_local15.onStart = _local7.onStart; | |
_local15.onUpdate = _local7.onUpdate; | |
_local15.onComplete = _local7.onComplete; | |
_local15.onOverwrite = _local7.onOverwrite; | |
_local15.onError = _local7.onError; | |
_local15.onStartParams = _local7.onStartParams; | |
_local15.onUpdateParams = _local7.onUpdateParams; | |
_local15.onCompleteParams = _local7.onCompleteParams; | |
_local15.onOverwriteParams = _local7.onOverwriteParams; | |
_local15.onStartScope = _local7.onStartScope; | |
_local15.onUpdateScope = _local7.onUpdateScope; | |
_local15.onCompleteScope = _local7.onCompleteScope; | |
_local15.onOverwriteScope = _local7.onOverwriteScope; | |
_local15.onErrorScope = _local7.onErrorScope; | |
_local15.rounded = _local7.rounded; | |
_local15.skipUpdates = _local7.skipUpdates; | |
if ((((_local7.overwrite == undefined)) ? autoOverwrite : _local7.overwrite)){ | |
removeTweensByTime(_local15.scope, _local15.properties, _local15.timeStart, _local15.timeComplete); | |
}; | |
_tweenList.push(_local15); | |
if ((((_local8 == 0)) && ((_local9 == 0)))){ | |
_local16 = (_tweenList.length - 1); | |
updateTweenByIndex(_local16); | |
removeTweenByIndex(_local16); | |
}; | |
_local3++; | |
}; | |
return (true); | |
} | |
public static function addCaller(_arg1:Object=null, _arg2:Object=null):Boolean{ | |
var _local3:Number; | |
var _local4:Array; | |
var _local8:Function; | |
var _local9:TweenListObj; | |
var _local10:Number; | |
var _local11:String; | |
if (!Boolean(_arg1)){ | |
return (false); | |
}; | |
if ((_arg1 is Array)){ | |
_local4 = _arg1.concat(); | |
} else { | |
_local4 = [_arg1]; | |
}; | |
var _local5:Object = _arg2; | |
if (!_inited){ | |
init(); | |
}; | |
if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){ | |
startEngine(); | |
}; | |
var _local6:Number = ((isNaN(_local5.time)) ? 0 : _local5.time); | |
var _local7:Number = ((isNaN(_local5.delay)) ? 0 : _local5.delay); | |
if (typeof(_local5.transition) == "string"){ | |
_local11 = _local5.transition.toLowerCase(); | |
_local8 = _transitionList[_local11]; | |
} else { | |
_local8 = _local5.transition; | |
}; | |
if (!Boolean(_local8)){ | |
_local8 = _transitionList["easeoutexpo"]; | |
}; | |
_local3 = 0; | |
while (_local3 < _local4.length) { | |
if (_local5.useFrames == true){ | |
_local9 = new TweenListObj(_local4[_local3], (_currentTimeFrame + (_local7 / _timeScale)), (_currentTimeFrame + ((_local7 + _local6) / _timeScale)), true, _local8, _local5.transitionParams); | |
} else { | |
_local9 = new TweenListObj(_local4[_local3], (_currentTime + ((_local7 * 1000) / _timeScale)), (_currentTime + (((_local7 * 1000) + (_local6 * 1000)) / _timeScale)), false, _local8, _local5.transitionParams); | |
}; | |
_local9.properties = null; | |
_local9.onStart = _local5.onStart; | |
_local9.onUpdate = _local5.onUpdate; | |
_local9.onComplete = _local5.onComplete; | |
_local9.onOverwrite = _local5.onOverwrite; | |
_local9.onStartParams = _local5.onStartParams; | |
_local9.onUpdateParams = _local5.onUpdateParams; | |
_local9.onCompleteParams = _local5.onCompleteParams; | |
_local9.onOverwriteParams = _local5.onOverwriteParams; | |
_local9.onStartScope = _local5.onStartScope; | |
_local9.onUpdateScope = _local5.onUpdateScope; | |
_local9.onCompleteScope = _local5.onCompleteScope; | |
_local9.onOverwriteScope = _local5.onOverwriteScope; | |
_local9.onErrorScope = _local5.onErrorScope; | |
_local9.isCaller = true; | |
_local9.count = _local5.count; | |
_local9.waitFrames = _local5.waitFrames; | |
_tweenList.push(_local9); | |
if ((((_local6 == 0)) && ((_local7 == 0)))){ | |
_local10 = (_tweenList.length - 1); | |
updateTweenByIndex(_local10); | |
removeTweenByIndex(_local10); | |
}; | |
_local3++; | |
}; | |
return (true); | |
} | |
public static function removeTweensByTime(_arg1:Object, _arg2:Object, _arg3:Number, _arg4:Number):Boolean{ | |
var removedLocally:* = false; | |
var i:* = 0; | |
var pName:* = null; | |
var eventScope:* = null; | |
var p_scope:* = _arg1; | |
var p_properties:* = _arg2; | |
var p_timeStart:* = _arg3; | |
var p_timeComplete:* = _arg4; | |
var removed:* = false; | |
var tl:* = _tweenList.length; | |
i = 0; | |
while (i < tl) { | |
if (((Boolean(_tweenList[i])) && ((p_scope == _tweenList[i].scope)))){ | |
if ((((p_timeComplete > _tweenList[i].timeStart)) && ((p_timeStart < _tweenList[i].timeComplete)))){ | |
removedLocally = false; | |
for (pName in _tweenList[i].properties) { | |
if (Boolean(p_properties[pName])){ | |
if (Boolean(_tweenList[i].onOverwrite)){ | |
eventScope = ((Boolean(_tweenList[i].onOverwriteScope)) ? _tweenList[i].onOverwriteScope : _tweenList[i].scope); | |
try { | |
_tweenList[i].onOverwrite.apply(eventScope, _tweenList[i].onOverwriteParams); | |
} catch(e:Error) { | |
handleError(_tweenList[i], e, "onOverwrite"); | |
}; | |
}; | |
_tweenList[i].properties[pName] = undefined; | |
delete _tweenList[i].properties[pName]; | |
removedLocally = true; | |
removed = true; | |
}; | |
}; | |
if (removedLocally){ | |
if (AuxFunctions.getObjectLength(_tweenList[i].properties) == 0){ | |
removeTweenByIndex(i); | |
}; | |
}; | |
}; | |
}; | |
i = (i + 1); | |
}; | |
return (removed); | |
} | |
public static function removeTweens(_arg1:Object, ... _args):Boolean{ | |
var _local4:uint; | |
var _local5:SpecialPropertySplitter; | |
var _local6:Array; | |
var _local7:uint; | |
var _local3:Array = new Array(); | |
_local4 = 0; | |
while (_local4 < _args.length) { | |
if ((((typeof(_args[_local4]) == "string")) && ((_local3.indexOf(_args[_local4]) == -1)))){ | |
if (_specialPropertySplitterList[_args[_local4]]){ | |
_local5 = _specialPropertySplitterList[_args[_local4]]; | |
_local6 = _local5.splitValues(_arg1, null); | |
_local7 = 0; | |
while (_local7 < _local6.length) { | |
_local3.push(_local6[_local7].name); | |
_local7++; | |
}; | |
} else { | |
_local3.push(_args[_local4]); | |
}; | |
}; | |
_local4++; | |
}; | |
return (affectTweens(removeTweenByIndex, _arg1, _local3)); | |
} | |
public static function removeAllTweens():Boolean{ | |
var _local2:uint; | |
if (!Boolean(_tweenList)){ | |
return (false); | |
}; | |
var _local1:Boolean; | |
_local2 = 0; | |
while (_local2 < _tweenList.length) { | |
removeTweenByIndex(_local2); | |
_local1 = true; | |
_local2++; | |
}; | |
return (_local1); | |
} | |
public static function pauseTweens(_arg1:Object, ... _args):Boolean{ | |
var _local4:uint; | |
var _local3:Array = new Array(); | |
_local4 = 0; | |
while (_local4 < _args.length) { | |
if ((((typeof(_args[_local4]) == "string")) && ((_local3.indexOf(_args[_local4]) == -1)))){ | |
_local3.push(_args[_local4]); | |
}; | |
_local4++; | |
}; | |
return (affectTweens(pauseTweenByIndex, _arg1, _local3)); | |
} | |
public static function pauseAllTweens():Boolean{ | |
var _local2:uint; | |
if (!Boolean(_tweenList)){ | |
return (false); | |
}; | |
var _local1:Boolean; | |
_local2 = 0; | |
while (_local2 < _tweenList.length) { | |
pauseTweenByIndex(_local2); | |
_local1 = true; | |
_local2++; | |
}; | |
return (_local1); | |
} | |
public static function resumeTweens(_arg1:Object, ... _args):Boolean{ | |
var _local4:uint; | |
var _local3:Array = new Array(); | |
_local4 = 0; | |
while (_local4 < _args.length) { | |
if ((((typeof(_args[_local4]) == "string")) && ((_local3.indexOf(_args[_local4]) == -1)))){ | |
_local3.push(_args[_local4]); | |
}; | |
_local4++; | |
}; | |
return (affectTweens(resumeTweenByIndex, _arg1, _local3)); | |
} | |
public static function resumeAllTweens():Boolean{ | |
var _local2:uint; | |
if (!Boolean(_tweenList)){ | |
return (false); | |
}; | |
var _local1:Boolean; | |
_local2 = 0; | |
while (_local2 < _tweenList.length) { | |
resumeTweenByIndex(_local2); | |
_local1 = true; | |
_local2++; | |
}; | |
return (_local1); | |
} | |
private static function affectTweens(_arg1:Function, _arg2:Object, _arg3:Array):Boolean{ | |
var _local5:uint; | |
var _local6:Array; | |
var _local7:uint; | |
var _local8:uint; | |
var _local9:uint; | |
var _local4:Boolean; | |
if (!Boolean(_tweenList)){ | |
return (false); | |
}; | |
_local5 = 0; | |
while (_local5 < _tweenList.length) { | |
if (((_tweenList[_local5]) && ((_tweenList[_local5].scope == _arg2)))){ | |
if (_arg3.length == 0){ | |
_arg1(_local5); | |
_local4 = true; | |
} else { | |
_local6 = new Array(); | |
_local7 = 0; | |
while (_local7 < _arg3.length) { | |
if (Boolean(_tweenList[_local5].properties[_arg3[_local7]])){ | |
_local6.push(_arg3[_local7]); | |
}; | |
_local7++; | |
}; | |
if (_local6.length > 0){ | |
_local8 = AuxFunctions.getObjectLength(_tweenList[_local5].properties); | |
if (_local8 == _local6.length){ | |
_arg1(_local5); | |
_local4 = true; | |
} else { | |
_local9 = splitTweens(_local5, _local6); | |
_arg1(_local9); | |
_local4 = true; | |
}; | |
}; | |
}; | |
}; | |
_local5++; | |
}; | |
return (_local4); | |
} | |
public static function splitTweens(_arg1:Number, _arg2:Array):uint{ | |
var _local5:uint; | |
var _local6:String; | |
var _local7:Boolean; | |
var _local3:TweenListObj = _tweenList[_arg1]; | |
var _local4:TweenListObj = _local3.clone(false); | |
_local5 = 0; | |
while (_local5 < _arg2.length) { | |
_local6 = _arg2[_local5]; | |
if (Boolean(_local3.properties[_local6])){ | |
_local3.properties[_local6] = undefined; | |
delete _local3.properties[_local6]; | |
}; | |
_local5++; | |
}; | |
for (_local6 in _local4.properties) { | |
_local7 = false; | |
_local5 = 0; | |
while (_local5 < _arg2.length) { | |
if (_arg2[_local5] == _local6){ | |
_local7 = true; | |
break; | |
}; | |
_local5++; | |
}; | |
if (!_local7){ | |
_local4.properties[_local6] = undefined; | |
delete _local4.properties[_local6]; | |
}; | |
}; | |
_tweenList.push(_local4); | |
return ((_tweenList.length - 1)); | |
} | |
private static function updateTweens():Boolean{ | |
var _local1:int; | |
if (_tweenList.length == 0){ | |
return (false); | |
}; | |
_local1 = 0; | |
while (_local1 < _tweenList.length) { | |
if ((((_tweenList[_local1] == undefined)) || (!(_tweenList[_local1].isPaused)))){ | |
if (!updateTweenByIndex(_local1)){ | |
removeTweenByIndex(_local1); | |
}; | |
if (_tweenList[_local1] == null){ | |
removeTweenByIndex(_local1, true); | |
_local1--; | |
}; | |
}; | |
_local1++; | |
}; | |
return (true); | |
} | |
public static function removeTweenByIndex(_arg1:Number, _arg2:Boolean=false):Boolean{ | |
_tweenList[_arg1] = null; | |
if (_arg2){ | |
_tweenList.splice(_arg1, 1); | |
}; | |
return (true); | |
} | |
public static function pauseTweenByIndex(_arg1:Number):Boolean{ | |
var _local2:TweenListObj = _tweenList[_arg1]; | |
if ((((_local2 == null)) || (_local2.isPaused))){ | |
return (false); | |
}; | |
_local2.timePaused = getCurrentTweeningTime(_local2); | |
_local2.isPaused = true; | |
return (true); | |
} | |
public static function resumeTweenByIndex(_arg1:Number):Boolean{ | |
var _local2:TweenListObj = _tweenList[_arg1]; | |
if ((((_local2 == null)) || (!(_local2.isPaused)))){ | |
return (false); | |
}; | |
var _local3:Number = getCurrentTweeningTime(_local2); | |
_local2.timeStart = (_local2.timeStart + (_local3 - _local2.timePaused)); | |
_local2.timeComplete = (_local2.timeComplete + (_local3 - _local2.timePaused)); | |
_local2.timePaused = undefined; | |
_local2.isPaused = false; | |
return (true); | |
} | |
private static function updateTweenByIndex(_arg1:Number):Boolean{ | |
var tTweening:* = null; | |
var mustUpdate:* = false; | |
var nv:* = NaN; | |
var t:* = NaN; | |
var b:* = NaN; | |
var c:* = NaN; | |
var d:* = NaN; | |
var pName:* = null; | |
var eventScope:* = null; | |
var tScope:* = null; | |
var tProperty:* = null; | |
var pv:* = NaN; | |
var i:* = _arg1; | |
tTweening = _tweenList[i]; | |
if ((((tTweening == null)) || (!(Boolean(tTweening.scope))))){ | |
return (false); | |
}; | |
var isOver:* = false; | |
var cTime:* = getCurrentTweeningTime(tTweening); | |
if (cTime >= tTweening.timeStart){ | |
tScope = tTweening.scope; | |
if (tTweening.isCaller){ | |
do { | |
t = (((tTweening.timeComplete - tTweening.timeStart) / tTweening.count) * (tTweening.timesCalled + 1)); | |
b = tTweening.timeStart; | |
c = (tTweening.timeComplete - tTweening.timeStart); | |
d = (tTweening.timeComplete - tTweening.timeStart); | |
nv = tTweening.transition(t, b, c, d); | |
if (cTime >= nv){ | |
if (Boolean(tTweening.onUpdate)){ | |
eventScope = ((Boolean(tTweening.onUpdateScope)) ? tTweening.onUpdateScope : tScope); | |
try { | |
tTweening.onUpdate.apply(eventScope, tTweening.onUpdateParams); | |
} catch(e1:Error) { | |
handleError(tTweening, e1, "onUpdate"); | |
}; | |
}; | |
tTweening.timesCalled++; | |
if (tTweening.timesCalled >= tTweening.count){ | |
isOver = true; | |
break; | |
}; | |
if (tTweening.waitFrames){ | |
break; | |
}; | |
}; | |
} while (cTime >= nv); | |
} else { | |
mustUpdate = (((((tTweening.skipUpdates < 1)) || (!(tTweening.skipUpdates)))) || ((tTweening.updatesSkipped >= tTweening.skipUpdates))); | |
if (cTime >= tTweening.timeComplete){ | |
isOver = true; | |
mustUpdate = true; | |
}; | |
if (!tTweening.hasStarted){ | |
if (Boolean(tTweening.onStart)){ | |
eventScope = ((Boolean(tTweening.onStartScope)) ? tTweening.onStartScope : tScope); | |
try { | |
tTweening.onStart.apply(eventScope, tTweening.onStartParams); | |
} catch(e2:Error) { | |
handleError(tTweening, e2, "onStart"); | |
}; | |
}; | |
for (pName in tTweening.properties) { | |
if (tTweening.properties[pName].isSpecialProperty){ | |
if (Boolean(_specialPropertyList[pName].preProcess)){ | |
tTweening.properties[pName].valueComplete = _specialPropertyList[pName].preProcess(tScope, _specialPropertyList[pName].parameters, tTweening.properties[pName].originalValueComplete, tTweening.properties[pName].extra); | |
}; | |
pv = _specialPropertyList[pName].getValue(tScope, _specialPropertyList[pName].parameters, tTweening.properties[pName].extra); | |
} else { | |
pv = tScope[pName]; | |
}; | |
tTweening.properties[pName].valueStart = ((isNaN(pv)) ? tTweening.properties[pName].valueComplete : pv); | |
}; | |
mustUpdate = true; | |
tTweening.hasStarted = true; | |
}; | |
if (mustUpdate){ | |
for (pName in tTweening.properties) { | |
tProperty = tTweening.properties[pName]; | |
if (isOver){ | |
nv = tProperty.valueComplete; | |
} else { | |
if (tProperty.hasModifier){ | |
t = (cTime - tTweening.timeStart); | |
d = (tTweening.timeComplete - tTweening.timeStart); | |
nv = tTweening.transition(t, 0, 1, d, tTweening.transitionParams); | |
nv = tProperty.modifierFunction(tProperty.valueStart, tProperty.valueComplete, nv, tProperty.modifierParameters); | |
} else { | |
t = (cTime - tTweening.timeStart); | |
b = tProperty.valueStart; | |
c = (tProperty.valueComplete - tProperty.valueStart); | |
d = (tTweening.timeComplete - tTweening.timeStart); | |
nv = tTweening.transition(t, b, c, d, tTweening.transitionParams); | |
}; | |
}; | |
if (tTweening.rounded){ | |
nv = Math.round(nv); | |
}; | |
if (tProperty.isSpecialProperty){ | |
_specialPropertyList[pName].setValue(tScope, nv, _specialPropertyList[pName].parameters, tTweening.properties[pName].extra); | |
} else { | |
tScope[pName] = nv; | |
}; | |
}; | |
tTweening.updatesSkipped = 0; | |
if (Boolean(tTweening.onUpdate)){ | |
eventScope = ((Boolean(tTweening.onUpdateScope)) ? tTweening.onUpdateScope : tScope); | |
try { | |
tTweening.onUpdate.apply(eventScope, tTweening.onUpdateParams); | |
} catch(e3:Error) { | |
handleError(tTweening, e3, "onUpdate"); | |
}; | |
}; | |
} else { | |
tTweening.updatesSkipped++; | |
}; | |
}; | |
if (((isOver) && (Boolean(tTweening.onComplete)))){ | |
eventScope = ((Boolean(tTweening.onCompleteScope)) ? tTweening.onCompleteScope : tScope); | |
try { | |
tTweening.onComplete.apply(eventScope, tTweening.onCompleteParams); | |
} catch(e4:Error) { | |
handleError(tTweening, e4, "onComplete"); | |
}; | |
}; | |
return (!(isOver)); | |
}; | |
return (true); | |
} | |
public static function init(... _args):void{ | |
_inited = true; | |
_transitionList = new Object(); | |
Equations.init(); | |
_specialPropertyList = new Object(); | |
_specialPropertyModifierList = new Object(); | |
_specialPropertySplitterList = new Object(); | |
} | |
public static function registerTransition(_arg1:String, _arg2:Function):void{ | |
if (!_inited){ | |
init(); | |
}; | |
_transitionList[_arg1] = _arg2; | |
} | |
public static function registerSpecialProperty(_arg1:String, _arg2:Function, _arg3:Function, _arg4:Array=null, _arg5:Function=null):void{ | |
if (!_inited){ | |
init(); | |
}; | |
var _local6:SpecialProperty = new SpecialProperty(_arg2, _arg3, _arg4, _arg5); | |
_specialPropertyList[_arg1] = _local6; | |
} | |
public static function registerSpecialPropertyModifier(_arg1:String, _arg2:Function, _arg3:Function):void{ | |
if (!_inited){ | |
init(); | |
}; | |
var _local4:SpecialPropertyModifier = new SpecialPropertyModifier(_arg2, _arg3); | |
_specialPropertyModifierList[_arg1] = _local4; | |
} | |
public static function registerSpecialPropertySplitter(_arg1:String, _arg2:Function, _arg3:Array=null):void{ | |
if (!_inited){ | |
init(); | |
}; | |
var _local4:SpecialPropertySplitter = new SpecialPropertySplitter(_arg2, _arg3); | |
_specialPropertySplitterList[_arg1] = _local4; | |
} | |
private static function startEngine():void{ | |
_engineExists = true; | |
_tweenList = new Array(); | |
__tweener_controller__ = new MovieClip(); | |
__tweener_controller__.addEventListener(Event.ENTER_FRAME, Tweener.onEnterFrame); | |
_currentTimeFrame = 0; | |
updateTime(); | |
} | |
private static function stopEngine():void{ | |
_engineExists = false; | |
_tweenList = null; | |
_currentTime = 0; | |
_currentTimeFrame = 0; | |
__tweener_controller__.removeEventListener(Event.ENTER_FRAME, Tweener.onEnterFrame); | |
__tweener_controller__ = null; | |
} | |
public static function updateTime():void{ | |
_currentTime = getTimer(); | |
} | |
public static function updateFrame():void{ | |
_currentTimeFrame++; | |
} | |
public static function onEnterFrame(_arg1:Event):void{ | |
updateTime(); | |
updateFrame(); | |
var _local2:Boolean; | |
_local2 = updateTweens(); | |
if (!_local2){ | |
stopEngine(); | |
}; | |
} | |
public static function setTimeScale(_arg1:Number):void{ | |
var _local2:Number; | |
var _local3:Number; | |
if (isNaN(_arg1)){ | |
_arg1 = 1; | |
}; | |
if (_arg1 < 1E-5){ | |
_arg1 = 1E-5; | |
}; | |
if (_arg1 != _timeScale){ | |
if (_tweenList != null){ | |
_local2 = 0; | |
while (_local2 < _tweenList.length) { | |
_local3 = getCurrentTweeningTime(_tweenList[_local2]); | |
_tweenList[_local2].timeStart = (_local3 - (((_local3 - _tweenList[_local2].timeStart) * _timeScale) / _arg1)); | |
_tweenList[_local2].timeComplete = (_local3 - (((_local3 - _tweenList[_local2].timeComplete) * _timeScale) / _arg1)); | |
if (_tweenList[_local2].timePaused != undefined){ | |
_tweenList[_local2].timePaused = (_local3 - (((_local3 - _tweenList[_local2].timePaused) * _timeScale) / _arg1)); | |
}; | |
_local2++; | |
}; | |
}; | |
_timeScale = _arg1; | |
}; | |
} | |
public static function isTweening(_arg1:Object):Boolean{ | |
var _local2:uint; | |
if (!Boolean(_tweenList)){ | |
return (false); | |
}; | |
_local2 = 0; | |
while (_local2 < _tweenList.length) { | |
if (((Boolean(_tweenList[_local2])) && ((_tweenList[_local2].scope == _arg1)))){ | |
return (true); | |
}; | |
_local2++; | |
}; | |
return (false); | |
} | |
public static function getTweens(_arg1:Object):Array{ | |
var _local2:uint; | |
var _local3:String; | |
if (!Boolean(_tweenList)){ | |
return ([]); | |
}; | |
var _local4:Array = new Array(); | |
_local2 = 0; | |
while (_local2 < _tweenList.length) { | |
if (((Boolean(_tweenList[_local2])) && ((_tweenList[_local2].scope == _arg1)))){ | |
for (_local3 in _tweenList[_local2].properties) { | |
_local4.push(_local3); | |
}; | |
}; | |
_local2++; | |
}; | |
return (_local4); | |
} | |
public static function getTweenCount(_arg1:Object):Number{ | |
var _local2:uint; | |
if (!Boolean(_tweenList)){ | |
return (0); | |
}; | |
var _local3:Number = 0; | |
_local2 = 0; | |
while (_local2 < _tweenList.length) { | |
if (((Boolean(_tweenList[_local2])) && ((_tweenList[_local2].scope == _arg1)))){ | |
_local3 = (_local3 + AuxFunctions.getObjectLength(_tweenList[_local2].properties)); | |
}; | |
_local2++; | |
}; | |
return (_local3); | |
} | |
private static function handleError(_arg1:TweenListObj, _arg2:Error, _arg3:String):void{ | |
var eventScope:* = null; | |
var pTweening:* = _arg1; | |
var pError:* = _arg2; | |
var pCallBackName:* = _arg3; | |
if (((Boolean(pTweening.onError)) && ((pTweening.onError is Function)))){ | |
eventScope = ((Boolean(pTweening.onErrorScope)) ? pTweening.onErrorScope : pTweening.scope); | |
try { | |
pTweening.onError.apply(eventScope, [pTweening.scope, pError]); | |
} catch(metaError:Error) { | |
printError(((((String(pTweening.scope) + " raised an error while executing the 'onError' handler. Original error:\n ") + pError.getStackTrace()) + "\nonError error: ") + metaError.getStackTrace())); | |
}; | |
} else { | |
if (!Boolean(pTweening.onError)){ | |
printError(((((String(pTweening.scope) + " raised an error while executing the '") + pCallBackName) + "'handler. \n") + pError.getStackTrace())); | |
}; | |
}; | |
} | |
public static function getCurrentTweeningTime(_arg1:Object):Number{ | |
return (((_arg1.useFrames) ? _currentTimeFrame : _currentTime)); | |
} | |
public static function getVersion():String{ | |
return ("AS3 1.33.74"); | |
} | |
public static function printError(_arg1:String):void{ | |
} | |
} | |
}//package caurina.transitions | |
package caurina.transitions { | |
public class TweenListObj { | |
public var scope:Object; | |
public var properties:Object; | |
public var timeStart:Number; | |
public var timeComplete:Number; | |
public var useFrames:Boolean; | |
public var transition:Function; | |
public var transitionParams:Object; | |
public var onStart:Function; | |
public var onUpdate:Function; | |
public var onComplete:Function; | |
public var onOverwrite:Function; | |
public var onError:Function; | |
public var onStartParams:Array; | |
public var onUpdateParams:Array; | |
public var onCompleteParams:Array; | |
public var onOverwriteParams:Array; | |
public var onStartScope:Object; | |
public var onUpdateScope:Object; | |
public var onCompleteScope:Object; | |
public var onOverwriteScope:Object; | |
public var onErrorScope:Object; | |
public var rounded:Boolean; | |
public var isPaused:Boolean; | |
public var timePaused:Number; | |
public var isCaller:Boolean; | |
public var count:Number; | |
public var timesCalled:Number; | |
public var waitFrames:Boolean; | |
public var skipUpdates:Number; | |
public var updatesSkipped:Number; | |
public var hasStarted:Boolean; | |
public function TweenListObj(_arg1:Object, _arg2:Number, _arg3:Number, _arg4:Boolean, _arg5:Function, _arg6:Object){ | |
this.scope = _arg1; | |
this.timeStart = _arg2; | |
this.timeComplete = _arg3; | |
this.useFrames = _arg4; | |
this.transition = _arg5; | |
this.transitionParams = _arg6; | |
this.properties = new Object(); | |
this.isPaused = false; | |
this.timePaused = undefined; | |
this.isCaller = false; | |
this.updatesSkipped = 0; | |
this.timesCalled = 0; | |
this.skipUpdates = 0; | |
this.hasStarted = false; | |
} | |
public static function makePropertiesChain(_arg1:Object):Object{ | |
var _local3:Object; | |
var _local4:Object; | |
var _local5:Object; | |
var _local6:Number; | |
var _local7:Number; | |
var _local8:Number; | |
var _local2:Object = _arg1.base; | |
if (_local2){ | |
_local3 = {}; | |
if ((_local2 is Array)){ | |
_local4 = []; | |
_local8 = 0; | |
while (_local8 < _local2.length) { | |
_local4.push(_local2[_local8]); | |
_local8++; | |
}; | |
} else { | |
_local4 = [_local2]; | |
}; | |
_local4.push(_arg1); | |
_local6 = _local4.length; | |
_local7 = 0; | |
while (_local7 < _local6) { | |
if (_local4[_local7]["base"]){ | |
_local5 = AuxFunctions.concatObjects(makePropertiesChain(_local4[_local7]["base"]), _local4[_local7]); | |
} else { | |
_local5 = _local4[_local7]; | |
}; | |
_local3 = AuxFunctions.concatObjects(_local3, _local5); | |
_local7++; | |
}; | |
if (_local3["base"]){ | |
delete _local3["base"]; | |
}; | |
return (_local3); | |
}; | |
return (_arg1); | |
} | |
public function clone(_arg1:Boolean):TweenListObj{ | |
var _local3:String; | |
var _local2:TweenListObj = new TweenListObj(this.scope, this.timeStart, this.timeComplete, this.useFrames, this.transition, this.transitionParams); | |
_local2.properties = new Array(); | |
for (_local3 in this.properties) { | |
_local2.properties[_local3] = this.properties[_local3].clone(); | |
}; | |
_local2.skipUpdates = this.skipUpdates; | |
_local2.updatesSkipped = this.updatesSkipped; | |
if (!_arg1){ | |
_local2.onStart = this.onStart; | |
_local2.onUpdate = this.onUpdate; | |
_local2.onComplete = this.onComplete; | |
_local2.onOverwrite = this.onOverwrite; | |
_local2.onError = this.onError; | |
_local2.onStartParams = this.onStartParams; | |
_local2.onUpdateParams = this.onUpdateParams; | |
_local2.onCompleteParams = this.onCompleteParams; | |
_local2.onOverwriteParams = this.onOverwriteParams; | |
_local2.onStartScope = this.onStartScope; | |
_local2.onUpdateScope = this.onUpdateScope; | |
_local2.onCompleteScope = this.onCompleteScope; | |
_local2.onOverwriteScope = this.onOverwriteScope; | |
_local2.onErrorScope = this.onErrorScope; | |
}; | |
_local2.rounded = this.rounded; | |
_local2.isPaused = this.isPaused; | |
_local2.timePaused = this.timePaused; | |
_local2.isCaller = this.isCaller; | |
_local2.count = this.count; | |
_local2.timesCalled = this.timesCalled; | |
_local2.waitFrames = this.waitFrames; | |
_local2.hasStarted = this.hasStarted; | |
return (_local2); | |
} | |
public function toString():String{ | |
var _local3:String; | |
var _local1 = "\n[TweenListObj "; | |
_local1 = (_local1 + ("scope:" + String(this.scope))); | |
_local1 = (_local1 + ", properties:"); | |
var _local2:Boolean; | |
for (_local3 in this.properties) { | |
if (!_local2){ | |
_local1 = (_local1 + ","); | |
}; | |
_local1 = (_local1 + ("[name:" + this.properties[_local3].name)); | |
_local1 = (_local1 + (",valueStart:" + this.properties[_local3].valueStart)); | |
_local1 = (_local1 + (",valueComplete:" + this.properties[_local3].valueComplete)); | |
_local1 = (_local1 + "]"); | |
_local2 = false; | |
}; | |
_local1 = (_local1 + (", timeStart:" + String(this.timeStart))); | |
_local1 = (_local1 + (", timeComplete:" + String(this.timeComplete))); | |
_local1 = (_local1 + (", useFrames:" + String(this.useFrames))); | |
_local1 = (_local1 + (", transition:" + String(this.transition))); | |
_local1 = (_local1 + (", transitionParams:" + String(this.transitionParams))); | |
if (this.skipUpdates){ | |
_local1 = (_local1 + (", skipUpdates:" + String(this.skipUpdates))); | |
}; | |
if (this.updatesSkipped){ | |
_local1 = (_local1 + (", updatesSkipped:" + String(this.updatesSkipped))); | |
}; | |
if (Boolean(this.onStart)){ | |
_local1 = (_local1 + (", onStart:" + String(this.onStart))); | |
}; | |
if (Boolean(this.onUpdate)){ | |
_local1 = (_local1 + (", onUpdate:" + String(this.onUpdate))); | |
}; | |
if (Boolean(this.onComplete)){ | |
_local1 = (_local1 + (", onComplete:" + String(this.onComplete))); | |
}; | |
if (Boolean(this.onOverwrite)){ | |
_local1 = (_local1 + (", onOverwrite:" + String(this.onOverwrite))); | |
}; | |
if (Boolean(this.onError)){ | |
_local1 = (_local1 + (", onError:" + String(this.onError))); | |
}; | |
if (this.onStartParams){ | |
_local1 = (_local1 + (", onStartParams:" + String(this.onStartParams))); | |
}; | |
if (this.onUpdateParams){ | |
_local1 = (_local1 + (", onUpdateParams:" + String(this.onUpdateParams))); | |
}; | |
if (this.onCompleteParams){ | |
_local1 = (_local1 + (", onCompleteParams:" + String(this.onCompleteParams))); | |
}; | |
if (this.onOverwriteParams){ | |
_local1 = (_local1 + (", onOverwriteParams:" + String(this.onOverwriteParams))); | |
}; | |
if (this.onStartScope){ | |
_local1 = (_local1 + (", onStartScope:" + String(this.onStartScope))); | |
}; | |
if (this.onUpdateScope){ | |
_local1 = (_local1 + (", onUpdateScope:" + String(this.onUpdateScope))); | |
}; | |
if (this.onCompleteScope){ | |
_local1 = (_local1 + (", onCompleteScope:" + String(this.onCompleteScope))); | |
}; | |
if (this.onOverwriteScope){ | |
_local1 = (_local1 + (", onOverwriteScope:" + String(this.onOverwriteScope))); | |
}; | |
if (this.onErrorScope){ | |
_local1 = (_local1 + (", onErrorScope:" + String(this.onErrorScope))); | |
}; | |
if (this.rounded){ | |
_local1 = (_local1 + (", rounded:" + String(this.rounded))); | |
}; | |
if (this.isPaused){ | |
_local1 = (_local1 + (", isPaused:" + String(this.isPaused))); | |
}; | |
if (this.timePaused){ | |
_local1 = (_local1 + (", timePaused:" + String(this.timePaused))); | |
}; | |
if (this.isCaller){ | |
_local1 = (_local1 + (", isCaller:" + String(this.isCaller))); | |
}; | |
if (this.count){ | |
_local1 = (_local1 + (", count:" + String(this.count))); | |
}; | |
if (this.timesCalled){ | |
_local1 = (_local1 + (", timesCalled:" + String(this.timesCalled))); | |
}; | |
if (this.waitFrames){ | |
_local1 = (_local1 + (", waitFrames:" + String(this.waitFrames))); | |
}; | |
if (this.hasStarted){ | |
_local1 = (_local1 + (", hasStarted:" + String(this.hasStarted))); | |
}; | |
_local1 = (_local1 + "]\n"); | |
return (_local1); | |
} | |
} | |
}//package caurina.transitions | |
package caurina.transitions { | |
public class AuxFunctions { | |
public static function numberToR(_arg1:Number):Number{ | |
return (((_arg1 & 0xFF0000) >> 16)); | |
} | |
public static function numberToG(_arg1:Number):Number{ | |
return (((_arg1 & 0xFF00) >> 8)); | |
} | |
public static function numberToB(_arg1:Number):Number{ | |
return ((_arg1 & 0xFF)); | |
} | |
public static function getObjectLength(_arg1:Object):uint{ | |
var _local3:String; | |
var _local2:uint; | |
for (_local3 in _arg1) { | |
_local2++; | |
}; | |
return (_local2); | |
} | |
public static function concatObjects(... _args):Object{ | |
var _local3:Object; | |
var _local5:String; | |
var _local2:Object = {}; | |
var _local4:int; | |
while (_local4 < _args.length) { | |
_local3 = _args[_local4]; | |
for (_local5 in _local3) { | |
if (_local3[_local5] == null){ | |
delete _local2[_local5]; | |
} else { | |
_local2[_local5] = _local3[_local5]; | |
}; | |
}; | |
_local4++; | |
}; | |
return (_local2); | |
} | |
} | |
}//package caurina.transitions | |
package caurina.transitions { | |
public class PropertyInfoObj { | |
public var valueStart:Number; | |
public var valueComplete:Number; | |
public var originalValueComplete:Object; | |
public var arrayIndex:Number; | |
public var extra:Object; | |
public var isSpecialProperty:Boolean; | |
public var hasModifier:Boolean; | |
public var modifierFunction:Function; | |
public var modifierParameters:Array; | |
public function PropertyInfoObj(_arg1:Number, _arg2:Number, _arg3:Object, _arg4:Number, _arg5:Object, _arg6:Boolean, _arg7:Function, _arg8:Array){ | |
this.valueStart = _arg1; | |
this.valueComplete = _arg2; | |
this.originalValueComplete = _arg3; | |
this.arrayIndex = _arg4; | |
this.extra = _arg5; | |
this.isSpecialProperty = _arg6; | |
this.hasModifier = Boolean(_arg7); | |
this.modifierFunction = _arg7; | |
this.modifierParameters = _arg8; | |
} | |
public function clone():PropertyInfoObj{ | |
var _local1:PropertyInfoObj = new PropertyInfoObj(this.valueStart, this.valueComplete, this.originalValueComplete, this.arrayIndex, this.extra, this.isSpecialProperty, this.modifierFunction, this.modifierParameters); | |
return (_local1); | |
} | |
public function toString():String{ | |
var _local1 = "\n[PropertyInfoObj "; | |
_local1 = (_local1 + ("valueStart:" + String(this.valueStart))); | |
_local1 = (_local1 + ", "); | |
_local1 = (_local1 + ("valueComplete:" + String(this.valueComplete))); | |
_local1 = (_local1 + ", "); | |
_local1 = (_local1 + ("originalValueComplete:" + String(this.originalValueComplete))); | |
_local1 = (_local1 + ", "); | |
_local1 = (_local1 + ("arrayIndex:" + String(this.arrayIndex))); | |
_local1 = (_local1 + ", "); | |
_local1 = (_local1 + ("extra:" + String(this.extra))); | |
_local1 = (_local1 + ", "); | |
_local1 = (_local1 + ("isSpecialProperty:" + String(this.isSpecialProperty))); | |
_local1 = (_local1 + ", "); | |
_local1 = (_local1 + ("hasModifier:" + String(this.hasModifier))); | |
_local1 = (_local1 + ", "); | |
_local1 = (_local1 + ("modifierFunction:" + String(this.modifierFunction))); | |
_local1 = (_local1 + ", "); | |
_local1 = (_local1 + ("modifierParameters:" + String(this.modifierParameters))); | |
_local1 = (_local1 + "]\n"); | |
return (_local1); | |
} | |
} | |
}//package caurina.transitions | |
package { | |
import flash.display.*; | |
public dynamic class StatusBtnBg extends MovieClip { | |
} | |
}//package |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment