Section 1
//DateFormat (ascb.util.DateFormat)
package ascb.util {
public class DateFormat {
private var _sMask:String;
public static const DAYS:Array = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
public static const DAYS_ABBREVIATED:Array = ["Sun", "Mon", "Tues", "Wed", "Thurs", "Fri", "Sat"];
public static const MONTHS:Array = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
public static const MONTHS_ABBREVIATED:Array = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
public static const DAYSINMONTH:Array = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
public function DateFormat(_arg1:String){
_sMask = _arg1;
}
public function set mask(_arg1:String):void{
_sMask = _arg1;
}
public function get mask():String{
return (_sMask);
}
private function getMaskElements(_arg1:Boolean=false):Array{
var _local4:Array;
var _local7:Number;
var _local2:Array = _sMask.split("'");
var _local3:Array = new Array();
var _local5:RegExp = new RegExp("[a-zA-Z]");
var _local6:Number = 0;
while (_local6 < _local2.length) {
if ((_local6 % 2) != 0){
_local3.push({type:"quoted", element:_local2[_local6]});
} else {
_local4 = _local2[_local6].split("");
_local7 = 0;
while (_local7 < _local4.length) {
if (((_local5.test(_local4[_local7])) && (_arg1))){
_local3.push({type:"regular", element:_local4[_local7]});
} else {
if (!_arg1){
_local3.push({type:"regular", element:_local4[_local7]});
};
};
_local7++;
};
};
_local6++;
};
return (_local3);
}
public function format(_arg1:Date):String{
var _local5:Number;
var _local6:NumberFormat;
var _local2:Array = getMaskElements();
var _local3:Array = new Array();
var _local4:Number = 0;
while (_local4 < _local2.length) {
switch (_local2[_local4].element){
case "a":
if (_arg1.getHours() < 12){
_local3.push("am");
} else {
_local3.push("pm");
};
break;
case "A":
if (_arg1.getHours() < 12){
_local3.push("AM");
} else {
_local3.push("PM");
};
break;
case "d":
_local3.push(_arg1.getDate());
break;
case "D":
_local3.push(DateFormat.DAYS_ABBREVIATED[_arg1.getDay()]);
break;
case "F":
_local3.push(DateFormat.MONTHS[_arg1.getMonth()]);
break;
case "g":
_local5 = _arg1.getHours();
if (_local5 == 12){
_local3.push(12);
} else {
if (_local5 <= 12){
_local3.push(_local5);
} else {
_local3.push((_local5 - 12));
};
};
break;
case "G":
_local3.push(_arg1.getHours());
break;
case "h":
_local6 = new NumberFormat("00");
_local5 = _arg1.getHours();
if (_local5 == 12){
_local3.push(12);
} else {
if (_local5 <= 12){
_local3.push(_local6.format(_local5));
} else {
_local3.push(_local6.format((_local5 - 12)));
};
};
break;
case "H":
_local6 = new NumberFormat("00");
_local3.push(_local6.format(_arg1.getHours()));
break;
case "i":
_local6 = new NumberFormat("00");
_local3.push(_local6.format(_arg1.getMinutes()));
break;
case "j":
_local3.push(_arg1.getDate());
break;
case "l":
_local3.push(DateFormat.DAYS[_arg1.getDay()]);
break;
case "m":
_local6 = new NumberFormat("00");
_local3.push(_local6.format((_arg1.getMonth() + 1)));
break;
case "M":
_local3.push(DateFormat.MONTHS_ABBREVIATED[_arg1.getMonth()]);
break;
case "n":
_local3.push((_arg1.getMonth() + 1));
break;
case "s":
_local6 = new NumberFormat("00");
_local3.push(_local6.format(_arg1.getSeconds()));
break;
case "t":
_local3.push(DateFormat.DAYSINMONTH[_arg1.getMonth()]);
break;
case "w":
_local3.push(_arg1.getDay());
break;
case "y":
_local3.push(String(_arg1.getFullYear()).substring(2));
break;
case "Y":
_local3.push(_arg1.getFullYear());
break;
case "\\":
_local3.push((_local2[_local4].element + ((_local2[(_local4 + 1)].element)==undefined) ? "" : _local2[(_local4 + 1)].element));
_local4++;
break;
default:
_local3.push(_local2[_local4].element);
};
_local4++;
};
return (_local3.join(""));
}
public function parse(_arg1:String):Date{
var _local3:Number;
var _local4:Number;
var _local6:Array;
var _local8:String;
var _local9:String;
var _local10:String;
var _local11:Number;
var _local2:Array = getMaskElements(true);
_local4 = 0;
while (_local4 < _local2.length) {
_local3 = _arg1.indexOf(_local2[_local4].element);
if (_local2[_local4].type == "quoted"){
if (_local3 != -1){
_arg1 = ((_arg1.substring(0, _local3) + " ") + _arg1.substring((_local3 + _local2[_local4].element.length)));
_local2.splice(_local4, 1);
_local4--;
};
};
_local4++;
};
var _local5:RegExp = new RegExp("[^a-zA-Z0-9]+");
_local6 = _arg1.split(_local5);
var _local7:Date = new Date(0, 0, 0, 0, 0, 0, 0);
_local4 = 0;
while (_local4 < _local2.length) {
_local9 = String(_local6.shift());
switch (_local2[_local4].element){
case "a":
case "A":
_local8 = _local9.toLowerCase();
break;
case "d":
_local7.setDate(parseInt(_local9));
break;
case "F":
_local10 = _local6.shift().toLowerCase();
_local11 = 0;
while (_local11 < DateFormat.MONTHS.length) {
if (_local10 == DateFormat.MONTHS[_local11].toLowerCase()){
_local7.setMonth(_local11);
break;
};
_local11++;
};
break;
case "g":
case "G":
case "h":
case "H":
_local7.setHours(parseInt(_local9));
break;
case "i":
_local7.setMinutes(parseInt(_local9));
break;
case "j":
_local7.setDate(parseInt(_local9));
break;
case "m":
case "n":
_local7.setMonth((parseInt(_local9) - 1));
break;
case "M":
_local10 = _local9.toLowerCase();
_local11 = 0;
while (_local11 < DateFormat.MONTHS_ABBREVIATED.length) {
if (DateFormat.MONTHS_ABBREVIATED[_local11].toLowerCase() == _local10){
_local7.setMonth(_local11);
break;
};
_local11++;
};
break;
case "s":
_local7.setSeconds(parseInt(_local9));
break;
case "y":
_local7.setFullYear((2000 + parseInt(_local9)));
break;
case "Y":
_local7.setFullYear(parseInt(_local9));
break;
};
_local4++;
};
if (_local8 == "pm"){
if (_local7.getHours() < 12){
_local7.setHours((_local7.getHours() + 12));
};
} else {
if (_local8 == "am"){
if (_local7.getHours() == 12){
_local7.setHours(0);
};
};
};
return (_local7);
}
public static function formatMilliseconds(_arg1:Number):String{
var _local2:Number = (_arg1 / 1000);
return (formatSeconds(_local2));
}
public static function formatSeconds(_arg1:Number):String{
var _local2:NumberFormat = new NumberFormat("00");
var _local3:String = _local2.format(Math.floor((_arg1 / 60)));
var _local4:String = _local2.format(Math.round((_arg1 - (parseInt(_local3) * 60))));
return (((_local3 + ":") + _local4));
}
}
}//package ascb.util
Section 2
//Locale (ascb.util.Locale)
package ascb.util {
import flash.system.*;
public class Locale {
private var _sLanguage:String;
private var _sVariant:String;
public static const ENGLISH:String = "en";
public static const SPANISH:String = "es";
public static const FRENCH:String = "fr";
public static const GERMAN:String = "de";
public static const JAPANESE:String = "jp";
public static const CHINESE:String = "zh";
public static const US:String = "US";
public static const UK:String = "UK";
private static var __sLanguage:String;
private static var __sVariant:String;
public function Locale(_arg1:String=null, _arg2:String=null){
_sLanguage = _arg1;
_sVariant = _arg2;
}
public function get language():String{
if (_sLanguage == null){
if (Locale.slanguage == null){
_sLanguage = Capabilities.language.substr(0, 2);
} else {
_sLanguage = Locale.slanguage;
};
};
return (_sLanguage);
}
public function set language(_arg1:String):void{
_sLanguage = _arg1;
}
public function get variant():String{
if (_sVariant == null){
if (Locale.svariant == null){
if (Capabilities.language.length > 2){
_sVariant = Capabilities.language.substr(3);
} else {
if (language == ENGLISH){
if (new Date().getTimezoneOffset() > 120){
_sVariant = US;
} else {
_sVariant = UK;
};
} else {
if (language == SPANISH){
if (new Date().getTimezoneOffset() > 120){
_sVariant = "MX";
} else {
_sVariant = "ES";
};
};
};
};
} else {
_sVariant = Locale.svariant;
};
};
return (_sVariant);
}
public function set variant(_arg1:String):void{
_sVariant = _arg1;
}
public function get languageVariant():String{
var _local1:String = language;
if (variant != null){
_local1 = (_local1 + ("-" + variant));
};
return (_local1);
}
public function set languageVariant(_arg1:String):void{
var _local2:Array = _arg1.split("-");
_sLanguage = _local2[0];
_sVariant = _local2[1];
}
public function reset():void{
_sLanguage = null;
_sVariant = null;
}
public static function get slanguage():String{
return (__sLanguage);
}
public static function set slanguage(_arg1:String):void{
__sLanguage = _arg1;
}
public static function get svariant():String{
return (__sVariant);
}
public static function set svariant(_arg1:String):void{
__sVariant = _arg1;
}
public static function get slanguageVariant():String{
var _local1:String = slanguage;
if (svariant != null){
_local1 = (_local1 + ("-" + svariant));
};
return (_local1);
}
public static function set slanguageVariant(_arg1:String):void{
var _local2:Array = _arg1.split("-");
__sLanguage = _local2[0];
__sVariant = _local2[1];
}
public static function sreset():void{
__sLanguage = null;
__sVariant = null;
}
}
}//package ascb.util
Section 3
//NumberFormat (ascb.util.NumberFormat)
package ascb.util {
public class NumberFormat {
private var _sMask:String;
public function NumberFormat(_arg1:String=null){
_sMask = _arg1;
}
public function get mask():String{
return (_sMask);
}
public function set mask(_arg1:String):void{
_sMask = _arg1;
}
public function format(_arg1:Number, _arg2:Object=null, _arg3:Object=null):String{
var _local4:String;
var _local10:Number;
var _local11:String;
var _local12:Object;
var _local13:Locale;
var _local14:Locale;
var _local15:Number;
var _local16:Number;
var _local17:Array;
var _local18:Array;
var _local19:Array;
var _local20:Number;
var _local21:Number;
var _local22:Boolean;
var _local23:Array;
var _local24:Number;
if (typeof(_arg2) == "number"){
_local10 = Number(_arg2);
_local4 = _arg1.toString(_local10);
_local11 = "";
if (_local10 == 16){
_local11 = "0x";
};
if (_local10 == 8){
_local11 = "0";
};
if (_arg3 != null){
_local11 = String(_arg3);
};
return ((_local11 + _local4.toUpperCase()));
};
var _local5 = ",";
var _local6 = ".";
if (((!((_arg2 == null))) && (_arg2.hasOwnProperty("group")))){
_local12 = _arg2;
} else {
_local13 = Locale(_arg2);
if (_local13 == null){
_local13 = new Locale();
};
_local14 = Locale(_local13);
_local12 = getSymbols(false, _local14);
};
_local5 = _local12.decimal;
_local6 = _local12.group;
var _local7:Array = String(_arg1).split(".");
var _local8:Array = _local7[0].split("");
var _local9:Array = ((_local7.length)>1) ? _local7[1].split("") : new Array();
if (_sMask == null){
_local15 = 1;
_local8.reverse();
_local16 = 0;
while (_local16 < _local8.length) {
if (_local15 > 3){
_local15 = 0;
_local8.splice(_local16, 0, _local6);
};
_local15++;
_local16++;
};
_local8.reverse();
_local4 = _local8.join("");
if (_local7[1] != null){
_local4 = (_local4 + (_local5 + _local7[1]));
};
} else {
_local17 = _sMask.split("");
_local16 = 0;
while (_local16 < _local17.length) {
if (((((!((_local17[_local16] == "0"))) && (!((_local17[_local16] == "#"))))) && (!((_local17[_local16] == "."))))){
_local17.splice(_local16, 1);
_local16--;
};
_local16++;
};
_local17 = _local17.join("").split(".");
_local18 = _local17[0].split("");
_local19 = ((_local17.length)>1) ? _local17[1].split("") : new Array();
_local15 = _local18.length;
_local20 = 0;
_local21 = 0;
_local4 = "";
if (_local15 < _local8.length){
_local16 = 0;
while (_local16 < (_local8.length - _local15)) {
_local4 = (_local4 + _local8[_local16]);
_local20++;
_local16++;
};
} else {
if (_local15 > _local8.length){
_local16 = 0;
while (_local16 < (_local15 - _local8.length)) {
if (_local18[_local16] == "0"){
_local4 = (_local4 + "0");
} else {
if (_local18[_local16] == "#"){
_local4 = (_local4 + " ");
};
};
_local21++;
_local16++;
};
};
};
_local22 = false;
_local16 = _local21;
while (_local16 < _local18.length) {
if ((((_local18[_local16] == "0")) || ((_local18[_local16] == "#")))){
_local4 = (_local4 + ((_local8[_local20])==undefined) ? "" : _local8[_local20]);
_local20++;
};
_local16++;
};
_local17 = _sMask.split(".");
_local17 = _local17[0].split("");
_local23 = _local4.split("");
_local22 = false;
_local16 = 0;
while (_local16 < _local17.length) {
if (((((!((_local17[_local16] == "0"))) && (!((_local17[_local16] == "#"))))) && (!((_local17[_local16] == "."))))){
if (_local22){
_local23.splice(_local16, 0, _local6);
} else {
_local23.splice(_local16, 0, " ");
};
};
if (((!((_local23[_local16] == " "))) && (!((_local23[_local16] == "0"))))){
_local22 = true;
};
_local16++;
};
_local4 = _local23.join("");
if (_local19.length > 0){
_local4 = (_local4 + _local5);
};
_local16 = 0;
while (_local16 < _local19.length) {
if (_local9[_local16] == null){
if (_local19[_local16] == "0"){
_local4 = (_local4 + "0");
} else {
if (_local19[_local16] == "#"){
_local4 = (_local4 + " ");
};
};
} else {
_local24 = Number(((_local9[_local16] + "") + _local9[(_local16 + 1)]));
if ((((_local16 == (_local19.length - 1))) && (!(isNaN(_local24))))){
_local4 = (_local4 + String(Math.round((_local24 / 10))));
} else {
_local4 = (_local4 + _local9[_local16]);
};
};
_local16++;
};
};
return (_local4);
}
public function currencyFormat(_arg1:Number, _arg2:Object=null):String{
var _local15:Object;
var _local16:Number;
var _local4:Locale = ((arguments[1] is Locale)) ? arguments[1] : new Locale();
if (((!((_arg2 == null))) && (_arg2.hasOwnProperty("group")))){
_local15 = _arg2;
} else {
_local15 = getSymbols(true, _local4);
};
var _local5:String = _local15.currency;
var _local6:String = _local15.group;
var _local7:String = _local15.decimal;
var _local8:String = _sMask;
_sMask = null;
var _local9:Locale = new Locale();
_local9.language = "en";
_local9.variant = "US";
var _local10:String = format(_arg1, _local9);
_sMask = _local8;
var _local11:Array = _local10.split(".");
if (_local11[1] == undefined){
_local11[1] = "00";
} else {
_local11[1] = Number(_local11[1]);
_local16 = String(_local11[1]).length;
if (_local16 > 2){
_local11[1] = (_local11[1] / Math.pow(10, (_local16 - 2)));
_local11[1] = Math.round(_local11[1]);
};
};
_local10 = _local11.join(".");
var _local12:Array = _local10.split("");
var _local13:Number = 0;
while (_local13 < _local12.length) {
if (_local12[_local13] == ","){
_local12[_local13] = _local6;
} else {
if (_local12[_local13] == "."){
_local12[_local13] = _local7;
};
};
_local13++;
};
var _local14:String = (((_local15.before) ? _local5 : "" + _local12.join("")) + (_local15.before) ? "" : _local5);
return (_local14);
}
public function parse(_arg1:String, _arg2:Number, _arg3:Boolean, _arg4:Locale):Number{
if (_arg4 == null){
_arg4 = new Locale();
};
var _local5:Object = getSymbols(_arg3, _arg4);
var _local6:Array = _arg1.split("");
if (isNaN(_arg2)){
if (_local6[0] == "O"){
if (_local6[1] == "x"){
_arg2 = 16;
} else {
_arg2 = 8;
};
} else {
if (_local6[0] == "#"){
_arg2 = 16;
} else {
_arg2 = (isNaN(_arg2)) ? 10 : _arg2;
};
};
};
var _local7:Number = 0;
while (_local7 < _local6.length) {
switch (_local6[_local7]){
case "0":
case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
case "7":
case "8":
case "9":
break;
case _local5.decimal:
_local6[_local7] = ".";
break;
default:
if (_arg2 > 10){
if ((((((_local6[_local7].charCodeAt(0) > 64)) && ((_local6[_local7].charCodeAt(0) < 91)))) || ((((_local6[_local7].charCodeAt(0) > 96)) && ((_local6[_local7].charCodeAt(0) < 123)))))){
break;
};
};
_local6.splice(_local7, 1);
_local7--;
};
_local7++;
};
if (_arg2 == 10){
return (Number(_local6.join("")));
};
return (parseInt(_local6.join(""), _arg2));
}
private function getSymbols(_arg1:Boolean, _arg2:Locale):Object{
var _local3:Object = new Object();
switch (_arg2.languageVariant){
case "en-US":
_local3.currency = "$";
_local3.group = ",";
_local3.decimal = ".";
_local3.before = true;
break;
case "en-UK":
_local3.currency = "£";
_local3.group = ",";
_local3.decimal = ".";
_local3.before = true;
break;
case "es-MX":
_local3.currency = "$";
_local3.group = ",";
_local3.decimal = ".";
_local3.before = true;
break;
case "es-ES":
_local3.currency = "€";
_local3.group = ".";
_local3.decimal = ",";
_local3.before = false;
break;
case "fr":
_local3.currency = "€";
_local3.group = ".";
_local3.decimal = ",";
_local3.before = false;
break;
case "sv":
_local3.currency = "kr";
_local3.group = (_arg1) ? "," : " ";
_local3.decimal = ".";
_local3.before = false;
break;
case "jp":
_local3.currency = " 5";
_local3.group = ",";
_local3.decimal = ".";
_local3.before = true;
break;
case "nl":
_local3.currency = "€";
_local3.group = ".";
_local3.decimal = ",";
_local3.before = true;
break;
default:
_local3.currency = "€";
_local3.group = ".";
_local3.decimal = ",";
_local3.before = true;
break;
};
return (_local3);
}
}
}//package ascb.util
Section 4
//SHA1 (com.meychi.ascrypt3.SHA1)
package com.meychi.ascrypt3 {
public class SHA1 {
public function calculate(_arg1:String):String{
return (hex_sha1(_arg1));
}
private function hex_sha1(_arg1:String):String{
return (binb2hex(core_sha1(str2binb(_arg1), (_arg1.length * 8))));
}
private function core_sha1(_arg1:Array, _arg2:Number):Array{
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
_arg1[(_arg2 >> 5)] = (_arg1[(_arg2 >> 5)] | (128 << (24 - (_arg2 % 32))));
_arg1[((((_arg2 + 64) >> 9) << 4) + 15)] = _arg2;
var _local3:Array = new Array(80);
var _local4:Number = 1732584193;
var _local5:Number = -271733879;
var _local6:Number = -1732584194;
var _local7:Number = 271733878;
var _local8:Number = -1009589776;
var _local9:Number = 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)];
} else {
_local3[_local15] = rol((((_local3[(_local15 - 3)] ^ _local3[(_local15 - 8)]) ^ _local3[(_local15 - 14)]) ^ _local3[(_local15 - 16)]), 1);
};
_local16 = safe_add(safe_add(rol(_local4, 5), sha1_ft(_local15, _local5, _local6, _local7)), safe_add(safe_add(_local8, _local3[_local15]), sha1_kt(_local15)));
_local8 = _local7;
_local7 = _local6;
_local6 = rol(_local5, 30);
_local5 = _local4;
_local4 = _local16;
_local15++;
};
_local4 = safe_add(_local4, _local10);
_local5 = safe_add(_local5, _local11);
_local6 = safe_add(_local6, _local12);
_local7 = safe_add(_local7, _local13);
_local8 = safe_add(_local8, _local14);
_local9 = (_local9 + 16);
};
return (new Array(_local4, _local5, _local6, _local7, _local8));
}
private function sha1_ft(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
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 sha1_kt(_arg1:Number):Number{
return (((_arg1)<20) ? 1518500249 : ((_arg1)<40) ? 1859775393 : ((_arg1)<60) ? -1894007588 : -899497514);
}
private function safe_add(_arg1:Number, _arg2:Number):Number{
var _local3:Number = ((_arg1 & 0xFFFF) + (_arg2 & 0xFFFF));
var _local4:Number = (((_arg1 >> 16) + (_arg2 >> 16)) + (_local3 >> 16));
return (((_local4 << 16) | (_local3 & 0xFFFF)));
}
private function rol(_arg1:Number, _arg2:Number):Number{
return (((_arg1 << _arg2) | (_arg1 >>> (32 - _arg2))));
}
private function str2binb(_arg1:String):Array{
var _local2:Array = new Array();
var _local3:Number = ((1 << 8) - 1);
var _local4:Number = 0;
while (_local4 < (_arg1.length * 8)) {
_local2[(_local4 >> 5)] = (_local2[(_local4 >> 5)] | ((_arg1.charCodeAt((_local4 / 8)) & _local3) << (24 - (_local4 % 32))));
_local4 = (_local4 + 8);
};
return (_local2);
}
private function binb2hex(_arg1:Array):String{
var _local2:String = new String("");
var _local3:String = new String("0123456789abcdef");
var _local4:Number = 0;
while (_local4 < (_arg1.length * 4)) {
_local2 = (_local2 + (_local3.charAt(((_arg1[(_local4 >> 2)] >> (((3 - (_local4 % 4)) * 8) + 4)) & 15)) + _local3.charAt(((_arg1[(_local4 >> 2)] >> ((3 - (_local4 % 4)) * 8)) & 15))));
_local4++;
};
return (_local2);
}
}
}//package com.meychi.ascrypt3
Section 5
//State (com.rawkins.fsm.State)
package com.rawkins.fsm {
public interface State {
function enter():void;
function exit():void;
function update():void;
}
}//package com.rawkins.fsm
Section 6
//StateMachine (com.rawkins.fsm.StateMachine)
package com.rawkins.fsm {
public class StateMachine {
private var currentState:State;
private var previousState:State;
private var nextState:State;
public function StateMachine():void{
currentState = null;
}
public function update():void{
if (currentState){
currentState.update();
};
}
public function changeState(_arg1:State):void{
if (currentState){
currentState.exit();
};
previousState = currentState;
currentState = _arg1;
currentState.enter();
}
public function setNextState(_arg1:State):void{
nextState = _arg1;
}
public function goToPreviousState():void{
changeState(previousState);
}
public function goToNextState():void{
changeState(nextState);
}
}
}//package com.rawkins.fsm
Section 7
//Anim (com.rawkins.fx.Anim)
package com.rawkins.fx {
import flash.display.*;
import flash.events.*;
public class Anim extends EventDispatcher {
public const SHAKE_DONE:String = "shake done";
public const FADE_DONE:String = "fade done";
public const SPRING_DONE:String = "spring done";
public const MOVE_DONE:String = "move done";
public const WIPE_DONE:String = "wipe done";
private var shaking:Boolean;// = false
private var shakeX:Number;
private var shakeY:Number;
private var shakeOrgX:Number;
private var shakeOrgY:Number;
private var shakeTarget:DisplayObject;
private var shakeDir;// = 1
private var shakeEase;// = 2
private var fading:Boolean;// = false
private var fadeDir:int;
private var fadeSpeed:Number;
private var springing:Boolean;// = false
private var springAX:Number;// = 0
private var springAY:Number;// = 0
private var springVX:Number;// = 0
private var springVY:Number;// = 0
private var lastSpringX:Number;
private var lastSpringY:Number;
private var springTargetX:Number;
private var springTargetY:Number;
private var springForce:Number;
private var springFriction:Number;
private var moving:Boolean;// = false
private var moveTargetX;
private var moveTargetY;
private var moveEasing;
private var wiping:Boolean;// = false
private var wipeSpeed:Number;
private var wipeMask:Shape;
private var wipeTarget:Number;
public function Anim():void{
}
public function wipe(_arg1:DisplayObjectContainer, _arg2:Boolean=true, _arg3:Number=1, _arg4:Boolean=false){
if (!wiping){
wiping = true;
wipeMask = new Shape();
wipeMask.graphics.beginFill(0xFF0000);
wipeMask.graphics.drawRect(0, 0, _arg1.width, _arg1.height);
if (_arg4){
if (_arg2){
wipeMask.graphics.moveTo(0, 0);
wipeMask.graphics.lineTo(0, _arg1.height);
wipeMask.graphics.lineTo(-50, _arg1.height);
wipeMask.graphics.lineTo(0, 0);
} else {
wipeMask.graphics.moveTo((_arg1.width + 50), 0);
wipeMask.graphics.lineTo(_arg1.width, _arg1.height);
wipeMask.graphics.lineTo(_arg1.width, 0);
};
};
wipeMask.graphics.endFill();
wipeSpeed = (_arg3 / 10);
if (!_arg2){
wipeTarget = -50;
wipeMask.x = (wipeMask.x - _arg1.width);
if (_arg4){
wipeMask.x = (wipeMask.x - 50);
};
} else {
wipeTarget = (_arg1.width + 50);
};
if (_arg4){
wipeTarget = (wipeTarget + 50);
};
if (wipeSpeed > 1){
wipeSpeed = 1;
} else {
if (wipeSpeed < 0){
wipeSpeed = 0.9;
};
};
_arg1.mask = wipeMask;
_arg1.addChild(wipeMask);
_arg1.addEventListener(Event.ENTER_FRAME, onWipe);
};
}
private function onWipe(_arg1:Event):void{
var _local2:DisplayObjectContainer = DisplayObjectContainer(_arg1.target);
var _local3:Number = (wipeTarget - wipeMask.x);
wipeMask.x = (wipeMask.x + (_local3 * wipeSpeed));
if (Math.abs(_local3) < 2){
wiping = false;
_local2.mask = null;
_local2.removeChild(wipeMask);
wipeMask.graphics.clear();
wipeMask = null;
_local2.removeEventListener(Event.ENTER_FRAME, onWipe);
_local2.dispatchEvent(new Event(WIPE_DONE));
};
}
public function moveTo(_arg1:DisplayObject, _arg2:Number, _arg3:Number, _arg4:Number=2){
if (!moving){
moving = true;
moveTargetX = _arg2;
moveTargetY = _arg3;
moveEasing = (_arg4 / 10);
if (moveEasing > 1){
moveEasing = 1;
} else {
if (moveEasing < 0){
moveEasing = 0.9;
};
};
_arg1.addEventListener(Event.ENTER_FRAME, onMove);
} else {
trace("Already moving something");
};
}
private function onMove(_arg1:Event):void{
var _local2:DisplayObject = DisplayObject(_arg1.target);
var _local3:Number = (moveTargetX - _local2.x);
var _local4:Number = (moveTargetY - _local2.y);
_local2.x = (_local2.x + (_local3 * moveEasing));
_local2.y = (_local2.y + (_local4 * moveEasing));
if ((((Math.abs(_local3) < 0.25)) && ((Math.abs(_local4) < 0.25)))){
_local2.removeEventListener(Event.ENTER_FRAME, onMove);
_local2.dispatchEvent(new Event(MOVE_DONE));
moving = false;
};
}
public function springTo(_arg1:DisplayObject, _arg2:Number, _arg3:Number, _arg4:Number=1, _arg5:Number=0.75){
if (!springing){
springTargetX = _arg2;
springTargetY = _arg3;
springForce = _arg4;
springFriction = _arg5;
springing = true;
_arg1.addEventListener(Event.ENTER_FRAME, onSpring);
};
}
public function onSpring(_arg1:Event):void{
var _local2:DisplayObject = DisplayObject(_arg1.target);
lastSpringX = _local2.x;
lastSpringY = _local2.y;
var _local3:Number = (springTargetX - _local2.x);
var _local4:Number = (springTargetY - _local2.y);
springAX = (_local3 * springForce);
springAY = (_local4 * springForce);
springVX = (springVX + springAX);
springVY = (springVY + springAY);
springVX = (springVX * springFriction);
springVY = (springVY * springFriction);
_local2.x = (_local2.x + springVX);
_local2.y = (_local2.y + springVY);
if ((((_local2.x == lastSpringX)) && ((_local2.y == lastSpringY)))){
_local2.removeEventListener(Event.ENTER_FRAME, onSpring);
_local2.dispatchEvent(new Event(SPRING_DONE));
springing = false;
};
}
public function fade(_arg1:String, _arg2:DisplayObject, _arg3:Number=10):void{
if (!fading){
if (_arg1 == "in"){
fadeDir = 1;
} else {
if (_arg1 == "out"){
fadeDir = -1;
} else {
trace("invalid fade direction");
return;
};
};
fadeSpeed = ((_arg3 / 100) * fadeDir);
fading = true;
_arg2.addEventListener(Event.ENTER_FRAME, onFade);
};
}
private function onFade(_arg1:Event):void{
var _local2:DisplayObject = DisplayObject(_arg1.target);
var _local3:Number = 0;
if (fadeDir == 1){
_local3 = ((1 - _local2.alpha) * fadeSpeed);
} else {
if (fadeDir == -1){
_local3 = (_local2.alpha * fadeSpeed);
};
};
_local2.alpha = (_local2.alpha + _local3);
if ((((((fadeDir == 1)) && ((_local2.alpha >= 0.98)))) || ((((fadeDir == -1)) && ((_local2.alpha <= 0.02)))))){
_local2.removeEventListener(Event.ENTER_FRAME, onFade);
_local2.dispatchEvent(new Event(FADE_DONE));
fading = false;
};
}
public function shake(_arg1:DisplayObject, _arg2:Number=50, _arg3:Number=50):void{
if (!shaking){
shakeX = _arg2;
shakeY = _arg3;
shakeOrgX = _arg1.x;
shakeOrgY = _arg1.y;
shaking = true;
_arg1.addEventListener(Event.ENTER_FRAME, onShake);
};
}
private function onShake(_arg1:Event):void{
var _local2:DisplayObject = DisplayObject(_arg1.target);
var _local3:Number = (shakeOrgX + (shakeX * shakeDir));
var _local4:Number = (shakeOrgY + (shakeY * shakeDir));
_local2.x = _local3;
_local2.y = _local4;
shakeDir = (shakeDir * -1);
shakeX = (shakeX / shakeEase);
shakeY = (shakeY / shakeEase);
if ((((shakeX < 1)) && ((shakeY < 1)))){
_local2.removeEventListener(Event.ENTER_FRAME, onShake);
_local2.x = shakeOrgX;
_local2.y = shakeOrgY;
_local2.dispatchEvent(new Event(SHAKE_DONE));
shaking = false;
};
}
}
}//package com.rawkins.fx
Section 8
//Particle (com.rawkins.fx.Particle)
package com.rawkins.fx {
import flash.display.*;
import flash.events.*;
import com.rawkins.utils.*;
public class Particle extends Sprite {
protected var _vx:Number;
protected var _vy:Number;
protected var _vz:Number;
protected var _angle:Number;
protected var _life:Number;
protected var _age:Number;
protected var _color:Number;
public var dead:Boolean;// = false
public var id:uint;
public var bounded:Boolean;// = true
public function Particle(_arg1:Number=0, _arg2:Number=0, _arg3:Number=10, _arg4:Number=0xFFFFFF):void{
this.angle = _arg2;
this.vz = _arg1;
this._life = _arg3;
this._age = 0;
this._color = _arg4;
}
private function onEnterFrame(_arg1:Event):void{
}
public function draw():void{
graphics.beginFill(color);
graphics.lineStyle(0, 0, 0);
graphics.drawCircle(2, 2, 2);
graphics.endFill();
cacheAsBitmap = true;
}
public function update():void{
if (!dead){
this.x = (this.x + vx);
this.y = (this.y + vy);
this._age++;
if (this._age > this._life){
this.die();
};
};
}
public function die():void{
graphics.clear();
this.dead = true;
}
public function get vz():Number{
return (_vz);
}
public function set vz(_arg1:Number):void{
this.vx = (Math.cos(MathSG.rad(angle)) * _arg1);
this.vy = (Math.sin(MathSG.rad(angle)) * _arg1);
_vz = _arg1;
}
public function set vx(_arg1:Number):void{
_vx = _arg1;
}
public function get vx():Number{
return (_vx);
}
public function set vy(_arg1:Number):void{
_vy = _arg1;
}
public function get vy():Number{
return (_vy);
}
public function set angle(_arg1:Number):void{
_angle = _arg1;
}
public function get angle():Number{
return (_angle);
}
public function set color(_arg1:Number):void{
_color = _arg1;
}
public function get color():Number{
return (_color);
}
}
}//package com.rawkins.fx
Section 9
//ParticleManager (com.rawkins.fx.ParticleManager)
package com.rawkins.fx {
import flash.display.*;
public class ParticleManager extends Sprite {
private var particles:Array;
private var particleCount:uint;// = 0
public function ParticleManager():void{
particles = new Array();
}
public function addParticle(_arg1:Particle):void{
particles.push(_arg1);
addChild(_arg1);
_arg1.name = ("particle_" + particleCount);
_arg1.id = particleCount;
particleCount++;
}
public function update():void{
var _local2:Particle;
var _local3:Number;
var _local4:Number;
var _local1:uint;
while (_local1 < particles.length) {
_local2 = particles[_local1];
if (_local2 != null){
_local2.update();
if (_local2.bounded){
_local3 = (_local2.x + this.x);
if ((((_local3 < 0)) || ((_local3 > 640)))){
_local2.dead = true;
} else {
_local4 = (parent.y + _local2.y);
if ((((_local4 > 480)) || ((_local4 < 0)))){
_local2.dead = true;
};
};
};
if (_local2.dead){
removeChild(_local2);
particles.splice(_local1, 1);
_local2 = null;
_local1--;
};
};
_local1++;
};
}
}
}//package com.rawkins.fx
Section 10
//Background (com.rawkins.games.dolphinOlympics.Background)
package com.rawkins.games.dolphinOlympics {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
public class Background extends Sprite {
protected var tiles:Array;
protected var scrollTiles:Array;
protected var tb:Number;
protected var rb:Number;
protected var bb:Number;
protected var lb:Number;
public var speed:Number;
public function Background(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=1):void{
tiles = new Array();
scrollTiles = new Array();
tb = _arg1;
rb = _arg2;
bb = _arg3;
lb = _arg4;
speed = _arg5;
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function onEnterFrame(_arg1:Event):void{
checkChildren();
}
public function addTile(_arg1:DisplayObject, _arg2:Boolean=false, _arg3:Boolean=false):DisplayObject{
var _local4:Array;
if (_arg3){
_local4 = slice(_arg1);
for each (s in _local4) {
tiles.push(s);
if (_arg2){
scrollTiles.push(s);
};
addChild(s);
};
} else {
tiles.push(_arg1);
if (_arg2){
scrollTiles.push(_arg1);
};
addChild(_arg1);
};
}
public function removeTile(_arg1:DisplayObject):void{
var _local3:DisplayObject;
if (contains(_arg1)){
removeChild(_arg1);
};
var _local2:int;
while (_local2 < tiles.length) {
_local3 = tiles[_local2];
if (_local3 == _arg1){
tiles.splice(_local2, 1);
};
_local2++;
};
_local2 = 0;
while (_local2 < scrollTiles.length) {
_local3 = scrollTiles[_local2];
if (_local3 == _arg1){
scrollTiles.splice(_local2, 1);
};
_local2++;
};
}
private function checkChildren():void{
var _local2:DisplayObject;
var _local3:Point;
var _local4:Point;
var _local1:int;
while (_local1 < tiles.length) {
_local2 = tiles[_local1];
_local3 = new Point();
_local3.x = _local2.x;
_local3.y = _local2.y;
_local4 = localToGlobal(_local3);
if ((((_local4.y > (bb + _local2.height))) || (((_local4.y + _local2.height) < tb)))){
if (contains(_local2)){
removeChild(_local2);
};
} else {
if (_local2.parent == null){
addChild(_local2);
};
};
_local1++;
};
}
public function debug():void{
var _local2:DisplayObject;
var _local1:int;
while (_local1 < tiles.length) {
_local2 = tiles[_local1];
_local1++;
};
}
protected function slice(_arg1:DisplayObject):Array{
var _local6:BitmapData;
var _local7:BitmapData;
var _local8:Bitmap;
var _local2:Number = 200;
var _local3:int = (Math.floor((_arg1.height / _local2)) + 1);
var _local4:Array = new Array();
var _local5:int;
while (_local5 < _local3) {
_local6 = new BitmapData(_arg1.width, _arg1.height, true, 0);
_local6.draw(_arg1, null, null, null, new Rectangle(0, (_local5 * _local2), _arg1.width, _local2));
_local7 = new BitmapData(_arg1.width, _local2, true, 0);
_local7.copyPixels(_local6, new Rectangle(0, (_local5 * _local2), _arg1.width, _local2), new Point(0, 0));
_local8 = new Bitmap(_local7);
_local8.y = (_arg1.y + (_local5 * _local2));
_local8.x = _arg1.x;
_local4.push(_local8);
_local5++;
};
return (_local4);
}
public function scroll(_arg1:Number):void{
var _local4:Object;
var _local2:Number = (_arg1 * speed);
var _local3:uint;
while (_local3 < scrollTiles.length) {
_local4 = scrollTiles[_local3];
scrollTiles[_local3].x = (_local4.x - _local2);
if (_local4.x > rb){
_local4.x = (lb + (_local4.x - rb));
};
if (_local4.x < lb){
_local4.x = (rb + (_local4.x - lb));
};
_local3++;
};
}
}
}//package com.rawkins.games.dolphinOlympics
Section 11
//Bluefish (com.rawkins.games.dolphinOlympics.Bluefish)
package com.rawkins.games.dolphinOlympics {
import flash.utils.*;
public class Bluefish extends Fish {
private var turnCounter:Number;// = 0
private var landTimer:Timer;
public function Bluefish(_arg1:Number=0, _arg2:Number=0):void{
addFrameScript(29, frame30, 39, frame40, 44, frame45);
super(_arg1, _arg2);
landTimer = new Timer(1000, 1);
_scalar = ((Math.random() / 6) + 0.35);
scaleX = (scaleY = _scalar);
}
override protected function swim():void{
updateSpeed();
if (!activated){
if (this.y > _bottom){
if ((((_angle > (Math.PI / 2))) && ((_angle < (Math.PI * 1.5))))){
_angle = (_angle + 0.1);
} else {
_angle = (_angle - 0.1);
};
} else {
changeDir();
};
} else {
follow();
};
this.x = (this.x + _vx);
this.y = (this.y + _vy);
}
override protected function jump():void{
super.jump();
angle = (angle + 0.2);
}
override public function startJump():void{
super.startJump();
if ((((angle > (Math.PI / 2))) && ((angle < (Math.PI * 1.5))))){
dirAdjust = Math.PI;
} else {
dirAdjust = 0;
};
}
override protected function changeDir():void{
if (!landTimer.running){
angle = ((Math.sin(turnCounter) * Math.cos((turnCounter / 4))) + dirAdjust);
turnCounter = (turnCounter + 0.05);
if (turnCounter > (2 * Math.PI)){
turnCounter = (-2 * Math.PI);
};
};
}
override public function endJump():void{
super.endJump();
_turnCounter = Math.sin(angle);
landTimer.start();
}
function frame30(){
gotoAndPlay("normal");
}
function frame40(){
gotoAndPlay("active");
}
function frame45(){
stop();
}
}
}//package com.rawkins.games.dolphinOlympics
Section 12
//Collidable (com.rawkins.games.dolphinOlympics.Collidable)
package com.rawkins.games.dolphinOlympics {
import flash.display.*;
import flash.utils.*;
public class Collidable extends MovieClip {
protected var _active:Boolean;// = false
protected var _activeTimer:Timer;
protected var _hitZone:Shape;
protected var _onScreen:Boolean;// = true
public static var COLLIDABLE_DEAD = "collidable_dead";
public function Collidable():void{
_hitZone = new Shape();
drawHitZone();
addChild(_hitZone);
_activeTimer = new Timer(5000, 1);
}
protected function drawHitZone(_arg1:Number=100):void{
_hitZone.graphics.clear();
_hitZone.graphics.lineStyle(0, 0, 0);
_hitZone.graphics.beginFill(0, 0);
_hitZone.graphics.drawCircle(0, 0, _arg1);
_hitZone.graphics.endFill();
}
public function update():void{
}
public function activate(_arg1:MovieClip):String{
_activeTimer.start();
return ("collidable");
}
public function deactivate():void{
_activeTimer.stop();
_activeTimer.reset();
}
public function get activated():Boolean{
return (_activeTimer.running);
}
public function get hitZone():Shape{
return (_hitZone);
}
public function get onScreen():Boolean{
return (_onScreen);
}
public function set onScreen(_arg1:Boolean){
_onScreen = _arg1;
}
}
}//package com.rawkins.games.dolphinOlympics
Section 13
//Constants (com.rawkins.games.dolphinOlympics.Constants)
package com.rawkins.games.dolphinOlympics {
public class Constants {
public static const GRAVITY:Number = 0.45;
public static const WATER_FRICTION:Number = 0.2;
public static const FRAMERATE:uint = 31;
public static function get countries():Array{
var _local1:Array = [{data:"AD", label:"Andorra"}, {data:"AE", label:"United Arab Emirates"}, {data:"AF", label:"Afghanistan"}, {data:"AG", label:"Antigua & Barbuda"}, {data:"AI", label:"Anguilla"}, {data:"AL", label:"Albania"}, {data:"AM", label:"Armenia"}, {data:"AN", label:"Netherlands Antilles"}, {data:"AO", label:"Angola"}, {data:"AQ", label:"Antarctica"}, {data:"AR", label:"Argentina"}, {data:"AS", label:"American Samoa"}, {data:"AT", label:"Austria"}, {data:"AU", label:"Australia"}, {data:"AW", label:"Aruba"}, {data:"AZ", label:"Azerbaijan"}, {data:"BA", label:"Bosnia and Herzegovina"}, {data:"BB", label:"Barbados"}, {data:"BD", label:"Bangladesh"}, {data:"BE", label:"Belgium"}, {data:"BF", label:"Burkina Faso"}, {data:"BG", label:"Bulgaria"}, {data:"BH", label:"Bahrain"}, {data:"BI", label:"Burundi"}, {data:"BJ", label:"Benin"}, {data:"BM", label:"Bermuda"}, {data:"BN", label:"Brunei Darussalam"}, {data:"BO", label:"Bolivia"}, {data:"BR", label:"Brazil"}, {data:"BS", label:"Bahama"}, {data:"BT", label:"Bhutan"}, {data:"BU", label:"Burma (no longer exists)"}, {data:"BV", label:"Bouvet Island"}, {data:"BW", label:"Botswana"}, {data:"BY", label:"Belarus"}, {data:"BZ", label:"Belize"}, {data:"CC", label:"Cocos (Keeling) Islands"}, {data:"CF", label:"Central African Republic"}, {data:"CG", label:"Congo"}, {data:"CH", label:"Switzerland"}, {data:"CI", label:"C�te D'ivoire (Ivory Coast)"}, {data:"CK", label:"Cook Iislands"}, {data:"CL", label:"Chile"}, {data:"CM", label:"Cameroon"}, {data:"CN", label:"China"}, {data:"CO", label:"Colombia"}, {data:"CR", label:"Costa Rica"}, {data:"CS", label:"Czechoslovakia (no longer exists)"}, {data:"CU", label:"Cuba"}, {data:"CV", label:"Cape Verde"}, {data:"CX", label:"Christmas Island"}, {data:"CY", label:"Cyprus"}, {data:"CZ", label:"Czech Republic"}, {data:"DE", label:"Germany"}, {data:"DJ", label:"Djibouti"}, {data:"DK", label:"Denmark"}, {data:"DM", label:"Dominica"}, {data:"DO", label:"Dominican Republic"}, {data:"DZ", label:"Algeria"}, {data:"EC", label:"Ecuador"}, {data:"EE", label:"Estonia"}, {data:"EG", label:"Egypt"}, {data:"EH", label:"Western Sahara"}, {data:"ER", label:"Eritrea"}, {data:"ES", label:"Spain"}, {data:"ET", label:"Ethiopia"}, {data:"FI", label:"Finland"}, {data:"FJ", label:"Fiji"}, {data:"FK", label:"Falkland Islands (Malvinas)"}, {data:"FM", label:"Micronesia"}, {data:"FO", label:"Faroe Islands"}, {data:"FR", label:"France"}, {data:"FX", label:"France, Metropolitan"}, {data:"GA", label:"Gabon"}, {data:"GB", label:"United Kingdom (Great Britain)"}, {data:"GD", label:"Grenada"}, {data:"GE", label:"Georgia"}, {data:"GF", label:"French Guiana"}, {data:"GH", label:"Ghana"}, {data:"GI", label:"Gibraltar"}, {data:"GL", label:"Greenland"}, {data:"GM", label:"Gambia"}, {data:"GN", label:"Guinea"}, {data:"GP", label:"Guadeloupe"}, {data:"GQ", label:"Equatorial Guinea"}, {data:"GR", label:"Greece"}, {data:"GS", label:"South Georgia and the South Sandwich Islands"}, {data:"GT", label:"Guatemala"}, {data:"GU", label:"Guam"}, {data:"GW", label:"Guinea-Bissau"}, {data:"GY", label:"Guyana"}, {data:"HK", label:"Hong Kong"}, {data:"HM", label:"Heard & McDonald Islands"}, {data:"HN", label:"Honduras"}, {data:"HR", label:"Croatia"}, {data:"HT", label:"Haiti"}, {data:"HU", label:"Hungary"}, {data:"ID", label:"Indonesia"}, {data:"IE", label:"Ireland"}, {data:"IL", label:"Israel"}, {data:"IN", label:"India"}, {data:"IO", label:"British Indian Ocean Territory"}, {data:"IQ", label:"Iraq"}, {data:"IR", label:"Islamic Republic of Iran"}, {data:"IS", label:"Iceland"}, {data:"IT", label:"Italy"}, {data:"JM", label:"Jamaica"}, {data:"JO", label:"Jordan"}, {data:"JP", label:"Japan"}, {data:"KE", label:"Kenya"}, {data:"KG", label:"Kyrgyzstan"}, {data:"KH", label:"Cambodia"}, {data:"KI", label:"Kiribati"}, {data:"KM", label:"Comoros"}, {data:"KN", label:"St. Kitts and Nevis"}, {data:"KP", label:"Korea, Democratic People's Republic of"}, {data:"KR", label:"Korea, Republic of"}, {data:"KW", label:"Kuwait"}, {data:"KY", label:"Cayman Islands"}, {data:"KZ", label:"Kazakhstan"}, {data:"LA", label:"Lao People's Democratic Republic"}, {data:"LB", label:"Lebanon"}, {data:"LC", label:"Saint Lucia"}, {data:"LI", label:"Liechtenstein"}, {data:"LK", label:"Sri Lanka"}, {data:"LR", label:"Liberia"}, {data:"LS", label:"Lesotho"}, {data:"LT", label:"Lithuania"}, {data:"LU", label:"Luxembourg"}, {data:"LV", label:"Latvia"}, {data:"LY", label:"Libyan Arab Jamahiriya"}, {data:"MA", label:"Morocco"}, {data:"MC", label:"Monaco"}, {data:"MD", label:"Moldova, Republic of"}, {data:"MG", label:"Madagascar"}, {data:"MH", label:"Marshall Islands"}, {data:"ML", label:"Mali"}, {data:"MN", label:"Mongolia"}, {data:"MM", label:"Myanmar"}, {data:"MO", label:"Macau"}, {data:"MP", label:"Northern Mariana Islands"}, {data:"MQ", label:"Martinique"}, {data:"MR", label:"Mauritania"}, {data:"MS", label:"Monserrat"}, {data:"MT", label:"Malta"}, {data:"MU", label:"Mauritius"}, {data:"MV", label:"Maldives"}, {data:"MW", label:"Malawi"}, {data:"MX", label:"Mexico"}, {data:"MY", label:"Malaysia"}, {data:"MZ", label:"Mozambique"}, {data:"NA", label:"Namibia"}, {data:"NC", label:"New Caledonia"}, {data:"NE", label:"Niger"}, {data:"NF", label:"Norfolk Island"}, {data:"NG", label:"Nigeria"}, {data:"NI", label:"Nicaragua"}, {data:"NL", label:"Netherlands"}, {data:"NO", label:"Norway"}, {data:"NP", label:"Nepal"}, {data:"NR", label:"Nauru"}, {data:"NT", label:"Neutral Zone (no longer exists)"}, {data:"NU", label:"Niue"}, {data:"NZ", label:"New Zealand"}, {data:"OM", label:"Oman"}, {data:"PA", label:"Panama"}, {data:"PE", label:"Peru"}, {data:"PF", label:"French Polynesia"}, {data:"PG", label:"Papua New Guinea"}, {data:"PH", label:"Philippines"}, {data:"PK", label:"Pakistan"}, {data:"PL", label:"Poland"}, {data:"PM", label:"St. Pierre & Miquelon"}, {data:"PN", label:"Pitcairn"}, {data:"PR", label:"Puerto Rico"}, {data:"PT", label:"Portugal"}, {data:"PW", label:"Palau"}, {data:"PY", label:"Paraguay"}, {data:"QA", label:"Qatar"}, {data:"RE", label:"Réunion"}, {data:"RO", label:"Romania"}, {data:"RU", label:"Russian Federation"}, {data:"RW", label:"Rwanda"}, {data:"SA", label:"Saudi Arabia"}, {data:"SB", label:"Solomon Islands"}, {data:"SC", label:"Seychelles"}, {data:"SD", label:"Sudan"}, {data:"SE", label:"Sweden"}, {data:"SG", label:"Singapore"}, {data:"SH", label:"St. Helena"}, {data:"SI", label:"Slovenia"}, {data:"SJ", label:"Svalbard & Jan Mayen Islands"}, {data:"SK", label:"Slovakia"}, {data:"SL", label:"Sierra Leone"}, {data:"SM", label:"San Marino"}, {data:"SN", label:"Senegal"}, {data:"SO", label:"Somalia"}, {data:"SR", label:"Suriname"}, {data:"ST", label:"Sao Tome & Principe"}, {data:"SU", label:"Union of Soviet Socialist Republics (no longer exists)"}, {data:"SV", label:"El Salvador"}, {data:"SY", label:"Syrian Arab Republic"}, {data:"SZ", label:"Swaziland"}, {data:"TC", label:"Turks & Caicos Islands"}, {data:"TD", label:"Chad"}, {data:"TF", label:"French Southern Territories"}, {data:"TG", label:"Togo"}, {data:"TH", label:"Thailand"}, {data:"TJ", label:"Tajikistan"}, {data:"TK", label:"Tokelau"}, {data:"TM", label:"Turkmenistan"}, {data:"TN", label:"Tunisia"}, {data:"TO", label:"Tonga"}, {data:"TP", label:"East Timor"}, {data:"TR", label:"Turkey"}, {data:"TT", label:"Trinidad & Tobago"}, {data:"TV", label:"Tuvalu"}, {data:"TW", label:"Taiwan, Province of China"}, {data:"TZ", label:"Tanzania, United Republic of"}, {data:"UA", label:"Ukraine"}, {data:"UG", label:"Uganda"}, {data:"UM", label:"United States Minor Outlying Islands"}, {data:"UY", label:"Uruguay"}, {data:"UZ", label:"Uzbekistan"}, {data:"VA", label:"Vatican City State (Holy See)"}, {data:"VC", label:"St. Vincent & the Grenadines"}, {data:"VE", label:"Venezuela"}, {data:"VG", label:"British Virgin Islands"}, {data:"VI", label:"United States Virgin Islands"}, {data:"VN", label:"Viet Nam"}, {data:"VU", label:"Vanuatu"}, {data:"WF", label:"Wallis & Futuna Islands"}, {data:"WS", label:"Samoa"}, {data:"YD", label:"Democratic Yemen (no longer exists)"}, {data:"YE", label:"Yemen"}, {data:"YT", label:"Mayotte"}, {data:"YU", label:"Yugoslavia"}, {data:"ZA", label:"South Africa"}, {data:"ZM", label:"Zambia"}, {data:"ZR", label:"Zaire"}, {data:"ZW", label:"Zimbabwe"}];
_local1.sortOn("label");
_local1.unshift({data:"US", label:"United States of America"});
_local1.unshift({data:"CA", label:"Canada"});
_local1.unshift({data:"--", label:"None Selected"});
return (_local1);
}
}
}//package com.rawkins.games.dolphinOlympics
Section 14
//Controller (com.rawkins.games.dolphinOlympics.Controller)
package com.rawkins.games.dolphinOlympics {
import flash.display.*;
import flash.events.*;
import com.rawkins.sg.*;
public class Controller extends KeyController {
private var player:Player;
public function Controller(_arg1:DisplayObject, _arg2:Player):void{
super(_arg1);
this.player = _arg2;
}
override protected function onKeyDown(_arg1:KeyboardEvent):void{
super.onKeyDown(_arg1);
if ((((((_arg1.keyCode == UP)) && (player.sliding))) && (!(downDown)))){
player.popSlide();
};
}
override protected function onLeft():void{
if (!player.sliding){
player.startTurn("left");
};
}
override protected function onRight():void{
if (!player.sliding){
player.startTurn("right");
};
}
override protected function onUp():void{
if (!downDown){
player.startAccelerating();
};
}
override protected function onDown():void{
if (!player.sliding){
player.slideReady = true;
};
player.startRoll();
}
override protected function recordEvent(_arg1:KeyboardEvent):void{
var _local2:String = _arg1.type;
var _local3:uint = _arg1.keyCode;
var _local4:Date = new Date();
var _local5:Number = _local4.time;
var _local6:Number = (_local5 - startTime);
var _local7:Array = [_local6, _local2, _local3, player.vz, player.angle];
inputRecord.push(_local7);
}
override protected function fireEvent(_arg1:Array):void{
var _local2:KeyboardEvent = new KeyboardEvent(_arg1[1]);
_local2.keyCode = _arg1[2];
player.vz = _arg1[3];
player.angle = _arg1[4];
player.dispatchEvent(_local2);
}
override protected function checkKeys(_arg1:uint):void{
if (_arg1 == LEFT){
leftDown = false;
player.endTurn("left");
} else {
if (_arg1 == RIGHT){
rightDown = false;
player.endTurn("right");
} else {
if (_arg1 == UP){
upDown = false;
player.accelerating = false;
} else {
if (_arg1 == DOWN){
downDown = false;
player.slideReady = false;
player.stopRoll();
};
};
};
};
}
private function onDash():void{
if (player.jumping){
player.maverick();
};
}
private function onHelicopter():void{
if (player.jumping){
player.helicopter();
};
}
}
}//package com.rawkins.games.dolphinOlympics
Section 15
//Creature (com.rawkins.games.dolphinOlympics.Creature)
package com.rawkins.games.dolphinOlympics {
import com.rawkins.utils.*;
public class Creature extends Collidable {
protected var _angle:Number;// = 0
protected var _vx:Number;// = 0
protected var _vy:Number;// = 0
protected var _vz:Number;// = 0
protected var _speed:Number;// = 10
protected var _chaseSpeed:Number;// = 14
protected var _vMax:Number;// = 14
protected var _vBoost:Number;// = 0
protected var _scalar:Number;// = 0.65
protected var dirAdjust:Number;
public function Creature():void{
var _local1:Number = MathSG.randNum(0, 2);
if (_local1 == 0){
dirAdjust = Math.PI;
} else {
dirAdjust = 0;
};
}
public function get speed():Number{
return (_speed);
}
public function get chaseSpeed():Number{
return (_chaseSpeed);
}
public function set chaseSpeed(_arg1:Number):void{
_chaseSpeed = _arg1;
}
public function set speed(_arg1:Number):void{
_speed = _arg1;
}
public function get angle():Number{
return (_angle);
}
public function set angle(_arg1:Number):void{
this.rotation = MathSG.deg(_arg1);
if ((((_arg1 > (Math.PI / 2))) && ((_arg1 < (Math.PI * 1.5))))){
this.scaleY = -(_scalar);
} else {
this.scaleY = _scalar;
};
_angle = _arg1;
}
public function get vBoost():Number{
return (_vBoost);
}
public function set vBoost(_arg1:Number):void{
_vBoost = _arg1;
}
}
}//package com.rawkins.games.dolphinOlympics
Section 16
//Firework (com.rawkins.games.dolphinOlympics.Firework)
package com.rawkins.games.dolphinOlympics {
import flash.display.*;
import com.rawkins.fx.*;
import flash.filters.*;
public class Firework extends Particle {
private var airFric:Number;// = 0.9
private var glowColor:Number;
private var bmpd:BitmapData;
private var bmp:Bitmap;
public function Firework(_arg1:Number=0, _arg2:Number=0, _arg3:Number=100, _arg4:Number=0xFF00FF):void{
super(_arg1, _arg2, _arg3);
this.glowColor = _arg4;
bounded = false;
}
override public function draw():void{
super.draw();
var _local1:GlowFilter = new GlowFilter(glowColor);
var _local2:Array = [_local1];
this.filters = _local2;
}
override public function update():void{
this.vz = (this.vz * airFric);
this.vy = (this.vy + (Constants.GRAVITY / 2));
super.update();
}
}
}//package com.rawkins.games.dolphinOlympics
Section 17
//Fish (com.rawkins.games.dolphinOlympics.Fish)
package com.rawkins.games.dolphinOlympics {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import com.rawkins.utils.*;
public class Fish extends Creature {
protected var _depth:Number;
protected var _bottom:Number;
protected var _top:Number;
protected var _target:MovieClip;
protected var _jumping:Boolean;// = false
protected var _turnSpeed:Number;// = 0.175
protected var _loopTimer:Timer;
protected var _followRand:Number;// = 0
protected var _playing:Boolean;// = true
public function Fish(_arg1:Number=0, _arg2:Number=0):void{
addFrameScript(11, frame12, 20, frame21, 25, frame26);
super();
this.depth = this.y;
this._bottom = _arg2;
this._top = _arg1;
var _local3:Number = MathSG.randNum(1, 10);
if (_local3 == 1){
this.angle = Math.PI;
};
_activeTimer.addEventListener(TimerEvent.TIMER_COMPLETE, endFollow);
_speed = MathSG.randNum(6, 8);
_loopTimer = new Timer(1000);
scaleX = (scaleY = _scalar);
}
override public function update():void{
if (_playing){
if ((((x < 0)) || ((x > 640)))){
stop();
_playing = false;
};
} else {
if ((((x >= 0)) && ((x <= 640)))){
play();
_playing = true;
};
};
if (!_jumping){
swim();
} else {
jump();
};
}
protected function updateSpeed():void{
var _local1:Number;
if (!activated){
_vx = (Math.cos(_angle) * (speed + vBoost));
_vy = (Math.sin(_angle) * (speed + vBoost));
} else {
_local1 = (chaseSpeed + vBoost);
if (_local1 > target.vz){
_local1 = (target.vz + 0.5);
};
if (_local1 <= 2){
_local1 = 7;
};
_vx = (Math.cos(_angle) * _local1);
_vy = (Math.sin(_angle) * _local1);
if (chaseSpeed > _vMax){
chaseSpeed = (chaseSpeed - Constants.WATER_FRICTION);
};
};
}
protected function swim():void{
var _local1:Number;
updateSpeed();
if (!activated){
if (this.y > _bottom){
if ((((_angle > (Math.PI / 2))) && ((_angle < (Math.PI * 1.5))))){
_angle = (_angle + 0.1);
} else {
_angle = (_angle - 0.1);
};
} else {
_local1 = MathSG.randNum(1, 10);
if (_local1 == 1){
changeDir();
};
};
} else {
follow();
};
this.x = (this.x + _vx);
this.y = (this.y + _vy);
}
protected function follow():void{
var _local1:Number = (_target.x - this.x);
var _local2:Number = (_target.y - this.y);
var _local3:Number = Math.sqrt(((_local1 * _local1) + (_local2 * _local2)));
var _local4:* = Math.atan2(_local2, _local1);
var _local5:* = (_local4 - angle);
if ((((_local5 > Math.PI)) || ((_local5 < -(Math.PI))))){
if (angle > 0){
angle = ((-2 * Math.PI) + angle);
} else {
angle = ((Math.PI * 2) + angle);
};
return;
};
angle = (angle + ((_local5 * _turnSpeed) + (Math.sin(_followRand) / 10)));
_followRand = (_followRand + 0.01);
}
public function startJump():void{
deactivate();
_jumping = true;
gotoAndPlay("jumping");
}
public function endJump():void{
_vy = speed;
this._jumping = false;
gotoAndPlay("moving");
}
protected function jump():void{
_vy = (_vy + Constants.GRAVITY);
this.x = (this.x + _vx);
this.y = (this.y + _vy);
this.angle = Math.atan2(_vy, _vx);
}
protected function endFollow(_arg1:TimerEvent):void{
var _local2:Number = (_target.x - this.x);
var _local3:Number = (_target.y - this.y);
var _local4:Number = Math.sqrt(((_local2 * _local2) + (_local3 * _local3)));
if (_local4 > 300){
deactivate();
} else {
_activeTimer.reset();
_activeTimer.start();
};
}
protected function changeDir():void{
angle = (angle + (0.1 * MathSG.randNum(-1, 2)));
}
override public function activate(_arg1:MovieClip):String{
if (!_jumping){
if (_arg1.vBoost != null){
_vBoost = (_vBoost + (_arg1.vBoost * 0.75));
};
_activeTimer.start();
this.target = _arg1;
gotoAndPlay("active");
this.filters = _arg1.filters;
};
return ("fish");
}
override public function deactivate():void{
super.deactivate();
gotoAndPlay("moving");
_vBoost = 0;
target = null;
this.filters = [];
}
public function set depth(_arg1:Number):void{
_depth = _arg1;
}
public function get depth():Number{
return (_depth);
}
public function get target():MovieClip{
return (_target);
}
public function set target(_arg1:MovieClip){
_target = _arg1;
}
public function get jumping(){
return (_jumping);
}
function frame12(){
gotoAndPlay("normal");
}
function frame21(){
gotoAndPlay("active");
}
function frame26(){
stop();
}
}
}//package com.rawkins.games.dolphinOlympics
Section 18
//Freestyle (com.rawkins.games.dolphinOlympics.Freestyle)
package com.rawkins.games.dolphinOlympics {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import ascb.util.*;
import com.rawkins.fx.*;
import flash.text.*;
import com.senocular.drawing.*;
import flash.utils.*;
import com.rawkins.utils.*;
import flash.ui.*;
public class Freestyle extends Game {
private var numFormat:NumberFormat;
private var gameTimer:Timer;
private var endID:Number;
private var ticker:uint;
private var _gameTime:uint;
private var _score:int;
private var totalDegs:Number;
private var slideSecs:Number;
private var flips:uint;
private var multiplier:Number;
private var jumpTotal:Number;
private var lastTrick:Trick;
private var lastFlip:String;
private var watchingSlide:Boolean;// = false
private var lastSlideTime:Number;// = 0
private var scoreTimer:Timer;
private var scoring:Boolean;
private var sinceJump:uint;// = 0
private var comboGap:uint;// = 31
private var tricks:Object;
private var heightTricks:Array;
private var combo:Array;
private var entryAng:Number;
private var exitAng:Number;
private var waterDegs:Number;
private var lastAng:Number;
private var biggestCombo:Number;
private var biggestSchool:Number;
private var longestStarslide:Number;
private var biggestBoost:Number;
private var slideTotal:Number;// = 0
private var celebrated:Boolean;// = false
private var mooned:Boolean;// = false
private var hailed:Boolean;// = false
private var marsed:Boolean;// = false
private var nebulad:Boolean;// = false
private var jupitered:Boolean;// = false
private var saturned:Boolean;// = false
private var neptuned:Boolean;// = false
private var uranused:Boolean;// = false
private var plutoed:Boolean;// = false
private var restauranted:Boolean;// = false
private var carouselReady:Boolean;// = false
private var startCarousel:Boolean;// = false
private var endCarousel:Boolean;// = false
private var fireworkTimer:Timer;
protected var text:Sprite;
protected var broadcastBase:Number;
protected var scoreSubmit:ScoreSubmitForm;
protected var scoreBoard:Scoreboard;
protected var anim:Anim;
protected var bc_txt:TextField;
protected var bc_tf:TextFormat;
protected var labels:Sprite;
protected var swLoader:Loader;
public function Freestyle(_arg1:SimpleGame, _arg2:Level):void{
super(_arg1, _arg2);
fireworkTimer = new Timer(100, 5);
fireworkTimer.addEventListener(TimerEvent.TIMER, onFirework);
}
private function checkHeightTricks():void{
var _local1:HeightTrick;
for each (_local1 in heightTricks) {
if (((!(_local1.done)) && ((level.bg.y > -(_local1.height))))){
_local1.done = true;
addToCombo(_local1);
};
};
}
private function resetHeightTricks():void{
var _local1:HeightTrick;
for each (_local1 in heightTricks) {
if (_local1.done){
_local1.done = false;
};
};
}
override public function init():void{
var _local1:Trick;
super.init();
tricks = {frontFlip:new Trick("Front Flip", 500), backFlip:new Trick("Back Flip", 500), niceEntry:new Trick("Nice Entry", 50), frontRewind:new Trick("Frontside Rewind", 750), backRewind:new Trick("Backside Rewind", 750), tailslide:new Trick("Tailslide", 150), starslide:new Trick("Starslide", 1500), corkscrew:new Trick("Corkscrew", 150), reversal:new Trick("Reversal", 300), wraparound:new Trick("Wraparound", 600), carousel:new Trick("Carnival", 1500), schooled:new Trick("Schooled", 150), celebration:new HeightTrick("Firecracker!", 1000, level.celebHeight, onCelebration), moon:new HeightTrick("Apollo 18!", 2500, level.moonHeight), mars:new HeightTrick("Mission to Mars!", 5000, level.marsHeight), nebulous:new HeightTrick("Nebulous!", 10000, level.nebulaHeight), jupiter:new HeightTrick("Wandering Star!", 20000, level.jupiterHeight), saturn:new HeightTrick("Ringer!", 50000, level.saturnHeight), neptune:new HeightTrick("Wizard's Eye!", 500000, level.neptuneHeight), uranus:new HeightTrick("Passing Gas!", 250000, level.uranusHeight), pluto:new HeightTrick("New Horizons!", 750000, level.plutoHeight), restaurant:new HeightTrick("So long and thanks for all the flips!", 1000000, level.endHeight), extension:new Trick("Extension", 250), schoolsOut:new Trick("School's Out!", 15000)};
heightTricks = new Array();
for each (_local1 in tricks) {
if ((_local1 is HeightTrick)){
heightTricks.push(_local1);
};
};
player.addEventListener("Roll", onRoll);
stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
anim = new Anim();
}
protected function onRing(_arg1:Event):void{
var _local2:WaterPowerUp;
var _local3:AirPowerUp;
if (!player.jumping){
player.vz = (player.vz + 12.5);
player.betweenJumps = true;
_local2 = new WaterPowerUp();
_local2.play();
} else {
player.vy = (player.vy - 17.5);
_local3 = new AirPowerUp();
_local3.play();
};
for each (c in activeCreatures) {
if (c.chaseSpeed){
c.chaseSpeed = (c.chaseSpeed + 12.5);
c.vBoost = (c.vBoost + 0.5);
};
};
player.vBoost = (player.vBoost + 0.5);
sinceJump = 0;
player.speedTrail();
gameTime++;
addToCombo(tricks.extension);
}
protected function onCelebration():void{
fireworkTimer.reset();
fireworkTimer.start();
var _local1:FireworkSound = new FireworkSound();
_local1.play();
}
private function onFirework(_arg1:TimerEvent){
level.fireworks(320, (240 - level.bg.y), 1, player.vx, player.vy);
}
override protected function onKeyDown(_arg1:KeyboardEvent):void{
super.onKeyDown(_arg1);
if ((((_arg1.keyCode == controller.LEFT)) || ((((_arg1.keyCode == controller.RIGHT)) && (!(carouselReady)))))){
carouselReady = true;
};
}
protected function onKeyUp(_arg1:KeyboardEvent):void{
if ((((_arg1.keyCode == controller.LEFT)) || ((_arg1.keyCode == controller.RIGHT)))){
startCarousel = false;
carouselReady = false;
};
}
override public function enter():void{
super.enter();
if (paused){
pause();
};
level.addEventListener(Ring.RING_HIT, onRing);
}
override public function exit():void{
level.removeEventListener(Ring.RING_HIT, onRing);
super.exit();
}
override public function pause():void{
super.pause();
if (paused){
level.stopRings();
} else {
level.startRings();
};
}
override protected function onMenuButtonClick(_arg1:MouseEvent):void{
if (scoreBoard.parent != null){
removeChild(scoreBoard);
addChild(menu);
} else {
super.onMenuButtonClick(_arg1);
};
}
override protected function startGame():void{
super.startGame();
over = false;
score = 0;
liveScore = 0;
multiplier = 0;
gameTime = 120;
ticker = 0;
flips = 0;
jumpTotal = 0;
player.spinDegs = 0;
totalDegs = 0;
lastTrick = new Trick("");
combo = new Array();
biggestCombo = 0;
longest_jump = 0;
highest_jump = 0;
biggest_splash = 0;
longest_tailslide = 0;
highest_speed = 0;
endTimer.reset();
if (menu.parent != null){
removeChild(menu);
};
clearBroadcast();
if (scoreBoard.parent != null){
scoreBoard.parent.removeChild(scoreBoard);
};
if (scoreSubmit.parent != null){
scoreSubmit.parent.removeChild(scoreSubmit);
};
for each (trick in tricks) {
trick.count = 0;
};
level.startRings();
}
override protected function endTimerComplete(_arg1:Event):void{
endCombo();
clearBroadcast();
scoreSubmit.alpha = 0;
addChild(scoreSubmit);
scoreSubmit.longest_jump = MathSG.roundTo((longest_jump / 50), 2);
scoreSubmit.highest_jump = MathSG.roundTo((highest_jump / 50), 2);
scoreSubmit.biggest_splash = MathSG.roundTo((biggest_splash / 4), 2);
scoreSubmit.longest_tailslide = MathSG.roundTo((longest_tailslide / 50), 2);
scoreSubmit.highest_speed = MathSG.roundTo(((highest_speed * 31) / 50), 2);
scoreSubmit.biggest_combo = biggestCombo;
scoreSubmit.final_score = score;
scoreSubmit.fadeIn();
}
protected function onScoreSubmit(_arg1:Event):void{
if (scoreSubmit.parent != null){
scoreSubmit.parent.removeChild(scoreSubmit);
};
showScores(_arg1);
}
protected function showScores(_arg1:Event):void{
scoreBoard.alpha = 0;
addChild(scoreBoard);
scoreBoard.fadeIn();
scoreBoard.addEventListener("Closed", onBoardClosed);
}
private function onBoardClosed(_arg1:Event):void{
if (over){
endMenu.alpha = 0;
addChild(endMenu);
endMenu.fadeIn();
};
}
private function endKeyDown(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.ENTER){
removeEventListener(KeyboardEvent.KEY_DOWN, endKeyDown);
sg.startGame();
};
}
override public function update():void{
var _local1:Number;
if (((!(paused)) && (!(over)))){
checkPaths();
if (player.y < level.surfaceHeight){
player.swimming = false;
if (((!(player.jumping)) && (!(player.sliding)))){
launchPlayer();
} else {
if (player.sliding){
continueSlide();
watchSlide();
} else {
if (player.jumping){
continueJump();
watchJump();
};
};
};
} else {
if (player.jumping){
landPlayer();
} else {
if (player.y > level.bottom){
crashPlayer();
} else {
if (player.hitFloor){
continueCrash();
} else {
applyFriction();
if (player.betweenJumps){
_local1 = Math.abs((player.angle - lastAng));
if (_local1 > 20){
_local1 = 20;
};
waterDegs = (waterDegs + _local1);
lastAng = player.angle;
};
};
};
};
};
ticker++;
if (ticker >= Constants.FRAMERATE){
ticker = 0;
tick();
};
if (player.betweenJumps){
if (((!(player.rolling)) && (!(player.sliding)))){
sinceJump++;
};
if (sinceJump > comboGap){
sinceJump = 0;
endCombo();
};
};
if (!player.sliding){
scroll((player.vx + player.crash_vx), (player.vy + player.crash_vy));
};
checkHeightTricks();
updateObjs();
player.update();
};
}
protected function tick():void{
gameTime--;
if (gameTime <= 0){
ticker = Constants.FRAMERATE;
if (player.swimming){
endGame();
};
};
}
public function watchJump(){
var _local1:Number = player.spinDegs;
var _local2:uint = player.rollCount;
var _local3:Trick;
if (_local1 >= 360){
if (lastFlip == "Back Flip"){
_local3 = tricks.backRewind;
lastFlip = "";
} else {
_local3 = tricks.frontFlip;
lastFlip = "Front Flip";
};
} else {
if (_local1 <= -360){
if (lastFlip == "Front Flip"){
_local3 = tricks.frontRewind;
lastFlip = "";
} else {
_local3 = tricks.backFlip;
lastFlip = "Back Flip";
};
};
};
if (_local3 != null){
addToCombo(_local3);
player.spinDegs = 0;
};
}
private function findCollisionPoint(_arg1:Path):Number{
var _local3:Point;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local2:Number = 0;
while (_local2 < 1) {
_local3 = _arg1.pointAt(_local2);
_local4 = player.x;
_local5 = (player.x + player.width);
_local6 = player.y;
_local7 = (player.y + player.height);
if ((((((((_local3.x > _local4)) && ((_local3.x < _local5)))) && ((_local3.y + _local6)))) && ((_local3.y < _local7)))){
break;
};
_local2 = (_local2 + 0.025);
};
return (_local2);
}
public function watchSlide():void{
if (!watchingSlide){
watchingSlide = true;
if (onWater){
addToCombo(tricks.tailslide);
} else {
addToCombo(tricks.starslide);
};
};
if (onWater){
jumpTotal = (jumpTotal + Math.floor((player.slideTime * 2)));
} else {
jumpTotal = (jumpTotal + Math.floor((player.slideTime * 3.5)));
};
liveScore = jumpTotal;
}
override protected function endSlide(_arg1:Event):void{
super.endSlide(_arg1);
}
private function onRoll(_arg1:Event):void{
addToCombo(tricks.corkscrew);
}
private function addToCombo(_arg1:Trick):void{
var _local2:Boolean;
var _local3:uint;
while (_local3 < combo.length) {
if (combo[_local3].name == _arg1.name){
_local2 = true;
};
_local3++;
};
if (!_local2){
combo.push(_arg1);
};
_arg1.count++;
jumpTotal = (jumpTotal + _arg1.value);
multiplier = (multiplier + (1 / _arg1.count));
clearBroadcast();
_local3 = 0;
while (_local3 < combo.length) {
broadcast(combo[_local3].name);
_local3++;
};
liveScore = jumpTotal;
lastTrick = _arg1;
if (_arg1.action != null){
_arg1.action();
};
}
private function endCombo():void{
jumpTotal = (jumpTotal * multiplier);
score = (score + Math.round(jumpTotal));
var _local1:int;
var _local2:uint;
while (_local2 < combo.length) {
_local1 = (_local1 + combo[_local2].count);
combo[_local2].count = 0;
_local2++;
};
if (_local1 > biggestCombo){
biggestCombo = _local1;
};
combo = new Array();
clearBroadcast();
(lastFlip == "");
flips = 0;
jumpTotal = 0;
player.spinDegs = 0;
totalDegs = 0;
multiplier = 0;
player.betweenJumps = false;
watchingSlide = false;
scoring = false;
for each (trick in tricks) {
trick.count = 0;
};
}
override protected function nice_entry(_arg1:Boolean):void{
if (_arg1){
player.vBoost = (player.vBoost + (2 + (combo.length / 3)));
addToCombo(tricks.niceEntry);
if (startCarousel){
addToCombo(tricks.carousel);
carouselReady = true;
} else {
if (carouselReady){
carouselReady = false;
startCarousel = true;
};
};
} else {
player.vBoost = 0;
endCombo();
};
}
override protected function landPlayer():void{
super.landPlayer();
player.betweenJumps = true;
this.entryAng = player.angle;
this.lastAng = this.entryAng;
this.waterDegs = 0;
lastFlip = "";
watchingSlide = false;
resetHeightTricks();
swimming = true;
if (over){
endGame();
};
}
override protected function launchPlayer():void{
var _local1:Number;
var _local2:String;
var _local3:String;
var _local4:SchoolBell;
super.launchPlayer();
sinceJump = 0;
if (((((controller.leftDown) || (controller.rightDown))) && (!(carouselReady)))){
carouselReady = true;
};
if (carouselReady){
carouselReady = false;
startCarousel = true;
};
if (player.betweenJumps){
_local1 = player.angle;
_local2 = "";
_local3 = "";
if ((((_local1 > 90)) && ((_local1 < 270)))){
_local2 = "left";
} else {
_local2 = "right";
};
if ((((entryAng > 90)) && ((entryAng < 270)))){
_local3 = "left";
} else {
_local3 = "right";
};
if (_local2 != _local3){
addToCombo(tricks.reversal);
} else {
if (waterDegs >= 200){
addToCombo(tricks.wraparound);
};
};
};
player.betweenJumps = false;
if (activeCreatures.length >= 7){
_local4 = new SchoolBell();
_local4.play();
addToCombo(tricks.schoolsOut);
};
for each (c in activeCreatures) {
addToCombo(tricks.schooled);
player.vBoost = (player.vBoost + 0.25);
};
}
override protected function startSlide():void{
super.startSlide();
slideTotal = 0;
sinceJump = 0;
player.betweenJumps = false;
lastFlip = "";
level.moveBG(10);
}
override protected function buildUI():void{
super.buildUI();
var _local1:SimpleButton = new RestartButton();
_local1.name = "Restart Game";
menu.addButton(_local1, sg.startGame);
var _local2:SimpleButton = new ScoreButton();
_local2.name = "View Scores";
menu.addButton(_local2, showScores);
numFormat = new NumberFormat();
labels = new FreestyleUI_labels();
labels.x = (labels.x + 10);
labels.y = (473 - labels.height);
labels.cacheAsBitmap = true;
ui.addChild(labels);
text = new FreestyleUI_text();
bc_txt = new TextField();
bc_txt.width = 540;
bc_txt.height = 36;
bc_txt.wordWrap = true;
bc_txt.autoSize = TextFieldAutoSize.CENTER;
bc_txt.antiAliasType = "advanced";
bc_txt.embedFonts = true;
bc_tf = new TextFormat("GrilledCheese BTN", null, 0xFFFFFF);
bc_tf.size = 14;
bc_tf.align = "center";
bc_txt.x = 50;
bc_txt.y = 381;
addChild(bc_txt);
broadcastBase = bc_txt.y;
ui.addChild(text);
scoreSubmit = new ScoreSubmitForm();
scoreSubmit.x = (scoreSubmit.x + 50);
scoreSubmit.y = (scoreSubmit.y + 25);
scoreSubmit.addEventListener("Score_Submitted", onScoreSubmit);
scoreSubmit.addEventListener(MouseEvent.CLICK, onSubmitClick);
scoreBoard = new Scoreboard(sg);
scoreBoard.x = (scoreBoard.x + 50);
scoreBoard.y = (scoreBoard.y + 25);
}
private function onSubmitClick(_arg1:MouseEvent):void{
if (_arg1.target.name == "playAgain_btn"){
removeChild(scoreSubmit);
sg.startGame(null);
};
}
private function broadcast(_arg1:String){
var _local3:Number;
var _local4:Number;
if (bc_txt.text != ""){
_arg1 = (" + " + _arg1);
};
var _local2:Number = bc_txt.textHeight;
bc_txt.appendText(_arg1);
bc_txt.setTextFormat(bc_tf);
if (_local2 > 0){
_local3 = bc_txt.textHeight;
_local4 = (_local3 - _local2);
if (_local4 > 0){
bc_txt.y = (bc_txt.y - _local4);
};
};
}
private function clearBroadcast():void{
bc_txt.text = "";
bc_txt.y = broadcastBase;
var _local1:TextField = text.liveScore_txt;
_local1.text = "";
}
public function set score(_arg1:int):void{
text.score_txt.text = numFormat.format(_arg1);
_score = _arg1;
}
public function get score():int{
return (_score);
}
public function set gameTime(_arg1:int):void{
if (_arg1 >= 0){
text.time_txt.text = DateFormat.formatSeconds(_arg1).substr(1);
};
_gameTime = _arg1;
}
public function get gameTime():int{
return (_gameTime);
}
public function set liveScore(_arg1:int):void{
var _local2 = "";
if (_arg1 != 0){
_local2 = numFormat.format(_arg1);
if (multiplier > 1){
_local2 = (_local2 + (" x " + MathSG.roundTo(multiplier, 2)));
};
text.liveScore_txt.text = _local2;
};
}
}
}//package com.rawkins.games.dolphinOlympics
Section 19
//Freeswim (com.rawkins.games.dolphinOlympics.Freeswim)
package com.rawkins.games.dolphinOlympics {
import ascb.util.*;
public class Freeswim extends Freestyle {
protected var numFormat:NumberFormat;
public function Freeswim(_arg1:SimpleGame, _arg2:Level):void{
super(_arg1, _arg2);
}
override public function init():void{
super.init();
}
override protected function buildUI():void{
super.buildUI();
menu.removeItem("Restart Game");
menu.removeItem("View Scores");
ui.removeChild(labels);
ui.removeChild(text);
removeChild(bc_txt);
}
override protected function tick():void{
}
}
}//package com.rawkins.games.dolphinOlympics
Section 20
//Game (com.rawkins.games.dolphinOlympics.Game)
package com.rawkins.games.dolphinOlympics {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.media.*;
import flash.text.*;
import flash.utils.*;
import com.rawkins.utils.*;
import com.rawkins.sg.*;
public class Game extends MainState {
protected var level:Level;
protected var level_bmpd:BitmapData;
protected var level_bmp:Bitmap;
protected var player:Player;
protected var ui:Sprite;
protected var menuButton:SimpleButton;
protected var muteButton:MovieClip;
protected var windUI:Sprite;
protected var text_buffer:BitmapData;
protected var text_bmpd:BitmapData;
protected var text_bmp:Bitmap;
protected var windStr:Number;
protected var windAng:Number;
protected var windVX:Number;// = 0
protected var windVY:Number;// = 0
protected var windAX:Number;// = 0
protected var windAY:Number;// = 0
protected var windMAX:Number;// = 7
protected var jumpTimer:Number;// = 0
protected var landingTimer:Number;// = 0
protected var crashTimer:Number;// = 0
protected var slideTimer:Number;// = 0
protected var landingInfo:Object;
protected var jump_vx:Number;
protected var jump_vy:Number;
protected var jump_xTotal:Number;// = 0
protected var jump_yTotal:Number;// = 0
protected var slide_distance:Number;// = 0
protected var onPath:Boolean;// = false
protected var pathPoint:Number;// = 0
protected var dismountTimer:Timer;
protected var slideSpeed:Number;
protected var currentPath:SlidePath;
protected var slideBase:Number;
protected var onWater:Boolean;// = false
protected var lastPoint:Point;
protected var thisPoint:Point;
protected var longest_jump:Number;// = 0
protected var highest_jump:Number;// = 0
protected var biggest_splash:Number;// = 0
protected var longest_tailslide:Number;// = 0
protected var highest_speed:Number;// = 0
protected var biggest_combo:Number;// = 0
protected var records:Array;
protected var playing:Boolean;// = false
protected var over:Boolean;// = false
protected var starting:Boolean;// = false
protected var inSpace:Boolean;// = false
protected var fx_bmpd:BitmapData;
protected var fx_bmp:Bitmap;
protected var trail1:BitmapData;
protected var trail2:BitmapData;
protected var trail3:BitmapData;
protected var trailCounter:int;// = 1
protected var trail:Array;
protected var trailStarted:Boolean;// = false
protected var controller:Controller;
protected var activeCreatures:Array;
protected var checkBuff:int;// = 0
protected var waterSound:Sound;
protected var swimSound:SoundLoop;
protected var swimSoundChannel:SoundChannel;
protected var seashore:Sound;
protected var jumpSound:SoundLoop;
protected var jumpSoundChannel:SoundChannel;
protected var spaceSound:SoundLoop;
protected var spaceSoundChannel:SoundChannel;
protected var splashSound:Sound;
protected var splashSoundChannel:SoundChannel;
protected var muted:Boolean;// = false
protected var endTimer:Timer;
public function Game(_arg1:SimpleGame, _arg2:Level):void{
records = [longest_jump, highest_jump, biggest_splash, longest_tailslide, highest_speed, biggest_combo];
super(_arg1);
setLevel(_arg2);
}
override public function init():void{
super.init();
addChildAt(level, 0);
this.player = sg.player;
player.stop();
GRAVITY = Constants.GRAVITY;
WATER_FRICTION = Constants.WATER_FRICTION;
controller = new Controller(stage, player);
controller.enable();
controller.enableCombos();
dismountTimer = new Timer(500, 1);
player.addEventListener("EndSlide", endSlide);
player.addEventListener("VelocityChanged", checkSpeed);
activeCreatures = new Array();
waterSound = new Underwater();
swimSound = new SoundLoop(waterSound, 0.4);
seashore = new Seashore();
jumpSound = new SoundLoop(seashore, 0.4);
spaceSound = new SoundLoop(new SpaceLoop1(), 0.5);
splashSound = new SplashSound();
buildUI();
endTimer = new Timer(1000, 1);
endTimer.addEventListener(TimerEvent.TIMER_COMPLETE, endTimerComplete);
}
public function setLevel(_arg1:Level):void{
this.level = _arg1;
}
override public function enter():void{
super.enter();
level.resume();
player.particleManager = level.particleManager;
swimSoundChannel = swimSound.play();
startGame();
}
override public function exit():void{
level.pause();
SoundMixer.stopAll();
super.exit();
}
protected function startGame():void{
player.clearState();
player.gotoAndStop("moving");
player.vz = 0;
player.crash_vz = 0;
player.vBoost = 0;
player.slideBoost = 0;
player.angle = 0;
player.jumping = false;
player.sliding = false;
level.y = 0;
level.reset();
player.particleManager = level.particleManager;
controller.resetKeys();
player.startSparkle();
controller.enable();
over = false;
}
protected function endGame():void{
controller.disable();
over = true;
player.stop();
player.vBoost = 0;
player.vz = 0;
endTimer.start();
}
protected function endTimerComplete(_arg1:Event):void{
endMenu.alpha = 0;
addChild(endMenu);
endMenu.fadeIn();
}
override public function update():void{
if (((!(super.paused)) && (!(over)))){
checkPaths();
if (player.y < level.surfaceHeight){
player.swimming = false;
if (((!(player.jumping)) && (!(player.sliding)))){
launchPlayer();
} else {
if (player.sliding){
continueSlide();
} else {
if (player.jumping){
continueJump();
};
};
};
} else {
if (player.jumping){
landPlayer();
} else {
if (player.y > level.bottom){
crashPlayer();
} else {
if (player.hitFloor){
continueCrash();
} else {
applyFriction();
};
};
};
};
if (!player.sliding){
scroll((player.vx + player.crash_vx), (player.vy + player.crash_vy));
};
updateObjs();
player.update();
};
}
protected function scroll(_arg1:Number, _arg2:Number):void{
level.scrollLevel(_arg1, _arg2);
if (!inSpace){
if (level.bg.y > -(level.moonHeight)){
inSpace = true;
jumpSound.fadeOut();
spaceSound.fadeIn();
};
} else {
if (level.bg.y < -(level.moonHeight)){
inSpace = false;
jumpSound.fadeIn();
spaceSound.fadeOut();
};
};
}
protected function updateObjs():void{
var _local4:int;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:int;
var _local9:Number;
var _local10:Collidable;
var _local1:Array = level.collidables;
var _local2:Array = level.fish;
var _local3:Array = level.birds;
for each (_local10 in _local1) {
_local5 = _local10.y;
if ((((_local5 < 480)) || ((_local5 > 0)))){
_local10.update();
_local6 = (_local10.hitZone.height / 2);
if (((((((!(player.sliding)) && (!(_local10.activated)))) && ((_local5 > (240 - _local6))))) && ((_local5 < (240 + _local6))))){
_local7 = _local10.x;
if ((((_local7 > (320 - _local6))) && ((_local7 < (320 + _local6))))){
_local10.activate(player);
_local8 = _local10.name.indexOf("ring");
if ((((_local8 == -1)) && (!(player.jumping)))){
activeCreatures.push(_local10);
};
};
};
};
};
for each (fish in _local2) {
_local9 = fish.y;
if ((((_local9 < level.bg.y)) && (!(fish.jumping)))){
fish.startJump();
} else {
if ((((_local9 > level.bg.y)) && (fish.jumping))){
fish.endJump();
};
};
};
_local4 = 0;
while (_local4 < activeCreatures.length) {
_local10 = activeCreatures[_local4];
if (!_local10.activated){
activeCreatures.splice(_local4, 1);
};
_local4++;
};
}
protected function launchPlayer():void{
var _local1:Number = player.vx;
var _local2:Number = player.angle;
swimSound.pause();
jumpSoundChannel = jumpSound.resume();
player.jumping = true;
this.jump_xTotal = 0;
this.jump_yTotal = 0;
if (player.crash_vx != 0){
player.vx = (player.vx + player.crash_vx);
player.crash_vx = 0;
};
if (player.crash_vy != 0){
player.vy = (player.vy + player.crash_vy);
player.crash_vy = 0;
};
level.splash(320, 0, player.vz);
splashSound.play(2000);
}
protected function continueJump():void{
player.vy = (player.vy + GRAVITY);
jump_xTotal = (jump_xTotal + Math.abs(player.vx));
if (player.vy < 0){
jump_yTotal = (jump_yTotal - player.vy);
};
jumpTimer++;
}
protected function checkPaths():void{
var _local1:Array;
var _local2:Boolean;
var _local3:Number;
var _local4:Number;
var _local5:*;
var _local6:*;
var _local7:int;
var _local8:Number;
var _local9:Number;
if (((((player.slideReady) && (!(player.sliding)))) && ((player.vy < 50)))){
_local1 = level.paths;
_local2 = false;
for each (path in _local1) {
_local3 = path.x;
_local4 = (level.bg.y + path.y);
if ((((level.bg.y <= 400)) && ((player.vy > 0)))){
break;
};
if ((((((((_local3 >= -(path.width))) && ((_local3 < (640 + path.width))))) && ((_local4 > -(path.height))))) && ((_local4 < (path.height + 480))))){
_local5 = player.vz;
_local6 = player.angle;
_local7 = 0;
while (_local7 < _local5) {
_local8 = ((Math.cos(MathSG.rad(_local6)) * _local7) + 320);
_local9 = ((Math.sin(MathSG.rad(_local6)) * _local7) + 240);
if (path.hitTestPoint(_local8, _local9, true)){
_local2 = true;
path.x = (path.x - (_local8 - 320));
level.moveBG(-((_local9 - 240)));
break;
};
_local7 = (_local7 + 15);
};
};
if (((((_local2) && ((Math.abs(player.vx) > 2)))) && (!(dismountTimer.running)))){
pathPoint = path.findCollisionPoint(player);
currentPath = path;
startSlide();
break;
};
};
};
}
protected function startSlide():void{
var _local2:DolphinChirp1;
var _local3:SoundChannel;
var _local4:SpaceDolphin;
var _local5:SoundChannel;
thisPoint = currentPath.path.pointAt(pathPoint);
var _local1:Number = MathSG.normalize(((currentPath.path.angleAt(pathPoint) * 180) / Math.PI));
if ((((_local1 > 90)) && ((_local1 < 270)))){
player.vx = -(player.vx);
};
player.angle = (_local1 - 90);
slideSpeed = (1 / (currentPath.length / player.vx));
slideBase = level.bg.y;
if (slideBase <= 300){
onWater = true;
};
if (player.vx > 0){
player.startSlide("right", currentPath);
} else {
player.startSlide("left", currentPath);
};
if (!inSpace){
_local2 = new DolphinChirp1();
_local3 = _local2.play();
_local3.soundTransform = new SoundTransform(0.7);
swimSound.pause();
jumpSoundChannel = jumpSound.resume();
} else {
_local4 = new SpaceDolphin();
_local5 = _local4.play();
_local5.soundTransform = new SoundTransform(0.8);
};
}
private function playTailSplash(_arg1:Event):void{
splashSoundChannel = splashSound.play(1000);
}
protected function continueSlide():void{
player.slide();
slide_distance = (slide_distance + player.vx);
var _local1:Number = currentPath.friction;
if (player.vx > 1){
player.vx = (player.vx - _local1);
} else {
if (player.vx < -1){
player.vx = (player.vx + _local1);
} else {
player.vx = 0;
};
};
slideSpeed = (1 / (currentPath.length / player.vx));
var _local2:Number = MathSG.normalize(((currentPath.path.angleAt(pathPoint) * 180) / Math.PI));
player.angle = (_local2 - 90);
if (onWater){
level.scrollLevel(player.vx, 0);
slideTimer++;
if (slideTimer == 3){
if (onWater){
level.splash(320, 0, player.vx, true);
};
slideTimer = 0;
};
} else {
lastPoint = thisPoint;
thisPoint = currentPath.path.pointAt(pathPoint);
level.scrollLevel((thisPoint.x - lastPoint.x), (thisPoint.y - lastPoint.y));
pathPoint = (pathPoint + slideSpeed);
};
if ((((((((((player.vx < 1)) && ((player.vx >= 0)))) || ((((player.vx > -1)) && ((player.vx <= 0)))))) || ((pathPoint >= 1)))) || ((pathPoint < 0)))){
if ((((_local2 > 90)) && ((_local2 < 270)))){
player.vx = -(player.vx);
};
player.endSlide();
onWater = false;
pathPoint = 0;
dismountTimer.start();
};
}
protected function endSlide(_arg1:Event):void{
var _local2:Sound;
player.slideBoost = (player.slideBoost + currentPath.slideBoost);
currentPath.slideBoost = (currentPath.slideBoost / 2);
currentPath = null;
if (((!(onWater)) && ((player.vy < -2)))){
_local2 = new Explosion();
_local2.play();
};
onWater = false;
if (slide_distance > longest_tailslide){
longest_tailslide = slide_distance;
};
slide_distance = 0;
}
protected function landPlayer():void{
var _local7:Number;
var _local8:SoundChannel;
var _local9:PowerDown;
var _local10:Sound;
jump_xTotal = Math.abs(jump_xTotal);
if (jump_xTotal > longest_jump){
longest_jump = jump_xTotal;
};
if (jump_yTotal > highest_jump){
highest_jump = jump_yTotal;
};
jump_yTotal = 0;
jump_xTotal = 0;
var _local1:Number = (player.vx + windVX);
var _local2:Number = MathSG.deg(Math.atan2((player.vy + windVY), Math.abs(_local1)));
if (_local1 < 0){
_local2 = (180 - _local2);
};
var _local3:* = player.angle;
if (_local3 > (_local2 + 180)){
_local3 = (_local3 - 360);
};
var _local4:Number = Math.abs((_local3 - _local2));
var _local5:Boolean;
if (_local4 > 90){
_local4 = (180 - _local4);
_local5 = true;
};
var _local6:* = (((player.vy * _local4) / 100) * 2.5);
if (_local6 > biggest_splash){
biggest_splash = _local6;
};
level.splash(320, 0, _local6);
if (((_local5) || ((_local4 > 28)))){
if (player.vBoost > 0){
_local9 = new PowerDown();
_local9.play();
};
_local7 = (_local4 / 100);
player.crash_angle = _local2;
player.crash_vx = (player.vx * (1 - _local7));
player.vx = 0;
player.crash_vy = (player.vy * (1 - _local7));
if (_local5){
player.crash_vx = (player.crash_vx / 2);
player.crash_vy = (player.crash_vy / 2);
};
player.vy = 0;
player.slideBoost = 0;
nice_entry(false);
_local8 = splashSound.play();
_local8.soundTransform = new SoundTransform(0.5);
} else {
if (jumpTimer > 40){
nice_entry(true);
_local10 = new AirPowerUp();
_local10.play();
};
};
jumpTimer = 0;
windVX = (windVY = 0);
player.land();
jumpSoundChannel = jumpSound.pause();
swimSoundChannel = swimSound.resume();
if (controller.upDown){
player.startAccelerating();
};
}
protected function crashPlayer():void{
player.clearState();
controller.disable();
if (player.crash_vy == 0){
player.crash_angle = (360 - player.angle);
level.moveBG(player.vy);
} else {
player.crash_angle = (360 - player.crash_angle);
level.moveBG(player.crash_vy);
};
player.crash_vy = -7;
player.crash_vx = (player.vx / 4);
player.gotoAndPlay("crashingRight");
player.vy = 0;
player.vx = 0;
player.hitFloor = true;
var _local1:Sound = new Impact();
_local1.play();
}
protected function continueCrash():void{
if (crashTimer >= 40){
player.hitFloor = false;
player.crash_vy = 0;
player.vx = player.crash_vx;
player.crash_vx = 0;
player.vBoost = 0;
player.slideBoost = 0;
controller.enable();
player.gotoAndPlay("accelerating");
crashTimer = 0;
} else {
crashTimer++;
applyFriction();
level.scrollLevel(player.crash_vx, player.crash_vy);
};
}
protected function applyFriction():void{
var _local1:Number = player.vz;
if (_local1 > 1){
player.vz = (player.vz - WATER_FRICTION);
} else {
if (_local1 < -1){
player.vz = (player.vz + WATER_FRICTION);
} else {
if (level.bottom > 275){
player.vy = GRAVITY;
} else {
player.vy = 0;
};
};
};
var _local2:* = player.crash_vz;
if (_local2 > WATER_FRICTION){
player.crash_vz = (player.crash_vz - WATER_FRICTION);
} else {
if (_local2 < -(WATER_FRICTION)){
player.crash_vz = (player.crash_vz + WATER_FRICTION);
} else {
if ((((_local2 < _local1)) && (!((_local2 == 0))))){
player.vz = (_local1 + _local2);
player.crash_vz = 0;
player.crash_angle = player.angle;
};
};
};
}
protected function nice_entry(_arg1:Boolean):void{
if (_arg1){
player.vBoost = (player.vBoost + 2);
} else {
player.vBoost = 0;
};
}
protected function buildUI():void{
ui = new Sprite();
addChild(ui);
menuButton = new MenuButton();
menuButton.focusRect = false;
menuButton.x = ((640 - menuButton.width) - 10);
menuButton.y = ((480 - menuButton.height) - 10);
menuButton.addEventListener(MouseEvent.CLICK, onMenuButtonClick);
ui.addChild(menuButton);
menu.addButton(new HelpButton(), sg.showHelp);
muteButton = new MuteButton();
muteButton.x = ((menuButton.x - muteButton.width) - 30);
muteButton.y = ((menuButton.y + menuButton.height) - muteButton.height);
muteButton.buttonMode = true;
addChild(muteButton);
muteButton.addEventListener(MouseEvent.CLICK, onMute);
}
protected function onMute(_arg1:MouseEvent):void{
if (!muted){
SoundMixer.soundTransform = new SoundTransform(0);
muted = true;
muteButton.gotoAndStop("off");
} else {
muted = false;
SoundMixer.soundTransform = new SoundTransform(1);
muteButton.gotoAndStop("on");
};
}
protected function drawText(_arg1:TextField):void{
}
protected function setWind():void{
var _local1:int = MathSG.randNum(0, 2);
var _local2:Number = 0;
if (_local1 == 1){
_local2 = MathSG.normalize(MathSG.randNum(-40, 40));
} else {
_local2 = MathSG.randNum(140, 220);
};
windUI.windVane.rotation = _local2;
var _local3:Number = (MathSG.randNum(0, 60) + (MathSG.randNum(1, 11) / 10));
_local3 = 0;
windUI.wind_txt.text = (_local3 + " km/h");
windUI.wind_txt.cacheAsBitmap = true;
_local2 = MathSG.rad(_local2);
windAX = ((Math.cos(_local2) * _local3) / 400);
windAY = ((Math.sin(_local2) * _local3) / 400);
windVX = (windVY = 0);
windAng = _local2;
windStr = _local3;
player.drag = windAX;
}
protected function checkSpeed(_arg1:Event):void{
var _local2:Number = (player.vz + player.vBoost);
if (_local2 > highest_speed){
highest_speed = _local2;
};
}
protected function onMenuButtonClick(_arg1:MouseEvent):void{
if (sg.helpScreen.parent != null){
sg.removeChild(sg.helpScreen);
} else {
pause();
};
}
override public function pause():void{
super.pause();
if (paused){
controller.disable();
player.endSparkle();
} else {
controller.enable();
player.startSparkle();
};
}
}
}//package com.rawkins.games.dolphinOlympics
Section 21
//Greenfish (com.rawkins.games.dolphinOlympics.Greenfish)
package com.rawkins.games.dolphinOlympics {
import flash.utils.*;
public class Greenfish extends Fish {
private var turnCounter:Number;// = 0
private var landTimer:Timer;
public function Greenfish(_arg1:Number=0, _arg2:Number=0):void{
addFrameScript(18, frame19, 29, frame30, 30, frame31);
super(_arg1, _arg2);
landTimer = new Timer(1000, 1);
_scalar = ((Math.random() / 6) + 0.25);
scaleX = (scaleY = _scalar);
}
override protected function swim():void{
updateSpeed();
if (!activated){
if (this.y > _bottom){
if ((((_angle > (Math.PI / 2))) && ((_angle < (Math.PI * 1.5))))){
_angle = (_angle + 0.1);
} else {
_angle = (_angle - 0.1);
};
} else {
changeDir();
};
} else {
follow();
};
this.x = (this.x + _vx);
this.y = (this.y + _vy);
}
override public function startJump():void{
super.startJump();
if ((((angle > (Math.PI / 2))) && ((angle < (Math.PI * 1.5))))){
dirAdjust = Math.PI;
} else {
dirAdjust = 0;
};
}
override protected function changeDir():void{
if (!landTimer.running){
angle = (Math.sin(turnCounter) + dirAdjust);
turnCounter = (turnCounter + 0.1);
};
}
override public function endJump():void{
super.endJump();
_turnCounter = Math.sin(angle);
landTimer.start();
}
function frame19(){
gotoAndPlay("normal");
}
function frame30(){
gotoAndPlay("active");
}
function frame31(){
stop();
}
}
}//package com.rawkins.games.dolphinOlympics
Section 22
//HeightTrick (com.rawkins.games.dolphinOlympics.HeightTrick)
package com.rawkins.games.dolphinOlympics {
public class HeightTrick extends Trick {
private var _done:Boolean;
private var _height:Number;
public function HeightTrick(_arg1:String, _arg2:uint, _arg3:Number, _arg4:Function=null):void{
super(_arg1, _arg2, _arg4);
_done = false;
_height = _arg3;
}
public function get height():Number{
return (_height);
}
public function get done():Boolean{
return (_done);
}
public function set done(_arg1:Boolean):void{
_done = _arg1;
}
}
}//package com.rawkins.games.dolphinOlympics
Section 23
//Level (com.rawkins.games.dolphinOlympics.Level)
package com.rawkins.games.dolphinOlympics {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.media.*;
import com.rawkins.fx.*;
import flash.utils.*;
import com.rawkins.utils.*;
public class Level extends Sprite {
private var _ocean:Background;
private var _water:Water;
private var _floor:Background;
private var _floor2:Background;
private var _floor3:Background;
private var _reef:Background;
private var _starPaths:Background;
private var _sky:Background;
private var _planets:Background;
private var _clouds:Background;
private var _oceanObjects:Background;
private var _scrollable:Array;
private var sky:Sprite;
private var wave1:Sprite;
private var wave2:Sprite;
private var foreGround:Array;
private var backGround:Array;
private var midGround:Array;
private var midGround2:Array;
public var bg:Sprite;
public var fg:Sprite;
public var mg:Sprite;
private var pm:ParticleManager;
private var theHour:uint;
private var leftBound:Number;// = -640
private var rightBound:Number;// = 640
private var sLeftBound:Number;// = -5000
private var sRightBound:Number;// = 5000
private var topBound:int;// = -100
private var bottomBound:int;// = 580
private var surface:SlidePath;
private var watchList:Array;
protected var floorDepth1:int;// = 500
protected var floorDepth2:int;// = 600
protected var floorDepth3:int;// = 700
private var slidePaths:Array;
private var stars1:Starfield;
private var stars2:Starfield;
private var stars3:Starfield;
private var starFields:Array;
public var starHeight:Number;// = -1500
public var celebHeight:Number;// = -1750
public var moonHeight:Number;// = -3500
public var marsHeight:Number;// = -6000
public var nebulaHeight:Number;// = -8000
public var jupiterHeight:Number;// = -11000
public var saturnHeight:Number;// = -14000
public var neptuneHeight:Number;// = -30000
public var uranusHeight:Number;// = -20000
public var plutoHeight:Number;// = -45000
public var endHeight:Number;// = -100000
private var oceanObjs:Array;
private var _creatures:Array;
private var _fish:Array;
private var _birds:Array;
public var collidables:Array;
protected var collCount:int;// = 0
protected var ringCount:int;// = 0
protected var skyRingCount:int;// = 0
protected var waterRingCount:int;// = 0
protected var maxRings:int;// = 5
protected var ringTimer:Timer;
protected var skyRingBase:Point;
protected var waterRingBase:Point;
protected var ringSwitch:Number;// = 0
private var splash_sound:Sound;
public var time:Date;
public function Level():void{
foreGround = new Array();
midGround2 = new Array();
midGround = new Array();
backGround = new Array();
slidePaths = new Array();
bg = new Sprite();
mg = new Sprite();
fg = new Sprite();
addChild(bg);
var _local1:Date = new Date();
theHour = _local1.hours;
watchList = new Array();
_creatures = new Array();
_fish = new Array();
_birds = new Array();
collidables = new Array();
_oceanObjects = new Background(topBound, rightBound, bottomBound, leftBound);
ringTimer = new Timer(10000);
ringTimer.addEventListener(TimerEvent.TIMER, addRing);
}
public function startRings():void{
if (!ringTimer.running){
ringTimer.start();
};
}
public function stopRings():void{
if (ringTimer.running){
ringTimer.stop();
};
}
public function refresh():void{
for each (path in slidePaths) {
path.slideBoost = 1;
};
for each (f in _fish) {
f.x = MathSG.randNum(sLeftBound, sRightBound);
};
surface.slideBoost = 0;
}
public function buildLevel(){
var _local10:*;
_scrollable = new Array();
this.y = (this.y + 200);
_ocean = new Background(topBound, rightBound, bottomBound, leftBound);
_scrollable.push(_ocean);
_water = new Water();
_ocean.addTile(_water, false, true);
bg.addChild(_ocean);
wave1 = new Waves();
wave2 = new Waves();
wave1.cacheAsBitmap = (wave2.cacheAsBitmap = true);
wave2.x = -(wave2.width);
wave1.y = (wave2.y = (-(wave1.height) + 2));
_ocean.addTile(wave1, true);
_ocean.addTile(wave2, true);
surface = new SlidePath(0.2);
surface.curveTo(0, 0, 640, 0);
surface.drawPath();
surface.draw();
surface.y = (surface.y - wave1.height);
bg.addChild(surface);
surface.visible = true;
surface.name = "surface";
slidePaths.push(surface);
_floor2 = new Background(topBound, rightBound, bottomBound, leftBound, 0.125);
_scrollable.push(_floor2);
var _local1:Floor3 = new Floor3();
var _local2:Floor4 = new Floor4();
_local1.cacheAsBitmap = (_local2.cacheAsBitmap = true);
_local2.x = -(_local2.width);
_floor2.y = ((_water.height + _water.y) - _local2.height);
_floor2.addTile(_local1, true, true);
_floor2.addTile(_local2, true, true);
_floor3 = new Background(topBound, rightBound, bottomBound, leftBound, 0.05);
_scrollable.push(_floor3);
var _local3:Floor5 = new Floor5();
var _local4:Floor6 = new Floor6();
new Floor6().x = -(_local4.width);
_floor3.addTile(_local3, true, true);
_floor3.addTile(_local4, true, true);
_floor3.y = ((_water.height + _water.y) - _local3.height);
bg.addChild(_floor3);
bg.addChild(_floor2);
_reef = new Background(topBound, rightBound, bottomBound, leftBound, 0.25);
_scrollable.push(_reef);
_reef.y = ((_water.height + _water.y) - 10);
var _local5:FullReef1 = new FullReef1();
var _local6:FullReef2 = new FullReef2();
new FullReef2().x = -(_local6.width);
_local5.cacheAsBitmap = true;
_local6.cacheAsBitmap = true;
_reef.addTile(_local5, true, true);
_reef.addTile(_local6, true, true);
_reef.y = (_reef.y - 75);
bg.addChild(_reef);
_floor = new Background(topBound, rightBound, bottomBound, leftBound);
_scrollable.push(_floor);
_floor.y = (_water.height + _water.y);
var _local7:Floor1 = new Floor1();
var _local8:Floor2 = new Floor2();
_local7.cacheAsBitmap = (_local8.cacheAsBitmap = true);
_local8.x = -(_local8.width);
_floor.addTile(_local7, true);
_floor.addTile(_local8, true);
var _local9:FloorBase = new FloorBase();
_floor.addTile(_local9);
_local9.y = _local7.height;
_floor.y = (_floor.y - 32);
bg.addChild(_floor);
_local9.y = (_local9.y - 1);
buildStars();
addFish(25);
addGulls(3);
pm = new ParticleManager();
bg.addChild(pm);
_sky = new Background(topBound, rightBound, bottomBound, leftBound, 0.5);
_scrollable.push(_sky);
if ((((theHour >= 19)) && ((theHour < 22)))){
sky = new EveningSky();
starHeight = (starHeight + 400);
darken(_ocean, -50);
darken(_floor2, -50);
darken(_floor3, -50);
darken(_reef, -50);
} else {
if ((((theHour >= 22)) || ((theHour <= 4)))){
sky = new NightSky();
darken(_ocean, -90);
starHeight = (starHeight + 750);
darken(_floor2, -90);
darken(_floor3, -90);
darken(_reef, -90);
} else {
sky = new SunnySky();
_local10 = new WaterRays();
_local10.alpha = 0.46;
_ocean.addTile(_local10, false, true);
};
};
sky.y = (sky.y - (sky.height - 2));
sky.cacheAsBitmap = true;
_sky.addTile(sky, false, false);
bg.addChildAt(_sky, 0);
_clouds = new Background(topBound, rightBound, bottomBound, leftBound, 0.5);
_scrollable.push(_clouds);
bg.addChild(_clouds);
addClouds(MathSG.randNum(2, 4));
addChild(_oceanObjects);
}
protected function addRing(_arg1:TimerEvent):void{
var _local2:Number;
var _local3:Point;
var _local4:Ring;
if (ringCount < maxRings){
_local2 = MathSG.randNum(0, 2);
if (_local2 == 1){
if ((((skyRingCount == 0)) || ((skyRingBase == null)))){
if (skyRingBase == null){
skyRingBase = new Point(MathSG.randNum(leftBound, rightBound), MathSG.randNum(-650, -200));
} else {
skyRingBase.x = (skyRingBase.x + 4000);
skyRingBase.y = MathSG.randNum(-650, -200);
};
};
_local3 = skyRingBase;
} else {
if ((((waterRingCount == 0)) || ((waterRingBase == null)))){
if (waterRingBase == null){
waterRingBase = new Point(MathSG.randNum(leftBound, rightBound), MathSG.randNum(200, 600));
} else {
waterRingBase.x = (waterRingBase.x + 4000);
waterRingBase.y = MathSG.randNum(200, 600);
};
};
_local3 = waterRingBase;
};
if (_local3.y < 0){
_local4 = new Ring(0xFF0000);
skyRingCount++;
} else {
_local4 = new Ring();
waterRingCount++;
};
_local4.x = (_local3.x + (ringCount * 600));
_local4.y = ((_local3.y + (150 * Math.sin(ringSwitch))) + bg.y);
ringSwitch = (ringSwitch + (Math.PI / 2));
collCount++;
_local4.name = ("ring" + collCount);
_oceanObjects.addTile(_local4);
collidables.push(_local4);
_local4.addEventListener(Collidable.COLLIDABLE_DEAD, killColl);
ringCount++;
};
}
protected function killColl(_arg1:Event):void{
var _local4:Collidable;
var _local5:int;
var _local2:Collidable = _arg1.target;
_local2.removeEventListener(Collidable.COLLIDABLE_DEAD, killColl);
var _local3:int;
while (_local3 < collidables.length) {
_local4 = collidables[_local3];
if (_local2.name == _local4.name){
collidables.splice(_local3, 1);
_local5 = _local2.name.indexOf("ring");
if (_local5 != -1){
if (_local2.y < 0){
skyRingCount--;
} else {
waterRingCount--;
};
ringCount--;
};
};
_local3++;
};
_oceanObjects.removeTile(_local2);
_local2 = null;
}
private function buildStars():void{
var _local2:Sprite;
stars1 = new Starfield(25, 100);
stars1.y = starHeight;
stars2 = new Starfield(25, 100);
stars2.y = (starHeight - 480);
stars3 = new Starfield(25, 100);
stars3.y = (starHeight - 960);
bg.addChild(stars1);
bg.addChild(stars2);
bg.addChild(stars3);
stars1.build();
stars2.build();
stars3.build();
starFields = [stars1, stars2, stars3];
_planets = new Background(topBound, rightBound, bottomBound, leftBound);
var _local1:Sprite = new Moon();
_local1.y = moonHeight;
_planets.addTile(_local1);
_local1.cacheAsBitmap = true;
_local2 = new Mars();
_local2.y = marsHeight;
_local2.x = (600 - _local2.width);
_planets.addTile(_local2);
_local2.cacheAsBitmap = true;
var _local3:Sprite = new Nebula();
_local3.y = nebulaHeight;
_local3.cacheAsBitmap = true;
_planets.addTile(_local3);
var _local4:Sprite = new Jupiter();
_local4.y = jupiterHeight;
_local4.x = (640 - _local4.width);
_local4.cacheAsBitmap = true;
_planets.addTile(_local4);
var _local5:Sprite = new Saturn();
_local5.y = saturnHeight;
_local5.x = (_local5.x + 100);
_local5.cacheAsBitmap = true;
_planets.addTile(_local5);
var _local6:Sprite = new Neptune();
_local6.y = neptuneHeight;
_local6.cacheAsBitmap = true;
_planets.addTile(_local6);
var _local7:Sprite = new Uranus();
_local7.y = uranusHeight;
_local7.x = 340;
_local7.cacheAsBitmap = true;
_planets.addTile(_local7);
var _local8:Sprite = new Pluto();
_local8.y = plutoHeight;
_local8.x = 170;
_local8.cacheAsBitmap = true;
_planets.addTile(_local8);
var _local9:Sprite = new Diner();
_local9.y = endHeight;
_local9.x = (_local9.x - 15);
_local9.cacheAsBitmap = true;
_planets.addTile(_local9);
bg.addChild(_planets);
_starPaths = new Background(topBound, sRightBound, bottomBound, sLeftBound);
_scrollable.push(_starPaths);
var _local10:StarPath = new StarPath();
_local10.curveTo(408, 288, 884, -4);
_local10.curveTo(1368, -348, 1820, 0);
_local10.drawPath();
_local10.draw();
_local10.y = (_local10.y + (moonHeight - 300));
slidePaths.push(_local10);
_starPaths.addTile(_local10, true);
var _local11:StarPath = new StarPath();
_local11.curveTo(288, 84, 546, -18);
_local11.curveTo(852, -138, 984, -402);
_local11.curveTo(1134, -702, 1032, -936);
_local11.curveTo(834, -1320, 354, -1236);
_local11.curveTo(6, -1104, 24, -738);
_local11.curveTo(66, -402, 432, -234);
_local11.curveTo(840, -60, 1308, -42);
_local11.curveTo(1980, -6, 2190, 252);
_local11.curveTo(2394, 636, 2112, 942);
_local11.curveTo(1686, 1170, 1428, 738);
_local11.curveTo(1350, 390, 1668, 294);
_local11.curveTo(2088, 192, 2508, 276);
_local11.curveTo(2778, 300, 2934, 204);
_local11.drawPath();
_local11.draw();
_local11.y = (marsHeight + 200);
_local11.x = (_local11.x + 4950);
slidePaths.push(_local11);
_starPaths.addTile(_local11, true);
var _local12:StarPath = new StarPath();
_local12.curveTo(456, 444, 1278, 330);
_local12.curveTo(2184, 180, 2628, 414);
_local12.curveTo(3300, 702, 3666, 300);
_local12.y = (nebulaHeight + 450);
_local12.x = (_local12.x - 4950);
_local12.drawPath();
_local12.draw();
slidePaths.push(_local12);
_starPaths.addTile(_local12, true);
var _local13:StarPath = new StarPath();
_local13.curveTo(260, -128, 484, -4);
_local13.curveTo(808, 164, 1052, -12);
_local13.curveTo(1376, -252, 1248, -640);
_local13.curveTo(1136, -884, 804, -868);
_local13.curveTo(464, -820, 484, -520);
_local13.curveTo(516, -216, 868, -200);
_local13.curveTo(1400, -220, 1576, -32);
_local13.curveTo(1824, 228, 2124, 12);
_local13.curveTo(2456, -228, 1900, -476);
_local13.curveTo(1612, -632, 1708, -800);
_local13.curveTo(1844, -1024, 2264, -696);
_local13.y = (nebulaHeight - 250);
_local13.x = 500;
_local13.drawPath();
_local13.draw();
slidePaths.push(_local13);
_starPaths.addTile(_local13, true);
var _local14:StarPath = new StarPath();
_local14.curveTo(904, 32, 1044, -456);
_local14.curveTo(1496, -1132, 596, -1232);
_local14.curveTo(28, -1304, 184, -1692);
_local14.curveTo(372, -1992, 752, -1892);
_local14.y = (jupiterHeight + 300);
_local14.x = 3500;
_local14.drawPath();
_local14.draw();
slidePaths.push(_local14);
_starPaths.addTile(_local14, true);
var _local15:StarPath = new StarPath();
_local15.curveTo(4, -484, 664, -424);
_local15.curveTo(1296, -356, 1772, -560);
_local15.curveTo(2260, -780, 2420, -456);
_local15.y = (saturnHeight - 300);
_local15.x = (_local15.x + 4500);
_local15.drawPath();
_local15.draw();
slidePaths.push(_local15);
_starPaths.addTile(_local15, true);
var _local16:StarPath = new StarPath();
_local16.curveTo(776, -68, 932, -232);
_local16.curveTo(1100, -368, 936, -436);
_local16.curveTo(640, -540, -76, -460);
_local16.curveTo(-420, -388, -100, -284);
_local16.curveTo(452, -220, 736, -384);
_local16.curveTo(1016, -544, 740, -592);
_local16.curveTo(472, -676, 12, -636);
_local16.curveTo(-140, -588, -12, -524);
_local16.curveTo(412, -464, 576, -580);
_local16.curveTo(732, -700, 564, -760);
_local16.curveTo(468, -808, 296, -808);
_local16.curveTo(140, -768, 276, -716);
_local16.curveTo(476, -708, 504, -900);
_local16.curveTo(492, -1060, 408, -1044);
_local16.y = (neptuneHeight + 300);
_local16.x = (_local16.x - 2000);
_local16.drawPath();
_local16.draw();
slidePaths.push(_local16);
_starPaths.addTile(_local16, true);
var _local17:StarPath = new StarPath();
_local17.curveTo(138, 612, 0x0300, 408);
_local17.curveTo(2076, -66, 2682, 300);
_local17.curveTo(2976, 492, 2994, 732);
_local17.curveTo(2964, 1056, 2640, 1190);
_local17.curveTo(1974, 1368, 1805, 888);
_local17.y = (saturnHeight - 1300);
_local17.x = (_local17.x - 1000);
_local17.drawPath();
_local17.draw();
_local17.cacheAsBitmap = false;
slidePaths.push(_local17);
_starPaths.addTile(_local17, true);
var _local18:StarPath = new StarPath();
_local18.curveTo(628, -4, 684, -556);
_local18.curveTo(676, -1060, 0, -1164);
_local18.curveTo(-660, -1080, -628, -544);
_local18.curveTo(-536, -136, -124, -188);
_local18.curveTo(416, -216, 376, -588);
_local18.curveTo(376, -924, 24, -948);
_local18.curveTo(-300, -880, -284, -624);
_local18.curveTo(-236, -360, 4, -372);
_local18.curveTo(221, -404, 208, -600);
_local18.curveTo(204, -788, 4, -782);
_local18.y = neptuneHeight;
_local18.x = (_local18.x + -4950);
_local18.drawPath();
_local18.draw();
slidePaths.push(_local18);
_starPaths.addTile(_local18, true);
var _local19:StarPath = new StarPath();
_local19.curveTo(165, -195, 475, -185);
_local19.curveTo(775, -190, 910, -30);
_local19.curveTo(1030, 190, 915, 345);
_local19.curveTo(765, 520, 560, 530);
_local19.curveTo(260, 485, 245, 245);
_local19.curveTo(295, 15, 545, 25);
_local19.curveTo(910, 15, 1345, 345);
_local19.curveTo(1640, 550, 1980, 460);
_local19.curveTo(2415, 360, 2535, 20);
_local19.curveTo(2710, -535, 2015, -760);
_local19.curveTo(1530, -815, 1455, -435);
_local19.curveTo(1410, -125, 1905, -80);
_local19.curveTo(2185, -35, 2415, -290);
_local19.y = (uranusHeight + 250);
_local19.x = (_local19.x + 0);
_local19.drawPath();
_local19.draw();
slidePaths.push(_local19);
_starPaths.addTile(_local19, true);
var _local20:StarPath = new StarPath();
_local20.curveTo(540, 268, 1204, 20);
_local20.curveTo(1828, -296, 1636, -792);
_local20.curveTo(1392, -1192, 772, -1044);
_local20.curveTo(292, -820, 540, -360);
_local20.curveTo(804, 52, 2112, -204);
_local20.curveTo(2676, -280, 2976, -592);
_local20.curveTo(3252, -880, 3704, -688);
_local20.y = (_local20.y + (plutoHeight - 2000));
_local20.x = (_local20.x + 4000);
_local20.drawPath();
_local20.draw();
slidePaths.push(_local20);
_starPaths.addTile(_local20, true);
bg.addChild(_starPaths);
}
private function scrollStars(_arg1):void{
if ((((_arg1 < 0)) && ((bg.y > (-(starHeight) - 480))))){
for each (sf in starFields) {
if (bg.y > -((sf.y - 480))){
sf.y = (sf.y - 1440);
sf.showMore();
};
};
} else {
if ((((_arg1 > 0)) && ((bg.y > (-(starHeight) + 480))))){
for each (sf in starFields) {
if (bg.y < -((sf.y + 480))){
sf.y = (sf.y + 1440);
sf.showLess();
};
};
};
};
}
private function darken(_arg1:DisplayObject, _arg2:Number=-50){
var _local3:ColorTransform = new ColorTransform();
_local3.blueOffset = (_local3.redOffset = (_local3.greenOffset = _arg2));
_arg1.transform.colorTransform = _local3;
}
public function scrollLevel(_arg1:Number, _arg2:Number){
for each (c in collidables) {
c.x = (c.x - _arg1);
c.y = (c.y - _arg2);
if (c.x < sLeftBound){
c.x = (sRightBound - c.width);
} else {
if (c.x > sRightBound){
c.x = (sLeftBound + c.width);
};
};
};
bg.y = (bg.y - _arg2);
for each (background in _scrollable) {
background.scroll(_arg1);
};
scrollStars(_arg2);
pm.update();
pm.x = (pm.x - _arg1);
}
public function scrollTiles(_arg1:Array, _arg2:Number, _arg3:Number, _arg4:Number=0, _arg5:Number=0):void{
var _local7:Object;
if (_arg4 == 0){
_arg4 = rightBound;
};
if (_arg5 == 0){
_arg5 = leftBound;
};
var _local6:uint;
while (_local6 < _arg1.length) {
_local7 = _arg1[_local6];
if (_local7.name != "surface"){
_local7.x = (_local7.x - _arg2);
};
if (_local7.x > _arg4){
_local7.x = _arg5;
};
if (_local7.x < _arg5){
_local7.x = _arg4;
};
_local6++;
};
}
public function splash(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Boolean=false){
var _local7:WaterDrop;
var _local8:int;
var _local5:Number = Math.abs(_arg3);
var _local6:uint;
while (_local6 < (_local5 * 2)) {
_local7 = new WaterDrop();
if (!_arg4){
_local7.bounded = false;
};
_local8 = Math.floor((Math.random() * 2));
if (_local8 == 0){
_local8 = -1;
};
_local7.vx = (_local8 * (Math.random() + (_local5 / 200)));
_local7.vy = (((Math.random() * 5) * -(Math.random())) - (_local5 / 6));
_local7.x = ((_arg1 - pm.x) - ((Math.random() * _arg3) / 2));
_local7.y = _arg2;
_local7.draw();
_local7.cacheAsBitmap = true;
pm.addParticle(_local7);
_local6++;
};
}
private function addClouds(_arg1:uint){
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Sprite;
var _local2:uint;
while (_local2 < _arg1) {
_local3 = MathSG.randNum(0, 3);
_local4 = MathSG.randNum(leftBound, rightBound);
_local5 = MathSG.randNum(-600, -400);
_local6 = MathSG.randNum(0, 2);
if (_local6 == 1){
_local4 = -(_local4);
};
_local7 = null;
switch (_local3){
case 0:
_local7 = new Cloud1();
break;
case 1:
_local7 = new Cloud2();
break;
case 2:
_local7 = new Cloud3();
break;
};
_local7.x = _local4;
_local7.y = _local5;
_local7.cacheAsBitmap = true;
_clouds.addTile(_local7, true, true);
_local2++;
};
}
private function addFish(_arg1:uint):void{
var _local3:Number;
var _local4:Number;
var _local5:int;
var _local6:MovieClip;
var _local2:int;
while (_local2 < _arg1) {
_local3 = MathSG.randNum(sLeftBound, sRightBound);
_local4 = MathSG.randNum(100, 600);
_local5 = MathSG.randNum(1, 5);
switch (_local5){
case 1:
_local6 = new Orangefish(bg.y, _water.height);
break;
case 2:
_local6 = new Fish(bg.y, _water.height);
break;
case 3:
_local6 = new Greenfish(bg.y, _water.height);
break;
case 4:
_local6 = new Bluefish(bg.y, _water.height);
break;
};
_local6.x = _local3;
_local6.y = _local4;
_oceanObjects.addTile(_local6);
collidables.push(_local6);
_fish.push(_local6);
_local2++;
};
}
private function addGulls(_arg1:uint):void{
var _local3:Number;
var _local4:Number;
var _local5:MovieClip;
var _local2:int;
while (_local2 < _arg1) {
_local3 = MathSG.randNum(sLeftBound, sRightBound);
_local4 = MathSG.randNum(-350, -450);
_local5 = new Seagull(-200, 200);
_local5.x = _local3;
_local5.y = _local4;
_oceanObjects.addTile(_local5);
collidables.push(_local5);
birds.push(_local5);
_local2++;
};
}
public function fireworks(_arg1:Number, _arg2:Number, _arg3:int=3, _arg4:Number=0, _arg5:Number=0):void{
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:int;
var _local15:Number;
var _local16:int;
var _local17:Firework;
var _local6:int = _arg3;
var _local7 = 50;
var _local8:Number = (360 / _local7);
var _local9:int;
while (_local9 < _local6) {
_local10 = 100;
_local11 = MathSG.randNum(-(_local10), _local10);
_local12 = MathSG.randNum(-(_local10), _local10);
_local14 = MathSG.randNum(0, 6);
switch (_local14){
case 0:
_local13 = 0xFFFF;
break;
case 1:
_local13 = 0xFF;
break;
case 2:
_local13 = 0xFFFF00;
break;
case 3:
_local13 = 0xFF00;
break;
case 4:
_local13 = 0xFF0000;
break;
case 5:
_local13 = 0xFF00FF;
break;
};
_local15 = MathSG.randNum(13, 20);
_local16 = 0;
while (_local16 < _local7) {
_local17 = new Firework((_local15 + (Math.random() * 2)), (_local16 * _local8), 20, _local13);
_local17.x = (((_arg1 - pm.x) + _local11) + (_arg4 * 8));
_local17.y = ((_arg2 + _local12) + (_arg5 * 8));
_local17.draw();
pm.addParticle(_local17);
_local16++;
};
_local9++;
};
}
public function addJumpBar():Sprite{
var _local1:Sprite = new Sprite();
_local1.graphics.lineStyle(1, 1, 1);
_local1.graphics.beginFill(0xFFFFFF, 1);
_local1.graphics.drawCircle(0, 0, 10);
addChild(_local1);
return (_local1);
}
public function removeJumpBar(_arg1:Sprite):void{
if (contains(_arg1)){
removeChild(_arg1);
};
}
public function reset():void{
bg.y = Math.floor(bg.y);
while (bg.y != 0) {
if (bg.y > 0){
scrollLevel(0, 1);
} else {
if (bg.y < 0){
scrollLevel(0, -1);
};
};
};
refresh();
wave1.x = 0;
wave2.x = 0;
wave2.x = -(wave2.width);
ringBase = null;
}
public function pause():void{
}
public function resume():void{
}
public function moveBG(_arg1:Number):void{
bg.y = (bg.y + _arg1);
}
public function get surfaceHeight():Number{
return (bg.y);
}
public function get bottom():Number{
return (((bg.y + _water.height) - 20));
}
public function get paths():Array{
return (slidePaths);
}
public function get creatures():Array{
return (_creatures);
}
public function set creatures(_arg1:Array):void{
_creatures = _arg1;
}
public function get fish():Array{
return (_fish);
}
public function set fish(_arg1:Array){
_fish = _arg1;
}
public function get birds():Array{
return (_birds);
}
public function set birds(_arg1:Array){
_birds = _arg1;
}
public function get particleManager():ParticleManager{
return (pm);
}
}
}//package com.rawkins.games.dolphinOlympics
Section 24
//Orangefish (com.rawkins.games.dolphinOlympics.Orangefish)
package com.rawkins.games.dolphinOlympics {
import flash.utils.*;
import com.rawkins.utils.*;
public class Orangefish extends Fish {
private var turnCounter:Number;// = 0
private var landTimer:Timer;
public function Orangefish(_arg1:Number=0, _arg2:Number=0):void{
addFrameScript(12, frame13, 26, frame27, 42, frame43);
super(_arg1, _arg2);
landTimer = new Timer(1000, 1);
_turnSpeed = 0.15;
angle = MathSG.randNum(0, (Math.PI * 2));
}
override protected function swim():void{
updateSpeed();
if (!activated){
if (this.y > _bottom){
if ((((_angle > (Math.PI / 2))) && ((_angle < (Math.PI * 1.5))))){
_angle = (_angle + 0.1);
} else {
_angle = (_angle - 0.1);
};
} else {
changeDir();
};
} else {
follow();
};
this.x = (this.x + _vx);
this.y = (this.y + _vy);
}
override protected function jump():void{
super.jump();
angle = (angle + 0.2);
}
override public function startJump():void{
super.startJump();
if ((((angle > (Math.PI / 2))) && ((angle < (Math.PI * 1.5))))){
dirAdjust = Math.PI;
} else {
dirAdjust = 0;
};
}
override protected function changeDir():void{
if (!landTimer.running){
angle = (angle + (0.25 * Math.sin(turnCounter)));
turnCounter = (turnCounter + 0.1);
};
}
override public function endJump():void{
super.endJump();
_turnCounter = Math.sin(angle);
landTimer.start();
}
function frame13(){
gotoAndPlay("normal");
}
function frame27(){
gotoAndPlay("active");
}
function frame43(){
gotoAndPlay("jumping");
}
}
}//package com.rawkins.games.dolphinOlympics
Section 25
//Pirateship (com.rawkins.games.dolphinOlympics.Pirateship)
package com.rawkins.games.dolphinOlympics {
public class Pirateship extends Collidable {
public function Pirateship():void{
}
}
}//package com.rawkins.games.dolphinOlympics
Section 26
//Player (com.rawkins.games.dolphinOlympics.Player)
package com.rawkins.games.dolphinOlympics {
import flash.display.*;
import flash.events.*;
import com.rawkins.fx.*;
import flash.utils.*;
import com.rawkins.utils.*;
import flash.filters.*;
public dynamic class Player extends MovieClip {
public var hitzone_mc:hitzone;
private var _vx:Number;
private var _vy:Number;
private var _vz:Number;
private var _angle:Number;
public var flips:uint;
public var spinDegs:Number;
private var _crash_vx:Number;
private var _crash_vy:Number;
private var _crasy_vz:Number;
private var _crash_angle:Number;
private var stamina:Number;
private var staminaBoost:Number;
private var restID:Number;
private var _vBoost:Number;
private var _slideBoost:Number;
private var power:Number;// = 1.4
private var powerBoost:Number;
private var slideDir:String;
private var slideRatio:Number;
private var slideHeight:Number;// = 15
private var slideHeightRatio:Number;
private var startHeight:Number;
public var slideTime:Number;
private var slidePath:SlidePath;
private var pointing:String;
private var weight:Number;
private var thisClip_mc:MovieClip;
private var turnRadius:Number;
private var turnSpeed:Number;
private var maxTurn:Number;
private var spinDrag:Number;// = 0
var slowingDown:Boolean;
var accelerating:Boolean;
var turningLeft:Boolean;
var turningRight:Boolean;
var upsideDown:Boolean;
var moving:Boolean;
var jumping:Boolean;
var swimming:Boolean;// = true
var landing:Boolean;
var hitFloor:Boolean;
var exhausted:Boolean;
var resting:Boolean;
var sliding:Boolean;
var slideReady:Boolean;// = false
var kicked:Boolean;// = false
var rolling:Boolean;// = false
var betweenJumps:Boolean;// = false
private var stateRecord:Array;
private var recording:Boolean;// = false
public var replay:Boolean;// = false
public var controller;
public var ui;
private var thisGame:Game;
private var sparkCount:Number;// = 0
private var sparkTimer:Timer;
private var sparkSpeed:Number;// = 30
private var glowing:Boolean;// = false
private var oldBoost:uint;// = 0
private var pm:ParticleManager;
private var shadowCount:Number;// = 0
private var shadowSpeed:Number;// = 15
public var extensionTimer:Timer;
private var trailTimer:Timer;
public var rollFrameCount:uint;// = 0
public var rollCount:uint;// = 0
private var rollBuffer:uint;// = 0
private var rollInterval:uint;// = 2
private static var staminaMax:Number = 100;
private static var vMax:Number = 13;
private static var org_vMax;
private static var sparkMax:uint = 10;
private static var sparkSpread:uint = 40;
private static var baseGlow:uint = 2;
public function Player():void{
addFrameScript(31, frame32, 78, frame79, 115, frame116, 152, frame153, 168, frame169);
sparkTimer = new Timer(15);
sparkTimer.addEventListener(TimerEvent.TIMER, sparkle);
powerBoost = 0;
crash_vx = 0;
crash_vy = 0;
angle = 0;
vx = 0;
vy = 0;
vz = 0;
crash_angle = 0;
turnRadius = 2;
maxTurn = 10.5;
minTurn = 2;
vBoost = 0;
slideBoost = 0;
flips = 0;
spinDegs = 0;
accelerating = false;
moving = false;
turningLeft = false;
turningRight = false;
upsideDown = false;
jumping = false;
landing = false;
hitFloor = false;
direction = "right";
exhausted = false;
sliding = false;
slideDir = "";
scaleX = (scaleY = 0.9);
extensionTimer = new Timer(500, 2);
trailTimer = new Timer(50, 12);
trailTimer.addEventListener(TimerEvent.TIMER, leaveTrail);
}
public function update():void{
if (this.accelerating){
accelerate();
};
if (this.rolling){
roll();
};
if (this.turningLeft){
turn("left");
} else {
if (this.turningRight){
turn("right");
};
};
}
public function clearState():void{
this.accelerating = false;
this.turningLeft = false;
this.turningRight = false;
this.moving = false;
this.upsideDown = false;
this.slowingDown = false;
this.sliding = false;
}
public function glide():void{
if ((!(moving) & !(rolling))){
clearState();
this.moving = true;
this.gotoAndStop("moving");
};
}
public function startAccelerating():void{
if (((!(accelerating)) && (!(sliding)))){
this.accelerating = true;
if (((((((!(rolling)) && (!(turningLeft)))) && (!(turningRight)))) && (!(jumping)))){
this.gotoAndPlay("accelerating");
};
};
}
public function accelerate():void{
if (((((!(exhausted)) && (!(jumping)))) && (!(rolling)))){
if (this.vz < (vMax + vBoost)){
this.vz = (this.vz + power);
};
if (crash_vz > power){
crash_vz = (crash_vz - (power * 0.65));
this.vz = (this.vz + (power * 0.65));
};
};
}
public function endSparkle():void{
sparkTimer.stop();
}
public function startSparkle():void{
sparkTimer.start();
}
public function sparkle(_arg1:TimerEvent):void{
var _local2:Number;
var _local3:GlowFilter;
var _local4:Spark;
var _local5:Shadow;
var _local6:GlowFilter;
if (vBoost > 0){
if (vBoost != oldBoost){
_local3 = new GlowFilter();
_local3.blurX = (baseGlow + (vBoost * 0.5));
_local3.blurY = (baseGlow + (vBoost * 0.5));
_local3.alpha = (0.6 - (1.5 / vBoost));
_local3.strength = (3 - ((1 / vBoost) / 2));
_local3.color = 0xFFFFFF;
filters = [_local3];
glowing = true;
};
oldBoost = vBoost;
_local2 = (2 / vBoost);
if (sparkCount >= _local2){
_local4 = new Spark(0, 0, 50);
_local4.x = (((320 - pm.x) + (Math.random() * sparkSpread)) + (Math.random() * -(sparkSpread)));
_local4.y = (((240 - pm.parent.y) + (Math.random() * sparkSpread)) + (Math.random() * -(sparkSpread)));
_local4.draw();
pm.addParticle(_local4);
sparkCount = 0;
} else {
sparkCount = (sparkCount + 0.1);
};
if (slideBoost > 0){
if (shadowCount > shadowSpeed){
_local5 = new Shadow(this);
_local5.x = (320 - pm.x);
_local5.y = (240 - pm.parent.y);
if (sliding){
_local5.y = (_local5.y - 10);
};
_local5.draw();
pm.addParticle(_local5);
shadowCount = 0;
} else {
shadowCount = (shadowCount + slideBoost);
};
};
} else {
if (glowing){
if (filters[0].alpha > 0){
_local6 = filters[0];
filters[0].alpha = (_local6.alpha - 0.075);
filters = [_local6];
} else {
glowing = false;
filters = null;
};
};
};
}
public function speedTrail():void{
trailTimer.reset();
trailTimer.start();
}
private function leaveTrail(_arg1:TimerEvent):void{
var _local2:Shadow = new Shadow(this, 0, 0, 70, false);
_local2.x = (320 - pm.x);
_local2.y = (240 - pm.parent.y);
if (sliding){
_local2.y = (_local2.y - 10);
};
_local2.draw();
pm.addParticle(_local2);
}
public function startTurn(_arg1:String):void{
if ((((_arg1 == "left")) && (!(turningLeft)))){
turningLeft = true;
if (!rolling){
gotoAndStop("turningLeft");
};
} else {
if ((((_arg1 == "right")) && (!(turningRight)))){
turningRight = true;
if (!rolling){
gotoAndStop("turningRight");
};
};
};
}
public function endTurn(_arg1:String):void{
if (_arg1 == "left"){
turningLeft = false;
} else {
if (_arg1 == "right"){
turningRight = false;
};
};
if (((!(rolling)) && (!(sliding)))){
if (turningRight){
gotoAndStop("turningRight");
} else {
if (turningLeft){
gotoAndStop("turningLeft");
} else {
if (((accelerating) && (!(jumping)))){
gotoAndPlay("accelerating");
} else {
gotoAndStop("moving");
};
};
};
};
}
private function turn(_arg1:String):void{
var _local4:Number;
var _local2:* = 0;
if (_arg1 == "left"){
_local2 = -1;
} else {
_local2 = 1;
};
var _local3:* = ((vz / turnRadius) + minTurn);
if (_local3 > maxTurn){
_local3 = maxTurn;
} else {
if (_local3 < -(maxTurn)){
_local3 = -(maxTurn);
};
};
if (jumping){
_local4 = 2.5;
if ((((_local3 < _local4)) && ((_local3 > 0)))){
_local3 = _local4;
} else {
if ((((_local3 > -(_local4))) && ((_local3 < 0)))){
_local3 = -(_local4);
};
};
if (rolling){
_local3 = (_local3 / 1.3);
};
spinDegs = (spinDegs + (_local2 * _local3));
_angle = (_angle + (_local2 * _local3));
} else {
_angle = (_angle + (_local2 * _local3));
};
if (_angle < 0){
_angle = (_angle + 360);
} else {
if (_angle > 360){
_angle = (_angle - 360);
};
};
rotation = _angle;
if ((((((_angle > 90)) && ((_angle < 270)))) || ((((_angle < -90)) && ((_angle > -270)))))){
pointing = "left";
} else {
pointing = "right";
};
}
public function startRoll(){
if (!rolling){
rolling = true;
gotoAndStop("rolling");
};
}
private function roll(){
var _local1:*;
if (!sliding){
rollBuffer++;
if (rollBuffer >= rollInterval){
rollBuffer = 0;
nextFrame();
rollFrameCount = (rollFrameCount + 1);
if (rollFrameCount >= 14){
gotoAndStop("rolling");
rollFrameCount = 0;
if (jumping){
rollCount++;
_local1 = new Event("Roll");
dispatchEvent(_local1);
};
};
};
};
}
public function stopRoll(){
this.rolling = false;
rollFrameCount = 0;
if (!sliding){
if (turningRight){
gotoAndStop("turningRight");
} else {
if (turningLeft){
gotoAndStop("turningLeft");
} else {
if (accelerating){
gotoAndPlay("accelerating");
};
};
};
};
}
public function land():void{
this.jumping = false;
this.sliding = false;
this.kicked = false;
this.swimming = true;
if (((((accelerating) && (!(turningLeft)))) && (!(turningRight)))){
gotoAndPlay("accelerating");
};
spinDegs = 0;
}
public function startSlide(_arg1:String, _arg2:SlidePath):void{
this.slidePath = _arg2;
this.kicked = false;
clearState();
this.sliding = true;
slideTime = 0;
gotoAndPlay("tailslide");
y = (y - slideHeight);
startHeight = y;
slideDir = _arg1;
vy = 0;
slideRatio = (90 / vx);
}
public function slide():void{
slideTime++;
}
public function endSlide():void{
if (slideDir == "right"){
gotoAndStop("turningRight");
angle = (180 + ((vx * slideRatio) * 2));
} else {
if (slideDir == "left"){
gotoAndStop("turningLeft");
angle = (360 - ((vx * slideRatio) * 2));
};
};
slideTime = 0;
this.sliding = false;
this.jumping = true;
crash_vz = 0;
slideReady = false;
y = 240;
vy = (vy - 2);
var _local1:* = new Event("EndSlide");
dispatchEvent(_local1);
}
public function popSlide():void{
var _local1:*;
if (!kicked){
this.kicked = true;
gotoAndStop("moving");
vy = ((-(Math.abs((this.vx / 1.5))) * slidePath.popMult) + slideBoost);
if (slideBoost > 0){
vy = (vy * (1 + (slideBoost / 4)));
};
if ((((angle > 0)) && ((angle < 180)))){
vx = -(vx);
};
_local1 = (360 + MathSG.deg(Math.atan2(this.vy, this.vx)));
if (slideDir == "right"){
angle = _local1;
} else {
angle = (180 + Math.abs(_local1));
};
endSlide();
};
}
public function helicopter():void{
var _local1:Number;
if (vx != 0){
_local1 = (vx / 2);
vy = (vy - Math.abs(vx));
vx = _local1;
};
}
public function maverick():void{
var _local1:Number = (vy / 2);
vy = (vy + _local1);
if (vx > 0){
vx = (vx + Math.abs(_local1));
} else {
vx = (vx - Math.abs(_local1));
};
}
public function set drag(_arg1:Number):void{
spinDrag = _arg1;
}
public function get vx():Number{
return (_vx);
}
public function set vx(_arg1:Number):void{
_vx = _arg1;
}
public function get vy():Number{
return (_vy);
}
public function set vy(_arg1:Number):void{
_vy = _arg1;
}
public function set vz(_arg1:Number):void{
dispatchEvent(new Event("VelocityChanged"));
vx = (Math.cos(((angle * Math.PI) / 180)) * _arg1);
vy = (Math.sin(((angle * Math.PI) / 180)) * _arg1);
}
public function get vz():Number{
return (Math.sqrt(((vx * vx) + (vy * vy))));
}
public function get crash_vx():Number{
return (_crash_vx);
}
public function set crash_vx(_arg1:Number):void{
_crash_vx = _arg1;
}
public function get crash_vy():Number{
return (_crash_vy);
}
public function set crash_vy(_arg1:Number):void{
_crash_vy = _arg1;
}
public function get crash_vz():Number{
return (Math.sqrt(((crash_vx * crash_vx) + (crash_vy * crash_vy))));
}
public function set crash_vz(_arg1:Number):void{
crash_vx = (Math.cos(((crash_angle * Math.PI) / 180)) * _arg1);
crash_vy = (Math.sin(((crash_angle * Math.PI) / 180)) * _arg1);
}
public function get angle():Number{
return (_angle);
}
public function set angle(_arg1:Number):void{
_angle = _arg1;
rotation = angle;
}
public function get crash_angle():Number{
return (_crash_angle);
}
public function set crash_angle(_arg1:Number):void{
_crash_angle = _arg1;
}
public function set vBoost(_arg1:Number):void{
_vBoost = _arg1;
dispatchEvent(new Event("VelocityChanged"));
}
public function get vBoost():Number{
return (_vBoost);
}
public function set slideBoost(_arg1:Number):void{
_slideBoost = _arg1;
if (_slideBoost > 10){
_slideBoost = 10;
};
}
public function get slideBoost():Number{
return (_slideBoost);
}
public function set particleManager(_arg1:ParticleManager){
pm = _arg1;
}
function frame32(){
gotoAndPlay(1);
}
function frame79(){
gotoAndPlay("crashingRight");
}
function frame116(){
gotoAndPlay("tailslide");
}
function frame153(){
gotoAndPlay("accelerating_left");
}
function frame169(){
gotoAndPlay("rolling");
}
}
}//package com.rawkins.games.dolphinOlympics
Section 27
//Ring (com.rawkins.games.dolphinOlympics.Ring)
package com.rawkins.games.dolphinOlympics {
import flash.display.*;
import flash.events.*;
import com.rawkins.fx.*;
import flash.utils.*;
import flash.filters.*;
public class Ring extends Collidable {
private var sparkCount:uint;// = 0
private var maxSparks;// = 15
private var sparkBuffer;// = 0
private var sparkTimer:Timer;
private var sparks:Array;
private var radius:Number;// = 85
private var centerX:Number;// = 0
private var centerY:Number;// = 0
private var radX:Number;// = 26
private var radY:Number;// = 85
private var speed:Number;// = 0.1
private var angle:Number;// = 0
private var pm:ParticleManager;
private var anim:Anim;
private var flip:int;// = 0
private var offColor:Number;
public static var RING_HIT:String = "ring_hit";
public function Ring(_arg1:Number=0xFFCC00):void{
this.offColor = _arg1;
pm = new ParticleManager();
addChild(pm);
anim = new Anim();
sparks = new Array();
addEventListener(Event.ENTER_FRAME, addSpark);
_activeTimer.addEventListener(TimerEvent.TIMER, die);
}
override protected function drawHitZone(_arg1:Number=65):void{
_hitZone.graphics.clear();
_hitZone.graphics.lineStyle(0, 0, 0);
_hitZone.graphics.beginFill(0, 0);
_hitZone.graphics.drawCircle(0, 0, (_arg1 + 10));
_hitZone.graphics.endFill();
_hitZone.scaleX = 0.3;
_hitZone.cacheAsBitmap = true;
}
protected function addSpark(_arg1:Event):void{
var _local2:Number;
var _local3:Particle;
var _local4:GlowFilter;
if (sparkCount <= maxSparks){
if (sparkBuffer >= 3){
_local2 = 0xFFFFFF;
if (flip == 1){
_local2 = offColor;
flip = 0;
} else {
flip++;
};
_local3 = new Particle(0, 0, 20, _local2);
_local3.bounded = false;
_local3.x = radX;
_local3.draw();
_local4 = new GlowFilter(_local2);
_local3.filters = [_local4];
pm.addParticle(_local3);
sparks.push(_local3);
sparkCount++;
sparkBuffer = 0;
} else {
sparkBuffer++;
};
} else {
removeEventListener(Event.ENTER_FRAME, addSpark);
};
}
override public function update():void{
if (!activated){
for each (spark in sparks) {
spark.x = (centerX + (Math.sin(spark.angle) * radX));
spark.y = (centerY + (Math.cos(spark.angle) * radY));
spark.angle = (spark.angle + speed);
};
} else {
pm.update();
};
}
override public function activate(_arg1:MovieClip):String{
var _local2:Event;
_activeTimer.start();
for each (spark in sparks) {
spark.vx = (Math.cos(spark.angle) * 10);
spark.vy = (Math.sin(spark.angle) * 10);
};
_local2 = new Event(RING_HIT, true);
dispatchEvent(_local2);
return ("ring");
}
private function die(_arg1:TimerEvent):void{
_activeTimer.stop();
_activeTimer.removeEventListener(TimerEvent.TIMER, die);
var _local2:Event = new Event(COLLIDABLE_DEAD);
dispatchEvent(_local2);
}
}
}//package com.rawkins.games.dolphinOlympics
Section 28
//Scoreboard (com.rawkins.games.dolphinOlympics.Scoreboard)
package com.rawkins.games.dolphinOlympics {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import ascb.util.*;
import com.rawkins.fx.*;
import flash.text.*;
import flash.system.*;
import flash.ui.*;
public class Scoreboard extends MovieClip {
public var topScores_btn:SimpleButton;
public var bs_score:TextField;
public var hj_score:TextField;
public var name_1:TextField;
public var bc_score:TextField;
public var name_2:TextField;
public var hilite_mc:MovieClip;
public var name_3:TextField;
public var todaysScores_btn:SimpleButton;
public var score_1:TextField;
public var name_4:TextField;
public var lj_score:TextField;
public var score_2:TextField;
public var name_5:TextField;
public var hs_name:TextField;
public var score_3:TextField;
public var name_6:TextField;
public var lt_score:TextField;
public var lt_name:TextField;
public var score_4:TextField;
public var name_7:TextField;
public var hs_score:TextField;
public var score_5:TextField;
public var name_8:TextField;
public var lj_name:TextField;
public var score_6:TextField;
public var name_9:TextField;
public var score_7:TextField;
public var score_8:TextField;
public var myScores_btn:SimpleButton;
public var bc_name:TextField;
public var score_9:TextField;
public var bs_name:TextField;
public var hj_name:TextField;
public var close_btn:SimpleButton;
public var score_10:TextField;
public var name_10:TextField;
protected var loader:URLLoader;
protected var context:LoaderContext;
protected var scoreData:Object;
protected var serverPath:String;// = "http://www.rawkins.com/scripts/scores/do2/"
protected var bg:Sprite;
protected var myScores:Sprite;
protected var allScores:Sprite;
protected var todaysScores:Sprite;
protected var anim:Anim;
protected var numFormat:NumberFormat;
protected var flags:Array;
protected var recordFlags:Array;
protected var flagLabels:Array;
protected var recordFlagLabels:Array;
protected var labelFormat:TextFormat;
public function Scoreboard(_arg1:SimpleGame=null):void{
this.focusRect = false;
anim = new Anim();
numFormat = new NumberFormat();
close_btn.addEventListener(MouseEvent.CLICK, onClose);
myScores = new Sprite();
allScores = new Sprite();
todaysScores = new Sprite();
buildFlags();
myScores.x = (allScores.x = (todaysScores.x = 50));
myScores.y = (allScores.y = (todaysScores.y = 100));
topScores_btn.addEventListener(MouseEvent.CLICK, onTopButton);
todaysScores_btn.addEventListener(MouseEvent.CLICK, onTodayButton);
myScores_btn.addEventListener(MouseEvent.CLICK, onMyButton);
hilite(topScores_btn);
loader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, onScoresLoaded);
loader.addEventListener(IOErrorEvent.IO_ERROR, catchIOError);
context = new LoaderContext(true);
loadTopScores();
}
public function loadTopScores():void{
var _local1:URLRequest = new URLRequest(((serverPath + "get_score.php?flash=1&ck=") + new Date()));
loader.load(_local1);
}
public function loadTodaysScores():void{
var _local1:URLRequest = new URLRequest(((serverPath + "get_score.php?today=1&flash=1&ck=") + new Date()));
loader.load(_local1);
}
public function loadMyScores():void{
var _local2:int;
var _local1:SharedObject = SharedObject.getLocal("myScores");
if (_local1.data.scoreData != null){
scoreData = _local1.data.scoreData;
} else {
scoreData = new Object();
_local2 = 1;
while (_local2 <= 10) {
scoreData[("name" + _local2)] = "-";
scoreData[("score" + _local2)] = 0;
scoreData[("country" + _local2)] = "--";
_local2++;
};
scoreData.lj_score = 0;
scoreData.hj_score = 0;
scoreData.bs_score = 0;
scoreData.lt_score = 0;
scoreData.hs_score = 0;
scoreData.bc_score = 0;
_local1.data.scoreData = scoreData;
_local1.flush();
};
showScores();
}
protected function onScoresLoaded(_arg1:Event):void{
scoreData = loader.data;
showScores();
}
protected function buildFlags():void{
var _local2:Loader;
var _local3:TextField;
var _local4:Loader;
flags = new Array();
flagLables = new Array();
labelFormat = new TextFormat();
labelFormat.color = 13158;
labelFormat.font = "Verdana";
var _local1:int;
while (_local1 < 10) {
_local2 = new Loader();
addChild(_local2);
_local2.x = 28.4;
_local2.y = (90 + (_local1 * 28));
flags.push(_local2);
_local3 = new TextField();
_local3.y = (_local2.y + 20);
_local3.x = (_local2.x + 20);
_local3.setTextFormat(labelFormat);
_local3.text = "Country name here";
flagLables.push(_local3);
_local1++;
};
recordFlags = new Array();
_local1 = 0;
while (_local1 < 6) {
_local4 = new Loader();
addChild(_local4);
_local4.x = 340;
_local4.y = (117 + (_local1 * 43.8));
recordFlags.push(_local4);
_local1++;
};
}
protected function showScores():void{
var _local8:TextFormat;
var _local9:String;
var _local10:String;
var _local11:URLRequest;
var _local12:*;
var _local13:int;
var _local1 = 1;
while (_local1 < 11) {
_local8 = new TextFormat();
_local8.color = 0xFFFFFF;
_local8.font = "Verdana";
_local9 = "-";
if (scoreData[("name" + _local1)] != null){
_local9 = scoreData[("name" + _local1)];
};
_local10 = "-";
if (scoreData[("score" + _local1)] != null){
_local10 = numFormat.format(Number(scoreData[("score" + _local1)]));
};
this[("name_" + _local1)].text = _local9;
this[("score_" + _local1)].text = _local10;
_local11 = new URLRequest((("flags/" + scoreData[("country" + _local1)]) + ".png"));
flags[(_local1 - 1)].unload();
flags[(_local1 - 1)].load(_local11);
_local12 = Constants.countries;
_local13 = 0;
while (_local13 < _local12.length) {
if (scoreData[("country" + _local1)] == _local12[_local13].data.toLowerCase()){
flagLables[(_local1 - 1)].text = _local12[_local13].label;
};
_local13++;
};
_local1++;
};
if (scoreData.lj_name == null){
scoreData.lj_name = "-";
};
if (scoreData.lj_score == null){
scoreData.lj_score = 0;
};
lj_name.text = scoreData.lj_name;
lj_score.text = (numFormat.format(scoreData.lj_score) + " m");
var _local2:URLRequest = new URLRequest((("flags/" + scoreData["lj_country"]) + ".png"));
recordFlags[0].load(_local2);
if (scoreData.hj_name == null){
scoreData.hj_name = "-";
};
if (scoreData.hj_score == null){
scoreData.hj_score = 0;
};
hj_name.text = scoreData.hj_name;
hj_score.text = (numFormat.format(scoreData.hj_score) + " m");
var _local3:URLRequest = new URLRequest((("flags/" + scoreData["hj_country"]) + ".png"));
recordFlags[1].load(_local3);
if (scoreData.bs_name == null){
scoreData.bs_name = "-";
};
if (scoreData.bs_score == null){
scoreData.bs_score = 0;
};
bs_name.text = scoreData.bs_name;
bs_score.text = (numFormat.format(scoreData.bs_score) + " litres");
var _local4:URLRequest = new URLRequest((("flags/" + scoreData["bs_country"]) + ".png"));
recordFlags[2].load(_local4);
if (scoreData.lt_name == null){
scoreData.lt_name = "-";
};
if (scoreData.lt_score == null){
scoreData.lt_score = 0;
};
lt_name.text = scoreData.lt_name;
lt_score.text = (numFormat.format(scoreData.lt_score) + " m");
var _local5:URLRequest = new URLRequest((("flags/" + scoreData["lt_country"]) + ".png"));
recordFlags[3].load(_local5);
if (scoreData.hs_name == null){
scoreData.hs_name = "-";
};
if (scoreData.hs_score == null){
scoreData.hs_score = 0;
};
hs_name.text = scoreData.hs_name;
hs_score.text = (numFormat.format(scoreData.hs_score) + " m/s");
var _local6:URLRequest = new URLRequest((("flags/" + scoreData["hs_country"]) + ".png"));
recordFlags[4].load(_local6);
if (scoreData.bc_name == null){
scoreData.bc_name = "-";
};
if (scoreData.bc_score == null){
scoreData.bc_score = 0;
};
bc_name.text = scoreData.bc_name;
bc_score.text = (numFormat.format(scoreData.bc_score) + " tricks");
var _local7:URLRequest = new URLRequest((("flags/" + scoreData["bc_country"]) + ".png"));
recordFlags[5].load(_local7);
}
public function fadeIn():void{
if (this.parent != null){
anim.fade("in", this, 20);
};
stage.focus = this;
}
public function fadeOut():void{
if (this.parent != null){
anim.fade("out", this, 30);
anim.addEventListener(anim.FADE_DONE, onFadeOut);
};
}
private function onKeyUp(_arg1:KeyboardEvent):void{
if ((((_arg1.keyCode == Keyboard.ENTER)) || ((_arg1.keyCode == Keyboard.ESCAPE)))){
removeEventListener(KeyboardEvent.KEY_UP, onKeyUp);
this.close();
};
}
private function onTopButton(_arg1:MouseEvent):void{
hilite(topScores_btn);
loadTopScores();
}
private function onTodayButton(_arg1:MouseEvent):void{
hilite(todaysScores_btn);
loadTodaysScores();
}
private function onMyButton(_arg1:MouseEvent):void{
hilite(myScores_btn);
loadMyScores();
}
private function hilite(_arg1:SimpleButton){
hilite_mc.x = (_arg1.x - 3);
hilite_mc.width = (_arg1.width - 1);
}
private function onFadeOut(_arg1:Event):void{
parent.removeChild(this);
}
private function onClose(_arg1:MouseEvent):void{
this.close();
}
private function catchIOError(_arg1:IOErrorEvent):void{
trace(("Error caught: " + _arg1.type));
}
private function close():void{
parent.removeChild(this);
dispatchEvent(new Event("Closed"));
}
}
}//package com.rawkins.games.dolphinOlympics
Section 29
//ScoreSubmitForm (com.rawkins.games.dolphinOlympics.ScoreSubmitForm)
package com.rawkins.games.dolphinOlympics {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import fl.controls.*;
import ascb.util.*;
import fl.data.*;
import com.rawkins.fx.*;
import flash.text.*;
import com.meychi.ascrypt3.*;
import flash.ui.*;
public class ScoreSubmitForm extends MovieClip {
public var playAgain_btn:SkipButton;
public var lc_txt:TextField;
public var name_ti:TextField;
public var error_txt:TextField;
public var bs_txt:TextField;
public var hj_txt:TextField;
public var submit_btn:SimpleButton;
public var lj_txt:TextField;
public var fs_txt:TextField;
public var lt_txt:TextField;
public var hs_txt:TextField;
private var serverPath:String;// = "http://www.rawkins.com/scripts/scores/do2/"
private var numFormat:NumberFormat;
private var hj:Number;// = 0
private var lj:Number;// = 0
private var bs:Number;// = 0
private var lt:Number;// = 0
private var hs:Number;// = 0
private var bc:Number;// = 0
private var score:Number;// = 0
private var country:String;// = "--"
private var anim:Anim;
private var countryIndex:int;
private var countriesXML:XML;
private var countryBox:ComboBox;
private var countryPref:SharedObject;
public function ScoreSubmitForm():void{
anim = new Anim();
numFormat = new NumberFormat();
submit_btn.addEventListener(MouseEvent.MOUSE_UP, onSubmit);
name_ti.addEventListener(FocusEvent.FOCUS_IN, onInput);
countryBox = new ComboBox();
countryBox.dropdownWidth = 210;
countryBox.width = 200;
countryBox.move(167, 247);
addChild(countryBox);
countryBox.addEventListener(Event.CHANGE, changeCountry);
setCountries();
countryPref = SharedObject.getLocal("countryPref");
if (countryPref.data.country != null){
countryIndex = countryPref.data.country;
} else {
countryIndex = 0;
};
countryBox.selectedIndex = countryIndex;
country = countryBox.selectedItem.data.toLowerCase();
}
protected function changeCountry(_arg1:Event):void{
country = countryBox.selectedItem.data.toLowerCase();
countryIndex = countryBox.selectedIndex;
countryPref = SharedObject.getLocal("countryPref");
countryPref.data.country = countryIndex;
countryPref.flush();
}
protected function onSubmit(_arg1:Event):void{
var _local2:Event = new Event("Score_Submitted");
if (name_ti.text == ""){
error_txt.text = "Please enter a name";
} else {
submitScore(name_ti.text, score, lj, hj, bs, lt, hs, bc);
dispatchEvent(_local2);
};
}
private function onInput(_arg1:Event):void{
_arg1.target.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
}
private function onKeyUp(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.ENTER){
_arg1.target.removeEventListener(KeyboardEvent.KEY_UP, onKeyUp);
onSubmit(_arg1);
};
}
public function fadeIn():void{
anim.fade("in", this, 20);
stage.focus = name_ti;
}
public function fadeOut():void{
anim.fade("out", this, 20);
}
public function submitScore(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number):void{
var scoreData:Object;
var i:int;
var name = _arg1;
var score = _arg2;
var longest_jump = _arg3;
var highest_jump = _arg4;
var biggest_splash = _arg5;
var longest_tailslide = _arg6;
var highest_speed = _arg7;
var biggest_combo = _arg8;
var variables:URLVariables = new URLVariables((((((((((((((((((((("name=" + name) + "&score=") + score) + "&longest_jump=") + longest_jump) + "&highest_jump=") + highest_jump) + "&biggest_splash=") + biggest_splash) + "&longest_tailslide=") + longest_tailslide) + "&highest_speed=") + highest_speed) + "&biggest_combo=") + biggest_combo) + "&pass=sc0r3r") + "&lock=") + makeKey()) + "&country=") + country));
var request:URLRequest = new URLRequest();
request.url = (serverPath + "new_score.php");
request.method = URLRequestMethod.POST;
request.data = variables;
var sender:URLLoader = new URLLoader();
sender.addEventListener(Event.COMPLETE, scoreSent);
try {
sender.load(request);
} catch(error:Error) {
trace("Unable to load URL");
};
var so:SharedObject = SharedObject.getLocal("myScores");
if (so.data.scoreData != null){
scoreData = so.data.scoreData;
} else {
scoreData = new Object();
i = 1;
while (i <= 10) {
scoreData[("name" + i)] = "-";
scoreData[("score" + i)] = 0;
scoreData[("country" + i)] = "--";
i = (i + 1);
};
scoreData.lj_score = 0;
scoreData.hj_score = 0;
scoreData.bs_score = 0;
scoreData.lt_score = 0;
scoreData.hs_score = 0;
scoreData.bc_score = 0;
};
var scores:Array = new Array();
var names:Array = new Array();
var countries:Array = new Array();
i = 1;
while (i <= 10) {
scores[i] = scoreData[("score" + i)];
names[i] = scoreData[("name" + i)];
countries[i] = scoreData[("country" + i)];
i = (i + 1);
};
i = 1;
while (i <= scores.length) {
if (scores[i] < score){
scores.splice(i, 0, score);
names.splice(i, 0, name);
countries.splice(i, 0, country);
break;
};
i = (i + 1);
};
i = 1;
while (i <= 10) {
scoreData[("name" + i)] = names[i];
scoreData[("score" + i)] = scores[i];
scoreData[("country" + i)] = countries[i];
i = (i + 1);
};
if (scoreData.lj_score < longest_jump){
scoreData.lj_name = name;
scoreData.lj_score = longest_jump;
scoreData.lj_country = country;
};
if (scoreData.hj_score < highest_jump){
scoreData.hj_name = name;
scoreData.hj_score = highest_jump;
scoreData.hj_country = country;
};
if (scoreData.bs_score < biggest_splash){
scoreData.bs_name = name;
scoreData.bs_score = biggest_splash;
scoreData.bs_country = country;
};
if (scoreData.lt_score < longest_tailslide){
scoreData.lt_name = name;
scoreData.lt_score = longest_tailslide;
scoreData.lt_country = country;
};
if (scoreData.hs_score < highest_speed){
scoreData.hs_name = name;
scoreData.hs_score = highest_speed;
scoreData.hs_country = country;
};
if (scoreData.bc_score < biggest_combo){
scoreData.bc_name = name;
scoreData.bc_score = biggest_combo;
scoreData.bc_country = country;
};
so.data.scoreData = scoreData;
so.flush();
}
protected function scoreSent(_arg1:Event):void{
dispatchEvent(new Event("Score_Submitted"));
}
public function set longest_jump(_arg1:Number):void{
lj_txt.text = (String(_arg1) + " m");
this.lj = _arg1;
}
public function set highest_jump(_arg1:Number):void{
hj_txt.text = (String(_arg1) + " m");
this.hj = _arg1;
}
public function set biggest_splash(_arg1:Number):void{
bs_txt.text = (String(_arg1) + " litres");
this.bs = _arg1;
}
public function set longest_tailslide(_arg1:Number):void{
lt_txt.text = String((_arg1 + " m"));
this.lt = _arg1;
}
public function set highest_speed(_arg1:Number):void{
hs_txt.text = String((_arg1 + " m/s"));
this.hs = _arg1;
}
public function set final_score(_arg1:Number):void{
fs_txt.text = numFormat.format(_arg1);
this.score = _arg1;
}
public function set biggest_combo(_arg1:Number):void{
lc_txt.text = String((_arg1 + " tricks"));
this.bc = _arg1;
}
private function makeKey():String{
var _local1:SHA1 = new SHA1();
if (hs == 0){
hs = 1;
};
var _local2:Number = Math.floor((((((((((hj + lj) / hs) * 43) + 96) + (121 / 12)) + (score * 23)) + (bc * 12)) + (bs * 11)) + (lt * 22)));
var _local3:String = _local1.calculate(String(_local2));
return (_local3);
}
private function setCountries():void{
var _local1:Array = Constants.countries;
var _local2:DataProvider = new DataProvider(_local1);
countryBox.dataProvider = _local2;
}
}
}//package com.rawkins.games.dolphinOlympics
Section 30
//Seagull (com.rawkins.games.dolphinOlympics.Seagull)
package com.rawkins.games.dolphinOlympics {
import flash.events.*;
import flash.utils.*;
import com.rawkins.utils.*;
public class Seagull extends Creature {
private var _altitude:Number;
private var _maxAlt:Number;
private var _minAlt:Number;
private var _flapPower:Number;// = 1
private var _flapTimer:Timer;
private var maxVY:Number;// = 2
private var dy:Number;// = 0
private var startY:Number;
public function Seagull(_arg1:Number=0, _arg2:Number=0):void{
addFrameScript(13, frame14, 26, frame27);
super();
startY = y;
_speed = 2;
_maxAlt = _arg1;
_minAlt = _arg2;
_vx = _speed;
_flapTimer = new Timer(500, 3);
_flapTimer.addEventListener(TimerEvent.TIMER, onFlapTimer);
}
override public function update():void{
this.x = (this.x + _vx);
this.y = (this.y + _vy);
dy = (dy + _vy);
var _local1:Number = 0;
if (dy > _minAlt){
_local1 = (dy - _minAlt);
y = (y - _local1);
dy = (dy - _local1);
_vy = 0;
} else {
if (dy < _maxAlt){
_local1 = Math.abs((dy - _maxAlt));
y = (y + _local1);
dy = (dy + _local1);
_vy = 0;
};
};
_vy = (_vy + (Constants.GRAVITY / 25));
if (_vy < -(maxVY)){
_vy = -(maxVY);
};
var _local2:Number = MathSG.randNum(0, 40);
if (_local2 == 0){
flap();
};
}
private function onFlapTimer(_arg1:TimerEvent):void{
flap();
}
private function flap():void{
gotoAndPlay("flapping");
_vy = (_vy - _flapPower);
if (_vy > maxVY){
_vy = maxVY;
};
}
function frame14(){
gotoAndPlay("gliding");
}
function frame27(){
gotoAndPlay("gliding");
}
}
}//package com.rawkins.games.dolphinOlympics
Section 31
//Shadow (com.rawkins.games.dolphinOlympics.Shadow)
package com.rawkins.games.dolphinOlympics {
import flash.display.*;
import flash.geom.*;
import com.rawkins.fx.*;
import com.rawkins.utils.*;
public class Shadow extends Particle {
protected var fx_bmpd:BitmapData;
protected var fx_bmp:Bitmap;
protected var target:DisplayObject;
protected var colored:Boolean;
public function Shadow(_arg1:DisplayObject, _arg2:Number=0, _arg3:Number=0, _arg4:Number=70, _arg5:Boolean=true):void{
super(_arg2, _arg3, _arg4);
this.target = _arg1;
fx_bmpd = new BitmapData(_arg1.width, _arg1.height, true, 0);
fx_bmp = new Bitmap(fx_bmpd);
addChild(fx_bmp);
fx_bmp.x = (fx_bmp.x - (_arg1.width / 2));
fx_bmp.y = (fx_bmp.y - (_arg1.height / 2));
this.colored = _arg5;
}
override public function draw():void{
var _local1:Number = MathSG.rad(target.angle);
var _local2:Number = Math.cos(_local1);
var _local3:Number = Math.sin(_local1);
fx_bmpd.draw(target, new Matrix(_local2, _local3, -(_local3), _local2, (target.width / 2), (target.height / 2)));
var _local4:ColorTransform;
if (colored){
_local4 = new ColorTransform(Math.random(), Math.random(), Math.random());
fx_bmp.transform.colorTransform = _local4;
} else {
_local4 = new ColorTransform(1, 1, 1, 1, 150, 150, 150);
fx_bmp.transform.colorTransform = _local4;
};
}
override public function update():void{
var _local1:ColorTransform = new ColorTransform();
_local1.alphaOffset = -15;
fx_bmpd.colorTransform(new Rectangle(0, 0, fx_bmp.width, fx_bmp.height), _local1);
super.update();
}
}
}//package com.rawkins.games.dolphinOlympics
Section 32
//SlidePath (com.rawkins.games.dolphinOlympics.SlidePath)
package com.rawkins.games.dolphinOlympics {
import flash.display.*;
import flash.geom.*;
import com.rawkins.fx.*;
import com.senocular.drawing.*;
public class SlidePath extends Sprite {
public const pathWidth:Number = 35;
protected var curvePoints:Array;
protected var len:Number;
public var friction:Number;
public var path:Path;
public var hitZone:Sprite;
protected var pm:ParticleManager;
public var popMult:Number;// = 1
public var slideBoost:Number;// = 0
protected var atPoint:Number;
public function SlidePath(_arg1:Number=0):void{
curvePoints = new Array();
hitZone = new Sprite();
addChild(hitZone);
hitZone.visible = false;
path = new Path();
this.friction = _arg1;
pm = new ParticleManager();
}
public function draw():void{
hitZone.graphics.clear();
hitZone.graphics.lineStyle(pathWidth, 0xFFFFFF, 1);
path.draw(hitZone.graphics);
hitZone.cacheAsBitmap = true;
}
public function drawPath():void{
path.clear();
path.moveTo(0, 0);
for each (point in curvePoints) {
path.curveTo(point.cx, point.cy, point.x, point.y);
};
calculateLength();
}
public function get length():Number{
return (len);
}
protected function calculateLength():void{
var _local2:Point;
var _local3:Point;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local1:Number = 0;
len = 0;
while (_local1 < 0.99) {
_local2 = path.pointAt(_local1);
_local1 = (_local1 + 0.01);
_local3 = path.pointAt(_local1);
_local4 = (_local3.x - _local2.x);
_local5 = (_local3.y - _local2.y);
_local6 = Math.sqrt(((_local4 * _local4) + (_local5 * _local5)));
len = (len + _local6);
};
}
public function findCollisionPoint(_arg1:DisplayObject):Number{
var _local3:Point;
var _local4:Shape;
var _local2:Number = 0;
while (_local2 < 1) {
_local3 = path.pointAt(_local2);
_local4 = new Shape();
_local4.graphics.lineStyle(0, 0, 0);
_local4.graphics.drawCircle(_local3.x, _local3.y, 10);
addChild(_local4);
if (_arg1.hitTestObject(_local4)){
removeChild(_local4);
break;
};
removeChild(_local4);
_local2 = (_local2 + 0.0025);
};
atPoint = _local2;
return (_local2);
}
public function curveTo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:Object = {cx:_arg1, cy:_arg2, x:_arg3, y:_arg4};
curvePoints.push(_local5);
}
}
}//package com.rawkins.games.dolphinOlympics
Section 33
//Spark (com.rawkins.games.dolphinOlympics.Spark)
package com.rawkins.games.dolphinOlympics {
import flash.display.*;
import com.rawkins.fx.*;
public class Spark extends Particle {
private var starBurst:MovieClip;
public function Spark(_arg1:Number=0, _arg2:Number=0, _arg3:Number=100):void{
super(_arg1, _arg2, _arg3);
}
override public function draw():void{
starBurst = new StarBurst();
addChild(starBurst);
starBurst.play();
}
}
}//package com.rawkins.games.dolphinOlympics
Section 34
//Starfield (com.rawkins.games.dolphinOlympics.Starfield)
package com.rawkins.games.dolphinOlympics {
import flash.display.*;
import com.rawkins.utils.*;
import flash.filters.*;
public class Starfield extends Sprite {
private var density:uint;
private var brightness:Number;
private var glow:GlowFilter;
private var blur:BlurFilter;
private var layer2:Sprite;
private var layer3:Sprite;
private var layerCount:int;// = 1
public function Starfield(_arg1:uint, _arg2:Number){
this.density = _arg1;
this.brightness = _arg2;
this.glow = new GlowFilter(0xFFFFFF, 1, 12, 12);
this.blur = new BlurFilter(2, 2, 5);
}
public function build():void{
var _local1:Number = 640;
var _local2:Number = 480;
buildQuadrant(this, 0, 0);
}
private function buildQuadrant(_arg1:Sprite, _arg2:Number, _arg3:Number):void{
var _local4:uint;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Shape;
var _local14:Number;
_local4 = 0;
while (_local4 < density) {
_local6 = (Math.random() * 640);
_local7 = (Math.random() * 480);
addStar(_arg1, _local6, _local7);
_local4++;
};
layer2 = new Sprite();
_local4 = 0;
while (_local4 < density) {
_local8 = (Math.random() * 640);
_local9 = (Math.random() * 480);
addStar(layer2, _local8, _local9, Math.round((Math.random() * 0xFFFFFF)), ((Math.random() * 2) + 1));
_local4++;
};
layer3 = new Sprite();
_local4 = 0;
while (_local4 < (density / 2)) {
_local10 = (Math.random() * 640);
_local11 = (Math.random() * 480);
_local12 = Math.round((Math.random() * 0xFFFFFF));
_local13 = new Shape();
addStar(_local13, 0, 0, 0xFFFFFF, ((Math.random() * 3) + 1));
_local13.x = _local10;
_local13.y = _local11;
_local13.graphics.lineStyle(1, _local12);
_local14 = MathSG.randNum(5, 15);
_local13.graphics.moveTo(0, -(_local14));
_local13.graphics.lineTo(0, _local14);
_local13.graphics.moveTo(-(_local14), 0);
_local13.graphics.lineTo(_local14, 0);
_local13.cacheAsBitmap = true;
layer3.addChild(_local13);
_local4++;
};
layer2.cacheAsBitmap = true;
var _local5:Array = new Array();
_local5.push(blur);
layer3.filters = _local5;
layer3.cacheAsBitmap = true;
}
private function addStar(_arg1:DisplayObject, _arg2:Number, _arg3:Number, _arg4:Number=0xFFFFFF, _arg5=1):void{
_arg1.graphics.beginFill(_arg4, brightness);
_arg1.graphics.drawCircle(_arg2, _arg3, _arg5);
}
public function showMore():void{
layerCount++;
if (layerCount == 3){
addChild(layer2);
} else {
if (layerCount == 6){
addChild(layer3);
};
};
}
public function showLess():void{
if (layerCount == 3){
removeChild(layer2);
} else {
if (layerCount == 6){
removeChild(layer3);
};
};
layerCount--;
if (layerCount < 1){
layerCount = 1;
};
}
}
}//package com.rawkins.games.dolphinOlympics
Section 35
//StarPath (com.rawkins.games.dolphinOlympics.StarPath)
package com.rawkins.games.dolphinOlympics {
import flash.display.*;
import flash.geom.*;
import com.rawkins.utils.*;
public class StarPath extends SlidePath {
private var spread:Number;// = 25
private var density:Number;// = 0.02
public function StarPath(_arg1:Number=0.075):void{
super(_arg1);
popMult = 1.05;
slideBoost = 1;
}
override public function draw():void{
var _local2:Point;
var _local3:Number;
var _local4:Number;
var _local5:Sprite;
var _local6:Number;
density = (20 / path.length);
var _local1:Number = 0;
while (_local1 < 1) {
_local2 = path.pointAt(_local1);
_local3 = (_local2.x + MathSG.randNum(-(spread), spread));
_local4 = (_local2.y + MathSG.randNum(-(spread), spread));
_local5 = new StarPic();
_local5.x = _local3;
_local5.y = _local4;
_local6 = (0.8 + (MathSG.randNum(-(spread), spread) / 35));
_local5.scaleX = _local6;
_local5.scaleY = _local6;
_local5.cacheAsBitmap = true;
addChild(_local5);
_local1 = (_local1 + density);
};
super.draw();
}
}
}//package com.rawkins.games.dolphinOlympics
Section 36
//TitleScreen (com.rawkins.games.dolphinOlympics.TitleScreen)
package com.rawkins.games.dolphinOlympics {
import flash.events.*;
import com.rawkins.utils.*;
import com.rawkins.sg.*;
public class TitleScreen extends IntroState {
protected var scoreBoard:Scoreboard;
protected var swimSound:SoundLoop;
public function TitleScreen(_arg1:SimpleGame=null):void{
stop();
scoreBoard = new Scoreboard(sg);
scoreBoard.x = (scoreBoard.x + 50);
scoreBoard.y = (scoreBoard.y + 50);
super(_arg1);
if (sg != null){
menu.addButton(new HelpButton(), sg.showHelp);
menu.addButton(new FreeswimButton(), sg.practiceGame);
menu.addButton(new ScoreButton(), showScores);
swimSound = new SoundLoop(new Seashore(), 0.5);
} else {
swimSound = null;
};
}
override public function init():void{
initialized = true;
menu.x = ((320 - (menu.width / 2)) + 90);
menu.y = (240 - 100);
}
override public function enter():void{
swimSound.fadeIn();
super.enter();
}
override public function exit():void{
swimSound.pause();
super.exit();
}
private function showScores(_arg1:Event):void{
scoreBoard.alpha = 0;
addChild(scoreBoard);
scoreBoard.fadeIn();
}
}
}//package com.rawkins.games.dolphinOlympics
Section 37
//Trick (com.rawkins.games.dolphinOlympics.Trick)
package com.rawkins.games.dolphinOlympics {
public class Trick {
private var _name:String;
private var _count:uint;
private var _quantifier:String;
private var _value:uint;
private var _action:Function;
private static var quantifiers:Array = ["", "Double", "Triple", "Quadruple", "Quintuple", "Sextuple", "Septuple", "Octuple", "Nonuple", "Decuple"];
public function Trick(_arg1:String, _arg2:uint=0, _arg3:Function=null):void{
_name = _arg1;
_value = _arg2;
_quantifier = "";
_action = _arg3;
}
private function updateQuantifier():void{
var _local1:* = "";
if (count < quantifiers.length){
_local1 = quantifiers[(count - 1)];
} else {
_local1 = ((count + 1) + "-Tuple");
};
if (count > 1){
_quantifier = (_local1 + " ");
} else {
_quantifier = _local1;
};
}
public function set value(_arg1:uint):void{
_value = _arg1;
}
public function get value():uint{
return (_value);
}
public function get name():String{
return ((_quantifier + _name));
}
public function set count(_arg1:uint):void{
_count = _arg1;
updateQuantifier();
}
public function get count():uint{
return (_count);
}
public function get action():Function{
return (_action);
}
}
}//package com.rawkins.games.dolphinOlympics
Section 38
//WaterDrop (com.rawkins.games.dolphinOlympics.WaterDrop)
package com.rawkins.games.dolphinOlympics {
import com.rawkins.fx.*;
import flash.filters.*;
public class WaterDrop extends Particle {
public function WaterDrop(_arg1:Number=0, _arg2:Number=0, _arg3:Number=100):void{
super(_arg1, _arg2, _arg3);
}
override public function draw():void{
var _local1:uint = Math.floor(((Math.random() * 3) + 1));
if (_local1 == 1){
graphics.beginFill(13106428);
} else {
if (_local1 == 2){
graphics.beginFill(16776444);
} else {
if (_local1 == 3){
graphics.beginFill(15204093);
};
};
};
graphics.lineStyle(0, 0, 0);
var _local2:Number = Math.floor(((Math.random() * 1) + 1));
graphics.drawCircle(_local2, _local2, _local2);
graphics.endFill();
var _local3:BlurFilter = new BlurFilter(5, 5, BitmapFilterQuality.LOW);
var _local4:Array = new Array();
_local4.push(_local3);
filters = _local4;
cacheAsBitmap = true;
}
override public function update():void{
if (!dead){
vy = (vy + (Constants.GRAVITY / 2));
this.x = (this.x + vx);
this.y = (this.y + vy);
if (y > 0){
this.die();
};
};
}
}
}//package com.rawkins.games.dolphinOlympics
Section 39
//EndState (com.rawkins.sg.EndState)
package com.rawkins.sg {
import flash.display.*;
import com.rawkins.fsm.*;
public class EndState extends Sprite implements State {
private var sg:SimpleGame;
private var menu:Menu;
private var initialized:Boolean;// = false
public function EndState(_arg1:SimpleGame):void{
sg = _arg1;
menu = new Menu();
menu.addButton(new PlayAgainButton(), sg.startGame);
menu.addButton(new BackButton(), sg.initGame);
addChild(menu);
}
public function init():void{
initialized = true;
menu.x = (320 - (menu.width / 2));
}
public function enter():void{
sg.addChild(this);
if (!initialized){
this.init();
};
}
public function exit():void{
sg.removeChild(this);
}
public function update():void{
}
}
}//package com.rawkins.sg
Section 40
//IntroState (com.rawkins.sg.IntroState)
package com.rawkins.sg {
import flash.display.*;
import com.rawkins.fsm.*;
public class IntroState extends MovieClip implements State {
protected var sg:SimpleGame;
protected var menu:Menu;
protected var initialized:Boolean;// = false
public function IntroState(_arg1:SimpleGame=null):void{
sg = _arg1;
menu = new Menu();
if (sg != null){
menu.addButton(new StartButton(), sg.startGame);
};
addChild(menu);
}
public function init():void{
initialized = true;
menu.x = ((sg.centerX - (menu.width / 2)) + 90);
menu.y = (sg.centerY + 20);
}
public function enter():void{
sg.addChild(this);
menu.focus();
if (!initialized){
this.init();
};
}
public function exit():void{
sg.removeChild(this);
}
public function update():void{
}
}
}//package com.rawkins.sg
Section 41
//KeyController (com.rawkins.sg.KeyController)
package com.rawkins.sg {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
public class KeyController extends EventDispatcher {
public const LEFT:uint = 37;
public const UP:uint = 38;
public const RIGHT:uint = 39;
public const DOWN:uint = 40;
public const W:uint = 87;
public const A:uint = 65;
public const D:uint = 68;
public const S:uint = 83;
protected var upTimer:Timer;
protected var downTimer:Timer;
protected var leftTimer:Timer;
protected var rightTimer:Timer;
public var leftDown:Boolean;
public var rightDown:Boolean;
public var upDown:Boolean;
public var downDown:Boolean;
protected var repeatSpeed:uint;
protected var target:DisplayObject;
private var keyTimer:Timer;
private var lastKey:uint;
private var doubleTapBuffer:Number;// = 2.5
private var combos:Array;
private var currentCombo:Array;
private var checkCombos:Boolean;// = false
protected var recording:Boolean;// = false
protected var inputRecord:Array;
protected var recordTimer:Timer;
protected var playBackTimer:Timer;
protected var startTime:Number;
public function KeyController(_arg1:DisplayObject){
this.target = _arg1;
this.keyTimer = new Timer(75);
this.combos = new Array();
this.currentCombo = new Array();
leftDown = (rightDown = (upDown = (downDown = false)));
repeatSpeed = 50;
}
protected function record(_arg1:TimerEvent):void{
}
public function startRecord():void{
var _local1:SharedObject = SharedObject.getLocal("inputRecord");
if (_local1.data.inputRecord != null){
inputRecord = _local1.data.inputRecord;
startPlayBack();
} else {
recordTimer.start();
recording = true;
};
}
public function stopRecord():void{
recording = false;
recordTimer.stop();
var _local1:SharedObject = SharedObject.getLocal("inputRecord");
_local1.data.inputRecord = inputRecord;
trace(_local1.data.inputRecord);
_local1.flush();
}
public function startPlayBack():void{
playBackTimer.start();
}
protected function fireEvent(_arg1:Array):void{
var _local2:KeyboardEvent = new KeyboardEvent(_arg1[1]);
_local2.keyCode = _arg1[2];
target.dispatchEvent(_local2);
}
protected function recordEvent(_arg1:KeyboardEvent):void{
var _local2:String = _arg1.type;
var _local3:uint = _arg1.keyCode;
var _local4:Date = new Date();
var _local5:Number = _local4.time;
var _local6:Number = (_local5 - startTime);
var _local7:Array = [_local6, _local2, _local3];
inputRecord.push(_local7);
}
protected function onKeyDown(_arg1:KeyboardEvent):void{
if ((((((_arg1.keyCode == LEFT)) || ((_arg1.keyCode == A)))) && (!(leftDown)))){
leftDown = true;
onLeft();
} else {
if ((((((_arg1.keyCode == UP)) || ((_arg1.keyCode == W)))) && (!(upDown)))){
upDown = true;
onUp();
} else {
if ((((((_arg1.keyCode == RIGHT)) || ((_arg1.keyCode == D)))) && (!(rightDown)))){
rightDown = true;
onRight();
} else {
if ((((((_arg1.keyCode == DOWN)) || ((_arg1.keyCode == S)))) && (!(downDown)))){
downDown = true;
onDown();
};
};
};
};
}
protected function onKeyUp(_arg1:KeyboardEvent):void{
var _local2:*;
var _local3:uint;
var _local4:Function;
if (recording){
recordEvent(_arg1);
};
if (checkCombos){
currentCombo.push(_arg1.keyCode);
if (keyTimer.running){
if (keyTimer.currentCount < doubleTapBuffer){
_local2 = currentCombo.toString();
_local3 = 0;
while (_local3 < combos.length) {
if (combos[_local3]["combo"].toString() == _local2){
_local4 = combos[_local3]["func"];
_local4();
break;
};
_local3++;
};
};
currentCombo = new Array();
keyTimer.stop();
} else {
keyTimer.reset();
keyTimer.start();
};
};
checkKeys(_arg1.keyCode);
}
protected function checkKeys(_arg1:uint):void{
if ((((_arg1 == LEFT)) || ((_arg1 == A)))){
leftDown = false;
} else {
if ((((_arg1 == RIGHT)) || ((_arg1 == D)))){
rightDown = false;
} else {
if ((((_arg1 == UP)) || ((_arg1 == W)))){
upDown = false;
} else {
if ((((_arg1 == DOWN)) || ((_arg1 == S)))){
downDown = false;
};
};
};
};
}
protected function onLeft():void{
}
protected function onRight():void{
}
protected function onUp():void{
}
protected function onDown():void{
}
public function addCombo(_arg1:String, _arg2:Array, _arg3:Function):void{
var _local4:* = {name:_arg1, combo:_arg2, func:_arg3};
combos.push(_local4);
}
public function enableCombos():void{
this.checkCombos = true;
}
public function disableCombos():void{
this.checkCombos = false;
}
public function enable():void{
this.target.addEventListener(KeyboardEvent.KEY_DOWN, this.onKeyDown, false, 0, true);
this.target.addEventListener(KeyboardEvent.KEY_UP, this.onKeyUp, false, 0, true);
if (leftDown){
onLeft();
};
if (rightDown){
onRight();
};
if (downDown){
onDown();
};
if (upDown){
onUp();
};
}
public function disable():void{
this.target.removeEventListener(KeyboardEvent.KEY_DOWN, this.onKeyDown);
this.target.removeEventListener(KeyboardEvent.KEY_UP, this.onKeyUp);
rightDown = (leftDown = (downDown = (upDown = false)));
checkKeys(this.DOWN);
}
public function resetKeys():void{
}
}
}//package com.rawkins.sg
Section 42
//MainState (com.rawkins.sg.MainState)
package com.rawkins.sg {
import flash.display.*;
import flash.events.*;
import com.rawkins.fsm.*;
import flash.text.*;
import flash.ui.*;
public class MainState extends Sprite implements State {
protected var sg:SimpleGame;
protected var menu:Menu;
protected var endMenu:Menu;
protected var label_txt:TextField;
protected var paused:Boolean;
protected var box:Sprite;
protected var initialized:Boolean;// = false
protected var debug_txt:TextField;
public function MainState(_arg1:SimpleGame):void{
sg = _arg1;
menu = new Menu();
menu.addButton(new ResumeButton(), onResume);
endMenu = new Menu();
endMenu.addButton(new PlayAgainButton(), sg.startGame);
endMenu.addButton(new BackButton(), sg.initGame);
debug_txt = new TextField();
debug_txt.textColor = 0xFFFFFF;
debug_txt.x = 50;
debug_txt.y = 50;
}
public function init():void{
initialized = true;
menu.x = (endMenu.x = sg.centerX);
menu.y = (menu.y + 100);
menu.x = (menu.x - (menu.width / 2));
endMenu.y = (endMenu.y + 100);
endMenu.x = menu.x;
}
public function enter():void{
sg.addChild(this);
stage.focus = this;
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
if (!initialized){
init();
};
}
public function exit():void{
stage.removeEventListener(KeyboardEvent.KEY_DOWN, pause);
sg.removeChild(this);
if (paused){
paused = false;
removeChild(menu);
};
if (this.contains(endMenu)){
removeChild(endMenu);
};
}
public function update():void{
}
private function onResume(_arg1:Event):void{
pause();
}
public function pause():void{
if (paused){
paused = false;
removeChild(menu);
stage.focus = this;
} else {
paused = true;
menu.alpha = 0;
addChild(menu);
menu.fadeIn();
};
}
protected function onKeyDown(_arg1:KeyboardEvent):void{
if ((((_arg1.keyCode == Keyboard.ESCAPE)) || ((_arg1.keyCode == 80)))){
pause();
};
}
public function debug(_arg1:String, _arg2):void{
debug_txt.text = (((_arg1 + ": ") + _arg2) + "\n");
}
}
}//package com.rawkins.sg
Section 43
//Menu (com.rawkins.sg.Menu)
package com.rawkins.sg {
import flash.display.*;
import flash.events.*;
import com.rawkins.fx.*;
import flash.text.*;
public class Menu extends Sprite {
private var _title:String;
private var items:Array;
private var title_txt:TextField;
private var bgColor:uint;
private var padding:Array;
private var anim:Anim;
public function Menu(_arg1:String=null, _arg2:uint=0xFFFFFF, _arg3:Number=450, _arg4:Number=350, _arg5:Number=10, _arg6:Number=10, _arg7:Number=50):void{
items = new Array();
if (_arg1 != null){
addMenuTitle(_arg1);
title = _arg1;
};
padding = [_arg7, (_arg7 / 4), _arg7, (_arg7 / 4)];
anim = new Anim();
}
public function addItem(_arg1:String, _arg2:Function):void{
var _local3:Sprite = new Sprite();
_local3.graphics.lineStyle(1, 1, 1);
_local3.graphics.beginFill(0xFFFFFF);
_local3.graphics.drawRect(0, 0, 200, 30);
addChild(_local3);
var _local4:TextField = new TextField();
_local4.name = _arg1;
_local4.text = _arg1;
items.push([_arg1, _arg2, _local3]);
_local3.y = (_local3.y + (this.numItems * padding[0]));
_local3.x = (_local3.x + padding[3]);
_local4.selectable = false;
_local3.addChild(_local4);
_local3.buttonMode = true;
_local3.addEventListener(MouseEvent.CLICK, _arg2);
}
public function focus():void{
if (stage != null){
stage.focus = items[0][2];
};
}
public function fadeIn():void{
anim.fade("in", this, 20);
addEventListener(anim.FADE_DONE, onFadeIn);
stage.focus = items[0][2];
}
private function onFadeIn(_arg1:Event):void{
stage.focus = items[0][2];
}
public function fadeOut():void{
anim.fade("out", this, 20);
}
public function addButton(_arg1:SimpleButton, _arg2:Function):void{
if (_arg1.name == null){
_arg1.name = ("Button" + this.numItems);
};
items.push([_arg1.name, _arg2, _arg1]);
addChild(_arg1);
_arg1.y = (_arg1.y + (this.numItems * padding[0]));
_arg1.addEventListener(MouseEvent.CLICK, _arg2);
_arg1.focusRect = false;
}
public function keyDown(_arg1:KeyboardEvent):void{
}
public function removeItem(_arg1:String):Boolean{
var _local2:uint;
while (_local2 < this.numItems) {
if (items[_local2][0] == _arg1){
removeChild(items[_local2][2]);
items.splice(_local2, 1);
return (true);
};
_local2++;
};
return (false);
}
private function addMenuTitle(_arg1:String):void{
title_txt = new TextField();
addChild(title_txt);
title_txt.width = 500;
title_txt.height = 200;
}
public function addBG(_arg1:DisplayObject):void{
this.addChildAt(_arg1, 0);
}
public function get numItems():uint{
return (items.length);
}
public function set title(_arg1:String):void{
name = _arg1;
_title = _arg1;
title_txt.htmlText = (("<h1 class=\"menuTitle\">" + _title) + "</h1>");
}
public function get title():String{
return (_title);
}
}
}//package com.rawkins.sg
Section 44
//MathSG (com.rawkins.utils.MathSG)
package com.rawkins.utils {
public class MathSG {
public function MathSG():void{
}
public static function deg(_arg1:Number):Number{
return (((_arg1 * 180) / Math.PI));
}
public static function rad(_arg1:Number):Number{
return (((_arg1 * Math.PI) / 180));
}
public static function normalize(_arg1:Number):Number{
if (_arg1 < 0){
_arg1 = (_arg1 + 360);
} else {
if (_arg1 > 360){
_arg1 = (_arg1 - 360);
};
};
return (_arg1);
}
public static function normRad(_arg1:Number):Number{
var _local2:Number = (2 * Math.PI);
if (_arg1 < 0){
_arg1 = (_arg1 + _local2);
} else {
if (_arg1 > _local2){
_arg1 = (_arg1 - _local2);
};
};
return (_arg1);
}
public static function roundTo(_arg1:Number, _arg2:int):Number{
var _local3:int = Math.pow(10, _arg2);
var _local4:Number = Math.round((_arg1 * _local3));
return ((_local4 / _local3));
}
public static function randNum(_arg1:Number, _arg2:Number, _arg3:Boolean=true):Number{
var _local4:Number = (Math.random() * (_arg2 - _arg1));
if (_arg3){
_local4 = Math.floor(_local4);
};
_local4 = (_local4 + _arg1);
return (_local4);
}
public static function checkMax(_arg1:Number, _arg2:Number):Number{
if (_arg1 > _arg2){
_arg1 = _arg2;
} else {
if (_arg1 < -(_arg2)){
_arg1 = -(_arg2);
};
};
return (_arg1);
}
}
}//package com.rawkins.utils
Section 45
//SoundLoop (com.rawkins.utils.SoundLoop)
package com.rawkins.utils {
import flash.events.*;
import flash.media.*;
import flash.utils.*;
public class SoundLoop {
private var sound:Sound;
private var pausePoint:Number;// = 0
private var channel:SoundChannel;
private var playing:Boolean;// = false
private var transform:SoundTransform;
private var fadeTransform:SoundTransform;
private var fadeTimer:Timer;
private var fadeSpeed:Number;// = 0.05
private var volume:Number;
private var fadingIn:Boolean;// = false
private var fadingOut:Boolean;// = false
public function SoundLoop(_arg1:Sound, _arg2:Number):void{
this.sound = _arg1;
transform = new SoundTransform(_arg2);
fadeTransform = new SoundTransform(_arg2);
fadeTimer = new Timer(100);
this.volume = _arg2;
}
public function fadeOut():void{
if (fadingIn){
endFadeIn();
};
fadeTransform.volume = volume;
fadeTimer.addEventListener(TimerEvent.TIMER, onFadeOut);
fadeTimer.start();
}
public function fadeIn():void{
if (fadingOut){
endFadeOut();
};
fadingIn = true;
fadeTransform.volume = 0;
channel = resume();
channel.soundTransform = fadeTransform;
fadeTimer.addEventListener(TimerEvent.TIMER, onFadeIn);
fadeTimer.start();
}
private function onFadeIn(_arg1:Event):void{
fadeTransform.volume = (fadeTransform.volume + fadeSpeed);
channel.soundTransform = fadeTransform;
if (fadeTransform.volume >= volume){
endFadeIn();
};
}
private function endFadeIn(){
fadeTimer.stop();
fadeTimer.removeEventListener(TimerEvent.TIMER, onFadeIn);
fadingIn = false;
}
private function onFadeOut(_arg1:Event):void{
fadeTransform.volume = (fadeTransform.volume - fadeSpeed);
if (fadeTransform.volume <= 0){
endFadeOut();
} else {
channel.soundTransform = fadeTransform;
};
}
private function endFadeOut():void{
this.pause();
fadeTimer.stop();
fadeTimer.removeEventListener(TimerEvent.TIMER, onFadeOut);
fadingOut = false;
}
public function play():SoundChannel{
channel = sound.play(0, 99999);
channel.soundTransform = transform;
playing = true;
return (channel);
}
public function pause():SoundChannel{
if (playing){
if (channel != null){
pausePoint = channel.position;
channel.stop();
} else {
pausePoint = 0;
};
playing = false;
};
return (channel);
}
public function resume():SoundChannel{
if (!playing){
playing = true;
channel = sound.play(pausePoint);
if (channel != null){
channel.soundTransform = transform;
channel.addEventListener(Event.SOUND_COMPLETE, onSoundComplete);
};
};
return (channel);
}
private function onSoundComplete(_arg1:Event):void{
channel = sound.play(0, 99999);
channel.soundTransform = transform;
channel.removeEventListener(Event.SOUND_COMPLETE, onSoundComplete);
}
}
}//package com.rawkins.utils
Section 46
//Path (com.senocular.drawing.Path)
package com.senocular.drawing {
import flash.geom.*;
public class Path {
private var _lengthValid:Boolean;// = true
protected var _length:Number;// = 0
protected var _moveToHasLength:Boolean;// = false
protected var _position:Point;
protected var _segments:Array;
public function Path():void{
init();
}
public function get length():Number{
var _local1:PathSegment;
var _local2:int;
if (!_lengthValid){
_lengthValid = true;
_length = 0;
_local2 = _segments.length;
while (_local2--) {
_local1 = _segments[_local2];
if (((_moveToHasLength) || (!((_local1 is PathMoveSegment))))){
_length = (_length + _local1.length);
};
};
};
return (_length);
}
public function get moveToHasLength():Boolean{
return (_moveToHasLength);
}
public function set moveToHasLength(_arg1:Boolean):void{
_lengthValid = false;
_moveToHasLength = _arg1;
}
public function get position():Point{
return (_position.clone());
}
public function set position(_arg1:Point):void{
_position = _arg1.clone();
_segments.push(new PathSegment(_position));
}
public function moveTo(_arg1:Number, _arg2:Number):void{
if (_moveToHasLength){
_lengthValid = false;
};
var _local3:Point = new Point(_arg1, _arg2);
_segments.push(new PathMoveSegment(_position, _local3));
_position = _local3;
}
public function lineTo(_arg1:Number, _arg2:Number):void{
_lengthValid = false;
var _local3:Point = new Point(_arg1, _arg2);
_segments.push(new PathLineSegment(_position, _local3));
_position = _local3;
}
public function curveTo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
_lengthValid = false;
var _local5:Point = new Point(_arg3, _arg4);
_segments.push(new PathCurveSegment(_position, new Point(_arg1, _arg2), _local5));
_position = _local5;
}
public function circleTo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
_lengthValid = false;
var _local5:Point = new Point(_arg3, _arg4);
_segments.push(new PathCircleSegment(_position, new Point(_arg1, _arg2), _local5));
_position = _local5;
}
public function clear():void{
init();
}
public function draw(_arg1, _arg2:Number=0, _arg3:Number=1):void{
var _local5:int;
var _local6:int;
_arg2 = cleant(_arg2, 0);
_arg3 = cleant(_arg3, 1);
if (_arg3 < _arg2){
draw(_arg1, _arg2, 1);
draw(_arg1, 0, _arg3);
return;
};
var _local4:Array = getSegmentsToDraw(_arg2, _arg3);
if (_local4.length){
_arg1.moveTo(_local4[0]._start.x, _local4[0]._start.y);
_local5 = _local4.length;
_local6 = 0;
while (_local6 < _local5) {
_local4[_local6].draw(_arg1);
_local6++;
};
};
}
public function pointAt(_arg1:Number):Point{
var _local5:PathSegment;
var _local7:int;
var _local8:int;
_arg1 = cleant(_arg1);
if (_arg1 == 0){
return (_segments[0].pointAt(_arg1));
};
if (_arg1 == 1){
_local8 = (_segments.length - 1);
return (_segments[_local8].pointAt(_arg1));
};
var _local2:Number = (_arg1 * length);
var _local3:Number = 0;
var _local4:Number = 0;
var _local6:int = _segments.length;
_local7 = 0;
for (;_local7 < _local6;_local7++) {
_local5 = _segments[_local7];
if (((((_moveToHasLength) || (!((_local5._command == "moveTo"))))) && (_local5.length))){
_local3 = (_local3 + _local5.length);
} else {
continue;
};
if (_local2 <= _local3){
return (_local5.pointAt(((_local2 - _local4) / _local5.length)));
};
_local4 = _local3;
};
return (new Point(0, 0));
}
public function angleAt(_arg1:Number):Number{
var _local5:PathSegment;
var _local7:int;
_arg1 = cleant(_arg1);
var _local2:Number = (_arg1 * length);
var _local3:Number = 0;
var _local4:Number = 0;
var _local6:int = _segments.length;
_local7 = 0;
for (;_local7 < _local6;_local7++) {
_local5 = _segments[_local7];
if (((((_moveToHasLength) || (!((_local5._command == "moveTo"))))) && (_local5.length))){
_local3 = (_local3 + _local5.length);
} else {
continue;
};
if (_local2 <= _local3){
return (_local5.angleAt(((_local2 - _local4) / _local5.length)));
};
_local4 = _local3;
};
return (0);
}
public function traceSegments():void{
var _local1:uint;
while (_local1 < _segments.length) {
trace(_segments[_local1]);
_local1++;
};
}
private function init():void{
_lengthValid = false;
_segments = new Array();
_position = new Point(0, 0);
}
private function cleant(_arg1:Number, _arg2:Number=0):Number{
if (isNaN(_arg1)){
_arg1 = _arg2;
} else {
if ((((_arg1 < 0)) || ((_arg1 > 1)))){
_arg1 = (_arg1 % 1);
if (_arg1 == 0){
_arg1 = _arg2;
} else {
if (_arg1 < 0){
_arg1 = (_arg1 + 1);
};
};
};
};
return (_arg1);
}
private function getSegmentsToDraw(_arg1:Number, _arg2:Number):Array{
var _local12:PathSegment;
var _local14:int;
var _local15:int;
var _local3:Number = (_arg1 * length);
var _local4:Number = (_arg2 * length);
var _local5:Number = 0;
var _local6:Number = 0;
var _local7 = -1;
var _local8 = -1;
var _local9:Number = 0;
var _local10:Number = 1;
var _local11:Array = new Array();
var _local13:int = _segments.length;
_local14 = 0;
for (;_local14 < _local13;_local14++) {
_local12 = _segments[_local14];
if (((((_moveToHasLength) || (!((_local12._command == "moveTo"))))) && (_local12.length))){
_local5 = (_local5 + _local12.length);
} else {
continue;
};
if ((((_local3 < _local5)) && ((_local7 == -1)))){
_local7 = _local14;
_local9 = ((_arg1)==0) ? 0 : ((_local3 - _local6) / _local12.length);
};
if (_local4 <= _local5){
_local8 = _local14;
_local10 = ((_arg2)==1) ? 1 : ((_local4 - _local6) / _local12.length);
break;
};
_local6 = _local5;
};
if ((((_local7 < 0)) || ((_local8 < 0)))){
return (_local11);
};
_local11 = _segments.slice(_local7, (_local8 + 1));
if (_local7 == _local8){
if (((!((_local9 == 0))) || (!((_local10 == 1))))){
_local11[0] = _local11[0].segment(_local9, _local10);
};
} else {
if (_local9 != 0){
_local11[0] = _local11[0].segment(_local9, 1);
};
if (_local10 != 1){
_local15 = (_local11.length - 1);
_local11[_local15] = _local11[_local15].segment(0, _local10);
};
};
return (_local11);
}
}
}//package com.senocular.drawing
import flash.geom.*;
class PathSegment {
private var _command:String;// = "moveTo"
private var _start:Point;
private var _end:Point;
private var _constructor:Class;
protected var _length:Number;
private static var curveAccuracy:int = 5;
private function PathSegment(_arg1:Point){
_start = _arg1.clone();
_end = _start;
_constructor = prototype.constructor;
}
private function get command():String{
return (_command);
}
private function get start():Point{
return (_start.clone());
}
private function get end():Point{
return (_end.clone());
}
private function get length():Number{
return (0);
}
private function toString():String{
return ((("[" + command) + "]"));
}
private function draw(_arg1):void{
var _local2 = _arg1;
_local2[command](_end.x, _end.y);
}
private function trim(_arg1:Number, _arg2:Boolean=false):PathSegment{
return (this);
}
private function pointAt(_arg1:Number, _arg2:Point=null, _arg3:Point=null):Point{
return (_start.clone());
}
private function angleAt(_arg1:Number, _arg2:Point=null, _arg3:Point=null):Number{
return (0);
}
}
class PathLineSegment extends PathSegment {
private function PathLineSegment(_arg1:Point, _arg2:Point){
super(_arg1);
_end = _arg2.clone();
_command = "lineTo";
_constructor = prototype.constructor;
}
override private function get length():Number{
if (isNaN(_length)){
_length = lineLength();
};
return (_length);
}
private function segment(_arg1:Number, _arg2:Number):PathSegment{
if (_arg2 == 1){
if (_arg1 == 0){
return (this);
};
return (trim(_arg1, true));
};
var _local3:PathSegment = trim(_arg2);
if (_arg1 != 0){
_local3 = _local3.trim((_arg1 / _arg2), true);
};
return (_local3);
}
override private function trim(_arg1:Number, _arg2:Boolean=false):PathSegment{
var _local3:Point;
var _local4:Point;
if (_arg2){
_local4 = _start;
_local3 = _end;
_arg1 = (1 - _arg1);
} else {
_local3 = _start;
_local4 = _end;
};
var _local5:Point = _local3;
var _local6:Point = _local3;
var _local7:Number = (_local4.x - _local3.x);
var _local8:Number = (_local4.y - _local3.y);
if (_arg2){
_local5 = new Point((_local3.x + (_local7 * _arg1)), (_local3.y + (_local8 * _arg1)));
} else {
_local6 = new Point((_local3.x + (_local7 * _arg1)), (_local3.y + (_local8 * _arg1)));
};
return (new _constructor(_local5, _local6));
}
override private function pointAt(_arg1:Number, _arg2:Point=null, _arg3:Point=null):Point{
if (!_arg2){
_arg2 = _start;
};
if (!_arg3){
_arg3 = _end;
};
var _local4:Number = (_arg3.x - _arg2.x);
var _local5:Number = (_arg3.y - _arg2.y);
return (new Point((_arg2.x + (_local4 * _arg1)), (_arg2.y + (_local5 * _arg1))));
}
override private function angleAt(_arg1:Number, _arg2:Point=null, _arg3:Point=null):Number{
if (!_arg2){
_arg2 = _start;
};
if (!_arg3){
_arg3 = _end;
};
return (Math.atan2((_arg3.y - _arg2.y), (_arg3.x - _arg2.x)));
}
protected function lineLength(_arg1:Point=null, _arg2:Point=null):Number{
if (!_arg1){
_arg1 = _start;
};
if (!_arg2){
_arg2 = _end;
};
var _local3:Number = (_arg2.x - _arg1.x);
var _local4:Number = (_arg2.y - _arg1.y);
return (Math.sqrt(((_local3 * _local3) + (_local4 * _local4))));
}
}
class PathMoveSegment extends PathLineSegment {
private function PathMoveSegment(_arg1:Point, _arg2:Point){
super(_arg1, _arg2);
_command = "moveTo";
_constructor = prototype.constructor;
}
}
class PathCurveSegment extends PathLineSegment {
private var _control:Point;
private function PathCurveSegment(_arg1:Point, _arg2:Point, _arg3:Point){
super(_arg1, _arg3);
_control = _arg2.clone();
_command = "curveTo";
_constructor = prototype.constructor;
}
override private function get length():Number{
if (isNaN(_length)){
_length = curveLength();
};
return (_length);
}
private function get control():Point{
return (_control.clone());
}
override private function draw(_arg1):void{
var _local2 = _arg1;
_local2[command](_control.x, _control.y, _end.x, _end.y);
}
override private function pointAt(_arg1:Number, _arg2:Point=null, _arg3:Point=null):Point{
var _local4:Point = Point.interpolate(_control, _start, _arg1);
var _local5:Point = Point.interpolate(_end, _control, _arg1);
return (Point.interpolate(_local5, _local4, _arg1));
}
override private function angleAt(_arg1:Number, _arg2:Point=null, _arg3:Point=null):Number{
_arg2 = super.pointAt(_arg1, _start, _control);
_arg3 = super.pointAt(_arg1, _control, _end);
return (super.angleAt(_arg1, _arg2, _arg3));
}
override private function trim(_arg1:Number, _arg2:Boolean=false):PathSegment{
var _local3:Point;
var _local4:Point;
var _local6:Point;
var _local12:Number;
var _local13:Number;
if (_arg2){
_local4 = _start;
_local3 = _end;
_arg1 = (1 - _arg1);
} else {
_local3 = _start;
_local4 = _end;
};
var _local5:Point = _local3;
var _local7:Point = _local3;
var _local8:Number = (_control.x - _local3.x);
var _local9:Number = (_control.y - _local3.y);
var _local10:Number = (_local4.x - _control.x);
var _local11:Number = (_local4.y - _control.y);
_local6 = new Point((_local3.x + (_local8 * _arg1)), (_local3.y + (_local9 * _arg1)));
_local12 = ((_control.x + (_local10 * _arg1)) - _local6.x);
_local13 = ((_control.y + (_local11 * _arg1)) - _local6.y);
if (_arg2){
_local5 = new Point((_local6.x + (_local12 * _arg1)), (_local6.y + (_local13 * _arg1)));
} else {
_local7 = new Point((_local6.x + (_local12 * _arg1)), (_local6.y + (_local13 * _arg1)));
};
return (new _constructor(_local5, _local6, _local7));
}
private function curveLength(_arg1:Point=null, _arg2:Point=null, _arg3:Point=null):Number{
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local13:Point;
var _local14:int;
if (!_arg1){
_arg1 = _start;
};
if (!_arg2){
_arg2 = _control;
};
if (!_arg3){
_arg3 = _end;
};
var _local4:Number = (_arg3.x - _arg1.x);
var _local5:Number = (_arg3.y - _arg1.y);
var _local6:Number = ((_local4)==0) ? 0 : ((_arg2.x - _arg1.x) / _local4);
var _local7:Number = ((_local5)==0) ? 0 : ((_arg2.y - _arg1.y) / _local5);
var _local11:Number = 0;
var _local12:Point = _arg1;
_local14 = 1;
while (_local14 < curveAccuracy) {
_local10 = (_local14 / curveAccuracy);
_local8 = ((2 * _local10) * (1 - _local10));
_local9 = (_local10 * _local10);
_local13 = new Point((_arg1.x + (_local4 * ((_local8 * _local6) + _local9))), (_arg1.y + (_local5 * ((_local8 * _local7) + _local9))));
_local11 = (_local11 + lineLength(_local12, _local13));
_local12 = _local13;
_local14++;
};
return ((_local11 + lineLength(_local12, _arg3)));
}
}
class PathCircleSegment extends PathLineSegment {
private var _control:Point;
private var _center:Point;
private var radius:Number;// = 0
private var angleStart:Number;// = 0
private var angleEnd:Number;// = 0
private var arc:Number;// = 0
private function PathCircleSegment(_arg1:Point, _arg2:Point, _arg3:Point){
super(_arg1, _arg3);
_control = _arg2.clone();
_command = "circleTo";
_center = getCircleCenter(_start, _control, _end);
_constructor = prototype.constructor;
if (_center){
radius = lineLength(_start, _center);
angleStart = Math.atan2((_start.y - _center.y), (_start.x - _center.x));
angleEnd = Math.atan2((_end.y - _center.y), (_end.x - _center.x));
if (angleEnd < angleStart){
angleEnd = (angleEnd + (Math.PI * 2));
};
arc = (angleEnd - angleStart);
};
}
override private function get length():Number{
if (isNaN(_length)){
_length = circleLength();
};
return (_length);
}
private function get control():Point{
return (_control.clone());
}
override private function draw(_arg1):void{
var _local3:Number;
var _local8:int;
if (!_center){
return;
};
var _local2:Number = angleStart;
var _local4:int = (Math.floor((arc / (Math.PI / 4))) + 1);
var _local5:Number = (arc / (2 * _local4));
var _local6:Number = Math.cos(_local5);
var _local7:Number = (_local6) ? (radius / _local6) : 0;
_local8 = 0;
while (_local8 < _local4) {
_local3 = (_local2 + _local5);
_local2 = (_local3 + _local5);
_arg1.curveTo((_center.x + (Math.cos(_local3) * _local7)), (_center.y + (Math.sin(_local3) * _local7)), (_center.x + (Math.cos(_local2) * radius)), (_center.y + (Math.sin(_local2) * radius)));
_local8++;
};
}
override private function pointAt(_arg1:Number, _arg2:Point=null, _arg3:Point=null):Point{
if (!_center){
return (_start.clone());
};
var _local4:Number = (angleStart + (_arg1 * arc));
return (new Point((_center.x + (Math.cos(_local4) * radius)), (_center.y + (Math.sin(_local4) * radius))));
}
override private function angleAt(_arg1:Number, _arg2:Point=null, _arg3:Point=null):Number{
var _local4:Number = (((angleStart + (_arg1 * arc)) + (Math.PI / 2)) % (Math.PI * 2));
if (_local4 > Math.PI){
_local4 = (_local4 - (Math.PI * 2));
} else {
if (_local4 < -(Math.PI)){
_local4 = (_local4 + (Math.PI * 2));
};
};
return (_local4);
}
override private function trim(_arg1:Number, _arg2:Boolean=false):PathSegment{
var _local3:Point;
var _local4:Point;
var _local6:Point;
if (_arg2){
_local4 = _start;
_local3 = _end;
} else {
_local3 = _start;
_local4 = _end;
};
var _local5:Point = _local3;
var _local7:Point = _local3;
var _local8:Number = (angleStart + (_arg1 * arc));
if (_arg2){
_local5 = new Point((_center.x + (Math.cos(_local8) * radius)), (_center.y + (Math.sin(_local8) * radius)));
_local8 = ((angleEnd + _local8) / 2);
} else {
_local7 = new Point((_center.x + (Math.cos(_local8) * radius)), (_center.y + (Math.sin(_local8) * radius)));
_local8 = ((angleStart + _local8) / 2);
};
_local6 = new Point((_center.x + (Math.cos(_local8) * radius)), (_center.y + (Math.sin(_local8) * radius)));
return (new _constructor(_local5, _local6, _local7));
}
private function circleLength():Number{
return ((radius * arc));
}
private function getCircleCenter(_arg1:Point, _arg2:Point, _arg3:Point):Point{
var _local4:Point;
if ((((_arg1.x == _arg2.x)) || ((_arg1.y == _arg2.y)))){
_local4 = _arg1;
_arg1 = _arg3;
_arg3 = _local4;
};
if (_arg2.x == _arg3.x){
_local4 = _arg1;
_arg1 = _arg2;
_arg2 = _local4;
};
if ((((_arg1.x == _arg2.x)) || ((_arg2.x == _arg3.x)))){
return (null);
};
var _local5:Number = ((_arg2.y - _arg1.y) / (_arg2.x - _arg1.x));
var _local6:Number = ((_arg3.y - _arg2.y) / (_arg3.x - _arg2.x));
if (_local5 == _local6){
return (null);
};
var _local7:Number = (_arg1.x + _arg2.x);
var _local8:Number = (_arg2.x + _arg3.x);
var _local9:Number = (((((_local5 * _local6) * (_arg1.y - _arg3.y)) + (_local6 * _local7)) - (_local5 * _local8)) / (2 * (_local6 - _local5)));
var _local10:Number = (_local5) ? (((_arg1.y + _arg2.y) / 2) - ((_local9 - (_local7 / 2)) / _local5)) : (((_arg2.y + _arg3.y) / 2) - ((_local9 - (_local8 / 2)) / _local6));
return (new Point(_local9, _local10));
}
}
Section 47
//assets_7 (do2_fla.assets_7)
package do2_fla {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.utils.*;
import flash.filters.*;
import flash.system.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
public dynamic class assets_7 extends MovieClip {
public function assets_7(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package do2_fla
Section 48
//loadtext_5 (do2_fla.loadtext_5)
package do2_fla {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.utils.*;
import flash.filters.*;
import flash.system.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
public dynamic class loadtext_5 extends MovieClip {
public function loadtext_5(){
addFrameScript(16, frame17);
}
function frame17(){
gotoAndPlay(1);
}
}
}//package do2_fla
Section 49
//MainTimeline (do2_fla.MainTimeline)
package do2_fla {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.utils.*;
public dynamic class MainTimeline extends MovieClip {
public var loadBar:MovieClip;
public var outline:MovieClip;
public var loadtxt:MovieClip;
public var allowLocal:Boolean;
public var centerX;
public var centerY;
public var enableDomainCheck;
public var rawkinsTimer:Timer;
public var msg:TextField;
public var app:App;
public function MainTimeline(){
addFrameScript(0, this.frame1, 1, this.frame2, 14, this.frame15, 15, this.frame16, 16, this.frame17, 28, this.frame29);
}
public function onDomain(_arg1:String):Boolean{
var _loc4_:uint;
var _loc5_:String;
trace("checking");
var _loc2_:String = loaderInfo.loaderURL;
var _loc3_:String = _loc2_.substr(0, _loc2_.indexOf(":"));
if (_loc3_ == "http"){
_loc4_ = _loc2_.indexOf("//");
_loc5_ = _loc2_.substr((_loc4_ + 2), ((_loc2_.indexOf("/", (_loc4_ + 2)) - _loc4_) - 2));
_loc5_ = _loc5_.toLowerCase();
if (_loc5_.indexOf(_arg1) != -1){
return (true);
};
return (false);
};
if ((((_loc3_ == "file")) && (this.allowLocal))){
return (true);
};
if (this.allowLocal){
return (true);
};
return (true);
}
public function rawLogoDone(_arg1:Event):void{
this.rawkinsTimer.removeEventListener(TimerEvent.TIMER_COMPLETE, this.rawLogoDone);
this.rawkinsTimer.stop();
play();
}
public function onEnterFrame(_arg1:Event){
var _loc2_:Number = (this.root.loaderInfo.bytesLoaded / this.root.loaderInfo.bytesTotal);
this.loadBar.scaleX = _loc2_;
if (this.root.loaderInfo.bytesLoaded == this.root.loaderInfo.bytesTotal){
this.removeEventListener("enterFrame", this.onEnterFrame);
removeChild(this.loadtxt);
removeChild(this.outline);
removeChild(this.loadBar);
gotoAndPlay("gameStart");
};
}
function frame1(){
stop();
this.allowLocal = false;
this.centerX = (stage.stageWidth / 2);
this.centerY = (stage.stageHeight / 2);
this.enableDomainCheck = false;
this.rawkinsTimer = new Timer(3000, 1);
if (((((((!(this.enableDomainCheck)) || (this.onDomain("www.rawkins.com")))) || (this.onDomain("rawkins.ca")))) || (this.onDomain("alanrawkins.com")))){
MochiAd.showPreloaderAd({clip:this.root, id:"a49656eb15613d29", res:"640x480"});
} else {
this.msg = new TextField();
this.msg.multiline = true;
this.msg.width = 500;
this.msg.height = 300;
this.msg.x = (this.centerX - (this.msg.width / 2));
this.msg.y = ((this.centerY / 2) - (this.msg.height / 2));
this.msg.htmlText = ("<p align='center'><font size='22px' face='Verdana, _sans' color='#FFFFFF'>UNFORTUNATELY...<br><br>" + "<font size='12px'>This game Is not authorized to play on this domain.<br> Sorry for the inconvenience.</font></font></p>");
addChild(this.msg);
};
}
function frame2(){
stop();
this.rawkinsTimer.addEventListener(TimerEvent.TIMER_COMPLETE, this.rawLogoDone);
this.rawkinsTimer.start();
}
function frame15(){
this.addEventListener("enterFrame", this.onEnterFrame);
}
function frame16(){
}
function frame17(){
gotoAndPlay("loader");
}
function frame29(){
this.app = new App();
addChild(this.app);
stop();
}
}
}//package do2_fla
Section 50
//movingWaves_14 (do2_fla.movingWaves_14)
package do2_fla {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.utils.*;
import flash.filters.*;
import flash.system.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
public dynamic class movingWaves_14 extends MovieClip {
public function movingWaves_14(){
addFrameScript(89, frame90);
}
function frame90(){
gotoAndPlay(1);
}
}
}//package do2_fla
Section 51
//rawkinsLogo_1 (do2_fla.rawkinsLogo_1)
package do2_fla {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.utils.*;
import flash.filters.*;
import flash.system.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
public dynamic class rawkinsLogo_1 extends MovieClip {
public function rawkinsLogo_1(){
addFrameScript(14, frame15);
}
function frame15(){
stop();
}
}
}//package do2_fla
Section 52
//BaseScrollPane (fl.containers.BaseScrollPane)
package fl.containers {
import fl.core.*;
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import fl.controls.*;
import fl.events.*;
public class BaseScrollPane extends UIComponent {
protected var defaultLineScrollSize:Number;// = 4
protected var _maxHorizontalScrollPosition:Number;// = 0
protected var vScrollBar:Boolean;
protected var disabledOverlay:Shape;
protected var hScrollBar:Boolean;
protected var availableWidth:Number;
protected var _verticalPageScrollSize:Number;// = 0
protected var vOffset:Number;// = 0
protected var _verticalScrollBar:ScrollBar;
protected var useFixedHorizontalScrolling:Boolean;// = false
protected var contentWidth:Number;// = 0
protected var contentHeight:Number;// = 0
protected var _horizontalPageScrollSize:Number;// = 0
protected var background:DisplayObject;
protected var _useBitmpScrolling:Boolean;// = false
protected var contentPadding:Number;// = 0
protected var availableHeight:Number;
protected var _horizontalScrollBar:ScrollBar;
protected var contentScrollRect:Rectangle;
protected var _horizontalScrollPolicy:String;
protected var _verticalScrollPolicy:String;
protected static const SCROLL_BAR_STYLES:Object = {upArrowDisabledSkin:"upArrowDisabledSkin", upArrowDownSkin:"upArrowDownSkin", upArrowOverSkin:"upArrowOverSkin", upArrowUpSkin:"upArrowUpSkin", downArrowDisabledSkin:"downArrowDisabledSkin", downArrowDownSkin:"downArrowDownSkin", downArrowOverSkin:"downArrowOverSkin", downArrowUpSkin:"downArrowUpSkin", thumbDisabledSkin:"thumbDisabledSkin", thumbDownSkin:"thumbDownSkin", thumbOverSkin:"thumbOverSkin", thumbUpSkin:"thumbUpSkin", thumbIcon:"thumbIcon", trackDisabledSkin:"trackDisabledSkin", trackDownSkin:"trackDownSkin", trackOverSkin:"trackOverSkin", trackUpSkin:"trackUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
private static var defaultStyles:Object = {repeatDelay:500, repeatInterval:35, skin:"ScrollPane_upSkin", contentPadding:0, disabledAlpha:0.5};
public function BaseScrollPane(){
contentWidth = 0;
contentHeight = 0;
contentPadding = 0;
vOffset = 0;
_maxHorizontalScrollPosition = 0;
_horizontalPageScrollSize = 0;
_verticalPageScrollSize = 0;
defaultLineScrollSize = 4;
useFixedHorizontalScrolling = false;
_useBitmpScrolling = false;
super();
}
protected function handleWheel(_arg1:MouseEvent):void{
if (((((!(enabled)) || (!(_verticalScrollBar.visible)))) || ((contentHeight <= availableHeight)))){
return;
};
_verticalScrollBar.scrollPosition = (_verticalScrollBar.scrollPosition - (_arg1.delta * verticalLineScrollSize));
setVerticalScrollPosition(_verticalScrollBar.scrollPosition);
dispatchEvent(new ScrollEvent(ScrollBarDirection.VERTICAL, _arg1.delta, horizontalScrollPosition));
}
public function get verticalScrollPosition():Number{
return (_verticalScrollBar.scrollPosition);
}
protected function drawDisabledOverlay():void{
if (enabled){
if (contains(disabledOverlay)){
removeChild(disabledOverlay);
};
} else {
disabledOverlay.x = (disabledOverlay.y = contentPadding);
disabledOverlay.width = availableWidth;
disabledOverlay.height = availableHeight;
disabledOverlay.alpha = (getStyleValue("disabledAlpha") as Number);
addChild(disabledOverlay);
};
}
public function set verticalScrollPosition(_arg1:Number):void{
drawNow();
_verticalScrollBar.scrollPosition = _arg1;
setVerticalScrollPosition(_verticalScrollBar.scrollPosition, false);
}
protected function setContentSize(_arg1:Number, _arg2:Number):void{
if ((((((contentWidth == _arg1)) || (useFixedHorizontalScrolling))) && ((contentHeight == _arg2)))){
return;
};
contentWidth = _arg1;
contentHeight = _arg2;
invalidate(InvalidationType.SIZE);
}
public function get horizontalScrollPosition():Number{
return (_horizontalScrollBar.scrollPosition);
}
public function get horizontalScrollBar():ScrollBar{
return (_horizontalScrollBar);
}
override public function set enabled(_arg1:Boolean):void{
if (enabled == _arg1){
return;
};
_verticalScrollBar.enabled = _arg1;
_horizontalScrollBar.enabled = _arg1;
super.enabled = _arg1;
}
public function get verticalLineScrollSize():Number{
return (_verticalScrollBar.lineScrollSize);
}
public function get horizontalScrollPolicy():String{
return (_horizontalScrollPolicy);
}
protected function calculateAvailableSize():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = ScrollBar.WIDTH;
_local2 = (contentPadding = Number(getStyleValue("contentPadding")));
_local3 = ((height - (2 * _local2)) - vOffset);
vScrollBar = (((_verticalScrollPolicy == ScrollPolicy.ON)) || ((((_verticalScrollPolicy == ScrollPolicy.AUTO)) && ((contentHeight > _local3)))));
_local4 = ((width - (vScrollBar) ? _local1 : 0) - (2 * _local2));
_local5 = (useFixedHorizontalScrolling) ? _maxHorizontalScrollPosition : (contentWidth - _local4);
hScrollBar = (((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && ((_local5 > 0)))));
if (hScrollBar){
_local3 = (_local3 - _local1);
};
if (((((((hScrollBar) && (!(vScrollBar)))) && ((_verticalScrollPolicy == ScrollPolicy.AUTO)))) && ((contentHeight > _local3)))){
vScrollBar = true;
_local4 = (_local4 - _local1);
};
availableHeight = (_local3 + vOffset);
availableWidth = _local4;
}
public function get maxVerticalScrollPosition():Number{
drawNow();
return (Math.max(0, (contentHeight - availableHeight)));
}
public function set horizontalScrollPosition(_arg1:Number):void{
drawNow();
_horizontalScrollBar.scrollPosition = _arg1;
setHorizontalScrollPosition(_horizontalScrollBar.scrollPosition, false);
}
public function get horizontalLineScrollSize():Number{
return (_horizontalScrollBar.lineScrollSize);
}
public function set verticalPageScrollSize(_arg1:Number):void{
_verticalPageScrollSize = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get verticalScrollPolicy():String{
return (_verticalScrollPolicy);
}
protected function setHorizontalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
}
public function get useBitmapScrolling():Boolean{
return (_useBitmpScrolling);
}
protected function handleScroll(_arg1:ScrollEvent):void{
if (_arg1.target == _verticalScrollBar){
setVerticalScrollPosition(_arg1.position);
} else {
setHorizontalScrollPosition(_arg1.position);
};
}
public function set verticalLineScrollSize(_arg1:Number):void{
_verticalScrollBar.lineScrollSize = _arg1;
}
public function get verticalScrollBar():ScrollBar{
return (_verticalScrollBar);
}
protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
}
public function set horizontalPageScrollSize(_arg1:Number):void{
_horizontalPageScrollSize = _arg1;
invalidate(InvalidationType.SIZE);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES)){
setStyles();
drawBackground();
if (contentPadding != getStyleValue("contentPadding")){
invalidate(InvalidationType.SIZE, false);
};
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STATE)){
drawLayout();
};
updateChildren();
super.draw();
}
public function set horizontalScrollPolicy(_arg1:String):void{
_horizontalScrollPolicy = _arg1;
invalidate(InvalidationType.SIZE);
}
override protected function configUI():void{
var _local1:Graphics;
super.configUI();
contentScrollRect = new Rectangle(0, 0, 85, 85);
_verticalScrollBar = new ScrollBar();
_verticalScrollBar.addEventListener(ScrollEvent.SCROLL, handleScroll, false, 0, true);
_verticalScrollBar.visible = false;
_verticalScrollBar.lineScrollSize = defaultLineScrollSize;
addChild(_verticalScrollBar);
copyStylesToChild(_verticalScrollBar, SCROLL_BAR_STYLES);
_horizontalScrollBar = new ScrollBar();
_horizontalScrollBar.direction = ScrollBarDirection.HORIZONTAL;
_horizontalScrollBar.addEventListener(ScrollEvent.SCROLL, handleScroll, false, 0, true);
_horizontalScrollBar.visible = false;
_horizontalScrollBar.lineScrollSize = defaultLineScrollSize;
addChild(_horizontalScrollBar);
copyStylesToChild(_horizontalScrollBar, SCROLL_BAR_STYLES);
disabledOverlay = new Shape();
_local1 = disabledOverlay.graphics;
_local1.beginFill(0xFFFFFF);
_local1.drawRect(0, 0, width, height);
_local1.endFill();
addEventListener(MouseEvent.MOUSE_WHEEL, handleWheel, false, 0, true);
}
protected function calculateContentWidth():void{
}
public function get verticalPageScrollSize():Number{
if (isNaN(availableHeight)){
drawNow();
};
return (((((_verticalPageScrollSize == 0)) && (!(isNaN(availableHeight))))) ? availableHeight : _verticalPageScrollSize);
}
protected function drawLayout():void{
calculateAvailableSize();
calculateContentWidth();
background.width = width;
background.height = height;
if (vScrollBar){
_verticalScrollBar.visible = true;
_verticalScrollBar.x = ((width - ScrollBar.WIDTH) - contentPadding);
_verticalScrollBar.y = contentPadding;
_verticalScrollBar.height = availableHeight;
} else {
_verticalScrollBar.visible = false;
};
_verticalScrollBar.setScrollProperties(availableHeight, 0, (contentHeight - availableHeight), verticalPageScrollSize);
setVerticalScrollPosition(_verticalScrollBar.scrollPosition, false);
if (hScrollBar){
_horizontalScrollBar.visible = true;
_horizontalScrollBar.x = contentPadding;
_horizontalScrollBar.y = ((height - ScrollBar.WIDTH) - contentPadding);
_horizontalScrollBar.width = availableWidth;
} else {
_horizontalScrollBar.visible = false;
};
_horizontalScrollBar.setScrollProperties(availableWidth, 0, (useFixedHorizontalScrolling) ? _maxHorizontalScrollPosition : (contentWidth - availableWidth), horizontalPageScrollSize);
setHorizontalScrollPosition(_horizontalScrollBar.scrollPosition, false);
drawDisabledOverlay();
}
protected function drawBackground():void{
var _local1:DisplayObject;
_local1 = background;
background = getDisplayObjectInstance(getStyleValue("skin"));
background.width = width;
background.height = height;
addChildAt(background, 0);
if (((!((_local1 == null))) && (!((_local1 == background))))){
removeChild(_local1);
};
}
public function set horizontalLineScrollSize(_arg1:Number):void{
_horizontalScrollBar.lineScrollSize = _arg1;
}
public function get horizontalPageScrollSize():Number{
if (isNaN(availableWidth)){
drawNow();
};
return (((((_horizontalPageScrollSize == 0)) && (!(isNaN(availableWidth))))) ? availableWidth : _horizontalPageScrollSize);
}
public function get maxHorizontalScrollPosition():Number{
drawNow();
return (Math.max(0, (contentWidth - availableWidth)));
}
protected function setStyles():void{
copyStylesToChild(_verticalScrollBar, SCROLL_BAR_STYLES);
copyStylesToChild(_horizontalScrollBar, SCROLL_BAR_STYLES);
}
protected function updateChildren():void{
_verticalScrollBar.enabled = (_horizontalScrollBar.enabled = enabled);
_verticalScrollBar.drawNow();
_horizontalScrollBar.drawNow();
}
public function set verticalScrollPolicy(_arg1:String):void{
_verticalScrollPolicy = _arg1;
invalidate(InvalidationType.SIZE);
}
public function set useBitmapScrolling(_arg1:Boolean):void{
_useBitmpScrolling = _arg1;
invalidate(InvalidationType.STATE);
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, ScrollBar.getStyleDefinition()));
}
}
}//package fl.containers
Section 53
//CellRenderer (fl.controls.listClasses.CellRenderer)
package fl.controls.listClasses {
import flash.events.*;
import fl.controls.*;
public class CellRenderer extends LabelButton implements ICellRenderer {
protected var _data:Object;
protected var _listData:ListData;
private static var defaultStyles:Object = {upSkin:"CellRenderer_upSkin", downSkin:"CellRenderer_downSkin", overSkin:"CellRenderer_overSkin", disabledSkin:"CellRenderer_disabledSkin", selectedDisabledSkin:"CellRenderer_selectedDisabledSkin", selectedUpSkin:"CellRenderer_selectedUpSkin", selectedDownSkin:"CellRenderer_selectedDownSkin", selectedOverSkin:"CellRenderer_selectedOverSkin", textFormat:null, disabledTextFormat:null, embedFonts:null, textPadding:5};
public function CellRenderer():void{
toggle = true;
focusEnabled = false;
}
override protected function toggleSelected(_arg1:MouseEvent):void{
}
override public function get selected():Boolean{
return (super.selected);
}
public function set listData(_arg1:ListData):void{
_listData = _arg1;
label = _listData.label;
setStyle("icon", _listData.icon);
}
override public function set selected(_arg1:Boolean):void{
super.selected = _arg1;
}
public function set data(_arg1:Object):void{
_data = _arg1;
}
public function get listData():ListData{
return (_listData);
}
override public function setSize(_arg1:Number, _arg2:Number):void{
super.setSize(_arg1, _arg2);
}
override protected function drawLayout():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = Number(getStyleValue("textPadding"));
_local2 = 0;
if (icon != null){
icon.x = _local1;
icon.y = Math.round(((height - icon.height) >> 1));
_local2 = (icon.width + _local1);
};
if (label.length > 0){
textField.visible = true;
_local3 = Math.max(0, ((width - _local2) - (_local1 * 2)));
textField.width = _local3;
textField.height = (textField.textHeight + 4);
textField.x = (_local2 + _local1);
textField.y = Math.round(((height - textField.height) >> 1));
} else {
textField.visible = false;
};
background.width = width;
background.height = height;
}
public function get data():Object{
return (_data);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls.listClasses
Section 54
//ICellRenderer (fl.controls.listClasses.ICellRenderer)
package fl.controls.listClasses {
public interface ICellRenderer {
function setSize(_arg1:Number, _arg2:Number):void;
function get listData():ListData;
function get data():Object;
function setMouseState(_arg1:String):void;
function set x(_arg1:Number):void;
function set y(_arg1:Number):void;
function set data(_arg1:Object):void;
function set selected(_arg1:Boolean):void;
function set listData(_arg1:ListData):void;
function get selected():Boolean;
}
}//package fl.controls.listClasses
Section 55
//ListData (fl.controls.listClasses.ListData)
package fl.controls.listClasses {
import fl.core.*;
public class ListData {
protected var _index:uint;
protected var _owner:UIComponent;
protected var _label:String;
protected var _icon:Object;// = null
protected var _row:uint;
protected var _column:uint;
public function ListData(_arg1:String, _arg2:Object, _arg3:UIComponent, _arg4:uint, _arg5:uint, _arg6:uint=0){
_icon = null;
super();
_label = _arg1;
_icon = _arg2;
_owner = _arg3;
_index = _arg4;
_row = _arg5;
_column = _arg6;
}
public function get owner():UIComponent{
return (_owner);
}
public function get label():String{
return (_label);
}
public function get row():uint{
return (_row);
}
public function get index():uint{
return (_index);
}
public function get icon():Object{
return (_icon);
}
public function get column():uint{
return (_column);
}
}
}//package fl.controls.listClasses
Section 56
//BaseButton (fl.controls.BaseButton)
package fl.controls {
import fl.core.*;
import flash.display.*;
import flash.events.*;
import fl.events.*;
import flash.utils.*;
public class BaseButton extends UIComponent {
protected var _selected:Boolean;// = false
private var unlockedMouseState:String;
protected var pressTimer:Timer;
protected var mouseState:String;
protected var background:DisplayObject;
private var _mouseStateLocked:Boolean;// = false
protected var _autoRepeat:Boolean;// = false
private static var defaultStyles:Object = {upSkin:"Button_upSkin", downSkin:"Button_downSkin", overSkin:"Button_overSkin", disabledSkin:"Button_disabledSkin", selectedDisabledSkin:"Button_selectedDisabledSkin", selectedUpSkin:"Button_selectedUpSkin", selectedDownSkin:"Button_selectedDownSkin", selectedOverSkin:"Button_selectedOverSkin", focusRectSkin:null, focusRectPadding:null, repeatDelay:500, repeatInterval:35};
public function BaseButton(){
_selected = false;
_autoRepeat = false;
_mouseStateLocked = false;
super();
buttonMode = true;
mouseChildren = false;
useHandCursor = false;
setupMouseEvents();
setMouseState("up");
pressTimer = new Timer(1, 0);
pressTimer.addEventListener(TimerEvent.TIMER, buttonDown, false, 0, true);
}
protected function endPress():void{
pressTimer.reset();
}
public function set mouseStateLocked(_arg1:Boolean):void{
_mouseStateLocked = _arg1;
if (_arg1 == false){
setMouseState(unlockedMouseState);
} else {
unlockedMouseState = mouseState;
};
}
public function get autoRepeat():Boolean{
return (_autoRepeat);
}
public function set autoRepeat(_arg1:Boolean):void{
_autoRepeat = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
mouseEnabled = _arg1;
}
public function get selected():Boolean{
return (_selected);
}
protected function mouseEventHandler(_arg1:MouseEvent):void{
if (_arg1.type == MouseEvent.MOUSE_DOWN){
setMouseState("down");
startPress();
} else {
if ((((_arg1.type == MouseEvent.ROLL_OVER)) || ((_arg1.type == MouseEvent.MOUSE_UP)))){
setMouseState("over");
endPress();
} else {
if (_arg1.type == MouseEvent.ROLL_OUT){
setMouseState("up");
endPress();
};
};
};
}
public function setMouseState(_arg1:String):void{
if (_mouseStateLocked){
unlockedMouseState = _arg1;
return;
};
if (mouseState == _arg1){
return;
};
mouseState = _arg1;
invalidate(InvalidationType.STATE);
}
protected function startPress():void{
if (_autoRepeat){
pressTimer.delay = Number(getStyleValue("repeatDelay"));
pressTimer.start();
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
protected function buttonDown(_arg1:TimerEvent):void{
if (!_autoRepeat){
endPress();
return;
};
if (pressTimer.currentCount == 1){
pressTimer.delay = Number(getStyleValue("repeatInterval"));
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
public function set selected(_arg1:Boolean):void{
if (_selected == _arg1){
return;
};
_selected = _arg1;
invalidate(InvalidationType.STATE);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function setupMouseEvents():void{
addEventListener(MouseEvent.ROLL_OVER, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_DOWN, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_UP, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.ROLL_OUT, mouseEventHandler, false, 0, true);
}
protected function drawLayout():void{
background.width = width;
background.height = height;
}
protected function drawBackground():void{
var _local1:String;
var _local2:DisplayObject;
_local1 = (enabled) ? mouseState : "disabled";
if (selected){
_local1 = (("selected" + _local1.substr(0, 1).toUpperCase()) + _local1.substr(1));
};
_local1 = (_local1 + "Skin");
_local2 = background;
background = getDisplayObjectInstance(getStyleValue(_local1));
addChildAt(background, 0);
if (((!((_local2 == null))) && (!((_local2 == background))))){
removeChild(_local2);
};
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 57
//Button (fl.controls.Button)
package fl.controls {
import fl.core.*;
import flash.display.*;
import fl.managers.*;
public class Button extends LabelButton implements IFocusManagerComponent {
protected var emphasizedBorder:DisplayObject;
protected var _emphasized:Boolean;// = false
private static var defaultStyles:Object = {emphasizedSkin:"Button_emphasizedSkin", emphasizedPadding:2};
public static var createAccessibilityImplementation:Function;
public function Button(){
_emphasized = false;
super();
}
override public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
var _local3:*;
super.drawFocus(_arg1);
if (_arg1){
_local2 = Number(getStyleValue("emphasizedPadding"));
if ((((_local2 < 0)) || (!(_emphasized)))){
_local2 = 0;
};
_local3 = getStyleValue("focusRectPadding");
_local3 = ((_local3)==null) ? 2 : _local3;
_local3 = (_local3 + _local2);
uiFocusRect.x = -(_local3);
uiFocusRect.y = -(_local3);
uiFocusRect.width = (width + (_local3 * 2));
uiFocusRect.height = (height + (_local3 * 2));
};
}
public function set emphasized(_arg1:Boolean):void{
_emphasized = _arg1;
invalidate(InvalidationType.STYLES);
}
override protected function draw():void{
if (((isInvalid(InvalidationType.STYLES)) || (isInvalid(InvalidationType.SIZE)))){
drawEmphasized();
};
super.draw();
if (emphasizedBorder != null){
setChildIndex(emphasizedBorder, (numChildren - 1));
};
}
public function get emphasized():Boolean{
return (_emphasized);
}
override protected function initializeAccessibility():void{
if (Button.createAccessibilityImplementation != null){
Button.createAccessibilityImplementation(this);
};
}
protected function drawEmphasized():void{
var _local1:Object;
var _local2:Number;
if (emphasizedBorder != null){
removeChild(emphasizedBorder);
};
emphasizedBorder = null;
if (!_emphasized){
return;
};
_local1 = getStyleValue("emphasizedSkin");
if (_local1 != null){
emphasizedBorder = getDisplayObjectInstance(_local1);
};
if (emphasizedBorder != null){
addChildAt(emphasizedBorder, 0);
_local2 = Number(getStyleValue("emphasizedPadding"));
emphasizedBorder.x = (emphasizedBorder.y = -(_local2));
emphasizedBorder.width = (width + (_local2 * 2));
emphasizedBorder.height = (height + (_local2 * 2));
};
}
public static function getStyleDefinition():Object{
return (UIComponent.mergeStyles(LabelButton.getStyleDefinition(), defaultStyles));
}
}
}//package fl.controls
Section 58
//ButtonLabelPlacement (fl.controls.ButtonLabelPlacement)
package fl.controls {
public class ButtonLabelPlacement {
public static const TOP:String = "top";
public static const LEFT:String = "left";
public static const BOTTOM:String = "bottom";
public static const RIGHT:String = "right";
}
}//package fl.controls
Section 59
//ComboBox (fl.controls.ComboBox)
package fl.controls {
import fl.controls.listClasses.*;
import fl.core.*;
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import fl.data.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.ui.*;
public class ComboBox extends UIComponent implements IFocusManagerComponent {
protected var _dropdownWidth:Number;
protected var highlightedCell:int;// = -1
protected var _prompt:String;
protected var isOpen:Boolean;// = false
protected var list:List;
protected var _rowCount:uint;// = 5
protected var currentIndex:int;
protected var isKeyDown:Boolean;// = false
protected var _labels:Array;
protected var background:BaseButton;
protected var inputField:TextInput;
protected var listOverIndex:uint;
protected var editableValue:String;
protected var _editable:Boolean;// = false
private var collectionItemImport:SimpleCollectionItem;
protected static const BACKGROUND_STYLES:Object = {overSkin:"overSkin", downSkin:"downSkin", upSkin:"upSkin", disabledSkin:"disabledSkin", repeatInterval:"repeatInterval"};
protected static const LIST_STYLES:Object = {upSkin:"comboListUpSkin", overSkin:"comboListOverSkin", downSkin:"comobListDownSkin", disabledSkin:"comboListDisabledSkin", downArrowDisabledSkin:"downArrowDisabledSkin", downArrowDownSkin:"downArrowDownSkin", downArrowOverSkin:"downArrowOverSkin", downArrowUpSkin:"downArrowUpSkin", upArrowDisabledSkin:"upArrowDisabledSkin", upArrowDownSkin:"upArrowDownSkin", upArrowOverSkin:"upArrowOverSkin", upArrowUpSkin:"upArrowUpSkin", thumbDisabledSkin:"thumbDisabledSkin", thumbDownSkin:"thumbDownSkin", thumbOverSkin:"thumbOverSkin", thumbUpSkin:"thumbUpSkin", thumbIcon:"thumbIcon", trackDisabledSkin:"trackDisabledSkin", trackDownSkin:"trackDownSkin", trackOverSkin:"trackOverSkin", trackUpSkin:"trackUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval", textFormat:"textFormat", disabledAlpha:"disabledAlpha", skin:"listSkin"};
private static var defaultStyles:Object = {upSkin:"ComboBox_upSkin", downSkin:"ComboBox_downSkin", overSkin:"ComboBox_overSkin", disabledSkin:"ComboBox_disabledSkin", focusRectSkin:null, focusRectPadding:null, textFormat:null, disabledTextFormat:null, textPadding:3, buttonWidth:24, disabledAlpha:null, listSkin:null};
public static var createAccessibilityImplementation:Function;
public function ComboBox(){
_rowCount = 5;
_editable = false;
isOpen = false;
highlightedCell = -1;
isKeyDown = false;
super();
}
protected function drawList():void{
list.rowCount = Math.max(0, Math.min(_rowCount, list.dataProvider.length));
}
public function set imeMode(_arg1:String):void{
inputField.imeMode = _arg1;
}
public function get dropdown():List{
return (list);
}
public function get dropdownWidth():Number{
return (list.width);
}
public function sortItemsOn(_arg1:String, _arg2:Object=null){
return (list.sortItemsOn(_arg1, _arg2));
}
protected function onEnter(_arg1:ComponentEvent):void{
_arg1.stopPropagation();
}
public function removeItemAt(_arg1:uint):void{
list.removeItemAt(_arg1);
invalidate(InvalidationType.DATA);
}
public function open():void{
currentIndex = selectedIndex;
if (((isOpen) || ((length == 0)))){
return;
};
dispatchEvent(new Event(Event.OPEN));
isOpen = true;
addEventListener(Event.ENTER_FRAME, addCloseListener, false, 0, true);
positionList();
list.scrollToSelected();
stage.addChild(list);
}
public function get selectedItem():Object{
return (list.selectedItem);
}
public function set text(_arg1:String):void{
if (!editable){
return;
};
inputField.text = _arg1;
}
public function get labelField():String{
return (list.labelField);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
var _local2:int;
var _local3:uint;
var _local4:Number;
var _local5:int;
isKeyDown = true;
if (_arg1.ctrlKey){
switch (_arg1.keyCode){
case Keyboard.UP:
if (highlightedCell > -1){
selectedIndex = highlightedCell;
dispatchEvent(new Event(Event.CHANGE));
};
close();
break;
case Keyboard.DOWN:
open();
break;
};
return;
};
_arg1.stopPropagation();
_local2 = Math.max(((calculateAvailableHeight() / list.rowHeight) << 0), 1);
_local3 = selectedIndex;
_local4 = ((highlightedCell)==-1) ? selectedIndex : highlightedCell;
_local5 = -1;
switch (_arg1.keyCode){
case Keyboard.SPACE:
if (isOpen){
close();
} else {
open();
};
return;
case Keyboard.ESCAPE:
if (isOpen){
if (highlightedCell > -1){
selectedIndex = selectedIndex;
};
close();
};
return;
case Keyboard.UP:
_local5 = Math.max(0, (_local4 - 1));
break;
case Keyboard.DOWN:
_local5 = Math.min((length - 1), (_local4 + 1));
break;
case Keyboard.PAGE_UP:
_local5 = Math.max((_local4 - _local2), 0);
break;
case Keyboard.PAGE_DOWN:
_local5 = Math.min((_local4 + _local2), (length - 1));
break;
case Keyboard.HOME:
_local5 = 0;
break;
case Keyboard.END:
_local5 = (length - 1);
break;
case Keyboard.ENTER:
if (((_editable) && ((highlightedCell == -1)))){
editableValue = inputField.text;
selectedIndex = -1;
} else {
if (((isOpen) && ((highlightedCell > -1)))){
editableValue = null;
selectedIndex = highlightedCell;
dispatchEvent(new Event(Event.CHANGE));
};
};
dispatchEvent(new ComponentEvent(ComponentEvent.ENTER));
close();
return;
default:
if (editable){
break;
};
_local5 = list.getNextIndexAtLetter(String.fromCharCode(_arg1.keyCode), _local4);
break;
};
if (_local5 > -1){
if (isOpen){
highlightCell(_local5);
inputField.text = list.itemToLabel(getItemAt(_local5));
} else {
highlightCell();
selectedIndex = _local5;
dispatchEvent(new Event(Event.CHANGE));
};
};
}
public function set dropdownWidth(_arg1:Number):void{
_dropdownWidth = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get editable():Boolean{
return (_editable);
}
override protected function focusInHandler(_arg1:FocusEvent):void{
super.focusInHandler(_arg1);
if (editable){
stage.focus = inputField.textField;
};
}
protected function onStageClick(_arg1:MouseEvent):void{
if (!isOpen){
return;
};
if (((!(contains((_arg1.target as DisplayObject)))) && (!(list.contains((_arg1.target as DisplayObject)))))){
if (highlightedCell != -1){
selectedIndex = highlightedCell;
dispatchEvent(new Event(Event.CHANGE));
};
close();
};
}
protected function handleDataChange(_arg1:DataChangeEvent):void{
invalidate(InvalidationType.DATA);
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
isKeyDown = false;
}
protected function onListItemUp(_arg1:MouseEvent):void{
var _local2:*;
stage.removeEventListener(MouseEvent.MOUSE_UP, onListItemUp);
if (((!((_arg1.target is ICellRenderer))) || (!(list.contains((_arg1.target as DisplayObject)))))){
return;
};
editableValue = null;
_local2 = selectedIndex;
selectedIndex = _arg1.target.listData.index;
if (_local2 != selectedIndex){
dispatchEvent(new Event(Event.CHANGE));
};
close();
}
public function removeAll():void{
list.removeAll();
inputField.text = "";
invalidate(InvalidationType.DATA);
}
public function set selectedItem(_arg1:Object):void{
list.selectedItem = _arg1;
invalidate(InvalidationType.SELECTED);
}
protected function highlightCell(_arg1:int=-1):void{
var _local2:ICellRenderer;
if (highlightedCell > -1){
_local2 = list.itemToCellRenderer(getItemAt(highlightedCell));
if (_local2 != null){
_local2.setMouseState("up");
};
};
if (_arg1 == -1){
return;
};
list.scrollToIndex(_arg1);
list.drawNow();
_local2 = list.itemToCellRenderer(getItemAt(_arg1));
if (_local2 != null){
_local2.setMouseState("over");
highlightedCell = _arg1;
};
}
public function itemToLabel(_arg1:Object):String{
if (_arg1 == null){
return ("");
};
return (list.itemToLabel(_arg1));
}
public function addItemAt(_arg1:Object, _arg2:uint):void{
list.addItemAt(_arg1, _arg2);
invalidate(InvalidationType.DATA);
}
public function replaceItemAt(_arg1:Object, _arg2:uint):Object{
return (list.replaceItemAt(_arg1, _arg2));
}
protected function showPrompt():void{
inputField.text = _prompt;
}
public function set rowCount(_arg1:uint):void{
_rowCount = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get restrict():String{
return (inputField.restrict);
}
protected function setEmbedFonts():void{
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
inputField.textField.embedFonts = _local1;
};
}
public function sortItems(... _args){
return (list.sortItems.apply(list, _args));
}
public function set labelField(_arg1:String):void{
list.labelField = _arg1;
invalidate(InvalidationType.DATA);
}
public function set editable(_arg1:Boolean):void{
_editable = _arg1;
drawTextField();
}
public function set prompt(_arg1:String):void{
if (_arg1 == ""){
_prompt = null;
} else {
_prompt = _arg1;
};
invalidate(InvalidationType.STATE);
}
public function get length():int{
return (list.length);
}
protected function drawTextField():void{
inputField.setStyle("upSkin", "");
inputField.setStyle("disabledSkin", "");
inputField.enabled = enabled;
inputField.editable = _editable;
inputField.textField.selectable = ((enabled) && (_editable));
inputField.mouseEnabled = (inputField.mouseChildren = ((enabled) && (_editable)));
inputField.focusEnabled = false;
if (_editable){
inputField.addEventListener(FocusEvent.FOCUS_IN, onInputFieldFocus, false, 0, true);
inputField.addEventListener(FocusEvent.FOCUS_OUT, onInputFieldFocusOut, false, 0, true);
} else {
inputField.removeEventListener(FocusEvent.FOCUS_IN, onInputFieldFocus);
inputField.removeEventListener(FocusEvent.FOCUS_OUT, onInputFieldFocusOut);
};
}
protected function onInputFieldFocusOut(_arg1:FocusEvent):void{
inputField.removeEventListener(ComponentEvent.ENTER, onEnter);
selectedIndex = selectedIndex;
}
protected function passEvent(_arg1:Event):void{
dispatchEvent(_arg1);
}
public function get imeMode():String{
return (inputField.imeMode);
}
public function get labelFunction():Function{
return (list.labelFunction);
}
protected function calculateAvailableHeight():Number{
var _local1:Number;
_local1 = Number(getStyleValue("contentPadding"));
return ((list.height - (_local1 * 2)));
}
public function get selectedIndex():int{
return (list.selectedIndex);
}
override protected function focusOutHandler(_arg1:FocusEvent):void{
isKeyDown = false;
if (isOpen){
if (((!(_arg1.relatedObject)) || (!(list.contains(_arg1.relatedObject))))){
if (((!((highlightedCell == -1))) && (!((highlightedCell == selectedIndex))))){
selectedIndex = highlightedCell;
dispatchEvent(new Event(Event.CHANGE));
};
close();
};
};
super.focusOutHandler(_arg1);
}
public function get selectedLabel():String{
if (editableValue != null){
return (editableValue);
};
if (selectedIndex == -1){
return (null);
};
return (itemToLabel(selectedItem));
}
public function get text():String{
return (inputField.text);
}
protected function onListChange(_arg1:Event):void{
editableValue = null;
dispatchEvent(_arg1);
invalidate(InvalidationType.SELECTED);
if (isKeyDown){
return;
};
close();
}
protected function onToggleListVisibility(_arg1:MouseEvent):void{
_arg1.stopPropagation();
dispatchEvent(_arg1);
if (isOpen){
close();
} else {
open();
stage.addEventListener(MouseEvent.MOUSE_UP, onListItemUp, false, 0, true);
};
}
override protected function draw():void{
var _local1:*;
_local1 = selectedIndex;
if ((((_local1 == -1)) && (((((!((prompt == null))) || (editable))) || ((length == 0)))))){
_local1 = Math.max(-1, Math.min(_local1, (length - 1)));
} else {
editableValue = null;
_local1 = Math.max(0, Math.min(_local1, (length - 1)));
};
if (list.selectedIndex != _local1){
list.selectedIndex = _local1;
invalidate(InvalidationType.SELECTED, false);
};
if (isInvalid(InvalidationType.STYLES)){
setStyles();
setEmbedFonts();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.DATA, InvalidationType.STATE)){
drawTextFormat();
drawLayout();
invalidate(InvalidationType.DATA);
};
if (isInvalid(InvalidationType.DATA)){
drawList();
invalidate(InvalidationType.SELECTED, true);
};
if (isInvalid(InvalidationType.SELECTED)){
if ((((_local1 == -1)) && (!((editableValue == null))))){
inputField.text = editableValue;
} else {
if (_local1 > -1){
if (length > 0){
inputField.horizontalScrollPosition = 0;
inputField.text = itemToLabel(list.selectedItem);
};
} else {
if ((((_local1 == -1)) && (!((_prompt == null))))){
showPrompt();
} else {
inputField.text = "";
};
};
};
if (((((editable) && ((selectedIndex > -1)))) && ((stage.focus == inputField.textField)))){
inputField.setSelection(0, inputField.length);
};
};
drawTextField();
super.draw();
}
public function addItem(_arg1:Object):void{
list.addItem(_arg1);
invalidate(InvalidationType.DATA);
}
public function get rowCount():uint{
return (_rowCount);
}
override protected function configUI():void{
super.configUI();
background = new BaseButton();
background.focusEnabled = false;
copyStylesToChild(background, BACKGROUND_STYLES);
background.addEventListener(MouseEvent.MOUSE_DOWN, onToggleListVisibility, false, 0, true);
addChild(background);
inputField = new TextInput();
inputField.focusTarget = (this as IFocusManagerComponent);
inputField.focusEnabled = false;
inputField.addEventListener(Event.CHANGE, onTextInput, false, 0, true);
addChild(inputField);
list = new List();
list.focusEnabled = false;
copyStylesToChild(list, LIST_STYLES);
list.addEventListener(Event.CHANGE, onListChange, false, 0, true);
list.addEventListener(ListEvent.ITEM_CLICK, onListChange, false, 0, true);
list.addEventListener(ListEvent.ITEM_ROLL_OUT, passEvent, false, 0, true);
list.addEventListener(ListEvent.ITEM_ROLL_OVER, passEvent, false, 0, true);
list.verticalScrollBar.addEventListener(Event.SCROLL, passEvent, false, 0, true);
}
protected function positionList():void{
var _local1:Point;
_local1 = localToGlobal(new Point(0, 0));
list.x = _local1.x;
if (((_local1.y + height) + list.height) > stage.stageHeight){
list.y = (_local1.y - list.height);
} else {
list.y = (_local1.y + height);
};
}
public function get value():String{
var _local1:Object;
if (editableValue != null){
return (editableValue);
};
_local1 = selectedItem;
if (((!(_editable)) && (!((_local1.data == null))))){
return (_local1.data);
};
return (itemToLabel(_local1));
}
public function get prompt():String{
return (_prompt);
}
public function set dataProvider(_arg1:DataProvider):void{
_arg1.addEventListener(DataChangeEvent.DATA_CHANGE, handleDataChange, false, 0, true);
list.dataProvider = _arg1;
invalidate(InvalidationType.DATA);
}
public function set restrict(_arg1:String):void{
if (((componentInspectorSetting) && ((_arg1 == "")))){
_arg1 = null;
};
if (!_editable){
return;
};
inputField.restrict = _arg1;
}
protected function onTextInput(_arg1:Event):void{
_arg1.stopPropagation();
if (!_editable){
return;
};
editableValue = inputField.text;
selectedIndex = -1;
dispatchEvent(new Event(Event.CHANGE));
}
protected function onInputFieldFocus(_arg1:FocusEvent):void{
inputField.addEventListener(ComponentEvent.ENTER, onEnter, false, 0, true);
close();
}
public function getItemAt(_arg1:uint):Object{
return (list.getItemAt(_arg1));
}
override protected function initializeAccessibility():void{
if (ComboBox.createAccessibilityImplementation != null){
ComboBox.createAccessibilityImplementation(this);
};
}
protected function drawLayout():void{
var _local1:Number;
var _local2:Number;
_local1 = (getStyleValue("buttonWidth") as Number);
_local2 = (getStyleValue("textPadding") as Number);
background.setSize(width, height);
inputField.x = (inputField.y = _local2);
inputField.setSize(((width - _local1) - _local2), (height - _local2));
list.width = (isNaN(_dropdownWidth)) ? width : _dropdownWidth;
background.enabled = enabled;
background.drawNow();
}
public function removeItem(_arg1:Object):Object{
return (list.removeItem(_arg1));
}
private function addCloseListener(_arg1:Event){
removeEventListener(Event.ENTER_FRAME, addCloseListener);
if (!isOpen){
return;
};
stage.addEventListener(MouseEvent.MOUSE_DOWN, onStageClick, false, 0, true);
}
public function get dataProvider():DataProvider{
return (list.dataProvider);
}
public function get textField():TextInput{
return (inputField);
}
protected function setStyles():void{
copyStylesToChild(background, BACKGROUND_STYLES);
copyStylesToChild(list, LIST_STYLES);
}
public function set labelFunction(_arg1:Function):void{
list.labelFunction = _arg1;
invalidate(InvalidationType.DATA);
}
protected function drawTextFormat():void{
var _local1:TextFormat;
_local1 = (getStyleValue((_enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local1 == null){
_local1 = new TextFormat();
};
inputField.textField.defaultTextFormat = _local1;
inputField.textField.setTextFormat(_local1);
setEmbedFonts();
}
public function set selectedIndex(_arg1:int):void{
list.selectedIndex = _arg1;
highlightCell();
invalidate(InvalidationType.SELECTED);
}
public function close():void{
highlightCell();
highlightedCell = -1;
if (!isOpen){
return;
};
dispatchEvent(new Event(Event.CLOSE));
stage.removeEventListener(MouseEvent.MOUSE_DOWN, onStageClick);
isOpen = false;
stage.removeChild(list);
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, List.getStyleDefinition()));
}
}
}//package fl.controls
Section 60
//LabelButton (fl.controls.LabelButton)
package fl.controls {
import fl.core.*;
import flash.display.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.ui.*;
public class LabelButton extends BaseButton implements IFocusManagerComponent {
protected var _labelPlacement:String;// = "right"
protected var _toggle:Boolean;// = false
protected var icon:DisplayObject;
protected var oldMouseState:String;
protected var mode:String;// = "center"
public var textField:TextField;
protected var _label:String;// = "Label"
private static var defaultStyles:Object = {icon:null, upIcon:null, downIcon:null, overIcon:null, disabledIcon:null, selectedDisabledIcon:null, selectedUpIcon:null, selectedDownIcon:null, selectedOverIcon:null, textFormat:null, disabledTextFormat:null, textPadding:5, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function LabelButton(){
_labelPlacement = ButtonLabelPlacement.RIGHT;
_toggle = false;
_label = "Label";
mode = "center";
super();
}
protected function toggleSelected(_arg1:MouseEvent):void{
selected = !(selected);
dispatchEvent(new Event(Event.CHANGE, true));
}
public function get labelPlacement():String{
return (_labelPlacement);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
if (oldMouseState == null){
oldMouseState = mouseState;
};
setMouseState("down");
startPress();
};
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
setMouseState(oldMouseState);
oldMouseState = null;
endPress();
dispatchEvent(new MouseEvent(MouseEvent.CLICK));
};
}
override public function get selected():Boolean{
return ((_toggle) ? _selected : false);
}
public function set labelPlacement(_arg1:String):void{
_labelPlacement = _arg1;
invalidate(InvalidationType.SIZE);
}
public function set toggle(_arg1:Boolean):void{
if (((!(_arg1)) && (super.selected))){
selected = false;
};
_toggle = _arg1;
if (_toggle){
addEventListener(MouseEvent.CLICK, toggleSelected, false, 0, true);
} else {
removeEventListener(MouseEvent.CLICK, toggleSelected);
};
invalidate(InvalidationType.STATE);
}
public function get label():String{
return (_label);
}
override public function set selected(_arg1:Boolean):void{
_selected = _arg1;
if (_toggle){
invalidate(InvalidationType.STATE);
};
}
override protected function draw():void{
if (textField.text != _label){
label = _label;
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
drawIcon();
drawTextFormat();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
public function get toggle():Boolean{
return (_toggle);
}
override protected function configUI():void{
super.configUI();
textField = new TextField();
textField.type = TextFieldType.DYNAMIC;
textField.selectable = false;
addChild(textField);
}
override protected function drawLayout():void{
var _local1:Number;
var _local2:String;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local1 = Number(getStyleValue("textPadding"));
_local2 = ((((icon == null)) && ((mode == "center")))) ? ButtonLabelPlacement.TOP : _labelPlacement;
textField.height = (textField.textHeight + 4);
_local3 = (textField.textWidth + 4);
_local4 = (textField.textHeight + 4);
_local5 = ((icon)==null) ? 0 : (icon.width + _local1);
_local6 = ((icon)==null) ? 0 : (icon.height + _local1);
textField.visible = (label.length > 0);
if (icon != null){
icon.x = Math.round(((width - icon.width) / 2));
icon.y = Math.round(((height - icon.height) / 2));
};
if (textField.visible == false){
textField.width = 0;
textField.height = 0;
} else {
if ((((_local2 == ButtonLabelPlacement.BOTTOM)) || ((_local2 == ButtonLabelPlacement.TOP)))){
_local7 = Math.max(0, Math.min(_local3, (width - (2 * _local1))));
if ((height - 2) > _local4){
_local8 = _local4;
} else {
_local8 = (height - 2);
};
_local3 = _local7;
textField.width = _local3;
_local4 = _local8;
textField.height = _local4;
textField.x = Math.round(((width - _local3) / 2));
textField.y = Math.round(((((height - textField.height) - _local6) / 2) + ((_local2)==ButtonLabelPlacement.BOTTOM) ? _local6 : 0));
if (icon != null){
icon.y = Math.round(((_local2)==ButtonLabelPlacement.BOTTOM) ? (textField.y - _local6) : ((textField.y + textField.height) + _local1));
};
} else {
_local7 = Math.max(0, Math.min(_local3, ((width - _local5) - (2 * _local1))));
_local3 = _local7;
textField.width = _local3;
textField.x = Math.round(((((width - _local3) - _local5) / 2) + ((_local2)!=ButtonLabelPlacement.LEFT) ? _local5 : 0));
textField.y = Math.round(((height - textField.height) / 2));
if (icon != null){
icon.x = Math.round(((_local2)!=ButtonLabelPlacement.LEFT) ? (textField.x - _local5) : ((textField.x + _local3) + _local1));
};
};
};
super.drawLayout();
}
override protected function initializeAccessibility():void{
if (LabelButton.createAccessibilityImplementation != null){
LabelButton.createAccessibilityImplementation(this);
};
}
protected function drawIcon():void{
var _local1:DisplayObject;
var _local2:String;
var _local3:Object;
_local1 = icon;
_local2 = (enabled) ? mouseState : "disabled";
if (selected){
_local2 = (("selected" + _local2.substr(0, 1).toUpperCase()) + _local2.substr(1));
};
_local2 = (_local2 + "Icon");
_local3 = getStyleValue(_local2);
if (_local3 == null){
_local3 = getStyleValue("icon");
};
if (_local3 != null){
icon = getDisplayObjectInstance(_local3);
};
if (icon != null){
addChildAt(icon, 1);
};
if (((!((_local1 == null))) && (!((_local1 == icon))))){
removeChild(_local1);
};
}
public function set label(_arg1:String):void{
_label = _arg1;
if (textField.text != _label){
textField.text = _label;
dispatchEvent(new ComponentEvent(ComponentEvent.LABEL_CHANGE));
};
invalidate(InvalidationType.SIZE);
invalidate(InvalidationType.STYLES);
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseButton.getStyleDefinition()));
}
}
}//package fl.controls
Section 61
//List (fl.controls.List)
package fl.controls {
import fl.controls.listClasses.*;
import fl.core.*;
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import fl.managers.*;
import flash.utils.*;
import flash.ui.*;
public class List extends SelectableList implements IFocusManagerComponent {
protected var _labelField:String;// = "label"
protected var _rowHeight:Number;// = 20
protected var _cellRenderer:Object;
protected var _iconField:String;// = "icon"
protected var _labelFunction:Function;
protected var _iconFunction:Function;
private static var defaultStyles:Object = {focusRectSkin:null, focusRectPadding:null};
public static var createAccessibilityImplementation:Function;
public function List(){
_rowHeight = 20;
_labelField = "label";
_iconField = "icon";
super();
}
public function get iconField():String{
return (_iconField);
}
protected function doKeySelection(_arg1:int, _arg2:Boolean, _arg3:Boolean):void{
var _local4:Boolean;
var _local5:int;
var _local6:Array;
var _local7:int;
var _local8:int;
_local4 = false;
if (_arg2){
_local6 = [];
_local7 = lastCaretIndex;
_local8 = _arg1;
if (_local7 == -1){
_local7 = ((caretIndex)!=-1) ? caretIndex : _arg1;
};
if (_local7 > _local8){
_local8 = _local7;
_local7 = _arg1;
};
_local5 = _local7;
while (_local5 <= _local8) {
_local6.push(_local5);
_local5++;
};
selectedIndices = _local6;
caretIndex = _arg1;
_local4 = true;
} else {
selectedIndex = _arg1;
caretIndex = (lastCaretIndex = _arg1);
_local4 = true;
};
if (_local4){
dispatchEvent(new Event(Event.CHANGE));
};
invalidate(InvalidationType.DATA);
}
override protected function drawList():void{
var _local1:Rectangle;
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:Object;
var _local6:ICellRenderer;
var _local7:Dictionary;
var _local8:Dictionary;
var _local9:Boolean;
var _local10:String;
var _local11:Object;
var _local12:Sprite;
var _local13:String;
listHolder.x = (listHolder.y = contentPadding);
_local1 = listHolder.scrollRect;
_local1.x = _horizontalScrollPosition;
_local1.y = (Math.floor(_verticalScrollPosition) % rowHeight);
listHolder.scrollRect = _local1;
listHolder.cacheAsBitmap = useBitmapScrolling;
_local2 = Math.floor((_verticalScrollPosition / rowHeight));
_local3 = Math.min(length, ((_local2 + rowCount) + 1));
_local7 = (renderedItems = new Dictionary(true));
_local4 = _local2;
while (_local4 < _local3) {
_local7[_dataProvider.getItemAt(_local4)] = true;
_local4++;
};
_local8 = new Dictionary(true);
while (activeCellRenderers.length > 0) {
_local6 = (activeCellRenderers.pop() as ICellRenderer);
_local5 = _local6.data;
if ((((_local7[_local5] == null)) || ((invalidItems[_local5] == true)))){
availableCellRenderers.push(_local6);
} else {
_local8[_local5] = _local6;
invalidItems[_local5] = true;
};
list.removeChild((_local6 as DisplayObject));
};
invalidItems = new Dictionary(true);
_local4 = _local2;
while (_local4 < _local3) {
_local9 = false;
_local5 = _dataProvider.getItemAt(_local4);
if (_local8[_local5] != null){
_local9 = true;
_local6 = _local8[_local5];
delete _local8[_local5];
} else {
if (availableCellRenderers.length > 0){
_local6 = (availableCellRenderers.pop() as ICellRenderer);
} else {
_local6 = (getDisplayObjectInstance(getStyleValue("cellRenderer")) as ICellRenderer);
_local12 = (_local6 as Sprite);
if (_local12 != null){
_local12.addEventListener(MouseEvent.CLICK, handleCellRendererClick, false, 0, true);
_local12.addEventListener(MouseEvent.ROLL_OVER, handleCellRendererMouseEvent, false, 0, true);
_local12.addEventListener(MouseEvent.ROLL_OUT, handleCellRendererMouseEvent, false, 0, true);
_local12.addEventListener(Event.CHANGE, handleCellRendererChange, false, 0, true);
_local12.doubleClickEnabled = true;
_local12.addEventListener(MouseEvent.DOUBLE_CLICK, handleCellRendererDoubleClick, false, 0, true);
if (_local12["setStyle"] != null){
for (_local13 in rendererStyles) {
var _local16 = _local12;
_local16["setStyle"](_local13, rendererStyles[_local13]);
};
};
};
};
};
list.addChild((_local6 as Sprite));
activeCellRenderers.push(_local6);
_local6.y = (rowHeight * (_local4 - _local2));
_local6.setSize((availableWidth + _maxHorizontalScrollPosition), rowHeight);
_local10 = itemToLabel(_local5);
_local11 = null;
if (_iconFunction != null){
_local11 = _iconFunction(_local5);
} else {
if (_iconField != null){
_local11 = _local5[_iconField];
};
};
if (!_local9){
_local6.data = _local5;
};
_local6.listData = new ListData(_local10, _local11, this, _local4, _local4, 0);
_local6.selected = !((_selectedIndices.indexOf(_local4) == -1));
if ((_local6 is UIComponent)){
(_local6 as UIComponent).drawNow();
};
_local4++;
};
}
public function get iconFunction():Function{
return (_iconFunction);
}
public function set iconField(_arg1:String):void{
if (_arg1 == _iconField){
return;
};
_iconField = _arg1;
invalidate(InvalidationType.DATA);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
var _local2:int;
if (!selectable){
return;
};
switch (_arg1.keyCode){
case Keyboard.UP:
case Keyboard.DOWN:
case Keyboard.END:
case Keyboard.HOME:
case Keyboard.PAGE_UP:
case Keyboard.PAGE_DOWN:
moveSelectionVertically(_arg1.keyCode, ((_arg1.shiftKey) && (_allowMultipleSelection)), ((_arg1.ctrlKey) && (_allowMultipleSelection)));
break;
case Keyboard.LEFT:
case Keyboard.RIGHT:
moveSelectionHorizontally(_arg1.keyCode, ((_arg1.shiftKey) && (_allowMultipleSelection)), ((_arg1.ctrlKey) && (_allowMultipleSelection)));
break;
case Keyboard.SPACE:
if (caretIndex == -1){
caretIndex = 0;
};
doKeySelection(caretIndex, _arg1.shiftKey, _arg1.ctrlKey);
scrollToSelected();
break;
default:
_local2 = getNextIndexAtLetter(String.fromCharCode(_arg1.keyCode), selectedIndex);
if (_local2 > -1){
selectedIndex = _local2;
scrollToSelected();
};
break;
};
_arg1.stopPropagation();
}
override public function itemToLabel(_arg1:Object):String{
if (_labelFunction != null){
return (String(_labelFunction(_arg1)));
};
return (((_arg1[_labelField])!=null) ? String(_arg1[_labelField]) : "");
}
public function get labelField():String{
return (_labelField);
}
override protected function moveSelectionVertically(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
var _local4:int;
var _local5:int;
var _local6:int;
_local4 = Math.max(Math.floor((calculateAvailableHeight() / rowHeight)), 1);
_local5 = -1;
_local6 = 0;
switch (_arg1){
case Keyboard.UP:
if (caretIndex > 0){
_local5 = (caretIndex - 1);
};
break;
case Keyboard.DOWN:
if (caretIndex < (length - 1)){
_local5 = (caretIndex + 1);
};
break;
case Keyboard.PAGE_UP:
if (caretIndex > 0){
_local5 = Math.max((caretIndex - _local4), 0);
};
break;
case Keyboard.PAGE_DOWN:
if (caretIndex < (length - 1)){
_local5 = Math.min((caretIndex + _local4), (length - 1));
};
break;
case Keyboard.HOME:
if (caretIndex > 0){
_local5 = 0;
};
break;
case Keyboard.END:
if (caretIndex < (length - 1)){
_local5 = (length - 1);
};
break;
};
if (_local5 >= 0){
doKeySelection(_local5, _arg2, _arg3);
scrollToSelected();
};
}
public function set labelField(_arg1:String):void{
if (_arg1 == _labelField){
return;
};
_labelField = _arg1;
invalidate(InvalidationType.DATA);
}
public function set rowCount(_arg1:uint):void{
var _local2:Number;
var _local3:Number;
_local2 = Number(getStyleValue("contentPadding"));
_local3 = ((((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && ((_maxHorizontalScrollPosition > 0)))))) ? 15 : 0;
height = (((rowHeight * _arg1) + (2 * _local2)) + _local3);
}
override protected function setHorizontalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
list.x = -(_arg1);
super.setHorizontalScrollPosition(_arg1, true);
}
public function set iconFunction(_arg1:Function):void{
if (_iconFunction == _arg1){
return;
};
_iconFunction = _arg1;
invalidate(InvalidationType.DATA);
}
public function get labelFunction():Function{
return (_labelFunction);
}
override protected function moveSelectionHorizontally(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
}
override protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
invalidate(InvalidationType.SCROLL);
super.setVerticalScrollPosition(_arg1, true);
}
protected function calculateAvailableHeight():Number{
var _local1:Number;
_local1 = Number(getStyleValue("contentPadding"));
return (((height - (_local1 * 2)) - ((((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && ((_maxHorizontalScrollPosition > 0)))))) ? 15 : 0));
}
override protected function draw():void{
var _local1:Boolean;
_local1 = !((contentHeight == (rowHeight * length)));
contentHeight = (rowHeight * length);
if (isInvalid(InvalidationType.STYLES)){
setStyles();
drawBackground();
if (contentPadding != getStyleValue("contentPadding")){
invalidate(InvalidationType.SIZE, false);
};
if (_cellRenderer != getStyleValue("cellRenderer")){
_invalidateList();
_cellRenderer = getStyleValue("cellRenderer");
};
};
if (((isInvalid(InvalidationType.SIZE, InvalidationType.STATE)) || (_local1))){
drawLayout();
};
if (isInvalid(InvalidationType.RENDERER_STYLES)){
updateRendererStyles();
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.SIZE, InvalidationType.DATA, InvalidationType.SCROLL, InvalidationType.SELECTED)){
drawList();
};
updateChildren();
validate();
}
override protected function configUI():void{
useFixedHorizontalScrolling = true;
_horizontalScrollPolicy = ScrollPolicy.AUTO;
_verticalScrollPolicy = ScrollPolicy.AUTO;
super.configUI();
}
override public function get rowCount():uint{
return (Math.ceil((calculateAvailableHeight() / rowHeight)));
}
override protected function initializeAccessibility():void{
if (List.createAccessibilityImplementation != null){
List.createAccessibilityImplementation(this);
};
}
override public function scrollToIndex(_arg1:int):void{
var _local2:uint;
var _local3:uint;
drawNow();
_local2 = (Math.floor(((_verticalScrollPosition + availableHeight) / rowHeight)) - 1);
_local3 = Math.ceil((_verticalScrollPosition / rowHeight));
if (_arg1 < _local3){
verticalScrollPosition = (_arg1 * rowHeight);
} else {
if (_arg1 > _local2){
verticalScrollPosition = (((_arg1 + 1) * rowHeight) - availableHeight);
};
};
}
public function get rowHeight():Number{
return (_rowHeight);
}
public function set labelFunction(_arg1:Function):void{
if (_labelFunction == _arg1){
return;
};
_labelFunction = _arg1;
invalidate(InvalidationType.DATA);
}
public function set rowHeight(_arg1:Number):void{
_rowHeight = _arg1;
invalidate(InvalidationType.SIZE);
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, SelectableList.getStyleDefinition()));
}
}
}//package fl.controls
Section 62
//ScrollBar (fl.controls.ScrollBar)
package fl.controls {
import fl.core.*;
import flash.events.*;
import fl.events.*;
public class ScrollBar extends UIComponent {
private var _direction:String;// = "vertical"
protected var inDrag:Boolean;// = false
protected var upArrow:BaseButton;
private var _pageScrollSize:Number;// = 0
protected var downArrow:BaseButton;
private var _pageSize:Number;// = 10
private var thumbScrollOffset:Number;
private var _maxScrollPosition:Number;// = 0
private var _scrollPosition:Number;// = 0
protected var track:BaseButton;
private var _minScrollPosition:Number;// = 0
private var _lineScrollSize:Number;// = 1
protected var thumb:LabelButton;
protected static const THUMB_STYLES:Object = {disabledSkin:"thumbDisabledSkin", downSkin:"thumbDownSkin", overSkin:"thumbOverSkin", upSkin:"thumbUpSkin", icon:"thumbIcon", textPadding:0};
public static const WIDTH:Number = 15;
protected static const DOWN_ARROW_STYLES:Object = {disabledSkin:"downArrowDisabledSkin", downSkin:"downArrowDownSkin", overSkin:"downArrowOverSkin", upSkin:"downArrowUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
protected static const UP_ARROW_STYLES:Object = {disabledSkin:"upArrowDisabledSkin", downSkin:"upArrowDownSkin", overSkin:"upArrowOverSkin", upSkin:"upArrowUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
protected static const TRACK_STYLES:Object = {disabledSkin:"trackDisabledSkin", downSkin:"trackDownSkin", overSkin:"trackOverSkin", upSkin:"trackUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
private static var defaultStyles:Object = {downArrowDisabledSkin:"ScrollArrowDown_disabledSkin", downArrowDownSkin:"ScrollArrowDown_downSkin", downArrowOverSkin:"ScrollArrowDown_overSkin", downArrowUpSkin:"ScrollArrowDown_upSkin", thumbDisabledSkin:"ScrollThumb_upSkin", thumbDownSkin:"ScrollThumb_downSkin", thumbOverSkin:"ScrollThumb_overSkin", thumbUpSkin:"ScrollThumb_upSkin", trackDisabledSkin:"ScrollTrack_skin", trackDownSkin:"ScrollTrack_skin", trackOverSkin:"ScrollTrack_skin", trackUpSkin:"ScrollTrack_skin", upArrowDisabledSkin:"ScrollArrowUp_disabledSkin", upArrowDownSkin:"ScrollArrowUp_downSkin", upArrowOverSkin:"ScrollArrowUp_overSkin", upArrowUpSkin:"ScrollArrowUp_upSkin", thumbIcon:"ScrollBar_thumbIcon", repeatDelay:500, repeatInterval:35};
public function ScrollBar(){
_pageSize = 10;
_pageScrollSize = 0;
_lineScrollSize = 1;
_minScrollPosition = 0;
_maxScrollPosition = 0;
_scrollPosition = 0;
_direction = ScrollBarDirection.VERTICAL;
inDrag = false;
super();
setStyles();
focusEnabled = false;
}
public function get minScrollPosition():Number{
return (_minScrollPosition);
}
public function set minScrollPosition(_arg1:Number):void{
setScrollProperties(_pageSize, _arg1, _maxScrollPosition);
}
public function setScrollPosition(_arg1:Number, _arg2:Boolean=true):void{
var _local3:Number;
_local3 = scrollPosition;
_scrollPosition = Math.max(_minScrollPosition, Math.min(_maxScrollPosition, _arg1));
if (_local3 == _scrollPosition){
return;
};
if (_arg2){
dispatchEvent(new ScrollEvent(_direction, (scrollPosition - _local3), scrollPosition));
};
updateThumb();
}
public function set scrollPosition(_arg1:Number):void{
setScrollPosition(_arg1, true);
}
public function get pageScrollSize():Number{
return (((_pageScrollSize)==0) ? _pageSize : _pageScrollSize);
}
public function set pageSize(_arg1:Number):void{
if (_arg1 > 0){
_pageSize = _arg1;
};
}
public function setScrollProperties(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number=0):void{
this.pageSize = _arg1;
_minScrollPosition = _arg2;
_maxScrollPosition = _arg3;
if (_arg4 >= 0){
_pageScrollSize = _arg4;
};
enabled = (_maxScrollPosition > _minScrollPosition);
setScrollPosition(_scrollPosition, false);
updateThumb();
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
downArrow.enabled = (track.enabled = (thumb.enabled = (upArrow.enabled = ((enabled) && ((_maxScrollPosition > _minScrollPosition))))));
updateThumb();
}
protected function updateThumb():void{
var _local1:Number;
_local1 = ((_maxScrollPosition - _minScrollPosition) + _pageSize);
if ((((((track.height <= 12)) || ((_maxScrollPosition <= _minScrollPosition)))) || ((((_local1 == 0)) || (isNaN(_local1)))))){
thumb.height = 12;
thumb.visible = false;
} else {
thumb.height = Math.max(13, ((_pageSize / _local1) * track.height));
thumb.y = (track.y + ((track.height - thumb.height) * ((_scrollPosition - _minScrollPosition) / (_maxScrollPosition - _minScrollPosition))));
thumb.visible = enabled;
};
}
protected function thumbPressHandler(_arg1:MouseEvent):void{
inDrag = true;
thumbScrollOffset = (mouseY - thumb.y);
thumb.mouseStateLocked = true;
mouseChildren = false;
stage.addEventListener(MouseEvent.MOUSE_MOVE, handleThumbDrag, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler, false, 0, true);
}
protected function thumbReleaseHandler(_arg1:MouseEvent):void{
inDrag = false;
mouseChildren = true;
thumb.mouseStateLocked = false;
stage.removeEventListener(MouseEvent.MOUSE_MOVE, handleThumbDrag);
stage.removeEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler);
}
public function set pageScrollSize(_arg1:Number):void{
if (_arg1 >= 0){
_pageScrollSize = _arg1;
};
}
protected function handleThumbDrag(_arg1:MouseEvent):void{
var _local2:Number;
_local2 = Math.max(0, Math.min((track.height - thumb.height), ((mouseY - track.y) - thumbScrollOffset)));
setScrollPosition((((_local2 / (track.height - thumb.height)) * (_maxScrollPosition - _minScrollPosition)) + _minScrollPosition));
}
public function set direction(_arg1:String):void{
var _local2:Boolean;
if (_direction == _arg1){
return;
};
_direction = _arg1;
if (isLivePreview){
return;
};
setScaleY(1);
_local2 = (_direction == ScrollBarDirection.HORIZONTAL);
if (((_local2) && (componentInspectorSetting))){
if (rotation == 90){
return;
};
setScaleX(-1);
rotation = -90;
};
if (!componentInspectorSetting){
if (((_local2) && ((rotation == 0)))){
rotation = -90;
setScaleX(-1);
} else {
if (((!(_local2)) && ((rotation == -90)))){
rotation = 0;
setScaleX(1);
};
};
};
invalidate(InvalidationType.SIZE);
}
public function set lineScrollSize(_arg1:Number):void{
if (_arg1 > 0){
_lineScrollSize = _arg1;
};
}
override public function get height():Number{
return (((_direction)==ScrollBarDirection.HORIZONTAL) ? super.width : super.height);
}
protected function scrollPressHandler(_arg1:ComponentEvent):void{
var _local2:Number;
var _local3:Number;
_arg1.stopImmediatePropagation();
if (_arg1.currentTarget == upArrow){
setScrollPosition((_scrollPosition - _lineScrollSize));
} else {
if (_arg1.currentTarget == downArrow){
setScrollPosition((_scrollPosition + _lineScrollSize));
} else {
_local2 = (((track.mouseY / track.height) * (_maxScrollPosition - _minScrollPosition)) + _minScrollPosition);
_local3 = ((pageScrollSize)==0) ? pageSize : pageScrollSize;
if (_scrollPosition < _local2){
setScrollPosition(Math.min(_local2, (_scrollPosition + _local3)));
} else {
if (_scrollPosition > _local2){
setScrollPosition(Math.max(_local2, (_scrollPosition - _local3)));
};
};
};
};
}
public function get pageSize():Number{
return (_pageSize);
}
public function set maxScrollPosition(_arg1:Number):void{
setScrollProperties(_pageSize, _minScrollPosition, _arg1);
}
public function get scrollPosition():Number{
return (_scrollPosition);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
var _local1:Number;
if (isInvalid(InvalidationType.SIZE)){
_local1 = super.height;
downArrow.move(0, Math.max(upArrow.height, (_local1 - downArrow.height)));
track.setSize(WIDTH, Math.max(0, (_local1 - (downArrow.height + upArrow.height))));
updateThumb();
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
setStyles();
};
downArrow.drawNow();
upArrow.drawNow();
track.drawNow();
thumb.drawNow();
validate();
}
override protected function configUI():void{
super.configUI();
track = new BaseButton();
track.move(0, 14);
track.useHandCursor = false;
track.autoRepeat = true;
track.focusEnabled = false;
addChild(track);
thumb = new LabelButton();
thumb.label = "";
thumb.setSize(WIDTH, 15);
thumb.move(0, 15);
thumb.focusEnabled = false;
addChild(thumb);
downArrow = new BaseButton();
downArrow.setSize(WIDTH, 14);
downArrow.autoRepeat = true;
downArrow.focusEnabled = false;
addChild(downArrow);
upArrow = new BaseButton();
upArrow.setSize(WIDTH, 14);
upArrow.move(0, 0);
upArrow.autoRepeat = true;
upArrow.focusEnabled = false;
addChild(upArrow);
upArrow.addEventListener(ComponentEvent.BUTTON_DOWN, scrollPressHandler, false, 0, true);
downArrow.addEventListener(ComponentEvent.BUTTON_DOWN, scrollPressHandler, false, 0, true);
track.addEventListener(ComponentEvent.BUTTON_DOWN, scrollPressHandler, false, 0, true);
thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbPressHandler, false, 0, true);
enabled = false;
}
public function get direction():String{
return (_direction);
}
public function get lineScrollSize():Number{
return (_lineScrollSize);
}
override public function setSize(_arg1:Number, _arg2:Number):void{
if (_direction == ScrollBarDirection.HORIZONTAL){
super.setSize(_arg2, _arg1);
} else {
super.setSize(_arg1, _arg2);
};
}
public function get maxScrollPosition():Number{
return (_maxScrollPosition);
}
override public function get width():Number{
return (((_direction)==ScrollBarDirection.HORIZONTAL) ? super.height : super.width);
}
protected function setStyles():void{
copyStylesToChild(downArrow, DOWN_ARROW_STYLES);
copyStylesToChild(thumb, THUMB_STYLES);
copyStylesToChild(track, TRACK_STYLES);
copyStylesToChild(upArrow, UP_ARROW_STYLES);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 63
//ScrollBarDirection (fl.controls.ScrollBarDirection)
package fl.controls {
public class ScrollBarDirection {
public static const HORIZONTAL:String = "horizontal";
public static const VERTICAL:String = "vertical";
}
}//package fl.controls
Section 64
//ScrollPolicy (fl.controls.ScrollPolicy)
package fl.controls {
public class ScrollPolicy {
public static const OFF:String = "off";
public static const ON:String = "on";
public static const AUTO:String = "auto";
}
}//package fl.controls
Section 65
//SelectableList (fl.controls.SelectableList)
package fl.controls {
import fl.controls.listClasses.*;
import fl.core.*;
import flash.display.*;
import flash.events.*;
import fl.data.*;
import fl.managers.*;
import fl.events.*;
import flash.utils.*;
import fl.containers.*;
import flash.ui.*;
public class SelectableList extends BaseScrollPane implements IFocusManagerComponent {
protected var invalidItems:Dictionary;
protected var renderedItems:Dictionary;
protected var listHolder:Sprite;
protected var _allowMultipleSelection:Boolean;// = false
protected var lastCaretIndex:int;// = -1
protected var _selectedIndices:Array;
protected var availableCellRenderers:Array;
protected var list:Sprite;
protected var caretIndex:int;// = -1
protected var updatedRendererStyles:Object;
protected var preChangeItems:Array;
protected var activeCellRenderers:Array;
protected var rendererStyles:Object;
protected var _verticalScrollPosition:Number;
protected var _dataProvider:DataProvider;
protected var _horizontalScrollPosition:Number;
private var collectionItemImport:SimpleCollectionItem;
protected var _selectable:Boolean;// = true
private static var defaultStyles:Object = {skin:"List_skin", cellRenderer:CellRenderer, contentPadding:null, disabledAlpha:null};
public static var createAccessibilityImplementation:Function;
public function SelectableList(){
_allowMultipleSelection = false;
_selectable = true;
caretIndex = -1;
lastCaretIndex = -1;
super();
activeCellRenderers = [];
availableCellRenderers = [];
invalidItems = new Dictionary(true);
renderedItems = new Dictionary(true);
_selectedIndices = [];
if (dataProvider == null){
dataProvider = new DataProvider();
};
verticalScrollPolicy = ScrollPolicy.AUTO;
rendererStyles = {};
updatedRendererStyles = {};
}
protected function drawList():void{
}
public function set allowMultipleSelection(_arg1:Boolean):void{
if (_arg1 == _allowMultipleSelection){
return;
};
_allowMultipleSelection = _arg1;
if (((!(_arg1)) && ((_selectedIndices.length > 1)))){
_selectedIndices = [_selectedIndices.pop()];
invalidate(InvalidationType.DATA);
};
}
public function sortItemsOn(_arg1:String, _arg2:Object=null){
return (_dataProvider.sortOn(_arg1, _arg2));
}
public function removeItemAt(_arg1:uint):Object{
return (_dataProvider.removeItemAt(_arg1));
}
public function get selectedItem():Object{
return (((_selectedIndices.length)==0) ? null : _dataProvider.getItemAt(selectedIndex));
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (!selectable){
return;
};
switch (_arg1.keyCode){
case Keyboard.UP:
case Keyboard.DOWN:
case Keyboard.END:
case Keyboard.HOME:
case Keyboard.PAGE_UP:
case Keyboard.PAGE_DOWN:
moveSelectionVertically(_arg1.keyCode, ((_arg1.shiftKey) && (_allowMultipleSelection)), ((_arg1.ctrlKey) && (_allowMultipleSelection)));
_arg1.stopPropagation();
break;
case Keyboard.LEFT:
case Keyboard.RIGHT:
moveSelectionHorizontally(_arg1.keyCode, ((_arg1.shiftKey) && (_allowMultipleSelection)), ((_arg1.ctrlKey) && (_allowMultipleSelection)));
_arg1.stopPropagation();
break;
};
}
public function get selectable():Boolean{
return (_selectable);
}
public function itemToCellRenderer(_arg1:Object):ICellRenderer{
var _local2:*;
var _local3:ICellRenderer;
if (_arg1 != null){
for (_local2 in activeCellRenderers) {
_local3 = (activeCellRenderers[_local2] as ICellRenderer);
if (_local3.data == _arg1){
return (_local3);
};
};
};
return (null);
}
public function getNextIndexAtLetter(_arg1:String, _arg2:int=-1):int{
var _local3:int;
var _local4:Number;
var _local5:Number;
var _local6:Object;
var _local7:String;
if (length == 0){
return (-1);
};
_arg1 = _arg1.toUpperCase();
_local3 = (length - 1);
_local4 = 0;
while (_local4 < _local3) {
_local5 = ((_arg2 + 1) + _local4);
if (_local5 > (length - 1)){
_local5 = (_local5 - length);
};
_local6 = getItemAt(_local5);
if (_local6 == null){
break;
};
_local7 = itemToLabel(_local6);
if (_local7 == null){
} else {
if (_local7.charAt(0).toUpperCase() == _arg1){
return (_local5);
};
};
_local4++;
};
return (-1);
}
public function invalidateList():void{
_invalidateList();
invalidate(InvalidationType.DATA);
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
list.mouseChildren = _enabled;
}
public function get selectedIndices():Array{
return (_selectedIndices.concat());
}
public function set selectable(_arg1:Boolean):void{
if (_arg1 == _selectable){
return;
};
if (!_arg1){
selectedIndices = [];
};
_selectable = _arg1;
}
public function itemToLabel(_arg1:Object):String{
return (_arg1["label"]);
}
public function addItemAt(_arg1:Object, _arg2:uint):void{
_dataProvider.addItemAt(_arg1, _arg2);
invalidateList();
}
public function replaceItemAt(_arg1:Object, _arg2:uint):Object{
return (_dataProvider.replaceItemAt(_arg1, _arg2));
}
protected function handleDataChange(_arg1:DataChangeEvent):void{
var _local2:int;
var _local3:int;
var _local4:String;
var _local5:uint;
_local2 = _arg1.startIndex;
_local3 = _arg1.endIndex;
_local4 = _arg1.changeType;
if (_local4 == DataChangeType.INVALIDATE_ALL){
clearSelection();
invalidateList();
} else {
if (_local4 == DataChangeType.INVALIDATE){
_local5 = 0;
while (_local5 < _arg1.items.length) {
invalidateItem(_arg1.items[_local5]);
_local5++;
};
} else {
if (_local4 == DataChangeType.ADD){
_local5 = 0;
while (_local5 < _selectedIndices.length) {
if (_selectedIndices[_local5] >= _local2){
_selectedIndices[_local5] = (_selectedIndices[_local5] + (_local2 - _local3));
};
_local5++;
};
} else {
if (_local4 == DataChangeType.REMOVE){
_local5 = 0;
while (_local5 < _selectedIndices.length) {
if (_selectedIndices[_local5] >= _local2){
if (_selectedIndices[_local5] <= _local3){
delete _selectedIndices[_local5];
} else {
_selectedIndices[_local5] = (_selectedIndices[_local5] - ((_local2 - _local3) + 1));
};
};
_local5++;
};
} else {
if (_local4 == DataChangeType.REMOVE_ALL){
clearSelection();
} else {
if (_local4 == DataChangeType.REPLACE){
} else {
selectedItems = preChangeItems;
preChangeItems = null;
};
};
};
};
};
};
invalidate(InvalidationType.DATA);
}
protected function _invalidateList():void{
availableCellRenderers = [];
while (activeCellRenderers.length > 0) {
list.removeChild((activeCellRenderers.pop() as DisplayObject));
};
}
protected function updateRendererStyles():void{
var _local1:Array;
var _local2:uint;
var _local3:uint;
var _local4:String;
_local1 = availableCellRenderers.concat(activeCellRenderers);
_local2 = _local1.length;
_local3 = 0;
while (_local3 < _local2) {
if (_local1[_local3].setStyle == null){
} else {
for (_local4 in updatedRendererStyles) {
_local1[_local3].setStyle(_local4, updatedRendererStyles[_local4]);
};
_local1[_local3].drawNow();
};
_local3++;
};
updatedRendererStyles = {};
}
public function set selectedItem(_arg1:Object):void{
var _local2:int;
_local2 = _dataProvider.getItemIndex(_arg1);
selectedIndex = _local2;
}
public function sortItems(... _args){
return (_dataProvider.sort.apply(_dataProvider, _args));
}
public function removeAll():void{
_dataProvider.removeAll();
}
protected function handleCellRendererChange(_arg1:Event):void{
var _local2:ICellRenderer;
var _local3:uint;
_local2 = (_arg1.currentTarget as ICellRenderer);
_local3 = _local2.listData.index;
_dataProvider.invalidateItemAt(_local3);
}
protected function moveSelectionVertically(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
}
override protected function setHorizontalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
var _local3:Number;
if (_arg1 == _horizontalScrollPosition){
return;
};
_local3 = (_arg1 - _horizontalScrollPosition);
_horizontalScrollPosition = _arg1;
if (_arg2){
dispatchEvent(new ScrollEvent(ScrollBarDirection.HORIZONTAL, _local3, _arg1));
};
}
public function scrollToSelected():void{
scrollToIndex(selectedIndex);
}
public function invalidateItem(_arg1:Object):void{
if (renderedItems[_arg1] == null){
return;
};
invalidItems[_arg1] = true;
invalidate(InvalidationType.DATA);
}
protected function handleCellRendererClick(_arg1:MouseEvent):void{
var _local2:ICellRenderer;
var _local3:uint;
var _local4:int;
var _local5:int;
var _local6:uint;
if (!_enabled){
return;
};
_local2 = (_arg1.currentTarget as ICellRenderer);
_local3 = _local2.listData.index;
if (((!(dispatchEvent(new ListEvent(ListEvent.ITEM_CLICK, false, true, _local2.listData.column, _local2.listData.row, _local3, _local2.data)))) || (!(_selectable)))){
return;
};
_local4 = selectedIndices.indexOf(_local3);
if (!_allowMultipleSelection){
if (_local4 != -1){
return;
};
_local2.selected = true;
_selectedIndices = [_local3];
lastCaretIndex = (caretIndex = _local3);
} else {
if (_arg1.shiftKey){
_local6 = ((_selectedIndices.length)>0) ? _selectedIndices[0] : _local3;
_selectedIndices = [];
if (_local6 > _local3){
_local5 = _local6;
while (_local5 >= _local3) {
_selectedIndices.push(_local5);
_local5--;
};
} else {
_local5 = _local6;
while (_local5 <= _local3) {
_selectedIndices.push(_local5);
_local5++;
};
};
caretIndex = _local3;
} else {
if (_arg1.ctrlKey){
if (_local4 != -1){
_local2.selected = false;
_selectedIndices.splice(_local4, 1);
} else {
_local2.selected = true;
_selectedIndices.push(_local3);
};
caretIndex = _local3;
} else {
_selectedIndices = [_local3];
lastCaretIndex = (caretIndex = _local3);
};
};
};
dispatchEvent(new Event(Event.CHANGE));
invalidate(InvalidationType.DATA);
}
public function get length():uint{
return (_dataProvider.length);
}
public function get allowMultipleSelection():Boolean{
return (_allowMultipleSelection);
}
protected function onPreChange(_arg1:DataChangeEvent):void{
switch (_arg1.changeType){
case DataChangeType.REMOVE:
case DataChangeType.ADD:
case DataChangeType.INVALIDATE:
case DataChangeType.REMOVE_ALL:
case DataChangeType.REPLACE:
case DataChangeType.INVALIDATE_ALL:
break;
default:
preChangeItems = selectedItems;
break;
};
}
public function getRendererStyle(_arg1:String, _arg2:int=-1):Object{
return (rendererStyles[_arg1]);
}
override protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
var _local3:Number;
if (_arg1 == _verticalScrollPosition){
return;
};
_local3 = (_arg1 - _verticalScrollPosition);
_verticalScrollPosition = _arg1;
if (_arg2){
dispatchEvent(new ScrollEvent(ScrollBarDirection.VERTICAL, _local3, _arg1));
};
}
protected function moveSelectionHorizontally(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
}
public function set selectedIndices(_arg1:Array):void{
if (!_selectable){
return;
};
_selectedIndices = ((_arg1)==null) ? [] : _arg1.concat();
invalidate(InvalidationType.SELECTED);
}
public function get selectedIndex():int{
return (((_selectedIndices.length)==0) ? -1 : _selectedIndices[(_selectedIndices.length - 1)]);
}
override protected function draw():void{
super.draw();
}
override protected function configUI():void{
super.configUI();
listHolder = new Sprite();
addChild(listHolder);
listHolder.scrollRect = contentScrollRect;
list = new Sprite();
listHolder.addChild(list);
}
public function addItem(_arg1:Object):void{
_dataProvider.addItem(_arg1);
invalidateList();
}
protected function handleCellRendererMouseEvent(_arg1:MouseEvent):void{
var _local2:ICellRenderer;
var _local3:String;
_local2 = (_arg1.target as ICellRenderer);
_local3 = ((_arg1.type)==MouseEvent.ROLL_OVER) ? ListEvent.ITEM_ROLL_OVER : ListEvent.ITEM_ROLL_OUT;
dispatchEvent(new ListEvent(_local3, false, false, _local2.listData.column, _local2.listData.row, _local2.listData.index, _local2.data));
}
public function clearRendererStyle(_arg1:String, _arg2:int=-1):void{
delete rendererStyles[_arg1];
updatedRendererStyles[_arg1] = null;
invalidate(InvalidationType.RENDERER_STYLES);
}
protected function handleCellRendererDoubleClick(_arg1:MouseEvent):void{
var _local2:ICellRenderer;
var _local3:uint;
if (!_enabled){
return;
};
_local2 = (_arg1.currentTarget as ICellRenderer);
_local3 = _local2.listData.index;
dispatchEvent(new ListEvent(ListEvent.ITEM_DOUBLE_CLICK, false, true, _local2.listData.column, _local2.listData.row, _local3, _local2.data));
}
public function get rowCount():uint{
return (0);
}
public function isItemSelected(_arg1:Object):Boolean{
return ((selectedItems.indexOf(_arg1) > -1));
}
public function set dataProvider(_arg1:DataProvider):void{
if (_dataProvider != null){
_dataProvider.removeEventListener(DataChangeEvent.DATA_CHANGE, handleDataChange);
_dataProvider.removeEventListener(DataChangeEvent.PRE_DATA_CHANGE, onPreChange);
};
_dataProvider = _arg1;
_dataProvider.addEventListener(DataChangeEvent.DATA_CHANGE, handleDataChange, false, 0, true);
_dataProvider.addEventListener(DataChangeEvent.PRE_DATA_CHANGE, onPreChange, false, 0, true);
clearSelection();
invalidateList();
}
override protected function drawLayout():void{
super.drawLayout();
contentScrollRect = listHolder.scrollRect;
contentScrollRect.width = availableWidth;
contentScrollRect.height = availableHeight;
listHolder.scrollRect = contentScrollRect;
}
public function getItemAt(_arg1:uint):Object{
return (_dataProvider.getItemAt(_arg1));
}
override protected function initializeAccessibility():void{
if (SelectableList.createAccessibilityImplementation != null){
SelectableList.createAccessibilityImplementation(this);
};
}
public function scrollToIndex(_arg1:int):void{
}
public function removeItem(_arg1:Object):Object{
return (_dataProvider.removeItem(_arg1));
}
public function get dataProvider():DataProvider{
return (_dataProvider);
}
public function set maxHorizontalScrollPosition(_arg1:Number):void{
_maxHorizontalScrollPosition = _arg1;
invalidate(InvalidationType.SIZE);
}
public function setRendererStyle(_arg1:String, _arg2:Object, _arg3:uint=0):void{
if (rendererStyles[_arg1] == _arg2){
return;
};
updatedRendererStyles[_arg1] = _arg2;
rendererStyles[_arg1] = _arg2;
invalidate(InvalidationType.RENDERER_STYLES);
}
public function invalidateItemAt(_arg1:uint):void{
var _local2:Object;
_local2 = _dataProvider.getItemAt(_arg1);
if (_local2 != null){
invalidateItem(_local2);
};
}
public function set selectedItems(_arg1:Array):void{
var _local2:Array;
var _local3:uint;
var _local4:int;
if (_arg1 == null){
selectedIndices = null;
return;
};
_local2 = [];
_local3 = 0;
while (_local3 < _arg1.length) {
_local4 = _dataProvider.getItemIndex(_arg1[_local3]);
if (_local4 != -1){
_local2.push(_local4);
};
_local3++;
};
selectedIndices = _local2;
}
public function clearSelection():void{
selectedIndex = -1;
}
override public function get maxHorizontalScrollPosition():Number{
return (_maxHorizontalScrollPosition);
}
public function get selectedItems():Array{
var _local1:Array;
var _local2:uint;
_local1 = [];
_local2 = 0;
while (_local2 < _selectedIndices.length) {
_local1.push(_dataProvider.getItemAt(_selectedIndices[_local2]));
_local2++;
};
return (_local1);
}
public function set selectedIndex(_arg1:int):void{
selectedIndices = ((_arg1)==-1) ? null : [_arg1];
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseScrollPane.getStyleDefinition()));
}
}
}//package fl.controls
Section 66
//TextInput (fl.controls.TextInput)
package fl.controls {
import fl.core.*;
import flash.display.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.ui.*;
public class TextInput extends UIComponent implements IFocusManagerComponent {
protected var _html:Boolean;// = false
protected var _savedHTML:String;
protected var background:DisplayObject;
protected var _editable:Boolean;// = true
public var textField:TextField;
private static var defaultStyles:Object = {upSkin:"TextInput_upSkin", disabledSkin:"TextInput_disabledSkin", focusRectSkin:null, focusRectPadding:null, textFormat:null, disabledTextFormat:null, textPadding:0, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function TextInput(){
_editable = true;
_html = false;
super();
}
override public function drawFocus(_arg1:Boolean):void{
if (focusTarget != null){
focusTarget.drawFocus(_arg1);
return;
};
super.drawFocus(_arg1);
}
public function set imeMode(_arg1:String):void{
_imeMode = _arg1;
}
override protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((((_arg1 == textField)) || (super.isOurFocus(_arg1))));
}
protected function handleKeyDown(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.ENTER){
dispatchEvent(new ComponentEvent(ComponentEvent.ENTER, true));
};
}
public function set text(_arg1:String):void{
textField.text = _arg1;
_html = false;
invalidate(InvalidationType.DATA);
invalidate(InvalidationType.STYLES);
}
protected function updateTextFieldType():void{
textField.type = (((enabled) && (editable))) ? TextFieldType.INPUT : TextFieldType.DYNAMIC;
textField.selectable = enabled;
}
public function get selectionEndIndex():int{
return (textField.selectionEndIndex);
}
public function get editable():Boolean{
return (_editable);
}
override protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (_arg1.target == this){
stage.focus = textField;
};
_local2 = focusManager;
if (((editable) && (_local2))){
_local2.showFocusIndicator = true;
if (((textField.selectable) && ((textField.selectionBeginIndex == textField.selectionBeginIndex)))){
setSelection(0, textField.length);
};
};
super.focusInHandler(_arg1);
if (editable){
setIMEMode(true);
};
}
public function get selectionBeginIndex():int{
return (textField.selectionBeginIndex);
}
public function set alwaysShowSelection(_arg1:Boolean):void{
textField.alwaysShowSelection = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
updateTextFieldType();
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
public function get horizontalScrollPosition():int{
return (textField.scrollH);
}
public function set condenseWhite(_arg1:Boolean):void{
textField.condenseWhite = _arg1;
}
public function set displayAsPassword(_arg1:Boolean):void{
textField.displayAsPassword = _arg1;
}
public function set horizontalScrollPosition(_arg1:int):void{
textField.scrollH = _arg1;
}
public function get restrict():String{
return (textField.restrict);
}
public function get textWidth():Number{
return (textField.textWidth);
}
public function get textHeight():Number{
return (textField.textHeight);
}
public function set editable(_arg1:Boolean):void{
_editable = _arg1;
updateTextFieldType();
}
public function get maxChars():int{
return (textField.maxChars);
}
public function get length():int{
return (textField.length);
}
public function getLineMetrics(_arg1:int):TextLineMetrics{
return (textField.getLineMetrics(_arg1));
}
public function get imeMode():String{
return (_imeMode);
}
override protected function focusOutHandler(_arg1:FocusEvent):void{
super.focusOutHandler(_arg1);
if (editable){
setIMEMode(false);
};
}
public function set htmlText(_arg1:String):void{
if (_arg1 == ""){
text = "";
return;
};
_html = true;
_savedHTML = _arg1;
textField.htmlText = _arg1;
invalidate(InvalidationType.DATA);
invalidate(InvalidationType.STYLES);
}
public function get text():String{
return (textField.text);
}
override public function get enabled():Boolean{
return (super.enabled);
}
public function get condenseWhite():Boolean{
return (textField.condenseWhite);
}
public function get alwaysShowSelection():Boolean{
return (textField.alwaysShowSelection);
}
override protected function draw():void{
var _local1:Object;
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawTextFormat();
drawBackground();
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function handleTextInput(_arg1:TextEvent):void{
_arg1.stopPropagation();
dispatchEvent(new TextEvent(TextEvent.TEXT_INPUT, true, false, _arg1.text));
}
override protected function configUI():void{
super.configUI();
tabChildren = true;
textField = new TextField();
addChild(textField);
updateTextFieldType();
textField.addEventListener(TextEvent.TEXT_INPUT, handleTextInput, false, 0, true);
textField.addEventListener(Event.CHANGE, handleChange, false, 0, true);
textField.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyDown, false, 0, true);
}
public function setSelection(_arg1:int, _arg2:int):void{
textField.setSelection(_arg1, _arg2);
}
public function get displayAsPassword():Boolean{
return (textField.displayAsPassword);
}
public function appendText(_arg1:String):void{
textField.appendText(_arg1);
}
public function set restrict(_arg1:String):void{
if (((componentInspectorSetting) && ((_arg1 == "")))){
_arg1 = null;
};
textField.restrict = _arg1;
}
public function get htmlText():String{
return (textField.htmlText);
}
protected function drawBackground():void{
var _local1:DisplayObject;
var _local2:String;
_local1 = background;
_local2 = (enabled) ? "upSkin" : "disabledSkin";
background = getDisplayObjectInstance(getStyleValue(_local2));
if (background == null){
return;
};
addChildAt(background, 0);
if (((((!((_local1 == null))) && (!((_local1 == background))))) && (contains(_local1)))){
removeChild(_local1);
};
}
override public function setFocus():void{
stage.focus = textField;
}
protected function drawLayout():void{
var _local1:Number;
_local1 = Number(getStyleValue("textPadding"));
if (background != null){
background.width = width;
background.height = height;
};
textField.width = (width - (2 * _local1));
textField.height = (height - (2 * _local1));
textField.x = (textField.y = _local1);
}
public function set maxChars(_arg1:int):void{
textField.maxChars = _arg1;
}
public function get maxHorizontalScrollPosition():int{
return (textField.maxScrollH);
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
if (_html){
textField.htmlText = _savedHTML;
};
}
protected function handleChange(_arg1:Event):void{
_arg1.stopPropagation();
dispatchEvent(new Event(Event.CHANGE, true));
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 67
//ComponentShim (fl.core.ComponentShim)
package fl.core {
import flash.display.*;
public dynamic class ComponentShim extends MovieClip {
}
}//package fl.core
Section 68
//InvalidationType (fl.core.InvalidationType)
package fl.core {
public class InvalidationType {
public static const SIZE:String = "size";
public static const ALL:String = "all";
public static const DATA:String = "data";
public static const SCROLL:String = "scroll";
public static const STATE:String = "state";
public static const STYLES:String = "styles";
public static const SELECTED:String = "selected";
public static const RENDERER_STYLES:String = "rendererStyles";
}
}//package fl.core
Section 69
//UIComponent (fl.core.UIComponent)
package fl.core {
import flash.display.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
public class UIComponent extends Sprite {
protected var _enabled:Boolean;// = true
private var _mouseFocusEnabled:Boolean;// = true
protected var startHeight:Number;
protected var _height:Number;
protected var _oldIMEMode:String;// = null
protected var startWidth:Number;
public var focusTarget:IFocusManagerComponent;
protected var errorCaught:Boolean;// = false
protected var uiFocusRect:DisplayObject;
protected var _width:Number;
public var version:String;// = "3.0.0.15"
protected var isFocused:Boolean;// = false
protected var callLaterMethods:Dictionary;
private var _focusEnabled:Boolean;// = true
private var tempText:TextField;
protected var invalidateFlag:Boolean;// = false
protected var _inspector:Boolean;// = false
protected var sharedStyles:Object;
protected var invalidHash:Object;
protected var isLivePreview:Boolean;// = false
protected var _imeMode:String;// = null
protected var instanceStyles:Object;
protected var _x:Number;
protected var _y:Number;
public static var inCallLaterPhase:Boolean = false;
private static var defaultStyles:Object = {focusRectSkin:"focusRectSkin", focusRectPadding:2, textFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), disabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultTextFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultDisabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0)};
public static var createAccessibilityImplementation:Function;
private static var focusManagers:Dictionary = new Dictionary(false);
public function UIComponent(){
version = "3.0.0.15";
isLivePreview = false;
invalidateFlag = false;
_enabled = true;
isFocused = false;
_focusEnabled = true;
_mouseFocusEnabled = true;
_imeMode = null;
_oldIMEMode = null;
errorCaught = false;
_inspector = false;
super();
instanceStyles = {};
sharedStyles = {};
invalidHash = {};
callLaterMethods = new Dictionary();
StyleManager.registerInstance(this);
configUI();
invalidate(InvalidationType.ALL);
tabEnabled = (this is IFocusManagerComponent);
focusRect = false;
if (tabEnabled){
addEventListener(FocusEvent.FOCUS_IN, focusInHandler);
addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler);
addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
};
initializeFocusManager();
addEventListener(Event.ENTER_FRAME, hookAccessibility, false, 0, true);
}
public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
isFocused = _arg1;
if (((!((uiFocusRect == null))) && (contains(uiFocusRect)))){
removeChild(uiFocusRect);
uiFocusRect = null;
};
if (_arg1){
uiFocusRect = (getDisplayObjectInstance(getStyleValue("focusRectSkin")) as Sprite);
if (uiFocusRect == null){
return;
};
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.x = -(_local2);
uiFocusRect.y = -(_local2);
uiFocusRect.width = (width + (_local2 * 2));
uiFocusRect.height = (height + (_local2 * 2));
addChildAt(uiFocusRect, 0);
};
}
private function callLaterDispatcher(_arg1:Event):void{
var _local2:Dictionary;
var _local3:Object;
if (_arg1.type == Event.ADDED_TO_STAGE){
removeEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher);
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
return;
};
_arg1.target.removeEventListener(Event.RENDER, callLaterDispatcher);
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
return;
};
inCallLaterPhase = true;
_local2 = callLaterMethods;
for (_local3 in _local2) {
_local3();
delete _local2[_local3];
};
inCallLaterPhase = false;
}
private function addedHandler(_arg1:Event):void{
removeEventListener("addedToStage", addedHandler);
initializeFocusManager();
}
protected function getStyleValue(_arg1:String):Object{
return (((instanceStyles[_arg1])==null) ? sharedStyles[_arg1] : instanceStyles[_arg1]);
}
protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((_arg1 == this));
}
override public function get scaleX():Number{
return ((width / startWidth));
}
override public function get scaleY():Number{
return ((height / startHeight));
}
override public function set height(_arg1:Number):void{
if (_height == _arg1){
return;
};
setSize(width, _arg1);
}
protected function keyDownHandler(_arg1:KeyboardEvent):void{
}
protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (isOurFocus((_arg1.target as DisplayObject))){
_local2 = focusManager;
if (((_local2) && (_local2.showFocusIndicator))){
drawFocus(true);
isFocused = true;
};
};
}
public function setStyle(_arg1:String, _arg2:Object):void{
if ((((instanceStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
instanceStyles[_arg1] = _arg2;
invalidate(InvalidationType.STYLES);
}
override public function get visible():Boolean{
return (super.visible);
}
public function get componentInspectorSetting():Boolean{
return (_inspector);
}
override public function get x():Number{
return ((isNaN(_x)) ? super.x : _x);
}
override public function get y():Number{
return ((isNaN(_y)) ? super.y : _y);
}
protected function setIMEMode(_arg1:Boolean){
var enabled = _arg1;
if (_imeMode != null){
if (enabled){
IME.enabled = true;
_oldIMEMode = IME.conversionMode;
try {
if (((!(errorCaught)) && (!((IME.conversionMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _imeMode;
};
errorCaught = false;
} catch(e:Error) {
errorCaught = true;
throw (new Error(("IME mode not supported: " + _imeMode)));
};
} else {
if (((!((IME.conversionMode == IMEConversionMode.UNKNOWN))) && (!((_oldIMEMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _oldIMEMode;
};
IME.enabled = false;
};
};
}
public function set enabled(_arg1:Boolean):void{
if (_arg1 == _enabled){
return;
};
_enabled = _arg1;
invalidate(InvalidationType.STATE);
}
public function setSharedStyle(_arg1:String, _arg2:Object):void{
if ((((sharedStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
sharedStyles[_arg1] = _arg2;
if (instanceStyles[_arg1] == null){
invalidate(InvalidationType.STYLES);
};
}
protected function keyUpHandler(_arg1:KeyboardEvent):void{
}
public function set focusEnabled(_arg1:Boolean):void{
_focusEnabled = _arg1;
}
override public function set scaleX(_arg1:Number):void{
setSize((startWidth * _arg1), height);
}
public function get mouseFocusEnabled():Boolean{
return (_mouseFocusEnabled);
}
override public function set scaleY(_arg1:Number):void{
setSize(width, (startHeight * _arg1));
}
protected function getDisplayObjectInstance(_arg1:Object):DisplayObject{
var classDef:Object;
var skin = _arg1;
classDef = null;
if ((skin is Class)){
return ((new (skin) as DisplayObject));
};
if ((skin is DisplayObject)){
(skin as DisplayObject).x = 0;
(skin as DisplayObject).y = 0;
return ((skin as DisplayObject));
};
try {
classDef = getDefinitionByName(skin.toString());
} catch(e:Error) {
try {
classDef = (loaderInfo.applicationDomain.getDefinition(skin.toString()) as Object);
} catch(e:Error) {
};
};
if (classDef == null){
return (null);
};
return ((new (classDef) as DisplayObject));
}
protected function copyStylesToChild(_arg1:UIComponent, _arg2:Object):void{
var _local3:String;
for (_local3 in _arg2) {
_arg1.setStyle(_local3, getStyleValue(_arg2[_local3]));
};
}
protected function beforeComponentParameters():void{
}
protected function callLater(_arg1:Function):void{
if (inCallLaterPhase){
return;
};
callLaterMethods[_arg1] = true;
if (stage != null){
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
} else {
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
};
}
protected function createFocusManager():void{
if (focusManagers[stage] == null){
focusManagers[stage] = new FocusManager(stage);
};
}
override public function set visible(_arg1:Boolean):void{
var _local2:String;
if (super.visible == _arg1){
return;
};
super.visible = _arg1;
_local2 = (_arg1) ? ComponentEvent.SHOW : ComponentEvent.HIDE;
dispatchEvent(new ComponentEvent(_local2, true));
}
protected function hookAccessibility(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, hookAccessibility);
initializeAccessibility();
}
public function set componentInspectorSetting(_arg1:Boolean):void{
_inspector = _arg1;
if (_inspector){
beforeComponentParameters();
} else {
afterComponentParameters();
};
}
override public function set x(_arg1:Number):void{
move(_arg1, _y);
}
public function drawNow():void{
draw();
}
override public function set y(_arg1:Number):void{
move(_x, _arg1);
}
protected function checkLivePreview():Boolean{
var className:String;
if (parent == null){
return (false);
};
try {
className = getQualifiedClassName(parent);
} catch(e:Error) {
};
return ((className == "fl.livepreview::LivePreviewParent"));
}
protected function focusOutHandler(_arg1:FocusEvent):void{
if (isOurFocus((_arg1.target as DisplayObject))){
drawFocus(false);
isFocused = false;
};
}
public function set mouseFocusEnabled(_arg1:Boolean):void{
_mouseFocusEnabled = _arg1;
}
public function getFocus():InteractiveObject{
if (stage){
return (stage.focus);
};
return (null);
}
protected function validate():void{
invalidHash = {};
}
override public function get height():Number{
return (_height);
}
public function invalidate(_arg1:String="all", _arg2:Boolean=true):void{
invalidHash[_arg1] = true;
if (_arg2){
this.callLater(draw);
};
}
public function get enabled():Boolean{
return (_enabled);
}
protected function getScaleX():Number{
return (super.scaleX);
}
protected function getScaleY():Number{
return (super.scaleY);
}
public function get focusEnabled():Boolean{
return (_focusEnabled);
}
protected function afterComponentParameters():void{
}
protected function draw():void{
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
protected function configUI():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
isLivePreview = checkLivePreview();
_local1 = rotation;
rotation = 0;
_local2 = super.width;
_local3 = super.height;
var _local4 = 1;
super.scaleY = _local4;
super.scaleX = _local4;
setSize(_local2, _local3);
move(super.x, super.y);
rotation = _local1;
startWidth = _local2;
startHeight = _local3;
if (numChildren > 0){
removeChildAt(0);
};
}
protected function setScaleX(_arg1:Number):void{
super.scaleX = _arg1;
}
protected function setScaleY(_arg1:Number):void{
super.scaleY = _arg1;
}
private function initializeFocusManager():void{
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, addedHandler, false, 0, true);
} else {
createFocusManager();
};
}
public function set focusManager(_arg1:IFocusManager):void{
UIComponent.focusManagers[this] = _arg1;
}
public function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
protected function isInvalid(_arg1:String, ... _args):Boolean{
if (((invalidHash[_arg1]) || (invalidHash[InvalidationType.ALL]))){
return (true);
};
while (_args.length > 0) {
if (invalidHash[_args.pop()]){
return (true);
};
};
return (false);
}
public function setSize(_arg1:Number, _arg2:Number):void{
_width = _arg1;
_height = _arg2;
invalidate(InvalidationType.SIZE);
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, false));
}
override public function set width(_arg1:Number):void{
if (_width == _arg1){
return;
};
setSize(_arg1, height);
}
public function setFocus():void{
if (stage){
stage.focus = this;
};
}
protected function initializeAccessibility():void{
if (UIComponent.createAccessibilityImplementation != null){
UIComponent.createAccessibilityImplementation(this);
};
}
public function get focusManager():IFocusManager{
var _local1:DisplayObject;
_local1 = this;
while (_local1) {
if (UIComponent.focusManagers[_local1] != null){
return (IFocusManager(UIComponent.focusManagers[_local1]));
};
_local1 = _local1.parent;
};
return (null);
}
override public function get width():Number{
return (_width);
}
public function move(_arg1:Number, _arg2:Number):void{
_x = _arg1;
_y = _arg2;
super.x = Math.round(_arg1);
super.y = Math.round(_arg2);
dispatchEvent(new ComponentEvent(ComponentEvent.MOVE));
}
public function validateNow():void{
invalidate(InvalidationType.ALL, false);
draw();
}
public function getStyle(_arg1:String):Object{
return (instanceStyles[_arg1]);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
public static function mergeStyles(... _args):Object{
var _local2:Object;
var _local3:uint;
var _local4:uint;
var _local5:Object;
var _local6:String;
_local2 = {};
_local3 = _args.length;
_local4 = 0;
while (_local4 < _local3) {
_local5 = _args[_local4];
for (_local6 in _local5) {
if (_local2[_local6] != null){
} else {
_local2[_local6] = _args[_local4][_local6];
};
};
_local4++;
};
return (_local2);
}
}
}//package fl.core
Section 70
//DataProvider (fl.data.DataProvider)
package fl.data {
import flash.events.*;
import fl.events.*;
public class DataProvider extends EventDispatcher {
protected var data:Array;
public function DataProvider(_arg1:Object=null){
if (_arg1 == null){
data = [];
} else {
data = getDataFromObject(_arg1);
};
}
protected function dispatchPreChangeEvent(_arg1:String, _arg2:Array, _arg3:int, _arg4:int):void{
dispatchEvent(new DataChangeEvent(DataChangeEvent.PRE_DATA_CHANGE, _arg1, _arg2, _arg3, _arg4));
}
public function invalidateItemAt(_arg1:int):void{
checkIndex(_arg1, (data.length - 1));
dispatchChangeEvent(DataChangeType.INVALIDATE, [data[_arg1]], _arg1, _arg1);
}
public function getItemIndex(_arg1:Object):int{
return (data.indexOf(_arg1));
}
protected function getDataFromObject(_arg1:Object):Array{
var _local2:Array;
var _local3:Array;
var _local4:uint;
var _local5:Object;
var _local6:XML;
var _local7:XMLList;
var _local8:XML;
var _local9:XMLList;
var _local10:XML;
var _local11:XMLList;
var _local12:XML;
if ((_arg1 is Array)){
_local3 = (_arg1 as Array);
if (_local3.length > 0){
if ((((_local3[0] is String)) || ((_local3[0] is Number)))){
_local2 = [];
_local4 = 0;
while (_local4 < _local3.length) {
_local5 = {label:String(_local3[_local4]), data:_local3[_local4]};
_local2.push(_local5);
_local4++;
};
return (_local2);
};
};
return (_arg1.concat());
} else {
if ((_arg1 is DataProvider)){
return (_arg1.toArray());
};
if ((_arg1 is XML)){
_local6 = (_arg1 as XML);
_local2 = [];
_local7 = _local6.*;
for each (_local8 in _local7) {
_arg1 = {};
_local9 = _local8.attributes();
for each (_local10 in _local9) {
_arg1[_local10.localName()] = _local10.toString();
};
_local11 = _local8.*;
for each (_local12 in _local11) {
if (_local12.hasSimpleContent()){
_arg1[_local12.localName()] = _local12.toString();
};
};
_local2.push(_arg1);
};
return (_local2);
//unresolved jump
};
};
throw (new ((!NULL! + !NULL!) + " to Array or DataProvider.").TypeError(!NULL!));
}
public function removeItemAt(_arg1:uint):Object{
var _local2:Array;
checkIndex(_arg1, (data.length - 1));
dispatchPreChangeEvent(DataChangeType.REMOVE, data.slice(_arg1, (_arg1 + 1)), _arg1, _arg1);
_local2 = data.splice(_arg1, 1);
dispatchChangeEvent(DataChangeType.REMOVE, _local2, _arg1, _arg1);
return (_local2[0]);
}
public function addItem(_arg1:Object):void{
dispatchPreChangeEvent(DataChangeType.ADD, [_arg1], (data.length - 1), (data.length - 1));
data.push(_arg1);
dispatchChangeEvent(DataChangeType.ADD, [_arg1], (data.length - 1), (data.length - 1));
}
public function sortOn(_arg1:Object, _arg2:Object=null){
var _local3:Array;
dispatchPreChangeEvent(DataChangeType.SORT, data.concat(), 0, (data.length - 1));
_local3 = data.sortOn(_arg1, _arg2);
dispatchChangeEvent(DataChangeType.SORT, data.concat(), 0, (data.length - 1));
return (_local3);
}
public function sort(... _args){
var _local2:Array;
dispatchPreChangeEvent(DataChangeType.SORT, data.concat(), 0, (data.length - 1));
_local2 = data.sort.apply(data, _args);
dispatchChangeEvent(DataChangeType.SORT, data.concat(), 0, (data.length - 1));
return (_local2);
}
public function addItems(_arg1:Object):void{
addItemsAt(_arg1, data.length);
}
public function concat(_arg1:Object):void{
addItems(_arg1);
}
public function clone():DataProvider{
return (new DataProvider(data));
}
public function toArray():Array{
return (data.concat());
}
public function get length():uint{
return (data.length);
}
public function addItemAt(_arg1:Object, _arg2:uint):void{
checkIndex(_arg2, data.length);
dispatchPreChangeEvent(DataChangeType.ADD, [_arg1], _arg2, _arg2);
data.splice(_arg2, 0, _arg1);
dispatchChangeEvent(DataChangeType.ADD, [_arg1], _arg2, _arg2);
}
public function getItemAt(_arg1:uint):Object{
checkIndex(_arg1, (data.length - 1));
return (data[_arg1]);
}
override public function toString():String{
return ((("DataProvider [" + data.join(" , ")) + "]"));
}
public function invalidateItem(_arg1:Object):void{
var _local2:uint;
_local2 = getItemIndex(_arg1);
if (_local2 == -1){
return;
};
invalidateItemAt(_local2);
}
protected function dispatchChangeEvent(_arg1:String, _arg2:Array, _arg3:int, _arg4:int):void{
dispatchEvent(new DataChangeEvent(DataChangeEvent.DATA_CHANGE, _arg1, _arg2, _arg3, _arg4));
}
protected function checkIndex(_arg1:int, _arg2:int):void{
if ((((_arg1 > _arg2)) || ((_arg1 < 0)))){
throw (new RangeError((((("DataProvider index (" + _arg1) + ") is not in acceptable range (0 - ") + _arg2) + ")")));
};
}
public function addItemsAt(_arg1:Object, _arg2:uint):void{
var _local3:Array;
checkIndex(_arg2, data.length);
_local3 = getDataFromObject(_arg1);
dispatchPreChangeEvent(DataChangeType.ADD, _local3, _arg2, ((_arg2 + _local3.length) - 1));
data.splice.apply(data, [_arg2, 0].concat(_local3));
dispatchChangeEvent(DataChangeType.ADD, _local3, _arg2, ((_arg2 + _local3.length) - 1));
}
public function replaceItem(_arg1:Object, _arg2:Object):Object{
var _local3:int;
_local3 = getItemIndex(_arg2);
if (_local3 != -1){
return (replaceItemAt(_arg1, _local3));
};
return (null);
}
public function removeItem(_arg1:Object):Object{
var _local2:int;
_local2 = getItemIndex(_arg1);
if (_local2 != -1){
return (removeItemAt(_local2));
};
return (null);
}
public function merge(_arg1:Object):void{
var _local2:Array;
var _local3:uint;
var _local4:uint;
var _local5:uint;
var _local6:Object;
_local2 = getDataFromObject(_arg1);
_local3 = _local2.length;
_local4 = data.length;
dispatchPreChangeEvent(DataChangeType.ADD, data.slice(_local4, data.length), _local4, (this.data.length - 1));
_local5 = 0;
while (_local5 < _local3) {
_local6 = _local2[_local5];
if (getItemIndex(_local6) == -1){
data.push(_local6);
};
_local5++;
};
if (data.length > _local4){
dispatchChangeEvent(DataChangeType.ADD, data.slice(_local4, data.length), _local4, (this.data.length - 1));
} else {
dispatchChangeEvent(DataChangeType.ADD, [], -1, -1);
};
}
public function replaceItemAt(_arg1:Object, _arg2:uint):Object{
var _local3:Array;
checkIndex(_arg2, (data.length - 1));
_local3 = [data[_arg2]];
dispatchPreChangeEvent(DataChangeType.REPLACE, _local3, _arg2, _arg2);
data[_arg2] = _arg1;
dispatchChangeEvent(DataChangeType.REPLACE, _local3, _arg2, _arg2);
return (_local3[0]);
}
public function invalidate():void{
dispatchEvent(new DataChangeEvent(DataChangeEvent.DATA_CHANGE, DataChangeType.INVALIDATE_ALL, data.concat(), 0, data.length));
}
public function removeAll():void{
var _local1:Array;
_local1 = data.concat();
dispatchPreChangeEvent(DataChangeType.REMOVE_ALL, _local1, 0, _local1.length);
data = [];
dispatchChangeEvent(DataChangeType.REMOVE_ALL, _local1, 0, _local1.length);
}
}
}//package fl.data
Section 71
//SimpleCollectionItem (fl.data.SimpleCollectionItem)
package fl.data {
public dynamic class SimpleCollectionItem {
public var label:String;
public var data:String;
public function toString():String{
return ((((("[SimpleCollectionItem: " + label) + ",") + data) + "]"));
}
}
}//package fl.data
Section 72
//ComponentEvent (fl.events.ComponentEvent)
package fl.events {
import flash.events.*;
public class ComponentEvent extends Event {
public static const HIDE:String = "hide";
public static const BUTTON_DOWN:String = "buttonDown";
public static const MOVE:String = "move";
public static const RESIZE:String = "resize";
public static const ENTER:String = "enter";
public static const LABEL_CHANGE:String = "labelChange";
public static const SHOW:String = "show";
public function ComponentEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
override public function toString():String{
return (formatToString("ComponentEvent", "type", "bubbles", "cancelable"));
}
override public function clone():Event{
return (new ComponentEvent(type, bubbles, cancelable));
}
}
}//package fl.events
Section 73
//DataChangeEvent (fl.events.DataChangeEvent)
package fl.events {
import flash.events.*;
public class DataChangeEvent extends Event {
protected var _items:Array;
protected var _endIndex:uint;
protected var _changeType:String;
protected var _startIndex:uint;
public static const PRE_DATA_CHANGE:String = "preDataChange";
public static const DATA_CHANGE:String = "dataChange";
public function DataChangeEvent(_arg1:String, _arg2:String, _arg3:Array, _arg4:int=-1, _arg5:int=-1):void{
super(_arg1);
_changeType = _arg2;
_startIndex = _arg4;
_items = _arg3;
_endIndex = ((_arg5)==-1) ? _startIndex : _arg5;
}
public function get changeType():String{
return (_changeType);
}
public function get startIndex():uint{
return (_startIndex);
}
public function get items():Array{
return (_items);
}
override public function clone():Event{
return (new DataChangeEvent(type, _changeType, _items, _startIndex, _endIndex));
}
override public function toString():String{
return (formatToString("DataChangeEvent", "type", "changeType", "startIndex", "endIndex", "bubbles", "cancelable"));
}
public function get endIndex():uint{
return (_endIndex);
}
}
}//package fl.events
Section 74
//DataChangeType (fl.events.DataChangeType)
package fl.events {
public class DataChangeType {
public static const ADD:String = "add";
public static const REMOVE:String = "remove";
public static const REMOVE_ALL:String = "removeAll";
public static const CHANGE:String = "change";
public static const REPLACE:String = "replace";
public static const INVALIDATE:String = "invalidate";
public static const INVALIDATE_ALL:String = "invalidateAll";
public static const SORT:String = "sort";
}
}//package fl.events
Section 75
//ListEvent (fl.events.ListEvent)
package fl.events {
import flash.events.*;
public class ListEvent extends Event {
protected var _index:int;
protected var _item:Object;
protected var _columnIndex:int;
protected var _rowIndex:int;
public static const ITEM_DOUBLE_CLICK:String = "itemDoubleClick";
public static const ITEM_ROLL_OUT:String = "itemRollOut";
public static const ITEM_ROLL_OVER:String = "itemRollOver";
public static const ITEM_CLICK:String = "itemClick";
public function ListEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:int=-1, _arg5:int=-1, _arg6:int=-1, _arg7:Object=null){
super(_arg1, _arg2, _arg3);
_rowIndex = _arg5;
_columnIndex = _arg4;
_index = _arg6;
_item = _arg7;
}
public function get rowIndex():Object{
return (_rowIndex);
}
public function get index():int{
return (_index);
}
public function get item():Object{
return (_item);
}
public function get columnIndex():int{
return (_columnIndex);
}
override public function clone():Event{
return (new ListEvent(type, bubbles, cancelable, _columnIndex, _rowIndex));
}
override public function toString():String{
return (formatToString("ListEvent", "type", "bubbles", "cancelable", "columnIndex", "rowIndex", "index", "item"));
}
}
}//package fl.events
Section 76
//ScrollEvent (fl.events.ScrollEvent)
package fl.events {
import flash.events.*;
public class ScrollEvent extends Event {
private var _position:Number;
private var _direction:String;
private var _delta:Number;
public static const SCROLL:String = "scroll";
public function ScrollEvent(_arg1:String, _arg2:Number, _arg3:Number){
super(ScrollEvent.SCROLL, false, false);
_direction = _arg1;
_delta = _arg2;
_position = _arg3;
}
override public function clone():Event{
return (new ScrollEvent(_direction, _delta, _position));
}
public function get position():Number{
return (_position);
}
override public function toString():String{
return (formatToString("ScrollEvent", "type", "bubbles", "cancelable", "direction", "delta", "position"));
}
public function get delta():Number{
return (_delta);
}
public function get direction():String{
return (_direction);
}
}
}//package fl.events
Section 77
//FocusManager (fl.managers.FocusManager)
package fl.managers {
import fl.core.*;
import flash.display.*;
import flash.events.*;
import fl.controls.*;
import flash.text.*;
import flash.utils.*;
import flash.ui.*;
public class FocusManager implements IFocusManager {
private var focusableObjects:Dictionary;
private var _showFocusIndicator:Boolean;// = true
private var defButton:Button;
private var focusableCandidates:Array;
private var _form:DisplayObjectContainer;
private var _defaultButtonEnabled:Boolean;// = true
private var activated:Boolean;// = false
private var _defaultButton:Button;
private var calculateCandidates:Boolean;// = true
private var lastFocus:InteractiveObject;
private var lastAction:String;
public function FocusManager(_arg1:DisplayObjectContainer){
activated = false;
calculateCandidates = true;
_showFocusIndicator = true;
_defaultButtonEnabled = true;
super();
focusableObjects = new Dictionary(true);
if (_arg1 != null){
_form = _arg1;
addFocusables(DisplayObject(_arg1));
_arg1.addEventListener(Event.ADDED, addedHandler);
_arg1.addEventListener(Event.REMOVED, removedHandler);
activate();
};
}
public function get showFocusIndicator():Boolean{
return (_showFocusIndicator);
}
private function getIndexOfNextObject(_arg1:int, _arg2:Boolean, _arg3:Boolean, _arg4:String):int{
var _local5:int;
var _local6:int;
var _local7:DisplayObject;
var _local8:IFocusManagerGroup;
var _local9:int;
var _local10:DisplayObject;
var _local11:IFocusManagerGroup;
_local5 = focusableCandidates.length;
_local6 = _arg1;
while (true) {
if (_arg2){
_arg1--;
} else {
_arg1++;
};
if (_arg3){
if (((_arg2) && ((_arg1 < 0)))){
break;
};
if (((!(_arg2)) && ((_arg1 == _local5)))){
break;
};
} else {
_arg1 = ((_arg1 + _local5) % _local5);
if (_local6 == _arg1){
break;
};
};
if (isValidFocusCandidate(focusableCandidates[_arg1], _arg4)){
_local7 = DisplayObject(findFocusManagerComponent(focusableCandidates[_arg1]));
if ((_local7 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local7);
_local9 = 0;
while (_local9 < focusableCandidates.length) {
_local10 = focusableCandidates[_local9];
if ((_local10 is IFocusManagerGroup)){
_local11 = IFocusManagerGroup(_local10);
if ((((_local11.groupName == _local8.groupName)) && (_local11.selected))){
_arg1 = _local9;
break;
};
};
_local9++;
};
};
return (_arg1);
};
};
return (_arg1);
}
public function set form(_arg1:DisplayObjectContainer):void{
_form = _arg1;
}
private function addFocusables(_arg1:DisplayObject, _arg2:Boolean=false):void{
var focusable:IFocusManagerComponent;
var io:InteractiveObject;
var doc:DisplayObjectContainer;
var i:int;
var child:DisplayObject;
var o = _arg1;
var skipTopLevel = _arg2;
if (!skipTopLevel){
if ((o is IFocusManagerComponent)){
focusable = IFocusManagerComponent(o);
if (focusable.focusEnabled){
if (((focusable.tabEnabled) && (isTabVisible(o)))){
focusableObjects[o] = true;
calculateCandidates = true;
};
o.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
o.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
} else {
if ((o is InteractiveObject)){
io = (o as InteractiveObject);
if (((((io) && (io.tabEnabled))) && ((findFocusManagerComponent(io) == io)))){
focusableObjects[io] = true;
calculateCandidates = true;
};
io.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
io.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
};
};
if ((o is DisplayObjectContainer)){
doc = DisplayObjectContainer(o);
o.addEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
if ((((((doc is Stage)) || ((doc.parent is Stage)))) || (doc.tabChildren))){
i = 0;
while (i < doc.numChildren) {
try {
child = doc.getChildAt(i);
if (child != null){
addFocusables(doc.getChildAt(i));
};
} catch(error:SecurityError) {
};
i = (i + 1);
};
};
};
}
private function getChildIndex(_arg1:DisplayObjectContainer, _arg2:DisplayObject):int{
return (_arg1.getChildIndex(_arg2));
}
private function mouseFocusChangeHandler(_arg1:FocusEvent):void{
if ((_arg1.relatedObject is TextField)){
return;
};
_arg1.preventDefault();
}
private function focusOutHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
_local2 = (_arg1.target as InteractiveObject);
}
private function isValidFocusCandidate(_arg1:DisplayObject, _arg2:String):Boolean{
var _local3:IFocusManagerGroup;
if (!isEnabledAndVisible(_arg1)){
return (false);
};
if ((_arg1 is IFocusManagerGroup)){
_local3 = IFocusManagerGroup(_arg1);
if (_arg2 == _local3.groupName){
return (false);
};
};
return (true);
}
public function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject{
var _local2:InteractiveObject;
_local2 = _arg1;
while (_arg1) {
if ((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
};
return (_local2);
}
private function sortFocusableObjectsTabIndex():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))){
focusableCandidates.push(_local2);
};
};
focusableCandidates.sort(sortByTabIndex);
}
private function removeFocusables(_arg1:DisplayObject):void{
var _local2:Object;
var _local3:DisplayObject;
if ((_arg1 is DisplayObjectContainer)){
_arg1.removeEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
_arg1.removeEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
for (_local2 in focusableObjects) {
_local3 = DisplayObject(_local2);
if (DisplayObjectContainer(_arg1).contains(_local3)){
if (_local3 == lastFocus){
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local2];
calculateCandidates = true;
};
};
};
}
private function addedHandler(_arg1:Event):void{
var _local2:DisplayObject;
_local2 = DisplayObject(_arg1.target);
if (_local2.stage){
addFocusables(DisplayObject(_arg1.target));
};
}
private function getTopLevelFocusTarget(_arg1:InteractiveObject):InteractiveObject{
while (_arg1 != InteractiveObject(form)) {
if ((((((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))) && (IFocusManagerComponent(_arg1).mouseFocusEnabled))) && (UIComponent(_arg1).enabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
if (_arg1 == null){
break;
};
};
return (null);
}
private function tabChildrenChangeHandler(_arg1:Event):void{
var _local2:DisplayObjectContainer;
if (_arg1.target != _arg1.currentTarget){
return;
};
calculateCandidates = true;
_local2 = DisplayObjectContainer(_arg1.target);
if (_local2.tabChildren){
addFocusables(_local2, true);
} else {
removeFocusables(_local2);
};
}
public function sendDefaultButtonEvent():void{
defButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
}
public function getFocus():InteractiveObject{
var _local1:InteractiveObject;
_local1 = form.stage.focus;
return (findFocusManagerComponent(_local1));
}
private function isEnabledAndVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
var _local3:TextField;
var _local4:SimpleButton;
_local2 = DisplayObject(form).parent;
while (_arg1 != _local2) {
if ((_arg1 is UIComponent)){
if (!UIComponent(_arg1).enabled){
return (false);
};
} else {
if ((_arg1 is TextField)){
_local3 = TextField(_arg1);
if ((((_local3.type == TextFieldType.DYNAMIC)) || (!(_local3.selectable)))){
return (false);
};
} else {
if ((_arg1 is SimpleButton)){
_local4 = SimpleButton(_arg1);
if (!_local4.enabled){
return (false);
};
};
};
};
if (!_arg1.visible){
return (false);
};
_arg1 = _arg1.parent;
};
return (true);
}
public function set defaultButton(_arg1:Button):void{
var _local2:Button;
_local2 = (_arg1) ? Button(_arg1) : null;
if (_local2 != _defaultButton){
if (_defaultButton){
_defaultButton.emphasized = false;
};
if (defButton){
defButton.emphasized = false;
};
_defaultButton = _local2;
defButton = _local2;
if (_local2){
_local2.emphasized = true;
};
};
}
private function deactivateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
}
public function setFocus(_arg1:InteractiveObject):void{
if ((_arg1 is IFocusManagerComponent)){
IFocusManagerComponent(_arg1).setFocus();
} else {
form.stage.focus = _arg1;
};
}
private function setFocusToNextObject(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
if (!hasFocusableObjects()){
return;
};
_local2 = getNextFocusManagerComponent(_arg1.shiftKey);
if (_local2){
setFocus(_local2);
};
}
private function hasFocusableObjects():Boolean{
var _local1:Object;
for (_local1 in focusableObjects) {
return (true);
};
return (false);
}
private function tabIndexChangeHandler(_arg1:Event):void{
calculateCandidates = true;
}
private function sortFocusableObjects():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))) && ((_local2.tabIndex > 0)))){
sortFocusableObjectsTabIndex();
return;
};
focusableCandidates.push(_local2);
};
focusableCandidates.sort(sortByDepth);
}
private function keyFocusChangeHandler(_arg1:FocusEvent):void{
showFocusIndicator = true;
if ((((((_arg1.keyCode == Keyboard.TAB)) || ((_arg1.keyCode == 0)))) && (!(_arg1.isDefaultPrevented())))){
setFocusToNextObject(_arg1);
_arg1.preventDefault();
};
}
private function getIndexOfFocusedObject(_arg1:DisplayObject):int{
var _local2:int;
var _local3:int;
_local2 = focusableCandidates.length;
_local3 = 0;
_local3 = 0;
while (_local3 < _local2) {
if (focusableCandidates[_local3] == _arg1){
return (_local3);
};
_local3++;
};
return (-1);
}
public function hideFocus():void{
}
private function removedHandler(_arg1:Event):void{
var _local2:int;
var _local3:DisplayObject;
var _local4:InteractiveObject;
_local3 = DisplayObject(_arg1.target);
if ((((_local3 is IFocusManagerComponent)) && ((focusableObjects[_local3] == true)))){
if (_local3 == lastFocus){
IFocusManagerComponent(lastFocus).drawFocus(false);
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local3];
calculateCandidates = true;
} else {
if ((((_local3 is InteractiveObject)) && ((focusableObjects[_local3] == true)))){
_local4 = (_local3 as InteractiveObject);
if (_local4){
if (_local4 == lastFocus){
lastFocus = null;
};
delete focusableObjects[_local4];
calculateCandidates = true;
};
_local3.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
};
};
removeFocusables(_local3);
}
private function sortByDepth(_arg1:InteractiveObject, _arg2:InteractiveObject):Number{
var _local3:String;
var _local4:String;
var _local5:int;
var _local6:String;
var _local7:String;
var _local8:String;
var _local9:DisplayObject;
var _local10:DisplayObject;
_local3 = "";
_local4 = "";
_local8 = "0000";
_local9 = DisplayObject(_arg1);
_local10 = DisplayObject(_arg2);
while (((!((_local9 == DisplayObject(form)))) && (_local9.parent))) {
_local5 = getChildIndex(_local9.parent, _local9);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local3 = (_local7 + _local3);
_local9 = _local9.parent;
};
while (((!((_local10 == DisplayObject(form)))) && (_local10.parent))) {
_local5 = getChildIndex(_local10.parent, _local10);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local4 = (_local7 + _local4);
_local10 = _local10.parent;
};
return (((_local3 > _local4)) ? 1 : ((_local3 < _local4)) ? -1 : 0);
}
public function get defaultButton():Button{
return (_defaultButton);
}
private function activateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
if (lastFocus){
if ((lastFocus is IFocusManagerComponent)){
IFocusManagerComponent(lastFocus).setFocus();
} else {
form.stage.focus = lastFocus;
};
};
lastAction = "ACTIVATE";
}
public function showFocus():void{
}
public function set defaultButtonEnabled(_arg1:Boolean):void{
_defaultButtonEnabled = _arg1;
}
public function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject{
var _local2:DisplayObject;
var _local3:String;
var _local4:int;
var _local5:Boolean;
var _local6:int;
var _local7:int;
var _local8:IFocusManagerGroup;
if (!hasFocusableObjects()){
return (null);
};
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
_local2 = form.stage.focus;
_local2 = DisplayObject(findFocusManagerComponent(InteractiveObject(_local2)));
_local3 = "";
if ((_local2 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local2);
_local3 = _local8.groupName;
};
_local4 = getIndexOfFocusedObject(_local2);
_local5 = false;
_local6 = _local4;
if (_local4 == -1){
if (_arg1){
_local4 = focusableCandidates.length;
};
_local5 = true;
};
_local7 = getIndexOfNextObject(_local4, _arg1, _local5, _local3);
return (findFocusManagerComponent(focusableCandidates[_local7]));
}
private function mouseDownHandler(_arg1:MouseEvent):void{
var _local2:InteractiveObject;
if (_arg1.isDefaultPrevented()){
return;
};
_local2 = getTopLevelFocusTarget(InteractiveObject(_arg1.target));
if (!_local2){
return;
};
showFocusIndicator = false;
if (((((!((_local2 == lastFocus))) || ((lastAction == "ACTIVATE")))) && (!((_local2 is TextField))))){
setFocus(_local2);
};
lastAction = "MOUSEDOWN";
}
private function isTabVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
_local2 = _arg1.parent;
while (((((_local2) && (!((_local2 is Stage))))) && (!(((_local2.parent) && ((_local2.parent is Stage))))))) {
if (!_local2.tabChildren){
return (false);
};
_local2 = _local2.parent;
};
return (true);
}
public function get nextTabIndex():int{
return (0);
}
private function keyDownHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.TAB){
lastAction = "KEY";
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
};
if (((((((defaultButtonEnabled) && ((_arg1.keyCode == Keyboard.ENTER)))) && (defaultButton))) && (defButton.enabled))){
sendDefaultButtonEvent();
};
}
private function focusInHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
var _local3:Button;
_local2 = InteractiveObject(_arg1.target);
if (form.contains(_local2)){
lastFocus = findFocusManagerComponent(InteractiveObject(_local2));
if ((lastFocus is Button)){
_local3 = Button(lastFocus);
if (defButton){
defButton.emphasized = false;
defButton = _local3;
_local3.emphasized = true;
};
} else {
if (((defButton) && (!((defButton == _defaultButton))))){
defButton.emphasized = false;
defButton = _defaultButton;
_defaultButton.emphasized = true;
};
};
};
}
private function tabEnabledChangeHandler(_arg1:Event):void{
var _local2:InteractiveObject;
var _local3:Boolean;
calculateCandidates = true;
_local2 = InteractiveObject(_arg1.target);
_local3 = (focusableObjects[_local2] == true);
if (_local2.tabEnabled){
if (((!(_local3)) && (isTabVisible(_local2)))){
if (!(_local2 is IFocusManagerComponent)){
_local2.focusRect = false;
};
focusableObjects[_local2] = true;
};
} else {
if (_local3){
delete focusableObjects[_local2];
};
};
}
public function set showFocusIndicator(_arg1:Boolean):void{
_showFocusIndicator = _arg1;
}
public function get form():DisplayObjectContainer{
return (_form);
}
private function sortByTabIndex(_arg1:InteractiveObject, _arg2:InteractiveObject):int{
return (((_arg1.tabIndex > _arg2.tabIndex)) ? 1 : ((_arg1.tabIndex < _arg2.tabIndex)) ? -1 : sortByDepth(_arg1, _arg2));
}
public function activate():void{
if (activated){
return;
};
form.stage.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false, 0, true);
form.stage.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false, 0, true);
form.addEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.addEventListener(Event.ACTIVATE, activateHandler, false, 0, true);
form.stage.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true);
form.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = true;
if (lastFocus){
setFocus(lastFocus);
};
}
public function deactivate():void{
form.stage.removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler);
form.stage.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler);
form.removeEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.removeEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.removeEventListener(Event.ACTIVATE, activateHandler);
form.stage.removeEventListener(Event.DEACTIVATE, deactivateHandler);
form.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = false;
}
public function get defaultButtonEnabled():Boolean{
return (_defaultButtonEnabled);
}
}
}//package fl.managers
Section 78
//IFocusManager (fl.managers.IFocusManager)
package fl.managers {
import flash.display.*;
import fl.controls.*;
public interface IFocusManager {
function getFocus():InteractiveObject;
function deactivate():void;
function set defaultButton(_arg1:Button):void;
function set showFocusIndicator(_arg1:Boolean):void;
function get defaultButtonEnabled():Boolean;
function get nextTabIndex():int;
function get defaultButton():Button;
function get showFocusIndicator():Boolean;
function setFocus(_arg1:InteractiveObject):void;
function activate():void;
function showFocus():void;
function set defaultButtonEnabled(_arg1:Boolean):void;
function hideFocus():void;
function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject;
function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject;
}
}//package fl.managers
Section 79
//IFocusManagerComponent (fl.managers.IFocusManagerComponent)
package fl.managers {
public interface IFocusManagerComponent {
function set focusEnabled(_arg1:Boolean):void;
function drawFocus(_arg1:Boolean):void;
function setFocus():void;
function get focusEnabled():Boolean;
function get tabEnabled():Boolean;
function get tabIndex():int;
function get mouseFocusEnabled():Boolean;
}
}//package fl.managers
Section 80
//IFocusManagerGroup (fl.managers.IFocusManagerGroup)
package fl.managers {
public interface IFocusManagerGroup {
function set groupName(_arg1:String):void;
function set selected(_arg1:Boolean):void;
function get groupName():String;
function get selected():Boolean;
}
}//package fl.managers
Section 81
//StyleManager (fl.managers.StyleManager)
package fl.managers {
import fl.core.*;
import flash.text.*;
import flash.utils.*;
public class StyleManager {
private var globalStyles:Object;
private var classToDefaultStylesDict:Dictionary;
private var styleToClassesHash:Object;
private var classToStylesDict:Dictionary;
private var classToInstancesDict:Dictionary;
private static var _instance:StyleManager;
public function StyleManager(){
styleToClassesHash = {};
classToInstancesDict = new Dictionary(true);
classToStylesDict = new Dictionary(true);
classToDefaultStylesDict = new Dictionary(true);
globalStyles = UIComponent.getStyleDefinition();
}
public static function clearComponentStyle(_arg1:Object, _arg2:String):void{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
if (((!((_local4 == null))) && (!((_local4[_arg2] == null))))){
delete _local4[_arg2];
invalidateComponentStyle(_local3, _arg2);
};
}
private static function getClassDef(_arg1:Object):Class{
var component = _arg1;
if ((component is Class)){
return ((component as Class));
};
try {
return ((getDefinitionByName(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
if ((component is UIComponent)){
try {
return ((component.loaderInfo.applicationDomain.getDefinition(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
};
};
};
return (null);
}
public static function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
public static function setComponentStyle(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Class;
var _local5:Object;
_local4 = getClassDef(_arg1);
_local5 = getInstance().classToStylesDict[_local4];
if (_local5 == null){
_local5 = (getInstance().classToStylesDict[_local4] = {});
};
if (_local5 == _arg3){
return;
};
_local5[_arg2] = _arg3;
invalidateComponentStyle(_local4, _arg2);
}
private static function setSharedStyles(_arg1:UIComponent):void{
var _local2:StyleManager;
var _local3:Class;
var _local4:Object;
var _local5:String;
_local2 = getInstance();
_local3 = getClassDef(_arg1);
_local4 = _local2.classToDefaultStylesDict[_local3];
for (_local5 in _local4) {
_arg1.setSharedStyle(_local5, getSharedStyle(_arg1, _local5));
};
}
public static function getComponentStyle(_arg1:Object, _arg2:String):Object{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
return (((_local4)==null) ? null : _local4[_arg2]);
}
private static function getInstance(){
if (_instance == null){
_instance = new (StyleManager);
};
return (_instance);
}
private static function invalidateComponentStyle(_arg1:Class, _arg2:String):void{
var _local3:Dictionary;
var _local4:Object;
var _local5:UIComponent;
_local3 = getInstance().classToInstancesDict[_arg1];
if (_local3 == null){
return;
};
for (_local4 in _local3) {
_local5 = (_local4 as UIComponent);
if (_local5 == null){
} else {
_local5.setSharedStyle(_arg2, getSharedStyle(_local5, _arg2));
};
};
}
private static function invalidateStyle(_arg1:String):void{
var _local2:Dictionary;
var _local3:Object;
_local2 = getInstance().styleToClassesHash[_arg1];
if (_local2 == null){
return;
};
for (_local3 in _local2) {
invalidateComponentStyle(Class(_local3), _arg1);
};
}
public static function registerInstance(_arg1:UIComponent):void{
var inst:StyleManager;
var classDef:Class;
var target:Class;
var defaultStyles:Object;
var styleToClasses:Object;
var n:String;
var instance = _arg1;
inst = getInstance();
classDef = getClassDef(instance);
if (classDef == null){
return;
};
if (inst.classToInstancesDict[classDef] == null){
inst.classToInstancesDict[classDef] = new Dictionary(true);
target = classDef;
while (defaultStyles == null) {
if (target["getStyleDefinition"] != null){
defaultStyles = target["getStyleDefinition"]();
break;
};
try {
target = (instance.loaderInfo.applicationDomain.getDefinition(getQualifiedSuperclassName(target)) as Class);
} catch(err:Error) {
try {
target = (getDefinitionByName(getQualifiedSuperclassName(target)) as Class);
} catch(e:Error) {
defaultStyles = UIComponent.getStyleDefinition();
break;
};
};
};
styleToClasses = inst.styleToClassesHash;
for (n in defaultStyles) {
if (styleToClasses[n] == null){
styleToClasses[n] = new Dictionary(true);
};
styleToClasses[n][classDef] = true;
};
inst.classToDefaultStylesDict[classDef] = defaultStyles;
inst.classToStylesDict[classDef] = {};
};
inst.classToInstancesDict[classDef][instance] = true;
setSharedStyles(instance);
}
public static function getStyle(_arg1:String):Object{
return (getInstance().globalStyles[_arg1]);
}
private static function getSharedStyle(_arg1:UIComponent, _arg2:String):Object{
var _local3:Class;
var _local4:StyleManager;
var _local5:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance();
_local5 = _local4.classToStylesDict[_local3][_arg2];
if (_local5 != null){
return (_local5);
};
_local5 = _local4.globalStyles[_arg2];
if (_local5 != null){
return (_local5);
};
return (_local4.classToDefaultStylesDict[_local3][_arg2]);
}
public static function setStyle(_arg1:String, _arg2:Object):void{
var _local3:Object;
_local3 = getInstance().globalStyles;
if ((((_local3[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
_local3[_arg1] = _arg2;
invalidateStyle(_arg1);
}
}
}//package fl.managers
Section 82
//AutoLayoutEvent (fl.video.AutoLayoutEvent)
package fl.video {
import flash.events.*;
import flash.geom.*;
public class AutoLayoutEvent extends LayoutEvent implements IVPEvent {
private var _vp:uint;
public static const AUTO_LAYOUT:String = "autoLayout";
public function AutoLayoutEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:Rectangle=null, _arg5:Rectangle=null, _arg6:uint=0){
super(_arg1, _arg2, _arg3, _arg4, _arg5);
_vp = _arg6;
}
override public function clone():Event{
return (new AutoLayoutEvent(type, bubbles, cancelable, Rectangle(oldBounds.clone()), Rectangle(oldRegistrationBounds.clone()), vp));
}
public function set vp(_arg1:uint):void{
_vp = _arg1;
}
public function get vp():uint{
return (_vp);
}
}
}//package fl.video
Section 83
//ConnectClient (fl.video.ConnectClient)
package fl.video {
import flash.net.*;
public class ConnectClient {
public var connIndex:uint;
public var nc:NetConnection;
public var pending:Boolean;
public var owner:NCManager;
public function ConnectClient(_arg1:NCManager, _arg2:NetConnection, _arg3:uint=0){
this.owner = _arg1;
this.nc = _arg2;
this.connIndex = _arg3;
this.pending = false;
}
public function onBWCheck(... _args):Number{
return (++owner._payload);
}
public function onBWDone(... _args):void{
var _local2:Number;
if (_args.length > 0){
_local2 = _args[0];
};
owner.onConnected(nc, _local2);
}
public function close():void{
}
}
}//package fl.video
Section 84
//ControlData (fl.video.ControlData)
package fl.video {
import flash.display.*;
public class ControlData {
public var state_mc:Array;
public var origWidth:Number;
public var handle_mc:Sprite;
public var state:uint;
public var leftMargin:Number;
public var fullness_mc:DisplayObject;
public var isDragging:Boolean;
public var currentState_mc:DisplayObject;
public var percentage:Number;
public var owner:DisplayObject;
public var origX:Number;
public var origY:Number;
public var bottomMargin:Number;
public var disabled_mc:DisplayObject;
public var enabled:Boolean;
public var hit_mc:Sprite;
public var origHeight:Number;
public var index:int;
public var mask_mc:DisplayObject;
public var avatar:DisplayObject;
public var fill_mc:DisplayObject;
public var topMargin:Number;
public var uiMgr:UIManager;
public var progress_mc:DisplayObject;
public var rightMargin:Number;
public var ctrl:DisplayObject;
public var origScaleX:Number;
public var origScaleY:Number;
public function ControlData(_arg1:UIManager, _arg2:DisplayObject, _arg3:DisplayObject, _arg4:int){
var uiMgr = _arg1;
var ctrl = _arg2;
var owner = _arg3;
var index = _arg4;
super();
this.uiMgr = uiMgr;
this.index = index;
this.ctrl = ctrl;
this.owner = owner;
try {
ctrl["uiMgr"] = uiMgr;
} catch(re:ReferenceError) {
};
}
}
}//package fl.video
Section 85
//CuePointManager (fl.video.CuePointManager)
package fl.video {
public class CuePointManager {
flvplayback_internal var _disabledCuePointsByNameOnly:Object;
flvplayback_internal var navCuePoints:Array;
flvplayback_internal var allCuePoints:Array;
flvplayback_internal var _disabledCuePoints:Array;
flvplayback_internal var _asCuePointTolerance:Number;
flvplayback_internal var _linearSearchTolerance:Number;
flvplayback_internal var _asCuePointIndex:int;
flvplayback_internal var asCuePoints:Array;
flvplayback_internal var flvCuePoints:Array;
flvplayback_internal var _metadataLoaded:Boolean;
flvplayback_internal var _id:uint;
private var _owner:FLVPlayback;
flvplayback_internal var eventCuePoints:Array;
public static const SHORT_VERSION:String = "2.0";
public static const VERSION:String = "2.0.0.37";
flvplayback_internal static const DEFAULT_LINEAR_SEARCH_TOLERANCE:Number = 50;
flvplayback_internal static var cuePointsReplace:Array = [""", "\"", "'", "'", ",", ",", "&", "&"];
public function CuePointManager(_arg1:FLVPlayback, _arg2:uint){
_owner = _arg1;
_id = _arg2;
reset();
_asCuePointTolerance = (_owner.getVideoPlayer(_id).playheadUpdateInterval / 2000);
_linearSearchTolerance = DEFAULT_LINEAR_SEARCH_TOLERANCE;
}
flvplayback_internal function getCuePoint(_arg1:Array, _arg2:Boolean, _arg3):Object{
var _local4:Object;
var _local5:int;
switch (typeof(_arg3)){
case "string":
_local4 = {name:_arg3};
break;
case "number":
_local4 = {time:_arg3};
break;
case "object":
_local4 = _arg3;
break;
};
_local5 = getCuePointIndex(_arg1, _arg2, _local4.time, _local4.name);
if (_local5 < 0){
return (null);
};
_local4 = deepCopyObject(_arg1[_local5]);
_local4.array = _arg1;
_local4.index = _local5;
return (_local4);
}
public function resetASCuePointIndex(_arg1:Number):void{
var _local2:int;
if ((((_arg1 <= 0)) || ((asCuePoints == null)))){
_asCuePointIndex = 0;
return;
};
_local2 = getCuePointIndex(asCuePoints, true, _arg1);
_asCuePointIndex = ((asCuePoints[_local2].time)<_arg1) ? (_local2 + 1) : _local2;
}
public function set playheadUpdateInterval(_arg1:Number):void{
_asCuePointTolerance = (_arg1 / 2000);
}
flvplayback_internal function addOrDisable(_arg1:Boolean, _arg2:Object):void{
if (_arg1){
if (_arg2.type == CuePointType.ACTIONSCRIPT){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "Cannot disable actionscript cue points"));
};
setFLVCuePointEnabled(false, _arg2);
} else {
if (_arg2.type == CuePointType.ACTIONSCRIPT){
addASCuePoint(_arg2);
};
};
}
public function processFLVCuePoints(_arg1:Array):void{
var _local2:int;
var _local3:Number;
var _local4:Object;
var _local5:Array;
var _local6:Number;
var _local7:int;
_metadataLoaded = true;
if ((((_arg1 == null)) || ((_arg1.length < 1)))){
flvCuePoints = null;
navCuePoints = null;
eventCuePoints = null;
return;
};
flvCuePoints = _arg1;
navCuePoints = new Array();
eventCuePoints = new Array();
_local3 = -1;
_local5 = _disabledCuePoints;
_local6 = 0;
_disabledCuePoints = new Array();
_local7 = 0;
while ((_local4 = flvCuePoints[_local7++]) != undefined) {
if ((((_local3 > 0)) && ((_local3 >= _local4.time)))){
flvCuePoints = null;
navCuePoints = null;
eventCuePoints = null;
_disabledCuePoints = new Array();
_disabledCuePointsByNameOnly = new Object();
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, ("Unsorted cuePoint found after time: " + _local3)));
};
_local3 = _local4.time;
while ((((_local6 < _local5.length)) && ((cuePointCompare(_local5[_local6].time, null, _local4) < 0)))) {
_local6++;
};
if (((!((_disabledCuePointsByNameOnly[_local4.name] == undefined))) || ((((_local6 < _local5.length)) && ((cuePointCompare(_local5[_local6].time, _local5[_local6].name, _local4) == 0)))))){
_disabledCuePoints.push({time:_local4.time, name:_local4.name});
};
if (_local4.type == CuePointType.NAVIGATION){
navCuePoints.push(_local4);
} else {
if (_local4.type == CuePointType.EVENT){
eventCuePoints.push(_local4);
};
};
if ((((allCuePoints == null)) || ((allCuePoints.length < 1)))){
allCuePoints = new Array();
allCuePoints.push(_local4);
} else {
_local2 = getCuePointIndex(allCuePoints, true, _local4.time);
_local2 = ((allCuePoints[_local2].time)>_local4.time) ? 0 : (_local2 + 1);
allCuePoints.splice(_local2, 0, _local4);
};
};
_disabledCuePointsByNameOnly = new Object();
}
public function addASCuePoint(_arg1, _arg2:String=null, _arg3:Object=null):Object{
var _local4:Object;
var _local5:Boolean;
var _local6:Boolean;
var _local7:int;
var _local8:Number;
var _local9:Object;
var _local10:int;
if (typeof(_arg1) == "object"){
_local4 = deepCopyObject(_arg1);
} else {
_local4 = {time:_arg1, name:_arg2, parameters:deepCopyObject(_arg3)};
};
if (_local4.parameters == null){
delete _local4.parameters;
};
_local5 = ((isNaN(_local4.time)) || ((_local4.time < 0)));
if (_local5){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "time must be number"));
};
_local6 = (_local4.name == null);
if (_local6){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "name cannot be undefined or null"));
};
_local4.type = CuePointType.ACTIONSCRIPT;
if ((((asCuePoints == null)) || ((asCuePoints.length < 1)))){
_local7 = 0;
asCuePoints = new Array();
asCuePoints.push(_local4);
} else {
_local7 = getCuePointIndex(asCuePoints, true, _local4.time);
_local7 = ((asCuePoints[_local7].time)>_local4.time) ? 0 : (_local7 + 1);
asCuePoints.splice(_local7, 0, _local4);
};
if ((((allCuePoints == null)) || ((allCuePoints.length < 1)))){
allCuePoints = new Array();
allCuePoints.push(_local4);
} else {
_local10 = getCuePointIndex(allCuePoints, true, _local4.time);
_local10 = ((allCuePoints[_local10].time)>_local4.time) ? 0 : (_local10 + 1);
allCuePoints.splice(_local10, 0, _local4);
};
_local8 = _owner.getVideoPlayer(_id).playheadTime;
if (_local8 > 0){
if (_asCuePointIndex == _local7){
if (_local8 > asCuePoints[_local7].time){
_asCuePointIndex++;
};
} else {
if (_asCuePointIndex > _local7){
_asCuePointIndex++;
};
};
} else {
_asCuePointIndex = 0;
};
_local9 = deepCopyObject(asCuePoints[_local7]);
_local9.array = asCuePoints;
_local9.index = _local7;
return (_local9);
}
public function get metadataLoaded():Boolean{
return (_metadataLoaded);
}
public function reset():void{
_metadataLoaded = false;
allCuePoints = null;
asCuePoints = null;
_disabledCuePoints = new Array();
_disabledCuePointsByNameOnly = new Object();
flvCuePoints = null;
navCuePoints = null;
eventCuePoints = null;
_asCuePointIndex = 0;
}
public function removeCuePoints(_arg1:Array, _arg2:Object):Number{
var _local3:int;
var _local4:Object;
var _local5:int;
_local5 = 0;
_local3 = getCuePointIndex(_arg1, true, -1, _arg2.name);
while (_local3 >= 0) {
_local4 = _arg1[_local3];
_arg1.splice(_local3, 1);
_local3--;
_local5++;
_local3 = getNextCuePointIndexWithName(_local4.name, _arg1, _local3);
};
return (_local5);
}
flvplayback_internal function unescape(_arg1:String):String{
var _local2:String;
var _local3:int;
_local2 = _arg1;
_local3 = 0;
while (_local3 < cuePointsReplace.length) {
var _temp1 = _local3;
_local3 = (_local3 + 1);
var _temp2 = _local3;
_local3 = (_local3 + 1);
_local2 = _local2.replace(cuePointsReplace[_temp1], cuePointsReplace[_temp2]);
};
return (_local2);
}
public function setFLVCuePointEnabled(_arg1:Boolean, _arg2):int{
var _local3:Object;
var _local4:Boolean;
var _local5:Boolean;
var _local6:uint;
var _local7:int;
var _local8:int;
var _local9:Object;
switch (typeof(_arg2)){
case "string":
_local3 = {name:_arg2};
break;
case "number":
_local3 = {time:_arg2};
break;
case "object":
_local3 = _arg2;
break;
};
_local4 = ((isNaN(_local3.time)) || ((_local3.time < 0)));
_local5 = (_local3.name == null);
if (((_local4) && (_local5))){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "time must be number and/or name must not be undefined or null"));
};
_local6 = 0;
if (_local4){
if (!_metadataLoaded){
if (_disabledCuePointsByNameOnly[_local3.name] == undefined){
if (!_arg1){
_disabledCuePointsByNameOnly[_local3.name] = new Array();
};
} else {
if (_arg1){
delete _disabledCuePointsByNameOnly[_local3.name];
};
return (-1);
};
removeCuePoints(_disabledCuePoints, _local3);
return (-1);
};
if (_arg1){
_local6 = removeCuePoints(_disabledCuePoints, _local3);
} else {
_local7 = getCuePointIndex(flvCuePoints, true, -1, _local3.name);
while (_local7 >= 0) {
_local9 = flvCuePoints[_local7];
_local8 = getCuePointIndex(_disabledCuePoints, true, _local9.time);
if ((((_local8 < 0)) || (!((_disabledCuePoints[_local8].time == _local9.time))))){
_disabledCuePoints = insertCuePoint(_local8, _disabledCuePoints, {name:_local9.name, time:_local9.time});
_local6 = (_local6 + 1);
};
_local7 = getNextCuePointIndexWithName(_local9.name, flvCuePoints, _local7);
};
};
return (_local6);
};
_local7 = getCuePointIndex(_disabledCuePoints, false, _local3.time, _local3.name);
if (_local7 < 0){
if (_arg1){
if (!_metadataLoaded){
_local7 = getCuePointIndex(_disabledCuePoints, false, _local3.time);
if (_local7 < 0){
_local8 = getCuePointIndex(_disabledCuePointsByNameOnly[_local3.name], true, _local3.time);
if (cuePointCompare(_local3.time, null, _disabledCuePointsByNameOnly[_local3.name]) != 0){
_disabledCuePointsByNameOnly[_local3.name] = insertCuePoint(_local8, _disabledCuePointsByNameOnly[_local3.name], _local3);
};
} else {
_disabledCuePoints.splice(_local7, 1);
};
};
return ((_metadataLoaded) ? 0 : -1);
};
} else {
if (_arg1){
_disabledCuePoints.splice(_local7, 1);
_local6 = 1;
} else {
_local6 = 0;
};
return ((_metadataLoaded) ? _local6 : -1);
};
if (_metadataLoaded){
_local7 = getCuePointIndex(flvCuePoints, false, _local3.time, _local3.name);
if (_local7 < 0){
return (0);
};
if (_local5){
_local3.name = flvCuePoints[_local7].name;
};
};
_local8 = getCuePointIndex(_disabledCuePoints, true, _local3.time);
_disabledCuePoints = insertCuePoint(_local8, _disabledCuePoints, _local3);
_local6 = 1;
return ((_metadataLoaded) ? _local6 : -1);
}
public function isFLVCuePointEnabled(_arg1):Boolean{
var _local2:Object;
var _local3:Boolean;
var _local4:Boolean;
var _local5:int;
if (!_metadataLoaded){
return (true);
};
switch (typeof(_arg1)){
case "string":
_local2 = {name:_arg1};
break;
case "number":
_local2 = {time:_arg1};
break;
case "object":
_local2 = _arg1;
break;
};
_local3 = ((isNaN(_local2.time)) || ((_local2.time < 0)));
_local4 = (_local2.name == null);
if (((_local3) && (_local4))){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "time must be number and/or name must not be undefined or null"));
};
if (_local3){
_local5 = getCuePointIndex(flvCuePoints, true, -1, _local2.name);
if (_local5 < 0){
return (true);
};
while (_local5 >= 0) {
if (getCuePointIndex(_disabledCuePoints, false, flvCuePoints[_local5].time, flvCuePoints[_local5].name) < 0){
return (true);
};
_local5 = getNextCuePointIndexWithName(_local2.name, flvCuePoints, _local5);
};
return (false);
};
return ((getCuePointIndex(_disabledCuePoints, false, _local2.time, _local2.name) < 0));
}
public function removeASCuePoint(_arg1):Object{
var _local2:Object;
var _local3:int;
if ((((asCuePoints == null)) || ((asCuePoints.length < 1)))){
return (null);
};
switch (typeof(_arg1)){
case "string":
_local2 = {name:_arg1};
break;
case "number":
_local2 = {time:_arg1};
break;
case "object":
_local2 = _arg1;
break;
};
_local3 = getCuePointIndex(asCuePoints, false, _local2.time, _local2.name);
if (_local3 < 0){
return (null);
};
_local2 = asCuePoints[_local3];
asCuePoints.splice(_local3, 1);
_local3 = getCuePointIndex(allCuePoints, false, _local2.time, _local2.name);
if (_local3 > 0){
allCuePoints.splice(_local3, 1);
};
if (_owner.getVideoPlayer(_id).playheadTime > 0){
if (_asCuePointIndex > _local3){
_asCuePointIndex--;
};
} else {
_asCuePointIndex = 0;
};
return (_local2);
}
public function get id():uint{
return (_id);
}
public function processCuePointsProperty(_arg1:Array):void{
var _local2:uint;
var _local3:uint;
var _local4:String;
var _local5:String;
var _local6:Object;
var _local7:Boolean;
var _local8:int;
if ((((_arg1 == null)) || ((_arg1.length == 0)))){
return;
};
_local2 = 0;
_local8 = 0;
while (_local8 < (_arg1.length - 1)) {
switch (_local2){
case 6:
addOrDisable(_local7, _local6);
_local2 = 0;
case 0:
var _temp1 = _local8;
_local8 = (_local8 + 1);
if (_arg1[_temp1] != "t"){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "unexpected cuePoint parameter format"));
};
if (isNaN(_arg1[_local8])){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "time must be number"));
};
_local6 = new Object();
_local6.time = (_arg1[_local8] / 1000);
_local2++;
break;
case 1:
var _temp2 = _local8;
_local8 = (_local8 + 1);
if (_arg1[_temp2] != "n"){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "unexpected cuePoint parameter format"));
};
if (_arg1[_local8] == undefined){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "name cannot be null or undefined"));
};
_local6.name = unescape(_arg1[_local8]);
_local2++;
break;
case 2:
var _temp3 = _local8;
_local8 = (_local8 + 1);
if (_arg1[_temp3] != "t"){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "unexpected cuePoint parameter format"));
};
if (isNaN(_arg1[_local8])){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "type must be number"));
};
switch (_arg1[_local8]){
case 0:
_local6.type = CuePointType.EVENT;
break;
case 1:
_local6.type = CuePointType.NAVIGATION;
break;
case 2:
_local6.type = CuePointType.ACTIONSCRIPT;
break;
default:
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "type must be 0, 1 or 2"));
};
_local2++;
break;
case 3:
var _temp4 = _local8;
_local8 = (_local8 + 1);
if (_arg1[_temp4] != "d"){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "unexpected cuePoint parameter format"));
};
if (isNaN(_arg1[_local8])){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "disabled must be number"));
};
_local7 = !((_arg1[_local8] == 0));
_local2++;
break;
case 4:
var _temp5 = _local8;
_local8 = (_local8 + 1);
if (_arg1[_temp5] != "p"){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "unexpected cuePoint parameter format"));
};
if (isNaN(_arg1[_local8])){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "num params must be number"));
};
_local3 = _arg1[_local8];
_local2++;
if (_local3 == 0){
_local2++;
} else {
_local6.parameters = new Object();
};
break;
case 5:
var _temp6 = _local8;
_local8 = (_local8 + 1);
_local4 = _arg1[_temp6];
_local5 = _arg1[_local8];
if ((_local4 is String)){
_local4 = unescape(_local4);
};
if ((_local5 is String)){
_local5 = unescape(_local5);
};
_local6.parameters[_local4] = _local5;
_local3--;
if (_local3 == 0){
_local2++;
};
break;
};
_local8++;
};
if (_local2 == 6){
addOrDisable(_local7, _local6);
} else {
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "unexpected end of cuePoint param string"));
};
}
flvplayback_internal function getNextCuePointIndexWithName(_arg1:String, _arg2:Array, _arg3:int):int{
var _local4:int;
if (_arg1 == null){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "name cannot be undefined or null"));
};
if (_arg2 == null){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "cuePoint.array undefined"));
};
if (((((isNaN(_arg3)) || ((_arg3 < -1)))) || ((_arg3 >= _arg2.length)))){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "cuePoint.index must be number between -1 and cuePoint.array.length"));
};
_local4 = (_arg3 + 1);
while (_local4 < _arg2.length) {
if (_arg2[_local4].name == _arg1){
break;
};
_local4++;
};
if (_local4 < _arg2.length){
return (_local4);
};
return (-1);
}
public function dispatchASCuePoints():void{
var _local1:Number;
_local1 = _owner.getVideoPlayer(_id).playheadTime;
if (((_owner.getVideoPlayer(_id).stateResponsive) && (!((asCuePoints == null))))){
while ((((_asCuePointIndex < asCuePoints.length)) && ((asCuePoints[_asCuePointIndex].time <= (_local1 + _asCuePointTolerance))))) {
_owner.dispatchEvent(new MetadataEvent(MetadataEvent.CUE_POINT, false, false, deepCopyObject(asCuePoints[_asCuePointIndex++]), _id));
};
};
}
flvplayback_internal function getNextCuePointWithName(_arg1:Object):Object{
var _local2:int;
var _local3:Object;
if (_arg1 == null){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "cuePoint parameter undefined"));
};
if (((isNaN(_arg1.time)) || ((_arg1.time < 0)))){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "time must be number"));
};
_local2 = getNextCuePointIndexWithName(_arg1.name, _arg1.array, _arg1.index);
if (_local2 < 0){
return (null);
};
_local3 = deepCopyObject(_arg1.array[_local2]);
_local3.array = _arg1.array;
_local3.index = _local2;
return (_local3);
}
public function insertCuePoint(_arg1:int, _arg2:Array, _arg3:Object):Array{
if (_arg1 < 0){
_arg2 = new Array();
_arg2.push(_arg3);
} else {
if (_arg2[_arg1].time > _arg3.time){
_arg1 = 0;
} else {
_arg1++;
};
_arg2.splice(_arg1, 0, _arg3);
};
return (_arg2);
}
flvplayback_internal function getCuePointIndex(_arg1:Array, _arg2:Boolean, _arg3:Number=NaN, _arg4:String=null, _arg5:int=-1, _arg6:int=-1):int{
var _local7:Boolean;
var _local8:Boolean;
var _local9:int;
var _local10:int;
var _local11:int;
var _local12:int;
var _local13:int;
var _local14:int;
var _local15:int;
if ((((_arg1 == null)) || ((_arg1.length < 1)))){
return (-1);
};
_local7 = ((isNaN(_arg3)) || ((_arg3 < 0)));
_local8 = (_arg4 == null);
if (((_local7) && (_local8))){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "time must be number and/or name must not be undefined or null"));
};
if (_arg5 < 0){
_arg5 = 0;
};
if (_arg6 < 0){
_arg6 = _arg1.length;
};
if (((!(_local8)) && (((_arg2) || (_local7))))){
if (_local7){
_local12 = _arg5;
} else {
_local12 = getCuePointIndex(_arg1, _arg2, _arg3);
};
_local13 = _local12;
while (_local13 >= _arg5) {
if (_arg1[_local13].name == _arg4){
break;
};
_local13--;
};
if (_local13 >= _arg5){
return (_local13);
};
_local13 = (_local12 + 1);
while (_local13 < _arg6) {
if (_arg1[_local13].name == _arg4){
break;
};
_local13++;
};
if (_local13 < _arg6){
return (_local13);
};
return (-1);
};
if (_arg6 <= _linearSearchTolerance){
_local14 = (_arg5 + _arg6);
_local15 = _arg5;
while (_local15 < _local14) {
_local9 = cuePointCompare(_arg3, _arg4, _arg1[_local15]);
if (_local9 == 0){
return (_local15);
};
if (_local9 < 0){
break;
};
_local15++;
};
if (_arg2){
if (_local15 > 0){
return ((_local15 - 1));
};
return (0);
};
return (-1);
};
_local10 = int((_arg6 / 2));
_local11 = (_arg5 + _local10);
_local9 = cuePointCompare(_arg3, _arg4, _arg1[_local11]);
if (_local9 < 0){
return (getCuePointIndex(_arg1, _arg2, _arg3, _arg4, _arg5, _local10));
};
if (_local9 > 0){
return (getCuePointIndex(_arg1, _arg2, _arg3, _arg4, (_local11 + 1), ((_local10 - 1) + (_arg6 % 2))));
};
return (_local11);
}
flvplayback_internal static function deepCopyObject(_arg1:Object, _arg2:uint=0):Object{
var _local3:Object;
var _local4:*;
if (_arg1 == null){
return (_arg1);
};
_local3 = new Object();
for (_local4 in _arg1) {
if ((((_arg2 == 0)) && ((((_local4 == "array")) || ((_local4 == "index")))))){
} else {
if (typeof(_arg1[_local4]) == "object"){
_local3[_local4] = deepCopyObject(_arg1[_local4], (_arg2 + 1));
} else {
_local3[_local4] = _arg1[_local4];
};
};
};
return (_local3);
}
flvplayback_internal static function cuePointCompare(_arg1:Number, _arg2:String, _arg3:Object):int{
var _local4:Number;
var _local5:Number;
_local4 = Math.round((_arg1 * 1000));
_local5 = Math.round((_arg3.time * 1000));
if (_local4 < _local5){
return (-1);
};
if (_local4 > _local5){
return (1);
};
if (_arg2 != null){
if (_arg2 == _arg3.name){
return (0);
};
if (_arg2 < _arg3.name){
return (-1);
};
return (1);
};
return (0);
}
}
}//package fl.video
Section 86
//CuePointType (fl.video.CuePointType)
package fl.video {
public final class CuePointType {
public static const FLV:String = "flv";
public static const ALL:String = "all";
public static const ACTIONSCRIPT:String = "actionscript";
public static const EVENT:String = "event";
public static const NAVIGATION:String = "navigation";
}
}//package fl.video
Section 87
//FLVPlayback (fl.video.FLVPlayback)
package fl.video {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.utils.*;
public class FLVPlayback extends Sprite {
private var _playheadUpdateInterval:Number;
private var _align:String;
flvplayback_internal var videoPlayerStateDict:Dictionary;
flvplayback_internal var cuePointMgrs:Array;
private var _volume:Number;
private var _origHeight:Number;
flvplayback_internal var videoPlayerStates:Array;
private var _progressInterval:Number;
private var _seekToPrevOffset:Number;
private var _origWidth:Number;
private var _scaleMode:String;
flvplayback_internal var resizingNow:Boolean;
flvplayback_internal var videoPlayers:Array;
private var _bufferTime:Number;
private var _aspectRatio:Boolean;
private var _autoRewind:Boolean;
flvplayback_internal var uiMgr:UIManager;
private var previewImage_mc:Loader;
private var _componentInspectorSetting:Boolean;
flvplayback_internal var _firstStreamShown:Boolean;
private var _visibleVP:uint;
private var _idleTimeout:Number;
private var _soundTransform:SoundTransform;
public var boundingBox_mc:DisplayObject;
flvplayback_internal var skinShowTimer:Timer;
private var preview_mc:MovieClip;
private var livePreviewHeight:Number;
flvplayback_internal var _firstStreamReady:Boolean;
private var _activeVP:uint;
private var isLivePreview:Boolean;
private var _topVP:uint;
private var livePreviewWidth:Number;
private var __forceNCMgr:NCManager;
private var previewImageUrl:String;
public static const SEEK_TO_PREV_OFFSET_DEFAULT:Number = 1;
public static const SHORT_VERSION:String = "2.0";
flvplayback_internal static const skinShowTimerInterval:Number = 2000;
public static const VERSION:String = "2.0.0.37";
flvplayback_internal static const DEFAULT_SKIN_SHOW_TIMER_INTERVAL:Number = 2000;
public function FLVPlayback(){
var _local1:VideoPlayer;
super();
isLivePreview = ((!((parent == null))) && ((getQualifiedClassName(parent) == "fl.livepreview::LivePreviewParent")));
_componentInspectorSetting = false;
_origWidth = super.width;
_origHeight = super.height;
super.scaleX = 1;
super.scaleY = 1;
_local1 = new VideoPlayer(0, 0);
_local1.setSize(_origWidth, _origHeight);
videoPlayers = new Array();
videoPlayers[0] = _local1;
_align = _local1.align;
_autoRewind = _local1.autoRewind;
_scaleMode = _local1.scaleMode;
_bufferTime = _local1.bufferTime;
_idleTimeout = _local1.idleTimeout;
_playheadUpdateInterval = _local1.playheadUpdateInterval;
_progressInterval = _local1.progressInterval;
_soundTransform = _local1.soundTransform;
_volume = _local1.volume;
_seekToPrevOffset = SEEK_TO_PREV_OFFSET_DEFAULT;
_firstStreamReady = false;
_firstStreamShown = false;
resizingNow = false;
uiMgr = new UIManager(this);
if (isLivePreview){
uiMgr.visible = true;
};
_activeVP = 0;
_visibleVP = 0;
_topVP = 0;
videoPlayerStates = new Array();
videoPlayerStateDict = new Dictionary(true);
cuePointMgrs = new Array();
createVideoPlayer(0);
boundingBox_mc.visible = false;
removeChild(boundingBox_mc);
boundingBox_mc = null;
if (isLivePreview){
previewImageUrl = "";
createLivePreviewMovieClip();
setSize(_origWidth, _origHeight);
};
}
public function set fullScreenTakeOver(_arg1:Boolean):void{
uiMgr.fullScreenTakeOver = _arg1;
}
public function pause():void{
var _local1:VideoPlayerState;
var _local2:VideoPlayer;
if (!_firstStreamShown){
_local1 = videoPlayerStates[_activeVP];
queueCmd(_local1, QueuedCommand.PAUSE);
} else {
_local2 = videoPlayers[_activeVP];
_local2.pause();
};
}
public function setScale(_arg1:Number, _arg2:Number):void{
var _local3:Rectangle;
var _local4:Rectangle;
var _local5:int;
var _local6:VideoPlayer;
_local3 = new Rectangle(x, y, width, height);
_local4 = new Rectangle(registrationX, registrationY, registrationWidth, registrationHeight);
resizingNow = true;
_local5 = 0;
while (_local5 < videoPlayers.length) {
_local6 = videoPlayers[_local5];
if (_local6 !== null){
_local6.setSize((_origWidth * _arg1), (_origWidth * _arg2));
};
_local5++;
};
resizingNow = false;
dispatchEvent(new LayoutEvent(LayoutEvent.LAYOUT, false, false, _local3, _local4));
}
public function stop():void{
var _local1:VideoPlayerState;
var _local2:VideoPlayer;
if (!_firstStreamShown){
_local1 = videoPlayerStates[_activeVP];
queueCmd(_local1, QueuedCommand.STOP);
} else {
_local2 = videoPlayers[_activeVP];
_local2.stop();
};
}
public function set align(_arg1:String):void{
var _local2:VideoPlayer;
if (_activeVP == 0){
_align = _arg1;
};
_local2 = videoPlayers[_activeVP];
_local2.align = _arg1;
}
public function getVideoPlayer(_arg1:Number):VideoPlayer{
return (videoPlayers[_arg1]);
}
public function get playheadTime():Number{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.playheadTime);
}
public function get progressInterval():Number{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.progressInterval);
}
public function set skinFadeTime(_arg1:int):void{
uiMgr.skinFadeTime = _arg1;
}
public function get seekToPrevOffset():Number{
return (_seekToPrevOffset);
}
public function set playheadTime(_arg1:Number):void{
seek(_arg1);
}
public function get source():String{
var _local1:VideoPlayerState;
var _local2:VideoPlayer;
_local1 = videoPlayerStates[_activeVP];
if (_local1.isWaiting){
return (_local1.url);
};
_local2 = videoPlayers[_activeVP];
return (_local2.source);
}
public function get activeVideoPlayerIndex():uint{
return (_activeVP);
}
public function get skinFadeTime():int{
return (uiMgr.skinFadeTime);
}
public function set scaleMode(_arg1:String):void{
var _local2:VideoPlayer;
if (_activeVP == 0){
_scaleMode = _arg1;
};
_local2 = videoPlayers[_activeVP];
_local2.scaleMode = _arg1;
}
public function set bufferingBar(_arg1:Sprite):void{
uiMgr.setControl(UIManager.BUFFERING_BAR, _arg1);
}
public function get metadataLoaded():Boolean{
var _local1:CuePointManager;
_local1 = cuePointMgrs[_activeVP];
return (_local1.metadataLoaded);
}
public function closeVideoPlayer(_arg1:uint):void{
var _local2:VideoPlayer;
if (_arg1 == 0){
throw (new VideoError(VideoError.DELETE_DEFAULT_PLAYER));
};
if (videoPlayers[_arg1] == undefined){
return;
};
_local2 = videoPlayers[_arg1];
if (_visibleVP == _arg1){
visibleVideoPlayerIndex = 0;
};
if (_activeVP == _arg1){
activeVideoPlayerIndex = 0;
};
removeChild(_local2);
_local2.close();
delete videoPlayers[_arg1];
delete videoPlayerStates[_arg1];
delete videoPlayerStateDict[_local2];
}
public function get scaleMode():String{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.scaleMode);
}
public function set progressInterval(_arg1:Number):void{
var _local2:VideoPlayer;
if (_activeVP == 0){
_progressInterval = _arg1;
};
_local2 = videoPlayers[_activeVP];
_local2.progressInterval = _arg1;
}
public function get playing():Boolean{
return ((state == VideoState.PLAYING));
}
public function get totalTime():Number{
var _local1:VideoPlayerState;
var _local2:VideoPlayer;
if (isLivePreview){
return (1);
};
_local1 = videoPlayerStates[_activeVP];
if (_local1.totalTimeSet){
return (_local1.totalTime);
};
_local2 = videoPlayers[_activeVP];
return (_local2.totalTime);
}
public function get ncMgr():INCManager{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.ncMgr);
}
public function set volume(_arg1:Number):void{
var _local2:VideoPlayer;
if (_volume == _arg1){
return;
};
_volume = _arg1;
if (!scrubbing){
_local2 = videoPlayers[_visibleVP];
_local2.volume = _volume;
};
dispatchEvent(new SoundEvent(SoundEvent.SOUND_UPDATE, false, false, _local2.soundTransform));
}
public function get skinAutoHide():Boolean{
return (uiMgr.skinAutoHide);
}
public function set source(_arg1:String):void{
var _local2:VideoPlayerState;
var _local3:CuePointManager;
if (isLivePreview){
return;
};
if (_arg1 == null){
_arg1 = "";
};
if (_componentInspectorSetting){
_local2 = videoPlayerStates[_activeVP];
_local2.url = _arg1;
if (_arg1.length > 0){
_local2.isWaiting = true;
addEventListener(Event.ENTER_FRAME, doContentPathConnect);
};
} else {
if (source == _arg1){
return;
};
_local3 = cuePointMgrs[_activeVP];
_local3.reset();
_local2 = videoPlayerStates[_activeVP];
_local2.url = _arg1;
_local2.isWaiting = true;
doContentPathConnect(_activeVP);
};
}
public function set activeVideoPlayerIndex(_arg1:uint):void{
if (_activeVP == _arg1){
return;
};
_activeVP = _arg1;
if (videoPlayers[_activeVP] == undefined){
createVideoPlayer(_activeVP);
};
}
override public function set soundTransform(_arg1:SoundTransform):void{
var _local2:VideoPlayer;
if (_arg1 == null){
return;
};
_volume = _arg1.volume;
_soundTransform.volume = (scrubbing) ? 0 : _arg1.volume;
_soundTransform.leftToLeft = _arg1.leftToLeft;
_soundTransform.leftToRight = _arg1.leftToRight;
_soundTransform.rightToLeft = _arg1.rightToLeft;
_soundTransform.rightToRight = _arg1.rightToRight;
_local2 = videoPlayers[_activeVP];
_local2.soundTransform = _soundTransform;
dispatchEvent(new SoundEvent(SoundEvent.SOUND_UPDATE, false, false, _local2.soundTransform));
}
public function set seekToPrevOffset(_arg1:Number):void{
_seekToPrevOffset = _arg1;
}
public function set seekBarScrubTolerance(_arg1:Number):void{
uiMgr.seekBarScrubTolerance = _arg1;
}
override public function get scaleX():Number{
var _local1:VideoPlayer;
_local1 = videoPlayers[_visibleVP];
return ((_local1.width / _origWidth));
}
override public function get scaleY():Number{
var _local1:VideoPlayer;
_local1 = videoPlayers[_visibleVP];
return ((_local1.height / _origHeight));
}
public function get bytesLoaded():uint{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.bytesLoaded);
}
override public function set height(_arg1:Number):void{
var _local2:Rectangle;
var _local3:Rectangle;
var _local4:int;
var _local5:VideoPlayer;
if (isLivePreview){
setSize(this.width, _arg1);
return;
};
_local2 = new Rectangle(x, y, width, height);
_local3 = new Rectangle(registrationX, registrationY, registrationWidth, registrationHeight);
resizingNow = true;
_local4 = 0;
while (_local4 < videoPlayers.length) {
_local5 = videoPlayers[_local4];
if (_local5 != null){
_local5.height = _arg1;
};
_local4++;
};
resizingNow = false;
dispatchEvent(new LayoutEvent(LayoutEvent.LAYOUT, false, false, _local2, _local3));
}
public function get forwardButton():Sprite{
return (uiMgr.getControl(UIManager.FORWARD_BUTTON));
}
public function get seekBarInterval():Number{
return (uiMgr.seekBarInterval);
}
public function set totalTime(_arg1:Number):void{
var _local2:VideoPlayerState;
_local2 = videoPlayerStates[_activeVP];
_local2.totalTime = _arg1;
_local2.totalTimeSet = true;
}
public function set skinAutoHide(_arg1:Boolean):void{
if (isLivePreview){
return;
};
uiMgr.skinAutoHide = _arg1;
}
public function set bufferTime(_arg1:Number):void{
var _local2:VideoPlayer;
_local2 = videoPlayers[_activeVP];
_local2.bufferTime = _arg1;
}
public function get fullScreenSkinDelay():int{
return (uiMgr.fullScreenSkinDelay);
}
public function seekToNavCuePoint(_arg1):void{
var _local2:Object;
var _local3:Object;
if ((_arg1 is String)){
_local2 = {name:String(_arg1)};
} else {
if ((_arg1 is Number)){
_local2 = {time:Number(_arg1)};
} else {
_local2 = _arg1;
};
};
if (_local2.name == undefined){
seekToNextNavCuePoint(_local2.time);
return;
};
if (isNaN(_local2.time)){
_local2.time = 0;
};
_local3 = findNearestCuePoint(_arg1, CuePointType.NAVIGATION);
while (((!((_local3 == null))) && ((((_local3.time < _local2.time)) || (!(isFLVCuePointEnabled(_local3))))))) {
_local3 = findNextCuePointWithName(_local3);
};
if (_local3 == null){
throw (new VideoError(VideoError.INVALID_SEEK));
};
seek(_local3.time);
}
private function onCompletePreview(_arg1:Event):void{
var e = _arg1;
try {
previewImage_mc.width = livePreviewWidth;
previewImage_mc.height = livePreviewHeight;
} catch(e:Error) {
};
}
public function set isLive(_arg1:Boolean):void{
var _local2:VideoPlayerState;
_local2 = videoPlayerStates[_activeVP];
_local2.isLive = _arg1;
_local2.isLiveSet = true;
}
flvplayback_internal function showSkinNow(_arg1:TimerEvent):void{
skinShowTimer = null;
uiMgr.visible = true;
}
override public function get x():Number{
var _local1:VideoPlayer;
_local1 = videoPlayers[_visibleVP];
return ((super.x + _local1.x));
}
override public function get y():Number{
var _local1:VideoPlayer;
_local1 = videoPlayers[_visibleVP];
return ((super.y + _local1.y));
}
public function get seekBar():Sprite{
return (uiMgr.getControl(UIManager.SEEK_BAR));
}
public function get volumeBarInterval():Number{
return (uiMgr.volumeBarInterval);
}
public function set registrationHeight(_arg1:Number):void{
height = _arg1;
}
public function get bufferingBarHidesAndDisablesOthers():Boolean{
return (uiMgr.bufferingBarHidesAndDisablesOthers);
}
public function seek(_arg1:Number):void{
var _local2:VideoPlayerState;
var _local3:VideoPlayer;
_local2 = videoPlayerStates[_activeVP];
if (!_firstStreamShown){
_local2.preSeekTime = 0;
queueCmd(_local2, QueuedCommand.SEEK, _arg1);
} else {
_local2.preSeekTime = playheadTime;
_local3 = videoPlayers[_activeVP];
_local3.seek(_arg1);
};
}
public function get state():String{
var _local1:VideoPlayer;
var _local2:String;
var _local3:VideoPlayerState;
if (isLivePreview){
return (VideoState.STOPPED);
};
_local1 = videoPlayers[_activeVP];
if ((((_activeVP == _visibleVP)) && (scrubbing))){
return (VideoState.SEEKING);
};
_local2 = _local1.state;
if (_local2 == VideoState.RESIZING){
return (VideoState.LOADING);
};
_local3 = videoPlayerStates[_activeVP];
if ((((((_local3.prevState == VideoState.LOADING)) && (_local3.autoPlay))) && ((_local2 == VideoState.STOPPED)))){
return (VideoState.LOADING);
};
return (_local2);
}
public function set autoRewind(_arg1:Boolean):void{
var _local2:VideoPlayer;
if (_activeVP == 0){
_autoRewind = _arg1;
};
_local2 = videoPlayers[_activeVP];
_local2.autoRewind = _arg1;
}
public function get volumeBar():Sprite{
return (uiMgr.getControl(UIManager.VOLUME_BAR));
}
flvplayback_internal function skinError(_arg1:String):void{
if (isLivePreview){
return;
};
if (((_firstStreamReady) && (!(_firstStreamShown)))){
showFirstStream();
};
dispatchEvent(new SkinErrorEvent(SkinErrorEvent.SKIN_ERROR, false, false, _arg1));
}
override public function set scaleX(_arg1:Number):void{
var _local2:Rectangle;
var _local3:Rectangle;
var _local4:int;
var _local5:VideoPlayer;
_local2 = new Rectangle(x, y, width, height);
_local3 = new Rectangle(registrationX, registrationY, registrationWidth, registrationHeight);
resizingNow = true;
_local4 = 0;
while (_local4 < videoPlayers.length) {
_local5 = videoPlayers[_local4];
if (_local5 !== null){
_local5.width = (_origWidth * _arg1);
};
_local4++;
};
resizingNow = false;
dispatchEvent(new LayoutEvent(LayoutEvent.LAYOUT, false, false, _local2, _local3));
}
override public function set scaleY(_arg1:Number):void{
var _local2:Rectangle;
var _local3:Rectangle;
var _local4:int;
var _local5:VideoPlayer;
_local2 = new Rectangle(x, y, width, height);
_local3 = new Rectangle(registrationX, registrationY, registrationWidth, registrationHeight);
resizingNow = true;
_local4 = 0;
while (_local4 < videoPlayers.length) {
_local5 = videoPlayers[_local4];
if (_local5 !== null){
_local5.height = (_origHeight * _arg1);
};
_local4++;
};
resizingNow = false;
dispatchEvent(new LayoutEvent(LayoutEvent.LAYOUT, false, false, _local2, _local3));
}
flvplayback_internal function createVideoPlayer(_arg1:Number):void{
var vp:VideoPlayer;
var added:Boolean;
var vpState:VideoPlayerState;
var cpMgr:CuePointManager;
var skinDepth:int;
var index = _arg1;
if (isLivePreview){
return;
};
vp = videoPlayers[index];
if (vp == null){
var _local3 = new VideoPlayer(0, 0);
vp = _local3;
videoPlayers[index] = _local3;
vp.setSize(registrationWidth, registrationHeight);
};
vp.visible = false;
vp.volume = 0;
vp.name = String(index);
added = false;
if (uiMgr.skin_mc != null){
try {
skinDepth = getChildIndex(uiMgr.skin_mc);
if (skinDepth > 0){
addChildAt(vp, skinDepth);
added = true;
};
} catch(err:Error) {
};
};
if (!added){
addChild(vp);
};
_topVP = index;
vp.autoRewind = _autoRewind;
vp.scaleMode = _scaleMode;
vp.bufferTime = _bufferTime;
vp.idleTimeout = _idleTimeout;
vp.playheadUpdateInterval = _playheadUpdateInterval;
vp.progressInterval = _progressInterval;
vp.soundTransform = _soundTransform;
vpState = new VideoPlayerState(vp, index);
videoPlayerStates[index] = vpState;
videoPlayerStateDict[vp] = vpState;
vp.addEventListener(AutoLayoutEvent.AUTO_LAYOUT, handleAutoLayoutEvent);
vp.addEventListener(MetadataEvent.CUE_POINT, handleMetadataEvent);
vp.addEventListener(MetadataEvent.METADATA_RECEIVED, handleMetadataEvent);
vp.addEventListener(VideoProgressEvent.PROGRESS, handleVideoProgressEvent);
vp.addEventListener(VideoEvent.AUTO_REWOUND, handleVideoEvent);
vp.addEventListener(VideoEvent.CLOSE, handleVideoEvent);
vp.addEventListener(VideoEvent.COMPLETE, handleVideoEvent);
vp.addEventListener(VideoEvent.PLAYHEAD_UPDATE, handleVideoEvent);
vp.addEventListener(VideoEvent.STATE_CHANGE, handleVideoEvent);
vp.addEventListener(VideoEvent.READY, handleVideoEvent);
cpMgr = new CuePointManager(this, index);
cuePointMgrs[index] = cpMgr;
cpMgr.playheadUpdateInterval = _playheadUpdateInterval;
}
public function findNearestCuePoint(_arg1, _arg2:String="all"):Object{
var _local3:CuePointManager;
_local3 = cuePointMgrs[_activeVP];
switch (_arg2){
case "event":
return (_local3.getCuePoint(_local3.eventCuePoints, true, _arg1));
case "navigation":
return (_local3.getCuePoint(_local3.navCuePoints, true, _arg1));
case "flv":
return (_local3.getCuePoint(_local3.flvCuePoints, true, _arg1));
case "actionscript":
return (_local3.getCuePoint(_local3.asCuePoints, true, _arg1));
case "all":
default:
return (_local3.getCuePoint(_local3.allCuePoints, true, _arg1));
};
}
public function get muteButton():Sprite{
return (uiMgr.getControl(UIManager.MUTE_BUTTON));
}
public function seekPercent(_arg1:Number):void{
var _local2:VideoPlayer;
_local2 = videoPlayers[_activeVP];
if (((((((((isNaN(_arg1)) || ((_arg1 < 0)))) || ((_arg1 > 100)))) || (isNaN(_local2.totalTime)))) || ((_local2.totalTime <= 0)))){
throw (new VideoError(VideoError.INVALID_SEEK));
};
seek(((_local2.totalTime * _arg1) / 100));
}
public function set forwardButton(_arg1:Sprite):void{
uiMgr.setControl(UIManager.FORWARD_BUTTON, _arg1);
}
public function get registrationWidth():Number{
var _local1:VideoPlayer;
_local1 = videoPlayers[_visibleVP];
return (_local1.registrationWidth);
}
flvplayback_internal function queueCmd(_arg1:VideoPlayerState, _arg2:Number, _arg3:Number=NaN):void{
if (_arg1.cmdQueue == null){
_arg1.cmdQueue = new Array();
};
_arg1.cmdQueue.push(new QueuedCommand(_arg2, null, false, _arg3));
}
private function doContentPathConnect(_arg1):void{
var _local2:int;
var _local3:VideoPlayer;
var _local4:VideoPlayerState;
if (isLivePreview){
return;
};
_local2 = 0;
if ((_arg1 is int)){
_local2 = int(_arg1);
} else {
removeEventListener(Event.ENTER_FRAME, doContentPathConnect);
};
_local3 = videoPlayers[_local2];
_local4 = videoPlayerStates[_local2];
if (!_local4.isWaiting){
return;
};
if (((_local4.autoPlay) && (_firstStreamShown))){
_local3.play(_local4.url, _local4.totalTime, _local4.isLive);
} else {
_local3.load(_local4.url, _local4.totalTime, _local4.isLive);
};
_local4.isLiveSet = false;
_local4.totalTimeSet = false;
_local4.isWaiting = false;
}
public function get registrationX():Number{
return (super.x);
}
public function bringVideoPlayerToFront(_arg1:uint):void{
var vp:VideoPlayer;
var moved:Boolean;
var skinDepth:int;
var index = _arg1;
if (index == _topVP){
return;
};
vp = videoPlayers[index];
if (vp == null){
createVideoPlayer(index);
vp = videoPlayers[index];
};
moved = false;
if (uiMgr.skin_mc != null){
try {
skinDepth = getChildIndex(uiMgr.skin_mc);
if (skinDepth > 0){
setChildIndex(vp, (skinDepth - 1));
moved = true;
};
} catch(err:Error) {
};
};
if (!moved){
setChildIndex(vp, (numChildren - 1));
};
_topVP = index;
}
public function get registrationY():Number{
return (super.y);
}
public function get pauseButton():Sprite{
return (uiMgr.getControl(UIManager.PAUSE_BUTTON));
}
public function set seekBarInterval(_arg1:Number):void{
uiMgr.seekBarInterval = _arg1;
}
public function addASCuePoint(_arg1, _arg2:String=null, _arg3:Object=null):Object{
var _local4:CuePointManager;
_local4 = cuePointMgrs[_activeVP];
return (_local4.addASCuePoint(_arg1, _arg2, _arg3));
}
public function get playheadPercentage():Number{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
if (isNaN(_local1.totalTime)){
return (NaN);
};
return (((_local1.playheadTime / _local1.totalTime) * 100));
}
public function setFLVCuePointEnabled(_arg1:Boolean, _arg2):Number{
var _local3:CuePointManager;
_local3 = cuePointMgrs[_activeVP];
return (_local3.setFLVCuePointEnabled(_arg1, _arg2));
}
public function set fullScreenSkinDelay(_arg1:int):void{
uiMgr.fullScreenSkinDelay = _arg1;
}
public function seekToNextNavCuePoint(_arg1:Number=NaN):void{
var _local2:VideoPlayer;
var _local3:Object;
var _local4:Number;
_local2 = videoPlayers[_activeVP];
if (((isNaN(_arg1)) || ((_arg1 < 0)))){
_arg1 = (_local2.playheadTime + 0.001);
};
_local3 = findNearestCuePoint(_arg1, CuePointType.NAVIGATION);
if (_local3 == null){
seek(_local2.totalTime);
return;
};
_local4 = _local3.index;
if (_local3.time < _arg1){
_local4++;
};
while ((((_local4 < _local3.array.length)) && (!(isFLVCuePointEnabled(_local3.array[_local4]))))) {
_local4++;
};
if (_local4 >= _local3.array.length){
_arg1 = _local2.totalTime;
if (_local3.array[(_local3.array.length - 1)].time > _arg1){
_arg1 = _local3.array[(_local3.array.length - 1)];
};
seek(_arg1);
} else {
seek(_local3.array[_local4].time);
};
}
public function load(_arg1:String, _arg2:Number=NaN, _arg3:Boolean=false):void{
if ((((_arg1 == null)) || ((_arg1.length == 0)))){
return;
};
if (_arg1 == this.source){
return;
};
this.autoPlay = false;
this.totalTime = _arg2;
this.isLive = _arg3;
this.source = _arg1;
}
public function seekSeconds(_arg1:Number):void{
seek(_arg1);
}
public function get fullScreenButton():Sprite{
return (uiMgr.getControl(UIManager.FULL_SCREEN_BUTTON));
}
public function get scrubbing():Boolean{
var _local1:Sprite;
var _local2:ControlData;
_local1 = seekBar;
if (_local1 != null){
_local2 = uiMgr.ctrlDataDict[_local1];
return (_local2.isDragging);
};
return (false);
}
override public function set y(_arg1:Number):void{
var _local2:VideoPlayer;
_local2 = videoPlayers[_visibleVP];
super.y = (_arg1 - _local2.y);
}
public function removeASCuePoint(_arg1):Object{
var _local2:CuePointManager;
_local2 = cuePointMgrs[_activeVP];
return (_local2.removeASCuePoint(_arg1));
}
public function get fullScreenTakeOver():Boolean{
return (uiMgr.fullScreenTakeOver);
}
override public function set x(_arg1:Number):void{
var _local2:VideoPlayer;
_local2 = videoPlayers[_visibleVP];
super.x = (_arg1 - _local2.x);
}
public function get backButton():Sprite{
return (uiMgr.getControl(UIManager.BACK_BUTTON));
}
public function set seekBar(_arg1:Sprite):void{
uiMgr.setControl(UIManager.SEEK_BAR, _arg1);
}
public function set skin(_arg1:String):void{
uiMgr.skin = _arg1;
}
public function set componentInspectorSetting(_arg1:Boolean):void{
_componentInspectorSetting = _arg1;
}
public function get preferredHeight():int{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.videoHeight);
}
public function set volumeBarInterval(_arg1:Number):void{
uiMgr.volumeBarInterval = _arg1;
}
public function set autoPlay(_arg1:Boolean):void{
var _local2:VideoPlayerState;
_local2 = videoPlayerStates[_activeVP];
_local2.autoPlay = _arg1;
}
public function set visibleVideoPlayerIndex(_arg1:uint):void{
var _local2:VideoPlayer;
var _local3:VideoPlayer;
var _local4:uint;
var _local5:Rectangle;
var _local6:Rectangle;
if (_visibleVP == _arg1){
return;
};
if (videoPlayers[_arg1] == undefined){
createVideoPlayer(_arg1);
};
_local2 = videoPlayers[_arg1];
_local3 = videoPlayers[_visibleVP];
_local3.visible = false;
_local3.volume = 0;
_visibleVP = _arg1;
if (_firstStreamShown){
uiMgr.setupSkinAutoHide(false);
_local2.visible = true;
_soundTransform.volume = (scrubbing) ? _volume : 0;
_local2.soundTransform = _soundTransform;
} else {
if (((((((_local2.stateResponsive) || ((_local2.state == VideoState.CONNECTION_ERROR)))) || ((_local2.state == VideoState.DISCONNECTED)))) && (uiMgr.skinReady))){
uiMgr.visible = true;
uiMgr.setupSkinAutoHide(false);
_firstStreamReady = true;
if (uiMgr.skin == ""){
uiMgr.hookUpCustomComponents();
};
showFirstStream();
};
};
if (((!((_local2.height == _local3.height))) || (!((_local2.width == _local3.width))))){
_local5 = new Rectangle((_local3.x + super.x), (_local3.y + super.y), _local3.width, _local3.height);
_local6 = new Rectangle((_local3.registrationX + super.x), (_local3.registrationY + super.y), _local3.registrationWidth, _local3.registrationHeight);
dispatchEvent(new LayoutEvent(LayoutEvent.LAYOUT, false, false, _local5, _local6));
};
_local4 = _activeVP;
_activeVP = _visibleVP;
uiMgr.handleIVPEvent(new VideoEvent(VideoEvent.STATE_CHANGE, false, false, state, playheadTime, _visibleVP));
uiMgr.handleIVPEvent(new VideoEvent(VideoEvent.PLAYHEAD_UPDATE, false, false, state, playheadTime, _visibleVP));
if (_local2.isRTMP){
uiMgr.handleIVPEvent(new VideoEvent(VideoEvent.READY, false, false, state, playheadTime, _visibleVP));
} else {
uiMgr.handleIVPEvent(new VideoProgressEvent(VideoProgressEvent.PROGRESS, false, false, bytesLoaded, bytesTotal, _visibleVP));
};
_activeVP = _local4;
}
public function get bufferingBar():Sprite{
return (uiMgr.getControl(UIManager.BUFFERING_BAR));
}
flvplayback_internal function _scrubStart():void{
var _local1:Number;
var _local2:VideoPlayer;
_local1 = playheadTime;
_local2 = videoPlayers[_visibleVP];
_volume = _local2.volume;
_local2.volume = 0;
dispatchEvent(new VideoEvent(VideoEvent.STATE_CHANGE, false, false, VideoState.SEEKING, _local1, _visibleVP));
dispatchEvent(new VideoEvent(VideoEvent.SCRUB_START, false, false, VideoState.SEEKING, _local1, _visibleVP));
}
public function get align():String{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.align);
}
flvplayback_internal function handleAutoLayoutEvent(_arg1:AutoLayoutEvent):void{
var _local2:VideoPlayerState;
var _local3:AutoLayoutEvent;
var _local4:Rectangle;
var _local5:Rectangle;
_local2 = videoPlayerStateDict[_arg1.currentTarget];
_local3 = AutoLayoutEvent(_arg1.clone());
_local3.oldBounds.x = (_local3.oldBounds.x + super.x);
_local3.oldBounds.y = (_local3.oldBounds.y + super.y);
_local3.oldRegistrationBounds.x = (_local3.oldRegistrationBounds.x + super.y);
_local3.oldRegistrationBounds.y = (_local3.oldRegistrationBounds.y + super.y);
_local3.vp = _local2.index;
dispatchEvent(_local3);
if (((!(resizingNow)) && ((_local2.index == _visibleVP)))){
_local4 = Rectangle(_arg1.oldBounds.clone());
_local5 = Rectangle(_arg1.oldRegistrationBounds.clone());
_local4.x = (_local4.x + super.x);
_local4.y = (_local4.y + super.y);
_local5.x = (_local5.x + super.y);
_local5.y = (_local5.y + super.y);
dispatchEvent(new LayoutEvent(LayoutEvent.LAYOUT, false, false, _local4, _local5));
};
}
public function findNextCuePointWithName(_arg1:Object):Object{
var _local2:CuePointManager;
_local2 = cuePointMgrs[_activeVP];
return (_local2.getNextCuePointWithName(_arg1));
}
public function set playButton(_arg1:Sprite):void{
uiMgr.setControl(UIManager.PLAY_BUTTON, _arg1);
}
public function set bitrate(_arg1:Number):void{
ncMgr.bitrate = _arg1;
}
public function set bufferingBarHidesAndDisablesOthers(_arg1:Boolean):void{
uiMgr.bufferingBarHidesAndDisablesOthers = _arg1;
}
override public function get soundTransform():SoundTransform{
var _local1:VideoPlayer;
var _local2:SoundTransform;
_local1 = videoPlayers[_visibleVP];
_local2 = _local1.soundTransform;
if (scrubbing){
_local2.volume = _volume;
};
return (_local2);
}
public function get stateResponsive():Boolean{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.stateResponsive);
}
public function get idleTimeout():Number{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.idleTimeout);
}
override public function get height():Number{
var _local1:VideoPlayer;
if (isLivePreview){
return (livePreviewHeight);
};
_local1 = videoPlayers[_visibleVP];
return (_local1.height);
}
public function set registrationWidth(_arg1:Number):void{
width = _arg1;
}
public function get metadata():Object{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.metadata);
}
public function set skinBackgroundColor(_arg1:uint):void{
uiMgr.skinBackgroundColor = _arg1;
}
public function get volume():Number{
return (_volume);
}
public function play(_arg1:String=null, _arg2:Number=NaN, _arg3:Boolean=false):void{
var _local4:VideoPlayerState;
var _local5:VideoPlayer;
if (_arg1 == null){
if (!_firstStreamShown){
_local4 = videoPlayerStates[_activeVP];
queueCmd(_local4, QueuedCommand.PLAY);
} else {
_local5 = videoPlayers[_activeVP];
_local5.play();
};
} else {
if (_arg1 == this.source){
return;
};
this.autoPlay = true;
this.totalTime = _arg2;
this.isLive = _arg3;
this.source = _arg1;
};
}
public function get paused():Boolean{
return ((state == VideoState.PAUSED));
}
flvplayback_internal function handleVideoEvent(_arg1:VideoEvent):void{
var _local2:VideoPlayerState;
var _local3:CuePointManager;
var _local4:VideoEvent;
var _local5:String;
var _local6:Number;
_local2 = videoPlayerStateDict[_arg1.currentTarget];
_local3 = cuePointMgrs[_local2.index];
_local4 = VideoEvent(_arg1.clone());
_local4.vp = _local2.index;
_local5 = ((((_local2.index == _visibleVP)) && (scrubbing))) ? VideoState.SEEKING : _arg1.state;
switch (_arg1.type){
case VideoEvent.AUTO_REWOUND:
dispatchEvent(_local4);
dispatchEvent(new VideoEvent(VideoEvent.REWIND, false, false, _local5, _arg1.playheadTime, _local2.index));
_local3.resetASCuePointIndex(_arg1.playheadTime);
break;
case VideoEvent.PLAYHEAD_UPDATE:
_local4.state = _local5;
dispatchEvent(_local4);
if (((!(isNaN(_local2.preSeekTime))) && (!((_arg1.state == VideoState.SEEKING))))){
_local6 = _local2.preSeekTime;
_local2.preSeekTime = NaN;
_local3.resetASCuePointIndex(_arg1.playheadTime);
dispatchEvent(new VideoEvent(VideoEvent.SEEKED, false, false, _arg1.state, _arg1.playheadTime, _local2.index));
if (_local6 < _arg1.playheadTime){
dispatchEvent(new VideoEvent(VideoEvent.FAST_FORWARD, false, false, _arg1.state, _arg1.playheadTime, _local2.index));
} else {
if (_local6 > _arg1.playheadTime){
dispatchEvent(new VideoEvent(VideoEvent.REWIND, false, false, _arg1.state, _arg1.playheadTime, _local2.index));
};
};
};
_local3.dispatchASCuePoints();
break;
case VideoEvent.STATE_CHANGE:
if ((((_local2.index == _visibleVP)) && (scrubbing))){
break;
};
if (_arg1.state == VideoState.RESIZING){
break;
};
if ((((((_local2.prevState == VideoState.LOADING)) && (_local2.autoPlay))) && ((_arg1.state == VideoState.STOPPED)))){
return;
};
if ((((((((_arg1.state == VideoState.CONNECTION_ERROR)) && ((_arg1.vp == _visibleVP)))) && (!(_firstStreamShown)))) && (uiMgr.skinReady))){
showFirstStream();
uiMgr.visible = true;
if (uiMgr.skin == ""){
uiMgr.hookUpCustomComponents();
};
if (skinShowTimer != null){
skinShowTimer.reset();
skinShowTimer = null;
};
};
_local2.prevState = _arg1.state;
_local4.state = _local5;
dispatchEvent(_local4);
if (_local2.owner.state != _arg1.state){
return;
};
switch (_arg1.state){
case VideoState.BUFFERING:
dispatchEvent(new VideoEvent(VideoEvent.BUFFERING_STATE_ENTERED, false, false, _local5, _arg1.playheadTime, _local2.index));
break;
case VideoState.PAUSED:
dispatchEvent(new VideoEvent(VideoEvent.PAUSED_STATE_ENTERED, false, false, _local5, _arg1.playheadTime, _local2.index));
break;
case VideoState.PLAYING:
dispatchEvent(new VideoEvent(VideoEvent.PLAYING_STATE_ENTERED, false, false, _local5, _arg1.playheadTime, _local2.index));
break;
case VideoState.STOPPED:
dispatchEvent(new VideoEvent(VideoEvent.STOPPED_STATE_ENTERED, false, false, _local5, _arg1.playheadTime, _local2.index));
break;
};
break;
case VideoEvent.READY:
if (!_firstStreamReady){
if (_local2.index == _visibleVP){
_firstStreamReady = true;
if (((uiMgr.skinReady) && (!(_firstStreamShown)))){
uiMgr.visible = true;
if (uiMgr.skin == ""){
uiMgr.hookUpCustomComponents();
};
showFirstStream();
};
};
} else {
if (((((_firstStreamShown) && ((_arg1.state == VideoState.STOPPED)))) && (_local2.autoPlay))){
if (_local2.owner.isRTMP){
_local2.owner.play();
} else {
_local2.prevState = VideoState.STOPPED;
_local2.owner.playWhenEnoughDownloaded();
};
};
};
_local4.state = _local5;
dispatchEvent(_local4);
break;
case VideoEvent.CLOSE:
case VideoEvent.COMPLETE:
_local4.state = _local5;
dispatchEvent(_local4);
break;
};
}
public function set volumeBar(_arg1:Sprite):void{
uiMgr.setControl(UIManager.VOLUME_BAR, _arg1);
}
public function set fullScreenBackgroundColor(_arg1:uint):void{
uiMgr.fullScreenBackgroundColor = _arg1;
}
public function get isLive():Boolean{
var _local1:VideoPlayerState;
var _local2:VideoPlayer;
_local1 = videoPlayerStates[_activeVP];
if (_local1.isLiveSet){
return (_local1.isLive);
};
_local2 = videoPlayers[_activeVP];
return (_local2.isLive);
}
public function get bufferTime():Number{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.bufferTime);
}
public function get registrationHeight():Number{
var _local1:VideoPlayer;
_local1 = videoPlayers[_visibleVP];
return (_local1.registrationHeight);
}
public function get playPauseButton():Sprite{
return (uiMgr.getControl(UIManager.PLAY_PAUSE_BUTTON));
}
flvplayback_internal function showFirstStream():void{
var _local1:VideoPlayer;
var _local2:int;
var _local3:VideoPlayerState;
var _local4:int;
_firstStreamShown = true;
_local1 = videoPlayers[_visibleVP];
_local1.visible = true;
if (!scrubbing){
_soundTransform.volume = _volume;
_local1.soundTransform = _soundTransform;
};
_local2 = 0;
while (_local2 < videoPlayers.length) {
_local1 = videoPlayers[_local2];
if (_local1 != null){
_local3 = videoPlayerStates[_local2];
if ((((_local1.state == VideoState.STOPPED)) && (_local3.autoPlay))){
if (_local1.isRTMP){
_local1.play();
} else {
_local3.prevState = VideoState.STOPPED;
_local1.playWhenEnoughDownloaded();
};
};
if (_local3.cmdQueue != null){
_local4 = 0;
while (_local4 < _local3.cmdQueue.length) {
switch (_local3.cmdQueue[_local4].type){
case QueuedCommand.PLAY:
_local1.play();
break;
case QueuedCommand.PAUSE:
_local1.pause();
break;
case QueuedCommand.STOP:
_local1.stop();
break;
case QueuedCommand.SEEK:
_local1.seek(_local3.cmdQueue[_local4].time);
break;
case QueuedCommand.PLAY_WHEN_ENOUGH:
_local1.playWhenEnoughDownloaded();
break;
};
_local4++;
};
_local3.cmdQueue = null;
};
};
_local2++;
};
}
public function set volumeBarScrubTolerance(_arg1:Number):void{
uiMgr.volumeBarScrubTolerance = _arg1;
}
public function set skinBackgroundAlpha(_arg1:Number):void{
uiMgr.skinBackgroundAlpha = _arg1;
}
public function get playheadUpdateInterval():Number{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.playheadUpdateInterval);
}
public function set muteButton(_arg1:Sprite):void{
uiMgr.setControl(UIManager.MUTE_BUTTON, _arg1);
}
public function get autoRewind():Boolean{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.autoRewind);
}
flvplayback_internal function handleMetadataEvent(_arg1:MetadataEvent):void{
var _local2:VideoPlayerState;
var _local3:CuePointManager;
var _local4:MetadataEvent;
_local2 = videoPlayerStateDict[_arg1.currentTarget];
_local3 = cuePointMgrs[_local2.index];
switch (_arg1.type){
case MetadataEvent.METADATA_RECEIVED:
_local3.processFLVCuePoints(_arg1.info.cuePoints);
break;
case MetadataEvent.CUE_POINT:
if (!_local3.isFLVCuePointEnabled(_arg1.info)){
return;
};
break;
};
_local4 = MetadataEvent(_arg1.clone());
_local4.vp = _local2.index;
dispatchEvent(_local4);
}
public function playWhenEnoughDownloaded():void{
var _local1:VideoPlayerState;
var _local2:VideoPlayer;
if (!_firstStreamShown){
_local1 = videoPlayerStates[_activeVP];
queueCmd(_local1, QueuedCommand.PLAY_WHEN_ENOUGH);
} else {
_local2 = videoPlayers[_activeVP];
_local2.playWhenEnoughDownloaded();
};
}
public function get bitrate():Number{
return (ncMgr.bitrate);
}
public function get fullScreenBackgroundColor():uint{
return (uiMgr.fullScreenBackgroundColor);
}
public function get skin():String{
return (uiMgr.skin);
}
public function set registrationX(_arg1:Number):void{
super.x = _arg1;
}
public function set registrationY(_arg1:Number):void{
super.y = _arg1;
}
public function setSize(_arg1:Number, _arg2:Number):void{
var _local3:Rectangle;
var _local4:Rectangle;
var _local5:int;
var _local6:VideoPlayer;
_local3 = new Rectangle(x, y, this.width, this.height);
_local4 = new Rectangle(registrationX, registrationY, registrationWidth, registrationHeight);
if (isLivePreview){
livePreviewWidth = _arg1;
livePreviewHeight = _arg2;
if (previewImage_mc != null){
previewImage_mc.width = _arg1;
previewImage_mc.height = _arg2;
};
preview_mc.box_mc.width = _arg1;
preview_mc.box_mc.height = _arg2;
if ((((preview_mc.box_mc.width < preview_mc.icon_mc.width)) || ((preview_mc.box_mc.height < preview_mc.icon_mc.height)))){
preview_mc.icon_mc.visible = false;
} else {
preview_mc.icon_mc.visible = true;
preview_mc.icon_mc.x = ((preview_mc.box_mc.width - preview_mc.icon_mc.width) / 2);
preview_mc.icon_mc.y = ((preview_mc.box_mc.height - preview_mc.icon_mc.height) / 2);
};
dispatchEvent(new LayoutEvent(LayoutEvent.LAYOUT, false, false, _local3, _local4));
return;
};
resizingNow = true;
_local5 = 0;
while (_local5 < videoPlayers.length) {
_local6 = videoPlayers[_local5];
if (_local6 != null){
_local6.setSize(_arg1, _arg2);
};
_local5++;
};
resizingNow = false;
dispatchEvent(new LayoutEvent(LayoutEvent.LAYOUT, false, false, _local3, _local4));
}
public function get isRTMP():Boolean{
var _local1:VideoPlayer;
if (isLivePreview){
return (true);
};
_local1 = videoPlayers[_activeVP];
return (_local1.isRTMP);
}
public function set preview(_arg1:String):void{
var filename = _arg1;
if (!isLivePreview){
return;
};
previewImageUrl = filename;
if (previewImage_mc != null){
removeChild(previewImage_mc);
};
previewImage_mc = new Loader();
previewImage_mc.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompletePreview);
previewImage_mc.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (_arg1:IOErrorEvent):void{
});
previewImage_mc.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, function (_arg1:SecurityErrorEvent):void{
});
addChildAt(previewImage_mc, 1);
previewImage_mc.load(new URLRequest(previewImageUrl));
}
override public function set width(_arg1:Number):void{
var _local2:Rectangle;
var _local3:Rectangle;
var _local4:int;
var _local5:VideoPlayer;
if (isLivePreview){
setSize(_arg1, this.height);
return;
};
_local2 = new Rectangle(x, y, width, height);
_local3 = new Rectangle(registrationX, registrationY, registrationWidth, registrationHeight);
resizingNow = true;
_local4 = 0;
while (_local4 < videoPlayers.length) {
_local5 = videoPlayers[_local4];
if (_local5 != null){
_local5.width = _arg1;
};
_local4++;
};
resizingNow = false;
dispatchEvent(new LayoutEvent(LayoutEvent.LAYOUT, false, false, _local2, _local3));
}
public function get playButton():Sprite{
return (uiMgr.getControl(UIManager.PLAY_BUTTON));
}
public function set pauseButton(_arg1:Sprite):void{
uiMgr.setControl(UIManager.PAUSE_BUTTON, _arg1);
}
public function get bytesTotal():uint{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.bytesTotal);
}
public function seekToPrevNavCuePoint(_arg1:Number=NaN):void{
var _local2:Object;
var _local3:Number;
var _local4:VideoPlayer;
if (((isNaN(_arg1)) || ((_arg1 < 0)))){
_local4 = videoPlayers[_activeVP];
_arg1 = _local4.playheadTime;
};
_local2 = findNearestCuePoint(_arg1, CuePointType.NAVIGATION);
if (_local2 == null){
seek(0);
return;
};
_local3 = _local2.index;
while ((((_local3 >= 0)) && (((!(isFLVCuePointEnabled(_local2.array[_local3]))) || ((_local2.array[_local3].time >= (_arg1 - _seekToPrevOffset))))))) {
_local3--;
};
if (_local3 < 0){
seek(0);
} else {
seek(_local2.array[_local3].time);
};
}
public function get autoPlay():Boolean{
var _local1:VideoPlayerState;
_local1 = videoPlayerStates[_activeVP];
return (_local1.autoPlay);
}
public function set playheadPercentage(_arg1:Number):void{
seekPercent(_arg1);
}
public function isFLVCuePointEnabled(_arg1):Boolean{
var _local2:CuePointManager;
_local2 = cuePointMgrs[_activeVP];
return (_local2.isFLVCuePointEnabled(_arg1));
}
public function get buffering():Boolean{
return ((state == VideoState.BUFFERING));
}
public function get volumeBarScrubTolerance():Number{
return (uiMgr.volumeBarScrubTolerance);
}
public function get skinBackgroundColor():uint{
return (uiMgr.skinBackgroundColor);
}
public function get visibleVideoPlayerIndex():uint{
return (_visibleVP);
}
public function set stopButton(_arg1:Sprite):void{
uiMgr.setControl(UIManager.STOP_BUTTON, _arg1);
}
public function get skinBackgroundAlpha():Number{
return (uiMgr.skinBackgroundAlpha);
}
public function get preferredWidth():int{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.videoWidth);
}
override public function get width():Number{
var _local1:VideoPlayer;
if (isLivePreview){
return (livePreviewWidth);
};
_local1 = videoPlayers[_visibleVP];
return (_local1.width);
}
public function get stopped():Boolean{
return ((state == VideoState.STOPPED));
}
public function set fullScreenButton(_arg1:Sprite):void{
uiMgr.setControl(UIManager.FULL_SCREEN_BUTTON, _arg1);
}
public function get stopButton():Sprite{
return (uiMgr.getControl(UIManager.STOP_BUTTON));
}
public function set playheadUpdateInterval(_arg1:Number):void{
var _local2:CuePointManager;
var _local3:VideoPlayer;
if (_activeVP == 0){
_playheadUpdateInterval = _arg1;
};
_local2 = cuePointMgrs[_activeVP];
_local2.playheadUpdateInterval = _arg1;
_local3 = videoPlayers[_activeVP];
_local3.playheadUpdateInterval = _arg1;
}
private function createLivePreviewMovieClip():void{
preview_mc = new MovieClip();
preview_mc.name = "preview_mc";
preview_mc.box_mc = new MovieClip();
preview_mc.box_mc.name = "box_mc";
preview_mc.box_mc.graphics.beginFill(0);
preview_mc.box_mc.graphics.moveTo(0, 0);
preview_mc.box_mc.graphics.lineTo(0, 100);
preview_mc.box_mc.graphics.lineTo(100, 100);
preview_mc.box_mc.graphics.lineTo(100, 0);
preview_mc.box_mc.graphics.lineTo(0, 0);
preview_mc.box_mc.graphics.endFill();
preview_mc.addChild(preview_mc.box_mc);
preview_mc.icon_mc = new Icon();
preview_mc.icon_mc.name = "icon_mc";
preview_mc.addChild(preview_mc.icon_mc);
addChild(preview_mc);
}
public function set idleTimeout(_arg1:Number):void{
var _local2:VideoPlayer;
if (_activeVP == 0){
_idleTimeout = _arg1;
};
_local2 = videoPlayers[_activeVP];
_local2.idleTimeout = _arg1;
}
flvplayback_internal function skinLoaded():void{
var _local1:VideoPlayer;
if (isLivePreview){
return;
};
_local1 = videoPlayers[_visibleVP];
if (((((_firstStreamReady) || ((_local1.state == VideoState.CONNECTION_ERROR)))) || ((_local1.state == VideoState.DISCONNECTED)))){
uiMgr.visible = true;
if (!_firstStreamShown){
showFirstStream();
};
} else {
if (skinShowTimer != null){
skinShowTimer.reset();
skinShowTimer = null;
};
skinShowTimer = new Timer(DEFAULT_SKIN_SHOW_TIMER_INTERVAL, 1);
skinShowTimer.addEventListener(TimerEvent.TIMER, showSkinNow);
skinShowTimer.start();
};
dispatchEvent(new VideoEvent(VideoEvent.SKIN_LOADED, false, false, state, playheadTime, _visibleVP));
}
flvplayback_internal function _scrubFinish():void{
var _local1:Number;
var _local2:String;
var _local3:VideoPlayer;
_local1 = playheadTime;
_local2 = state;
_local3 = videoPlayers[_visibleVP];
_soundTransform.volume = _volume;
_local3.soundTransform = _soundTransform;
if (_local2 != VideoState.SEEKING){
dispatchEvent(new VideoEvent(VideoEvent.STATE_CHANGE, false, false, _local2, _local1, _visibleVP));
};
dispatchEvent(new VideoEvent(VideoEvent.SCRUB_FINISH, false, false, _local2, _local1, _visibleVP));
}
public function set playPauseButton(_arg1:Sprite):void{
uiMgr.setControl(UIManager.PLAY_PAUSE_BUTTON, _arg1);
}
public function set backButton(_arg1:Sprite):void{
uiMgr.setControl(UIManager.BACK_BUTTON, _arg1);
}
public function set cuePoints(_arg1:Array):void{
if (!_componentInspectorSetting){
return;
};
cuePointMgrs[0].processCuePointsProperty(_arg1);
}
public function findCuePoint(_arg1, _arg2:String="all"):Object{
var _local3:CuePointManager;
_local3 = cuePointMgrs[_activeVP];
switch (_arg2){
case "event":
return (_local3.getCuePoint(_local3.eventCuePoints, false, _arg1));
case "navigation":
return (_local3.getCuePoint(_local3.navCuePoints, false, _arg1));
case "flv":
return (_local3.getCuePoint(_local3.flvCuePoints, false, _arg1));
case "actionscript":
return (_local3.getCuePoint(_local3.asCuePoints, false, _arg1));
case "all":
default:
return (_local3.getCuePoint(_local3.allCuePoints, false, _arg1));
};
}
public function get seekBarScrubTolerance():Number{
return (uiMgr.seekBarScrubTolerance);
}
flvplayback_internal function handleVideoProgressEvent(_arg1:VideoProgressEvent):void{
var _local2:VideoPlayerState;
var _local3:VideoProgressEvent;
_local2 = videoPlayerStateDict[_arg1.currentTarget];
_local3 = VideoProgressEvent(_arg1.clone());
_local3.vp = _local2.index;
dispatchEvent(_local3);
}
}
}//package fl.video
Section 88
//flvplayback_internal (fl.video.flvplayback_internal)
package fl.video {
public namespace flvplayback_internal = "http://www.adobe.com/2007/flash/flvplayback/internal";
}//package fl.video
Section 89
//FPADManager (fl.video.FPADManager)
package fl.video {
import flash.events.*;
import flash.net.*;
public class FPADManager {
flvplayback_internal var _parseResults:ParseResults;
flvplayback_internal var rtmpURL:String;
flvplayback_internal var _url:String;
flvplayback_internal var xmlLoader:URLLoader;
flvplayback_internal var xml:XML;
flvplayback_internal var _uriParam:String;
private var _owner:INCManager;
public static const VERSION:String = "2.0.0.37";
public static const SHORT_VERSION:String = "2.0";
public function FPADManager(_arg1:INCManager){
_owner = _arg1;
}
flvplayback_internal function connectXML(_arg1:String, _arg2:String, _arg3:String, _arg4:ParseResults):Boolean{
_uriParam = _arg2;
_parseResults = _arg4;
_url = ((_arg1 + "uri=") + _parseResults.protocol);
if (_parseResults.serverName != null){
_url = (_url + ("/" + _parseResults.serverName));
};
if (_parseResults.portNumber != null){
_url = (_url + (":" + _parseResults.portNumber));
};
if (_parseResults.wrappedURL != null){
_url = (_url + ("/?" + _parseResults.wrappedURL));
};
_url = (_url + ("/" + _parseResults.appName));
_url = (_url + _arg3);
xml = new XML();
xmlLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, xmlLoadEventHandler);
xmlLoader.addEventListener(IOErrorEvent.IO_ERROR, xmlLoadEventHandler);
xmlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, xmlLoadEventHandler);
xmlLoader.load(new URLRequest(_url));
return (false);
}
flvplayback_internal function xmlLoadEventHandler(_arg1:Event):void{
var proxy:String;
var e = _arg1;
try {
if (e.type != Event.COMPLETE){
_owner.helperDone(this, false);
} else {
xml = new XML(xmlLoader.data);
if ((((xml == null)) || ((xml.localName() == null)))){
throw (new VideoError(VideoError.INVALID_XML, (("URL: \"" + _url) + "\" No root node found; if url is for an flv it must have .flv extension and take no parameters")));
} else {
if (xml.localName() != "fpad"){
throw (new VideoError(VideoError.INVALID_XML, (("URL: \"" + _url) + "\" Root node not fpad")));
};
};
proxy = null;
if ((((((xml.proxy.length() > 0)) && (xml.proxy.hasSimpleContent()))) && ((xml.proxy.*[0].nodeKind() == "text")))){
proxy = xml.proxy.*[0].toString();
};
if (proxy == null){
throw (new VideoError(VideoError.INVALID_XML, (("URL: \"" + _url) + "\" fpad xml requires proxy tag.")));
};
rtmpURL = ((((_parseResults.protocol + "/") + proxy) + "/?") + _uriParam);
_owner.helperDone(this, true);
};
} catch(err:Error) {
_owner.helperDone(this, false);
throw (err);
};
}
}
}//package fl.video
Section 90
//Icon (fl.video.Icon)
package fl.video {
import flash.display.*;
public dynamic class Icon extends MovieClip {
}
}//package fl.video
Section 91
//INCManager (fl.video.INCManager)
package fl.video {
import flash.net.*;
public interface INCManager {
function set timeout(_arg1:uint):void;
function get streamLength():Number;
function get timeout():uint;
function connectToURL(_arg1:String):Boolean;
function get streamName():String;
function get bitrate():Number;
function get streamHeight():int;
function helperDone(_arg1:Object, _arg2:Boolean):void;
function getProperty(_arg1:String);
function get streamWidth():int;
function connectAgain():Boolean;
function reconnect():void;
function set videoPlayer(_arg1:VideoPlayer):void;
function setProperty(_arg1:String, _arg2):void;
function set bitrate(_arg1:Number):void;
function get netConnection():NetConnection;
function get videoPlayer():VideoPlayer;
function get isRTMP():Boolean;
function close():void;
}
}//package fl.video
Section 92
//IVPEvent (fl.video.IVPEvent)
package fl.video {
public interface IVPEvent {
function set vp(_arg1:uint):void;
function get vp():uint;
function get type():String;
}
}//package fl.video
Section 93
//LayoutEvent (fl.video.LayoutEvent)
package fl.video {
import flash.events.*;
import flash.geom.*;
public class LayoutEvent extends Event {
private var _oldBounds:Rectangle;
private var _oldRegistrationBounds:Rectangle;
public static const LAYOUT:String = "layout";
public function LayoutEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:Rectangle=null, _arg5:Rectangle=null){
super(_arg1, _arg2, _arg3);
_oldBounds = _arg4;
_oldRegistrationBounds = _arg5;
}
public function get oldRegistrationBounds():Rectangle{
return (_oldRegistrationBounds);
}
override public function clone():Event{
return (new LayoutEvent(type, bubbles, cancelable, Rectangle(oldBounds.clone()), Rectangle(oldRegistrationBounds.clone())));
}
public function set oldRegistrationBounds(_arg1:Rectangle):void{
_oldRegistrationBounds = _arg1;
}
public function set oldBounds(_arg1:Rectangle):void{
_oldBounds = _arg1;
}
public function get oldBounds():Rectangle{
return (_oldBounds);
}
}
}//package fl.video
Section 94
//MetadataEvent (fl.video.MetadataEvent)
package fl.video {
import flash.events.*;
public class MetadataEvent extends Event implements IVPEvent {
private var _info:Object;
private var _vp:uint;
public static const METADATA_RECEIVED:String = "metadataReceived";
public static const CUE_POINT:String = "cuePoint";
public function MetadataEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:Object=null, _arg5:uint=0){
super(_arg1, _arg2, _arg3);
_info = _arg4;
_vp = _arg5;
}
public function get vp():uint{
return (_vp);
}
public function set info(_arg1:Object):void{
_info = _arg1;
}
override public function clone():Event{
return (new MetadataEvent(type, bubbles, cancelable, info, vp));
}
public function get info():Object{
return (_info);
}
public function set vp(_arg1:uint):void{
_vp = _arg1;
}
}
}//package fl.video
Section 95
//NCManager (fl.video.NCManager)
package fl.video {
import flash.events.*;
import flash.net.*;
import flash.utils.*;
public class NCManager implements INCManager {
public const DEFAULT_TIMEOUT:uint = 60000;
flvplayback_internal var _serverName:String;
flvplayback_internal var _tryNCTimer:Timer;
flvplayback_internal var _autoSenseBW:Boolean;
flvplayback_internal var _fpadZone:Number;
flvplayback_internal var _appName:String;
flvplayback_internal var _ncConnected:Boolean;
flvplayback_internal var _fpadMgr:FPADManager;
flvplayback_internal var _bitrate:Number;
flvplayback_internal var _timeoutTimer:Timer;
flvplayback_internal var _wrappedURL:String;
flvplayback_internal var _payload:Number;
flvplayback_internal var _proxyType:String;
flvplayback_internal var _nc:NetConnection;
flvplayback_internal var _streamLength:Number;
flvplayback_internal var _connTypeCounter:uint;
flvplayback_internal var _streamWidth:int;
flvplayback_internal var _ncUri:String;
flvplayback_internal var _contentPath:String;
flvplayback_internal var _smilMgr:SMILManager;
flvplayback_internal var _streamHeight:int;
flvplayback_internal var _isRTMP:Boolean;
flvplayback_internal var _tryNC:Array;
flvplayback_internal var _owner:VideoPlayer;
flvplayback_internal var _streams:Array;
flvplayback_internal var _portNumber:String;
flvplayback_internal var _streamName:String;
flvplayback_internal var _objectEncoding:uint;
public var fallbackServerName:String;
flvplayback_internal var _protocol:String;
public static const SHORT_VERSION:String = "2.0";
flvplayback_internal static const RTMP_CONN:Array = [{protocol:"rtmp:/", port:"1935"}, {protocol:"rtmp:/", port:"443"}, {protocol:"rtmpt:/", port:"80"}, {protocol:"rtmps:/", port:"443"}];
public static const VERSION:String = "2.0.0.37";
public function NCManager(){
_fpadZone = NaN;
_objectEncoding = ObjectEncoding.AMF0;
_proxyType = "best";
_timeoutTimer = new Timer(DEFAULT_TIMEOUT);
_timeoutTimer.addEventListener(TimerEvent.TIMER, this._onFMSConnectTimeOut);
_tryNCTimer = new Timer(1500);
_tryNCTimer.addEventListener(TimerEvent.TIMER, this.nextConnect);
initNCInfo();
initOtherInfo();
_nc = null;
_ncConnected = false;
}
flvplayback_internal function initNCInfo():void{
_isRTMP = false;
_serverName = null;
_wrappedURL = null;
_portNumber = null;
_appName = null;
}
flvplayback_internal function cleanConns():void{
var _local1:uint;
_tryNCTimer.stop();
if (_tryNC != null){
_local1 = 0;
while (_local1 < _tryNC.length) {
if (((!((_tryNC[_local1] == null))) && (!((_tryNC[_local1] == undefined))))){
_tryNC[_local1].removeEventListener(NetStatusEvent.NET_STATUS, connectOnStatus);
if (_tryNC[_local1].client.pending){
_tryNC[_local1].addEventListener(NetStatusEvent.NET_STATUS, disconnectOnStatus);
} else {
_tryNC[_local1].close();
};
};
_tryNC[_local1] = null;
_local1++;
};
_tryNC = null;
};
}
public function get streamWidth():int{
return (_streamWidth);
}
public function connectToURL(_arg1:String):Boolean{
var parseResults:ParseResults;
var canReuse:Boolean;
var url = _arg1;
initOtherInfo();
_contentPath = url;
if ((((_contentPath == null)) || ((_contentPath == "")))){
throw (new VideoError(VideoError.INVALID_SOURCE));
};
parseResults = parseURL(_contentPath);
if ((((parseResults.streamName == null)) || ((parseResults.streamName == "")))){
throw (new VideoError(VideoError.INVALID_SOURCE, url));
};
if (parseResults.isRTMP){
canReuse = canReuseOldConnection(parseResults);
_isRTMP = true;
_protocol = parseResults.protocol;
_streamName = parseResults.streamName;
_serverName = parseResults.serverName;
_wrappedURL = parseResults.wrappedURL;
_portNumber = parseResults.portNumber;
_appName = parseResults.appName;
if ((((((((_appName == null)) || ((_appName == "")))) || ((_streamName == null)))) || ((_streamName == "")))){
throw (new VideoError(VideoError.INVALID_SOURCE, url));
};
_autoSenseBW = (_streamName.indexOf(",") >= 0);
return (((canReuse) || (connectRTMP())));
} else {
if ((((parseResults.streamName.indexOf("?") < 0)) && ((parseResults.streamName.slice(-4).toLowerCase() == ".flv")))){
canReuse = canReuseOldConnection(parseResults);
_isRTMP = false;
_streamName = parseResults.streamName;
return (((canReuse) || (connectHTTP())));
};
if (parseResults.streamName.indexOf("/fms/fpad") >= 0){
try {
return (connectFPAD(parseResults.streamName));
} catch(err:Error) {
};
};
};
new this.SMILManager(!NULL!)._smilMgr = !NULL!;
return (_smilMgr.connectXML(parseResults.streamName));
}
public function get streamName():String{
return (_streamName);
}
flvplayback_internal function reconnectOnStatus(_arg1:NetStatusEvent):void{
if ((((_arg1.info.code == "NetConnection.Connect.Failed")) || ((_arg1.info.code == "NetConnection.Connect.Rejected")))){
_nc = null;
_ncConnected = false;
_owner.ncReconnected();
};
}
public function get videoPlayer():VideoPlayer{
return (_owner);
}
flvplayback_internal function getStreamLengthResult(_arg1:Number):void{
trace((("calling getStreamLengthResult(" + _arg1) + ")"));
if (_arg1 > 0){
_streamLength = _arg1;
};
_owner.ncConnected();
}
flvplayback_internal function canReuseOldConnection(_arg1:ParseResults):Boolean{
if ((((_nc == null)) || (!(_ncConnected)))){
return (false);
};
if (!_arg1.isRTMP){
if (!_isRTMP){
return (true);
};
_owner.close();
_nc = null;
_ncConnected = false;
initNCInfo();
return (false);
};
if (_isRTMP){
if ((((((((((_arg1.serverName == _serverName)) && ((_arg1.appName == _appName)))) && ((_arg1.protocol == _protocol)))) && ((_arg1.portNumber == _portNumber)))) && ((_arg1.wrappedURL == _wrappedURL)))){
return (true);
};
_owner.close();
_nc = null;
_ncConnected = false;
};
initNCInfo();
return (false);
}
public function getProperty(_arg1:String){
switch (_arg1){
case "fallbackServerName":
return (fallbackServerName);
case "fpadZone":
return (_fpadZone);
case "objectEncoding":
return (_objectEncoding);
case "proxyType":
return (_proxyType);
default:
throw (new VideoError(VideoError.UNSUPPORTED_PROPERTY, _arg1));
};
}
flvplayback_internal function connectRTMP():Boolean{
var _local1:uint;
_timeoutTimer.stop();
_timeoutTimer.start();
_tryNC = new Array();
_local1 = 0;
while (_local1 < RTMP_CONN.length) {
_tryNC[_local1] = new NetConnection();
_tryNC[_local1].objectEncoding = _objectEncoding;
_tryNC[_local1].proxyType = _proxyType;
if (!isNaN(_fpadZone)){
_tryNC[_local1].fpadZone = _fpadZone;
};
_tryNC[_local1].client = new ConnectClient(this, _tryNC[_local1], _local1);
_tryNC[_local1].addEventListener(NetStatusEvent.NET_STATUS, connectOnStatus);
_local1++;
};
nextConnect();
return (false);
}
public function reconnect():void{
if (!_isRTMP){
throw (new Error("Cannot call reconnect on an http connection"));
};
_nc.client = new ReconnectClient(this);
_nc.addEventListener(NetStatusEvent.NET_STATUS, reconnectOnStatus);
_nc.connect(_ncUri, false);
}
public function helperDone(_arg1:Object, _arg2:Boolean):void{
var _local3:ParseResults;
var _local4:String;
var _local5:Boolean;
var _local6:uint;
var _local7:Number;
if (!_arg2){
_nc = null;
_ncConnected = false;
_owner.ncConnected();
_smilMgr = null;
_fpadMgr = null;
return;
};
_local5 = false;
if (_arg1 == _fpadMgr){
_local4 = _fpadMgr.rtmpURL;
_fpadMgr = null;
_local3 = parseURL(_local4);
_isRTMP = _local3.isRTMP;
_protocol = _local3.protocol;
_serverName = _local3.serverName;
_portNumber = _local3.portNumber;
_wrappedURL = _local3.wrappedURL;
_appName = _local3.appName;
_streamName = _local3.streamName;
_local7 = _fpadZone;
_fpadZone = NaN;
connectRTMP();
_fpadZone = _local7;
return;
};
if (_arg1 != _smilMgr){
return;
};
_streamWidth = _smilMgr.width;
_streamHeight = _smilMgr.height;
_local4 = _smilMgr.baseURLAttr[0];
if (((!((_local4 == null))) && (!((_local4 == ""))))){
if (_local4.charAt((_local4.length - 1)) != "/"){
_local4 = (_local4 + "/");
};
_local3 = parseURL(_local4);
_isRTMP = _local3.isRTMP;
_local5 = true;
_streamName = _local3.streamName;
if (_isRTMP){
_protocol = _local3.protocol;
_serverName = _local3.serverName;
_portNumber = _local3.portNumber;
_wrappedURL = _local3.wrappedURL;
_appName = _local3.appName;
if ((((_appName == null)) || ((_appName == "")))){
_smilMgr = null;
throw (new VideoError(VideoError.INVALID_XML, ("Base RTMP URL must include application name: " + _local4)));
};
if (_smilMgr.baseURLAttr.length > 1){
_local3 = parseURL(_smilMgr.baseURLAttr[1]);
if (_local3.serverName != null){
fallbackServerName = _local3.serverName;
};
};
};
};
_streams = _smilMgr.videoTags;
_smilMgr = null;
_local6 = 0;
while (_local6 < _streams.length) {
_local4 = _streams[_local6].src;
_local3 = parseURL(_local4);
if (!_local5){
_isRTMP = _local3.isRTMP;
_local5 = true;
if (_isRTMP){
_protocol = _local3.protocol;
if (_streams.length > 1){
throw (new VideoError(VideoError.INVALID_XML, "Cannot switch between multiple absolute RTMP URLs, must use meta tag base attribute."));
};
_serverName = _local3.serverName;
_portNumber = _local3.portNumber;
_wrappedURL = _local3.wrappedURL;
_appName = _local3.appName;
if ((((_appName == null)) || ((_appName == "")))){
throw (new VideoError(VideoError.INVALID_XML, ("Base RTMP URL must include application name: " + _local4)));
};
} else {
if ((((_local3.streamName.indexOf("/fms/fpad") >= 0)) && ((_streams.length > 1)))){
throw (new VideoError(VideoError.INVALID_XML, "Cannot switch between multiple absolute fpad URLs, must use meta tag base attribute."));
};
};
} else {
if (((((((!((_streamName == null))) && (!((_streamName == ""))))) && (!(_local3.isRelative)))) && ((_streams.length > 1)))){
throw (new VideoError(VideoError.INVALID_XML, "When using meta tag base attribute, cannot use absolute URLs for video or ref tag src attributes."));
};
};
_streams[_local6].parseResults = _local3;
_local6++;
};
_autoSenseBW = (_streams.length > 1);
if (!_autoSenseBW){
if (_streamName != null){
_streamName = (_streamName + _streams[0].parseResults.streamName);
} else {
_streamName = _streams[0].parseResults.streamName;
};
if (((_isRTMP) && ((_streamName.substr(-4).toLowerCase() == ".flv")))){
_streamName = _streamName.substr(0, (_streamName.length - 4));
};
_streamLength = _streams[0].dur;
};
if (_isRTMP){
connectRTMP();
} else {
if (((!((_streamName == null))) && ((_streamName.indexOf("/fms/fpad") >= 0)))){
connectFPAD(_streamName);
} else {
if (_autoSenseBW){
bitrateMatch();
};
connectHTTP();
_owner.ncConnected();
};
};
}
public function get netConnection():NetConnection{
return (_nc);
}
public function get bitrate():Number{
return (_bitrate);
}
public function setProperty(_arg1:String, _arg2):void{
switch (_arg1){
case "fallbackServerName":
fallbackServerName = String(_arg2);
break;
case "fpadZone":
_fpadZone = Number(_arg2);
break;
case "objectEncoding":
_objectEncoding = uint(_arg2);
break;
case "proxyType":
_proxyType = String(_arg2);
break;
default:
throw (new VideoError(VideoError.UNSUPPORTED_PROPERTY, _arg1));
};
}
public function get timeout():uint{
return (_timeoutTimer.delay);
}
public function set videoPlayer(_arg1:VideoPlayer):void{
_owner = _arg1;
}
flvplayback_internal function bitrateMatch():void{
var _local1:Number;
var _local2:uint;
var _local3:uint;
_local1 = _bitrate;
if (isNaN(_local1)){
_local1 = 0;
};
_local2 = _streams.length;
_local3 = 0;
while (_local3 < _streams.length) {
if (((isNaN(_streams[_local3].bitrate)) || ((_local1 >= _streams[_local3].bitrate)))){
_local2 = _local3;
break;
};
_local3++;
};
if (_local2 == _streams.length){
throw (new VideoError(VideoError.NO_BITRATE_MATCH));
};
if (_streamName != null){
_streamName = (_streamName + _streams[_local2].src);
} else {
_streamName = _streams[_local2].src;
};
if (((_isRTMP) && ((_streamName.substr(-4).toLowerCase() == ".flv")))){
_streamName = _streamName.substr(0, (_streamName.length - 4));
};
_streamLength = _streams[_local2].dur;
}
flvplayback_internal function disconnectOnStatus(_arg1:NetStatusEvent):void{
if (_arg1.info.code == "NetConnection.Connect.Success"){
_arg1.target.removeEventListener(NetStatusEvent.NET_STATUS, disconnectOnStatus);
_arg1.target.close();
};
}
flvplayback_internal function nextConnect(_arg1:TimerEvent=null):void{
var _local2:String;
var _local3:String;
var _local4:String;
var _local5:uint;
_tryNCTimer.stop();
if (_connTypeCounter == 0){
_local2 = _protocol;
if (_portNumber != null){
_local3 = _portNumber;
} else {
_local5 = 0;
while (_local5 < RTMP_CONN.length) {
if (_local2 == RTMP_CONN[_local5].protocol){
_local3 = RTMP_CONN[_local5].port;
break;
};
_local5++;
};
};
} else {
_local2 = RTMP_CONN[_connTypeCounter].protocol;
_local3 = RTMP_CONN[_connTypeCounter].port;
};
_local4 = (((_local2 + ((_serverName)==null) ? "" : (((("/" + _serverName) + ":") + _local3) + "/")) + ((_wrappedURL)==null) ? "" : (_wrappedURL + "/")) + _appName);
_tryNC[_connTypeCounter].client.pending = true;
_tryNC[_connTypeCounter].connect(_local4, _autoSenseBW);
if (_connTypeCounter < (RTMP_CONN.length - 1)){
_connTypeCounter++;
_tryNCTimer.start();
};
}
flvplayback_internal function connectFPAD(_arg1:String):Boolean{
var _local2:Object;
var _local3:String;
var _local4:String;
var _local5:String;
var _local6:ParseResults;
_local2 = /^(.+)(\?|\&)(uri=)([^&]+)(\&.*)?$/.exec(_arg1);
if (_local2 == null){
throw (new VideoError(VideoError.INVALID_SOURCE, ("fpad url must include uri parameter: " + _arg1)));
};
_local3 = (_local2[1] + _local2[2]);
_local4 = _local2[4];
_local5 = ((_local2[5])==undefined) ? "" : _local2[5];
_local6 = parseURL(_local4);
if (!_local6.isRTMP){
throw (new VideoError(VideoError.INVALID_SOURCE, ("fpad url uri parameter must be rtmp url: " + _arg1)));
};
_fpadMgr = new FPADManager(this);
return (_fpadMgr.connectXML(_local3, _local4, _local5, _local6));
}
flvplayback_internal function connectHTTP():Boolean{
_nc = new NetConnection();
_nc.connect(null);
_ncConnected = true;
return (true);
}
public function get isRTMP():Boolean{
return (_isRTMP);
}
public function get streamLength():Number{
return (_streamLength);
}
public function connectAgain():Boolean{
var _local1:int;
var _local2:String;
_local1 = _appName.indexOf("/");
if (_local1 < 0){
_local1 = _streamName.indexOf("/");
if (_local1 >= 0){
_appName = (_appName + "/");
_appName = (_appName + _streamName.slice(0, _local1));
_streamName = _streamName.slice((_local1 + 1));
};
return (false);
};
_local2 = _appName.slice((_local1 + 1));
_local2 = (_local2 + "/");
_local2 = (_local2 + _streamName);
_streamName = _local2;
_appName = _appName.slice(0, _local1);
close();
_payload = 0;
_connTypeCounter = 0;
cleanConns();
connectRTMP();
return (true);
}
flvplayback_internal function parseURL(_arg1:String):ParseResults{
var _local2:ParseResults;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:String;
var _local8:ParseResults;
_local2 = new ParseResults();
_local3 = 0;
_local4 = _arg1.indexOf(":/", _local3);
if (_local4 >= 0){
_local4 = (_local4 + 2);
_local2.protocol = _arg1.slice(_local3, _local4).toLowerCase();
_local2.isRelative = false;
} else {
_local2.isRelative = true;
};
if (((!((_local2.protocol == null))) && ((((((_local2.protocol == "rtmp:/")) || ((_local2.protocol == "rtmpt:/")))) || ((_local2.protocol == "rtmps:/")))))){
_local2.isRTMP = true;
_local3 = _local4;
if (_arg1.charAt(_local3) == "/"){
_local3++;
_local5 = _arg1.indexOf(":", _local3);
_local6 = _arg1.indexOf("/", _local3);
if (_local6 < 0){
if (_local5 < 0){
_local2.serverName = _arg1.slice(_local3);
} else {
_local4 = _local5;
_local2.portNumber = _arg1.slice(_local3, _local4);
_local3 = (_local4 + 1);
_local2.serverName = _arg1.slice(_local3);
};
return (_local2);
};
if ((((_local5 >= 0)) && ((_local5 < _local6)))){
_local4 = _local5;
_local2.serverName = _arg1.slice(_local3, _local4);
_local3 = (_local4 + 1);
_local4 = _local6;
_local2.portNumber = _arg1.slice(_local3, _local4);
} else {
_local4 = _local6;
_local2.serverName = _arg1.slice(_local3, _local4);
};
_local3 = (_local4 + 1);
};
if (_arg1.charAt(_local3) == "?"){
_local7 = _arg1.slice((_local3 + 1));
_local8 = parseURL(_local7);
if ((((_local8.protocol == null)) || (!(_local8.isRTMP)))){
throw (new VideoError(VideoError.INVALID_SOURCE, _arg1));
};
_local2.wrappedURL = "?";
_local2.wrappedURL = (_local2.wrappedURL + _local8.protocol);
if (_local8.serverName != null){
_local2.wrappedURL = (_local2.wrappedURL + "/");
_local2.wrappedURL = (_local2.wrappedURL + _local8.serverName);
};
if (_local8.portNumber != null){
_local2.wrappedURL = (_local2.wrappedURL + (":" + _local8.portNumber));
};
if (_local8.wrappedURL != null){
_local2.wrappedURL = (_local2.wrappedURL + "/");
_local2.wrappedURL = (_local2.wrappedURL + _local8.wrappedURL);
};
_local2.appName = _local8.appName;
_local2.streamName = _local8.streamName;
return (_local2);
};
_local4 = _arg1.indexOf("/", _local3);
if (_local4 < 0){
_local2.appName = _arg1.slice(_local3);
return (_local2);
};
_local2.appName = _arg1.slice(_local3, _local4);
_local3 = (_local4 + 1);
_local4 = _arg1.indexOf("/", _local3);
if (_local4 < 0){
_local2.streamName = _arg1.slice(_local3);
if (_local2.streamName.slice(-4).toLowerCase() == ".flv"){
_local2.streamName = _local2.streamName.slice(0, -4);
};
return (_local2);
};
_local2.appName = (_local2.appName + "/");
_local2.appName = (_local2.appName + _arg1.slice(_local3, _local4));
_local3 = (_local4 + 1);
_local2.streamName = _arg1.slice(_local3);
if (_local2.streamName.slice(-4).toLowerCase() == ".flv"){
_local2.streamName = _local2.streamName.slice(0, -4);
};
} else {
_local2.isRTMP = false;
_local2.streamName = _arg1;
};
return (_local2);
}
flvplayback_internal function initOtherInfo():void{
_contentPath = null;
_streamName = null;
_streamWidth = -1;
_streamHeight = -1;
_streamLength = NaN;
_streams = null;
_autoSenseBW = false;
_payload = 0;
_connTypeCounter = 0;
cleanConns();
}
public function set timeout(_arg1:uint):void{
_timeoutTimer.delay = _arg1;
}
flvplayback_internal function _onFMSConnectTimeOut(_arg1:TimerEvent=null):void{
cleanConns();
_nc = null;
_ncConnected = false;
if (!connectAgain()){
_owner.ncConnected();
};
}
public function get streamHeight():int{
return (_streamHeight);
}
flvplayback_internal function connectOnStatus(_arg1:NetStatusEvent):void{
_arg1.target.client.pending = false;
if (_arg1.info.code == "NetConnection.Connect.Success"){
_nc = _tryNC[_arg1.target.client.connIndex];
cleanConns();
} else {
if ((((((_arg1.info.code == "NetConnection.Connect.Failed")) || ((_arg1.info.code == "NetConnection.Connect.Rejected")))) && ((_arg1.target.client.connIndex == (RTMP_CONN.length - 1))))){
if (!connectAgain()){
tryFallBack();
};
};
};
}
flvplayback_internal function onReconnected():void{
_ncConnected = true;
_owner.ncReconnected();
}
flvplayback_internal function tryFallBack():void{
if ((((_serverName == fallbackServerName)) || ((fallbackServerName == null)))){
_nc = null;
_ncConnected = false;
_owner.ncConnected();
} else {
_connTypeCounter = 0;
cleanConns();
_serverName = fallbackServerName;
connectRTMP();
};
}
public function set bitrate(_arg1:Number):void{
if (!_isRTMP){
_bitrate = _arg1;
};
}
flvplayback_internal function onConnected(_arg1:NetConnection, _arg2:Number):void{
var _local3:Array;
var _local4:uint;
var _local5:String;
_timeoutTimer.stop();
_arg1.removeEventListener(NetStatusEvent.NET_STATUS, connectOnStatus);
_nc = _arg1;
_ncUri = _nc.uri;
_ncConnected = true;
if (_autoSenseBW){
_bitrate = (_arg2 * 0x0400);
if (_streams != null){
bitrateMatch();
} else {
_local3 = _streamName.split(",");
_local4 = 0;
while (_local4 < _local3.length) {
_local5 = stripFrontAndBackWhiteSpace(_local3[_local4]);
if ((_local4 + 1) < _local3.length){
if (_arg2 <= Number(_local3[(_local4 + 1)])){
_streamName = _local5;
break;
};
} else {
_streamName = _local5;
break;
};
_local4 = (_local4 + 2);
};
if (_streamName.slice(-4).toLowerCase() == ".flv"){
_streamName = _streamName.slice(0, -4);
};
};
};
trace(("_streamLength = " + _streamLength));
if (((!(_owner.isLive)) && (isNaN(_streamLength)))){
trace("calling getStreamLength");
_nc.call("getStreamLength", new Responder(getStreamLengthResult), _streamName);
} else {
_owner.ncConnected();
};
}
public function close():void{
if (_nc){
_nc.close();
_ncConnected = false;
};
}
flvplayback_internal static function stripFrontAndBackWhiteSpace(_arg1:String):String{
var _local2:uint;
var _local3:uint;
var _local4:int;
var _local5:int;
_local3 = _arg1.length;
_local4 = 0;
_local5 = _local3;
_local2 = 0;
for (;_local2 < _local3;_local2++) {
switch (_arg1.charCodeAt(_local2)){
case 9:
case 10:
case 13:
case 32:
continue;
};
_local4 = _local2;
break;
};
_local2 = _local3;
for (;_local2 >= 0;_local2--) {
switch (_arg1.charCodeAt(_local2)){
case 9:
case 10:
case 13:
case 32:
continue;
};
_local5 = (_local2 + 1);
break;
};
if (_local5 <= _local4){
return ("");
};
return (_arg1.slice(_local4, _local5));
}
}
}//package fl.video
Section 96
//ParseResults (fl.video.ParseResults)
package fl.video {
public class ParseResults {
public var portNumber:String;
public var streamName:String;
public var serverName:String;
public var isRTMP:Boolean;
public var appName:String;
public var isRelative:Boolean;
public var protocol:String;
public var wrappedURL:String;
}
}//package fl.video
Section 97
//QueuedCommand (fl.video.QueuedCommand)
package fl.video {
public class QueuedCommand {
public var type:uint;
public var time:Number;
public var url:String;
public var isLive:Boolean;
public static const LOAD:uint = 1;
public static const STOP:uint = 3;
public static const PLAY_WHEN_ENOUGH:uint = 5;
public static const PLAY:uint = 0;
public static const PAUSE:uint = 2;
public static const SEEK:uint = 4;
public function QueuedCommand(_arg1:uint, _arg2:String, _arg3:Boolean, _arg4:Number){
this.type = _arg1;
this.url = _arg2;
this.isLive = _arg3;
this.time = _arg4;
}
}
}//package fl.video
Section 98
//ReconnectClient (fl.video.ReconnectClient)
package fl.video {
public class ReconnectClient {
public var owner:NCManager;
public function ReconnectClient(_arg1:NCManager){
this.owner = _arg1;
}
public function close():void{
}
public function onBWDone(... _args):void{
owner.onReconnected();
}
}
}//package fl.video
Section 99
//SkinErrorEvent (fl.video.SkinErrorEvent)
package fl.video {
import flash.events.*;
public class SkinErrorEvent extends ErrorEvent {
public static const SKIN_ERROR:String = "skinError";
public function SkinErrorEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:String=""){
super(_arg1, _arg2, _arg3, _arg4);
}
override public function clone():Event{
return (new SkinErrorEvent(type, bubbles, cancelable, text));
}
}
}//package fl.video
Section 100
//SMILManager (fl.video.SMILManager)
package fl.video {
import flash.events.*;
import flash.net.*;
public class SMILManager {
flvplayback_internal var width:int;
flvplayback_internal var xmlLoader:URLLoader;
flvplayback_internal var xml:XML;
flvplayback_internal var height:int;
private var _url:String;
flvplayback_internal var videoTags:Array;
flvplayback_internal var baseURLAttr:Array;
private var _owner:INCManager;
public static const VERSION:String = "2.0.0.37";
public static const SHORT_VERSION:String = "2.0";
public function SMILManager(_arg1:INCManager){
_owner = _arg1;
width = -1;
height = -1;
}
flvplayback_internal function parseVideo(_arg1:XML):Object{
var _local2:Object;
_local2 = new Object();
if (_arg1.@src.length() > 0){
_local2.src = _arg1.@src.toString();
};
if (_arg1.@["system-bitrate"].length() > 0){
_local2.bitrate = int(_arg1.@["system-bitrate"].toString());
};
if (_arg1.@dur.length() > 0){
_local2.dur = parseTime(_arg1.@dur.toString());
};
return (_local2);
}
flvplayback_internal function connectXML(_arg1:String):Boolean{
_url = fixURL(_arg1);
xmlLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, xmlLoadEventHandler);
xmlLoader.addEventListener(IOErrorEvent.IO_ERROR, xmlLoadEventHandler);
xmlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, xmlLoadEventHandler);
xmlLoader.load(new URLRequest(_url));
return (false);
}
flvplayback_internal function parseSwitch(_arg1:XML):void{
var _local2:String;
var _local3:XML;
for (_local2 in _arg1.*) {
_local3 = _arg1.*[_local2];
if (_local3.nodeKind() != "element"){
} else {
switch (_local3.localName()){
case "video":
case "ref":
videoTags.push(parseVideo(_local3));
break;
default:
break;
};
};
};
}
flvplayback_internal function fixURL(_arg1:String):String{
var _local2:String;
if (/^(http:|https:)/i.test(_arg1)){
_local2 = ((_arg1.indexOf("?"))>=0) ? "&" : "?";
return ((((_arg1 + _local2) + "FLVPlaybackVersion=") + SHORT_VERSION));
};
return (_arg1);
}
flvplayback_internal function xmlLoadEventHandler(_arg1:Event):void{
var e = _arg1;
try {
if (e.type != Event.COMPLETE){
_owner.helperDone(this, false);
} else {
baseURLAttr = new Array();
videoTags = new Array();
xml = new XML(xmlLoader.data);
if ((((xml == null)) || ((xml.localName() == null)))){
throw (new VideoError(VideoError.INVALID_XML, (("URL: \"" + _url) + "\" No root node found; if url is for an flv it must have .flv extension and take no parameters")));
} else {
if (xml.localName() != "smil"){
throw (new VideoError(VideoError.INVALID_XML, (("URL: \"" + _url) + "\" Root node not smil")));
};
};
checkForIllegalNodes(xml, "element", ["head", "body"]);
if (xml.head.length() > 0){
parseHead(xml.head[0]);
};
if (xml.body.length() < 1){
throw (new VideoError(VideoError.INVALID_XML, (("URL: \"" + _url) + "\" Tag body is required.")));
} else {
parseBody(xml.body[0]);
};
_owner.helperDone(this, true);
};
} catch(err:Error) {
_owner.helperDone(this, false);
throw (err);
} finally {
xmlLoader.removeEventListener(Event.COMPLETE, xmlLoadEventHandler);
xmlLoader.removeEventListener(IOErrorEvent.IO_ERROR, xmlLoadEventHandler);
xmlLoader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, xmlLoadEventHandler);
xmlLoader = null;
};
}
flvplayback_internal function checkForIllegalNodes(_arg1:XML, _arg2:String, _arg3:Array):void{
var _local4:String;
var _local5:Boolean;
var _local6:XML;
var _local7:String;
var _local8:String;
for (_local4 in _arg1.*) {
_local5 = false;
_local6 = _arg1.*[_local4];
if (_local6.nodeKind() != _arg2){
} else {
_local7 = _local6.localName();
for (_local8 in _arg3) {
if (_arg3[_local8] == _local7){
_local5 = true;
break;
};
};
if (!_local5){
throw (new VideoError(VideoError.INVALID_XML, (((((((("URL: \"" + _url) + "\" ") + _arg2) + " ") + _local7) + " not supported in ") + _arg1.localName()) + " tag.")));
};
};
};
}
flvplayback_internal function parseHead(_arg1:XML):void{
checkForIllegalNodes(_arg1, "element", ["meta", "layout"]);
if (_arg1.meta.length() > 0){
checkForIllegalNodes(_arg1.meta[0], "element", []);
checkForIllegalNodes(_arg1.meta[0], "attribute", ["base"]);
if (_arg1.meta.@base.length() > 0){
baseURLAttr.push(_arg1.meta.@base.toString());
};
};
if (_arg1.layout.length() > 0){
parseLayout(_arg1.layout[0]);
};
}
flvplayback_internal function parseBody(_arg1:XML):void{
var _local2:XML;
var _local3:String;
var _local4:Object;
if (((!((_arg1.*.length() == 1))) || (!((_arg1.*[0].nodeKind() == "element"))))){
throw (new VideoError(VideoError.INVALID_XML, (((("URL: \"" + _url) + "\" Tag ") + _arg1.localName()) + " is required to contain exactly one tag.")));
};
_local2 = _arg1.*[0];
_local3 = _local2.localName();
switch (_local3){
case "switch":
parseSwitch(_local2);
break;
case "video":
case "ref":
_local4 = parseVideo(_local2);
videoTags.push(_local4);
break;
default:
throw (new VideoError(VideoError.INVALID_XML, (((((("URL: \"" + _url) + "\" Tag ") + _local3) + " not supported in ") + _arg1.localName()) + " tag.")));
};
if (videoTags.length < 1){
throw (new VideoError(VideoError.INVALID_XML, (("URL: \"" + _url) + "\" At least one video of ref tag is required.")));
};
}
flvplayback_internal function parseTime(_arg1:String):Number{
var _local2:Object;
var _local3:Number;
var _local4:Number;
_local2 = /^((\d+):)?(\d+):((\d+)(.\d+)?)$/.exec(_arg1);
if (_local2 == null){
_local3 = Number(_arg1);
if (((isNaN(_local3)) || ((_local3 < 0)))){
throw (new VideoError(VideoError.INVALID_XML, ("Invalid dur value: " + _arg1)));
};
return (_local3);
//unresolved jump
};
_local4 = 0;
_local4 = (_local4 + ((uint(_local2[2]) * 60) * 60));
_local4 = (_local4 + (uint(_local2[3]) * 60));
_local4 = (_local4 + Number(_local2[4]));
return (_local4);
}
flvplayback_internal function parseLayout(_arg1:XML):void{
var _local2:XML;
var _local3:Number;
var _local4:Number;
checkForIllegalNodes(_arg1, "element", ["root-layout"]);
if (_arg1["root-layout"].length() > 1){
throw (new VideoError(VideoError.INVALID_XML, (("URL: \"" + _url) + "\" Only one base attribute supported in meta tag.")));
};
if (_arg1["root-layout"].length() > 0){
_local2 = _arg1["root-layout"][0];
if (_local2.@width.length() > 0){
_local3 = Number(_local2.@width[0]);
};
if (_local2.@height.length() > 0){
_local4 = Number(_local2.@height[0]);
};
if (((((((isNaN(_local3)) || ((_local3 < 0)))) || (isNaN(_local4)))) || ((_local4 < 0)))){
throw (new VideoError(VideoError.INVALID_XML, (((("URL: \"" + _url) + "\" Tag ") + _arg1.localName()) + " requires attributes width and height. Width and height must be numbers greater than or equal to 0.")));
};
width = Math.round(_local3);
height = Math.round(_local4);
};
}
}
}//package fl.video
Section 101
//SoundEvent (fl.video.SoundEvent)
package fl.video {
import flash.events.*;
import flash.media.*;
public class SoundEvent extends Event {
private var _soundTransform:SoundTransform;
public static const SOUND_UPDATE:String = "soundUpdate";
public function SoundEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:SoundTransform=null){
super(_arg1, _arg2, _arg3);
_soundTransform = _arg4;
}
public function get soundTransform():SoundTransform{
return (_soundTransform);
}
override public function clone():Event{
return (new SoundEvent(type, bubbles, cancelable, soundTransform));
}
}
}//package fl.video
Section 102
//UIManager (fl.video.UIManager)
package fl.video {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.net.*;
import flash.utils.*;
public class UIManager {
flvplayback_internal var _bufferingDelayTimer:Timer;
public var ctrlDataDict:Dictionary;
flvplayback_internal var _skinAutoHide:Boolean;
flvplayback_internal var placeholderLeft:Number;
flvplayback_internal var _playAfterScrub:Boolean;
public var customClips:Array;
flvplayback_internal var _skinFadeStartTime:int;
flvplayback_internal var delayedControls:Array;
flvplayback_internal var _lastScrubPos:Number;
flvplayback_internal var _skinAutoHideLastMotionTime:int;
flvplayback_internal var _volumeBarTimer:Timer;
flvplayback_internal var borderScale9Rects:Array;
flvplayback_internal var _volumeBarScrubTolerance:Number;
flvplayback_internal var _skin:String;
flvplayback_internal var videoRight:Number;
flvplayback_internal var _bufferingBarHides:Boolean;
flvplayback_internal var placeholderRight:Number;
flvplayback_internal var cachedSoundLevel:Number;
flvplayback_internal var videoBottom:Number;
flvplayback_internal var border_mc:DisplayObject;
flvplayback_internal var _skinFadingTimer:Timer;
flvplayback_internal var borderAlpha:Number;
flvplayback_internal var borderColorTransform:ColorTransform;
flvplayback_internal var borderColor:uint;
flvplayback_internal var __visible:Boolean;
flvplayback_internal var cacheFLVPlaybackLocation:Rectangle;
flvplayback_internal var cacheFLVPlaybackIndex:int;
flvplayback_internal var _skinReady:Boolean;
flvplayback_internal var controls:Array;
flvplayback_internal var _skinAutoHideMouseX:Number;
flvplayback_internal var _skinAutoHideMouseY:Number;
flvplayback_internal var layout_mc:Sprite;
flvplayback_internal var cacheSkinAutoHide:Boolean;
flvplayback_internal var cacheStageScaleMode:String;
flvplayback_internal var videoTop:Number;
flvplayback_internal var _skinFadingMaxTime:int;
flvplayback_internal var placeholderTop:Number;
flvplayback_internal var _lastVolumePos:Number;
flvplayback_internal var mouseCaptureCtrl:int;
flvplayback_internal var _seekBarScrubTolerance:Number;
flvplayback_internal var borderPrevRect:Rectangle;
flvplayback_internal var skinTemplate:Sprite;
flvplayback_internal var _progressPercent:Number;
flvplayback_internal var videoLeft:Number;
flvplayback_internal var _isMuted:Boolean;
flvplayback_internal var _skinAutoHideTimer:Timer;
flvplayback_internal var _fullScreenBgColor:uint;
flvplayback_internal var _vc:FLVPlayback;
flvplayback_internal var _bufferingOn:Boolean;
flvplayback_internal var _seekBarTimer:Timer;
flvplayback_internal var _controlsEnabled:Boolean;
flvplayback_internal var _fullScreen:Boolean;
flvplayback_internal var placeholderBottom:Number;
flvplayback_internal var _fullScreenTakeOver:Boolean;
flvplayback_internal var skin_mc:Sprite;
flvplayback_internal var skinLoadDelayCount:uint;
flvplayback_internal var _skinFadingIn:Boolean;
flvplayback_internal var _skinAutoHideMotionTimeout:int;
flvplayback_internal var borderCopy:Sprite;
flvplayback_internal var cacheStageAlign:String;
flvplayback_internal var cacheFLVPlaybackParent:DisplayObjectContainer;
flvplayback_internal var skinLoader:Loader;
public static const VOLUME_BAR_HIT:int = 12;
public static const MUTE_OFF_BUTTON:int = 10;
public static const BACK_BUTTON:int = 5;
public static const FORWARD_BUTTON:int = 6;
public static const STOP_BUTTON:int = 2;
public static const NUM_BUTTONS:int = 13;
public static const NORMAL_STATE:uint = 0;
public static const SEEK_BAR_HANDLE:int = 3;
public static const PLAY_BUTTON:int = 1;
public static const MUTE_BUTTON:int = 15;
public static const DOWN_STATE:uint = 2;
public static const SEEK_BAR_SCRUB_TOLERANCE_DEFAULT:Number = 5;
public static const FULL_SCREEN_OFF_BUTTON:int = 8;
flvplayback_internal static const SKIN_AUTO_HIDE_MOTION_TIMEOUT_DEFAULT:Number = 3000;
public static const SEEK_BAR:int = 17;
public static const VOLUME_BAR_SCRUB_TOLERANCE_DEFAULT:Number = 0;
public static const FULL_SCREEN_ON_BUTTON:int = 7;
public static const FULL_SCREEN_BUTTON:int = 14;
public static const BUFFERING_BAR:int = 16;
public static const VERSION:String = "2.0.0.37";
public static const VOLUME_BAR_HANDLE:int = 11;
public static const PAUSE_BUTTON:int = 0;
flvplayback_internal static const SKIN_AUTO_HIDE_INTERVAL:Number = 200;
public static const OVER_STATE:uint = 1;
flvplayback_internal static const SKIN_FADING_INTERVAL:Number = 100;
public static const VOLUME_BAR:int = 18;
public static const SHORT_VERSION:String = "2.0";
public static const SEEK_BAR_INTERVAL_DEFAULT:Number = 250;
flvplayback_internal static const SKIN_FADING_MAX_TIME_DEFAULT:Number = 500;
public static const SEEK_BAR_HIT:int = 4;
public static const PLAY_PAUSE_BUTTON:int = 13;
public static const BUFFERING_DELAY_INTERVAL_DEFAULT:Number = 1000;
public static const MUTE_ON_BUTTON:int = 9;
public static const NUM_CONTROLS:int = 19;
public static const VOLUME_BAR_INTERVAL_DEFAULT:Number = 250;
flvplayback_internal static var layoutNameToIndexMappings:Object = null;
flvplayback_internal static var buttonSkinLinkageIDs:Array = ["upLinkageID", "overLinkageID", "downLinkageID"];
flvplayback_internal static var layoutNameArray:Array = ["pause_mc", "play_mc", "stop_mc", null, null, "back_mc", "forward_mc", null, null, null, null, null, null, "playpause_mc", "fullScreenToggle_mc", "volumeMute_mc", "bufferingBar_mc", "seekBar_mc", "volumeBar_mc", "seekBarHandle_mc", "seekBarHit_mc", "seekBarProgress_mc", "seekBarFullness_mc", "volumeBarHandle_mc", "volumeBarHit_mc", "volumeBarProgress_mc", "volumeBarFullness_mc", "progressFill_mc"];
flvplayback_internal static var skinClassPrefixes:Array = ["pauseButton", "playButton", "stopButton", null, null, "backButton", "forwardButton", "fullScreenButtonOn", "fullScreenButtonOff", "muteButtonOn", "muteButtonOff", null, null, null, null, null, "bufferingBar", "seekBar", "volumeBar"];
flvplayback_internal static var customComponentClassNames:Array = ["PauseButton", "PlayButton", "StopButton", null, null, "BackButton", "ForwardButton", null, null, null, null, null, null, "PlayPauseButton", "FullScreenButton", "MuteButton", "BufferingBar", "SeekBar", "VolumeBar"];
public function UIManager(_arg1:FLVPlayback){
var vc = _arg1;
super();
_vc = vc;
_skin = null;
_skinAutoHide = false;
cacheSkinAutoHide = _skinAutoHide;
_skinFadingMaxTime = SKIN_FADING_MAX_TIME_DEFAULT;
_skinAutoHideMotionTimeout = SKIN_AUTO_HIDE_MOTION_TIMEOUT_DEFAULT;
_skinReady = true;
__visible = false;
_bufferingBarHides = false;
_controlsEnabled = true;
_lastScrubPos = 0;
_lastVolumePos = 0;
cachedSoundLevel = _vc.volume;
_isMuted = false;
controls = new Array();
customClips = null;
ctrlDataDict = new Dictionary(true);
skin_mc = null;
skinLoader = null;
skinTemplate = null;
layout_mc = null;
border_mc = null;
borderCopy = null;
borderPrevRect = null;
borderScale9Rects = null;
borderAlpha = 0.85;
borderColor = 4697035;
borderColorTransform = new ColorTransform(0, 0, 0, 0, 71, 171, 203, (0xFF * borderAlpha));
_seekBarScrubTolerance = SEEK_BAR_SCRUB_TOLERANCE_DEFAULT;
_volumeBarScrubTolerance = VOLUME_BAR_SCRUB_TOLERANCE_DEFAULT;
_bufferingOn = false;
mouseCaptureCtrl = -1;
_seekBarTimer = new Timer(SEEK_BAR_INTERVAL_DEFAULT);
_seekBarTimer.addEventListener(TimerEvent.TIMER, seekBarListener);
_volumeBarTimer = new Timer(VOLUME_BAR_INTERVAL_DEFAULT);
_volumeBarTimer.addEventListener(TimerEvent.TIMER, volumeBarListener);
_bufferingDelayTimer = new Timer(BUFFERING_DELAY_INTERVAL_DEFAULT, 1);
_bufferingDelayTimer.addEventListener(TimerEvent.TIMER, doBufferingDelay);
_skinAutoHideTimer = new Timer(SKIN_AUTO_HIDE_INTERVAL);
_skinAutoHideTimer.addEventListener(TimerEvent.TIMER, skinAutoHideHitTest);
_skinFadingTimer = new Timer(SKIN_FADING_INTERVAL);
_skinFadingTimer.addEventListener(TimerEvent.TIMER, skinFadeMore);
_vc.addEventListener(MetadataEvent.METADATA_RECEIVED, handleIVPEvent);
_vc.addEventListener(VideoEvent.PLAYHEAD_UPDATE, handleIVPEvent);
_vc.addEventListener(VideoProgressEvent.PROGRESS, handleIVPEvent);
_vc.addEventListener(VideoEvent.STATE_CHANGE, handleIVPEvent);
_vc.addEventListener(VideoEvent.READY, handleIVPEvent);
_vc.addEventListener(LayoutEvent.LAYOUT, handleLayoutEvent);
_vc.addEventListener(AutoLayoutEvent.AUTO_LAYOUT, handleLayoutEvent);
_vc.addEventListener(SoundEvent.SOUND_UPDATE, handleSoundEvent);
_vc.addEventListener(Event.ADDED_TO_STAGE, handleEvent);
_fullScreen = false;
_fullScreenTakeOver = true;
_fullScreenBgColor = 0;
if (_vc.stage != null){
try {
_fullScreen = (_vc.stage.displayState == StageDisplayState.FULL_SCREEN);
_vc.stage.addEventListener(FullScreenEvent.FULL_SCREEN, handleFullScreenEvent);
} catch(se:SecurityError) {
};
};
if (layoutNameToIndexMappings == null){
initLayoutNameToIndexMappings();
};
}
flvplayback_internal function removeButtonListeners(_arg1:Sprite):void{
if (_arg1 == null){
return;
};
_arg1.removeEventListener(MouseEvent.ROLL_OVER, handleButtonEvent);
_arg1.removeEventListener(MouseEvent.ROLL_OUT, handleButtonEvent);
_arg1.removeEventListener(MouseEvent.MOUSE_DOWN, handleButtonEvent);
_arg1.removeEventListener(MouseEvent.CLICK, handleButtonEvent);
_arg1.removeEventListener(Event.ENTER_FRAME, skinButtonControl);
}
public function set skinFadeTime(_arg1:int):void{
_skinFadingMaxTime = _arg1;
}
public function get skinFadeTime():int{
return (_skinFadingMaxTime);
}
flvplayback_internal function finishLoad(_arg1:Event):void{
var i:int;
var cachedActivePlayerIndex:int;
var state:String;
var j:int;
var e = _arg1;
try {
skinLoadDelayCount++;
if (skinLoadDelayCount < 2){
return;
} else {
_vc.removeEventListener(Event.ENTER_FRAME, finishLoad);
};
i = 0;
while (i < NUM_CONTROLS) {
if (delayedControls[i] != undefined){
setControl(i, delayedControls[i]);
};
i = (i + 1);
};
if (_fullScreenTakeOver){
enterFullScreenTakeOver();
} else {
exitFullScreenTakeOver();
};
layoutSkin();
setupSkinAutoHide(false);
skin_mc.visible = __visible;
_vc.addChild(skin_mc);
_skinReady = true;
_vc.skinLoaded();
cachedActivePlayerIndex = _vc.activeVideoPlayerIndex;
_vc.activeVideoPlayerIndex = _vc.visibleVideoPlayerIndex;
state = _vc.state;
j = 0;
while (j < NUM_CONTROLS) {
if (controls[j] == undefined){
} else {
setEnabledAndVisibleForState(j, state);
if (j < NUM_BUTTONS){
skinButtonControl(controls[j]);
};
};
j = (j + 1);
};
_vc.activeVideoPlayerIndex = cachedActivePlayerIndex;
} catch(err:Error) {
_vc.skinError(err.message);
removeSkin();
};
}
flvplayback_internal function downloadSkin():void{
if (skinLoader == null){
skinLoader = new Loader();
skinLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, handleLoad);
skinLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, handleLoadErrorEvent);
skinLoader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, handleLoadErrorEvent);
};
skinLoader.load(new URLRequest(_skin));
}
flvplayback_internal function removeSkin():void{
var i:int;
if (skinLoader != null){
try {
skinLoader.close();
} catch(e1:Error) {
};
skinLoader = null;
};
if (skin_mc != null){
i = 0;
while (i < NUM_CONTROLS) {
if (controls[i] == undefined){
} else {
if (i < NUM_BUTTONS){
removeButtonListeners(controls[i]);
};
delete ctrlDataDict[controls[i]];
delete controls[i];
};
i = (i + 1);
};
try {
skin_mc.parent.removeChild(skin_mc);
} catch(e2:Error) {
};
skin_mc = null;
};
skinTemplate = null;
layout_mc = null;
border_mc = null;
borderCopy = null;
borderPrevRect = null;
borderScale9Rects = null;
}
flvplayback_internal function positionBar(_arg1:Sprite, _arg2:String, _arg3:Number):void{
var ctrlData:ControlData;
var bar:DisplayObject;
var barData:ControlData;
var ctrl = _arg1;
var type = _arg2;
var percent = _arg3;
try {
if ((((ctrl["positionBar"] is Function)) && (ctrl["positionBar"](type, percent)))){
return;
};
} catch(re2:ReferenceError) {
};
ctrlData = ctrlDataDict[ctrl];
bar = ctrlData[(type + "_mc")];
if (bar == null){
return;
};
barData = ctrlDataDict[bar];
if (bar.parent == ctrl){
if (barData.fill_mc == null){
bar.scaleX = ((barData.origScaleX * percent) / 100);
} else {
positionMaskedFill(bar, percent);
};
} else {
bar.x = (ctrl.x + barData.leftMargin);
bar.y = (ctrl.y + barData.origY);
if (barData.fill_mc == null){
bar.width = ((((ctrl.width - barData.leftMargin) - barData.rightMargin) * percent) / 100);
} else {
positionMaskedFill(bar, percent);
};
};
}
flvplayback_internal function setupButtonSkin(_arg1:int):Sprite{
var _local2:String;
var _local3:Sprite;
var _local4:ControlData;
_local2 = skinClassPrefixes[_arg1];
if (_local2 == null){
return (null);
};
_local3 = new Sprite();
_local4 = new ControlData(this, _local3, null, _arg1);
ctrlDataDict[_local3] = _local4;
_local4.state_mc = new Array();
_local4.state_mc[NORMAL_STATE] = setupButtonSkinState(_local3, skinTemplate, (_local2 + "NormalState"));
_local4.state_mc[NORMAL_STATE].visible = true;
_local4.state_mc[OVER_STATE] = setupButtonSkinState(_local3, skinTemplate, (_local2 + "OverState"), _local4.state_mc[NORMAL_STATE]);
_local4.state_mc[DOWN_STATE] = setupButtonSkinState(_local3, skinTemplate, (_local2 + "DownState"), _local4.state_mc[NORMAL_STATE]);
_local4.disabled_mc = setupButtonSkinState(_local3, skinTemplate, (_local2 + "DisabledState"), _local4.state_mc[NORMAL_STATE]);
return (_local3);
}
public function get skinReady():Boolean{
return (_skinReady);
}
public function get skinAutoHide():Boolean{
return (_skinAutoHide);
}
flvplayback_internal function dispatchMessage(_arg1:int):void{
var _local2:int;
var _local3:Sprite;
var _local4:ControlData;
var _local5:Sprite;
if ((((_arg1 == SEEK_BAR_HANDLE)) || ((_arg1 == SEEK_BAR_HIT)))){
_vc._scrubStart();
};
_local2 = _vc.activeVideoPlayerIndex;
_vc.activeVideoPlayerIndex = _vc.visibleVideoPlayerIndex;
switch (_arg1){
case PAUSE_BUTTON:
_vc.pause();
break;
case PLAY_BUTTON:
_vc.play();
break;
case STOP_BUTTON:
_vc.stop();
break;
case SEEK_BAR_HIT:
case SEEK_BAR_HANDLE:
_local3 = controls[SEEK_BAR];
_local4 = ctrlDataDict[_local3];
calcPercentageFromHandle(_local3);
_lastScrubPos = _local4.percentage;
if (_arg1 == SEEK_BAR_HIT){
_local5 = controls[SEEK_BAR_HANDLE];
controls[SEEK_BAR_HANDLE].x = _local5.parent.mouseX;
_local5.y = _local5.parent.mouseY;
};
_vc.removeEventListener(VideoEvent.PLAYHEAD_UPDATE, handleIVPEvent);
if (((_vc.playing) || (_vc.buffering))){
_playAfterScrub = true;
} else {
if (_vc.state != VideoState.SEEKING){
_playAfterScrub = false;
};
};
_seekBarTimer.start();
startHandleDrag(_local3);
_vc.pause();
break;
case VOLUME_BAR_HIT:
case VOLUME_BAR_HANDLE:
_local3 = controls[VOLUME_BAR];
_local4 = ctrlDataDict[_local3];
calcPercentageFromHandle(_local3);
_lastVolumePos = _local4.percentage;
if (_arg1 == VOLUME_BAR_HIT){
_local5 = controls[VOLUME_BAR_HANDLE];
controls[VOLUME_BAR_HANDLE].x = _local5.parent.mouseX;
_local5.y = _local5.parent.mouseY;
};
_vc.removeEventListener(SoundEvent.SOUND_UPDATE, handleSoundEvent);
_volumeBarTimer.start();
startHandleDrag(_local3);
break;
case BACK_BUTTON:
_vc.seekToPrevNavCuePoint();
break;
case FORWARD_BUTTON:
_vc.seekToNextNavCuePoint();
break;
case MUTE_ON_BUTTON:
if (!_isMuted){
_isMuted = true;
cachedSoundLevel = _vc.volume;
_vc.volume = 0;
setEnabledAndVisibleForState(MUTE_OFF_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[MUTE_OFF_BUTTON]);
setEnabledAndVisibleForState(MUTE_ON_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[MUTE_ON_BUTTON]);
};
break;
case MUTE_OFF_BUTTON:
if (_isMuted){
_isMuted = false;
_vc.volume = cachedSoundLevel;
setEnabledAndVisibleForState(MUTE_OFF_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[MUTE_OFF_BUTTON]);
setEnabledAndVisibleForState(MUTE_ON_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[MUTE_ON_BUTTON]);
};
break;
case FULL_SCREEN_ON_BUTTON:
if (((!(_fullScreen)) && (!((_vc.stage == null))))){
_vc.stage.displayState = StageDisplayState.FULL_SCREEN;
setEnabledAndVisibleForState(FULL_SCREEN_OFF_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[FULL_SCREEN_OFF_BUTTON]);
setEnabledAndVisibleForState(FULL_SCREEN_ON_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[FULL_SCREEN_ON_BUTTON]);
};
break;
case FULL_SCREEN_OFF_BUTTON:
if (((_fullScreen) && (!((_vc.stage == null))))){
_vc.stage.displayState = StageDisplayState.NORMAL;
setEnabledAndVisibleForState(FULL_SCREEN_OFF_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[FULL_SCREEN_OFF_BUTTON]);
setEnabledAndVisibleForState(FULL_SCREEN_ON_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[FULL_SCREEN_ON_BUTTON]);
};
break;
default:
throw (new Error("Unknown ButtonControl"));
};
_vc.activeVideoPlayerIndex = _local2;
}
flvplayback_internal function handleFullScreenEvent(_arg1:FullScreenEvent):void{
_fullScreen = _arg1.fullScreen;
setEnabledAndVisibleForState(FULL_SCREEN_OFF_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[FULL_SCREEN_OFF_BUTTON]);
setEnabledAndVisibleForState(FULL_SCREEN_ON_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[FULL_SCREEN_ON_BUTTON]);
if (((_fullScreen) && (_fullScreenTakeOver))){
enterFullScreenTakeOver();
} else {
if (!_fullScreen){
exitFullScreenTakeOver();
};
};
}
flvplayback_internal function handleLayoutEvent(_arg1:LayoutEvent):void{
layoutSkin();
setupSkinAutoHide(false);
}
flvplayback_internal function seekBarListener(_arg1:TimerEvent):void{
var _local2:int;
var _local3:Sprite;
var _local4:ControlData;
var _local5:Number;
_local2 = _vc.activeVideoPlayerIndex;
_vc.activeVideoPlayerIndex = _vc.visibleVideoPlayerIndex;
_local3 = controls[SEEK_BAR];
if (_local3 == null){
return;
};
_local4 = ctrlDataDict[_local3];
calcPercentageFromHandle(_local3);
_local5 = _local4.percentage;
if (_arg1 == null){
_seekBarTimer.stop();
if (_local5 != _lastScrubPos){
_vc.seekPercent(_local5);
};
_vc.addEventListener(VideoEvent.PLAYHEAD_UPDATE, handleIVPEvent);
if (_playAfterScrub){
_vc.play();
};
} else {
if (_vc.getVideoPlayer(_vc.visibleVideoPlayerIndex).state == VideoState.SEEKING){
} else {
if ((((((((_seekBarScrubTolerance <= 0)) || ((Math.abs((_local5 - _lastScrubPos)) > _seekBarScrubTolerance)))) || ((_local5 < _seekBarScrubTolerance)))) || ((_local5 > (100 - _seekBarScrubTolerance))))){
if (_local5 != _lastScrubPos){
_lastScrubPos = _local5;
_vc.seekPercent(_local5);
};
};
};
};
_vc.activeVideoPlayerIndex = _local2;
}
public function get seekBarInterval():Number{
return (_seekBarTimer.delay);
}
public function set skinAutoHide(_arg1:Boolean):void{
if (_arg1 == _skinAutoHide){
return;
};
_skinAutoHide = _arg1;
cacheSkinAutoHide = _arg1;
setupSkinAutoHide(true);
}
flvplayback_internal function setCustomClip(_arg1:DisplayObject):void{
var dCopy:DisplayObject;
var ctrlData:ControlData;
var scale9Grid:Rectangle;
var diff:Number;
var numBorderBitmaps:int;
var i:int;
var lastXDim:Number;
var lastYDim:Number;
var newRect:Rectangle;
var dispObj = _arg1;
dCopy = new (dispObj["constructor"]);
skin_mc.addChild(dCopy);
ctrlData = new ControlData(this, dCopy, null, -1);
ctrlDataDict[dCopy] = ctrlData;
ctrlData.avatar = dispObj;
customClips.push(dCopy);
if (dispObj.name == "border_mc"){
border_mc = dCopy;
try {
borderCopy = (ctrlData.avatar["colorMe"]) ? new Sprite() : null;
} catch(re:ReferenceError) {
borderCopy = null;
};
if (borderCopy != null){
border_mc.visible = false;
scale9Grid = border_mc.scale9Grid;
scale9Grid.x = Math.round(scale9Grid.x);
scale9Grid.y = Math.round(scale9Grid.y);
scale9Grid.width = Math.round(scale9Grid.width);
diff = ((scale9Grid.x + scale9Grid.width) - border_mc.scale9Grid.right);
if (diff > 0.5){
scale9Grid.width--;
} else {
if (diff < -0.5){
scale9Grid.width++;
};
};
scale9Grid.height = Math.round(scale9Grid.height);
diff = ((scale9Grid.y + scale9Grid.height) - border_mc.scale9Grid.bottom);
if (diff > 0.5){
scale9Grid.height--;
} else {
if (diff < -0.5){
scale9Grid.height++;
};
};
if (scale9Grid != null){
borderScale9Rects = new Array();
lastXDim = (border_mc.width - (scale9Grid.x + scale9Grid.width));
lastXDim = (Math.floor(lastXDim) + 1);
lastYDim = (border_mc.height - (scale9Grid.y + scale9Grid.height));
lastYDim = (Math.floor(lastYDim) + 1);
newRect = new Rectangle(0, 0, scale9Grid.x, scale9Grid.y);
borderScale9Rects.push(((((newRect.width < 1)) || ((newRect.height < 1)))) ? null : newRect);
newRect = new Rectangle(scale9Grid.x, 0, scale9Grid.width, scale9Grid.y);
borderScale9Rects.push(((((newRect.width < 1)) || ((newRect.height < 1)))) ? null : newRect);
newRect = new Rectangle((scale9Grid.x + scale9Grid.width), 0, lastXDim, scale9Grid.y);
borderScale9Rects.push(((((newRect.width < 1)) || ((newRect.height < 1)))) ? null : newRect);
newRect = new Rectangle(0, scale9Grid.y, scale9Grid.x, scale9Grid.height);
borderScale9Rects.push(((((newRect.width < 1)) || ((newRect.height < 1)))) ? null : newRect);
newRect = new Rectangle(scale9Grid.x, scale9Grid.y, scale9Grid.width, scale9Grid.height);
borderScale9Rects.push(((((newRect.width < 1)) || ((newRect.height < 1)))) ? null : newRect);
newRect = new Rectangle((scale9Grid.x + scale9Grid.width), scale9Grid.y, lastXDim, scale9Grid.height);
borderScale9Rects.push(((((newRect.width < 1)) || ((newRect.height < 1)))) ? null : newRect);
newRect = new Rectangle(0, (scale9Grid.y + scale9Grid.height), scale9Grid.x, lastYDim);
borderScale9Rects.push(((((newRect.width < 1)) || ((newRect.height < 1)))) ? null : newRect);
newRect = new Rectangle(scale9Grid.x, (scale9Grid.y + scale9Grid.height), scale9Grid.width, lastYDim);
borderScale9Rects.push(((((newRect.width < 1)) || ((newRect.height < 1)))) ? null : newRect);
newRect = new Rectangle((scale9Grid.x + scale9Grid.width), (scale9Grid.y + scale9Grid.height), lastXDim, lastYDim);
borderScale9Rects.push(((((newRect.width < 1)) || ((newRect.height < 1)))) ? null : newRect);
i = 0;
while (i < borderScale9Rects.length) {
if (borderScale9Rects[i] != null){
break;
};
i = (i + 1);
};
if (i >= borderScale9Rects.length){
borderScale9Rects = null;
};
};
numBorderBitmaps = ((borderScale9Rects)==null) ? 1 : 9;
i = 0;
while (i < numBorderBitmaps) {
if ((((borderScale9Rects == null)) || (!((borderScale9Rects[i] == null))))){
borderCopy.addChild(new Bitmap());
};
i = (i + 1);
};
skin_mc.addChild(borderCopy);
borderPrevRect = null;
};
};
}
public function get fullScreenSkinDelay():int{
return (_skinAutoHideMotionTimeout);
}
flvplayback_internal function doBufferingDelay(_arg1:TimerEvent):void{
var _local2:int;
_bufferingDelayTimer.reset();
_local2 = _vc.activeVideoPlayerIndex;
_vc.activeVideoPlayerIndex = _vc.visibleVideoPlayerIndex;
if (_vc.state == VideoState.BUFFERING){
_bufferingOn = true;
handleIVPEvent(new VideoEvent(VideoEvent.STATE_CHANGE, false, false, VideoState.BUFFERING, NaN, _vc.visibleVideoPlayerIndex));
};
_vc.activeVideoPlayerIndex = _local2;
}
flvplayback_internal function volumeBarListener(_arg1:TimerEvent):void{
var _local2:Sprite;
var _local3:ControlData;
var _local4:Number;
var _local5:Boolean;
_local2 = controls[VOLUME_BAR];
if (_local2 == null){
return;
};
_local3 = ctrlDataDict[_local2];
calcPercentageFromHandle(_local2);
_local4 = _local3.percentage;
_local5 = (_arg1 == null);
if (_local5){
_volumeBarTimer.stop();
_vc.addEventListener(SoundEvent.SOUND_UPDATE, handleSoundEvent);
};
if (((((((((_local5) || ((_volumeBarScrubTolerance <= 0)))) || ((Math.abs((_local4 - _lastVolumePos)) > _volumeBarScrubTolerance)))) || ((_local4 < _volumeBarScrubTolerance)))) || ((_local4 > (100 - _volumeBarScrubTolerance))))){
if (_local4 != _lastVolumePos){
if (_isMuted){
cachedSoundLevel = (_local4 / 100);
} else {
_vc.volume = (_local4 / 100);
};
_lastVolumePos = _local4;
};
};
}
public function get visible():Boolean{
return (__visible);
}
flvplayback_internal function fixUpBar(_arg1:DisplayObject, _arg2:String, _arg3:DisplayObject, _arg4:String):void{
var ctrlData:ControlData;
var bar:DisplayObject;
var barData:ControlData;
var definitionHolder = _arg1;
var propPrefix = _arg2;
var ctrl = _arg3;
var name = _arg4;
ctrlData = ctrlDataDict[ctrl];
if (ctrlData[name] != null){
return;
};
try {
bar = ctrl[name];
} catch(re:ReferenceError) {
bar = null;
};
if (bar == null){
try {
bar = createSkin(definitionHolder, (propPrefix + "LinkageID"));
} catch(ve:VideoError) {
bar = null;
};
if (bar == null){
return;
};
if (ctrl.parent != null){
if (getBooleanPropSafe(ctrl, (propPrefix + "Below"))){
ctrl.parent.addChildAt(bar, ctrl.parent.getChildIndex(ctrl));
} else {
ctrl.parent.addChild(bar);
};
};
};
ctrlData[name] = bar;
barData = ctrlDataDict[bar];
if (barData == null){
barData = new ControlData(this, bar, ctrl, -1);
ctrlDataDict[bar] = barData;
};
}
public function get volumeBarInterval():Number{
return (_volumeBarTimer.delay);
}
public function get bufferingBarHidesAndDisablesOthers():Boolean{
return (_bufferingBarHides);
}
flvplayback_internal function calcLayoutControl(_arg1:DisplayObject):Rectangle{
var rect:Rectangle;
var ctrlData:ControlData;
var anchorRight:Boolean;
var anchorLeft:Boolean;
var anchorTop:Boolean;
var anchorBottom:Boolean;
var ctrl = _arg1;
rect = new Rectangle();
if (ctrl == null){
return (rect);
};
ctrlData = ctrlDataDict[ctrl];
if (ctrlData == null){
return (rect);
};
if (ctrlData.avatar == null){
return (rect);
};
anchorRight = false;
anchorLeft = true;
anchorTop = false;
anchorBottom = true;
try {
anchorRight = ctrlData.avatar["anchorRight"];
} catch(re1:ReferenceError) {
anchorRight = false;
};
try {
anchorLeft = ctrlData.avatar["anchorLeft"];
} catch(re1:ReferenceError) {
anchorLeft = true;
};
try {
anchorTop = ctrlData.avatar["anchorTop"];
} catch(re1:ReferenceError) {
anchorTop = false;
};
try {
anchorBottom = ctrlData.avatar["anchorBottom"];
} catch(re1:ReferenceError) {
anchorBottom = true;
};
if (anchorRight){
if (anchorLeft){
rect.x = ((ctrlData.avatar.x - placeholderLeft) + videoLeft);
rect.width = ((((ctrlData.avatar.x + ctrlData.avatar.width) - placeholderRight) + videoRight) - rect.x);
ctrlData.origWidth = NaN;
} else {
rect.x = ((ctrlData.avatar.x - placeholderRight) + videoRight);
rect.width = ctrl.width;
};
} else {
rect.x = ((ctrlData.avatar.x - placeholderLeft) + videoLeft);
rect.width = ctrl.width;
};
if (anchorTop){
if (anchorBottom){
rect.y = ((ctrlData.avatar.y - placeholderTop) + videoTop);
rect.height = ((((ctrlData.avatar.y + ctrlData.avatar.height) - placeholderBottom) + videoBottom) - rect.y);
ctrlData.origHeight = NaN;
} else {
rect.y = ((ctrlData.avatar.y - placeholderTop) + videoTop);
rect.height = ctrl.height;
};
} else {
rect.y = ((ctrlData.avatar.y - placeholderBottom) + videoBottom);
rect.height = ctrl.height;
};
try {
if ((ctrl["layoutSelf"] is Function)){
rect = ctrl["layoutSelf"](rect);
};
} catch(re3:ReferenceError) {
};
return (rect);
}
flvplayback_internal function skinFadeMore(_arg1:TimerEvent):void{
var _local2:Number;
if (((((!(_skinFadingIn)) && ((skin_mc.alpha <= 0.5)))) || (((_skinFadingIn) && ((skin_mc.alpha >= 0.95)))))){
skin_mc.visible = _skinFadingIn;
skin_mc.alpha = 1;
_skinFadingTimer.stop();
} else {
_local2 = ((getTimer() - _skinFadeStartTime) / _skinFadingMaxTime);
if (!_skinFadingIn){
_local2 = (1 - _local2);
};
if (_local2 < 0){
_local2 = 0;
} else {
if (_local2 > 1){
_local2 = 1;
};
};
skin_mc.alpha = _local2;
};
}
flvplayback_internal function resetPlayPause():void{
var _local1:int;
if (controls[PLAY_PAUSE_BUTTON] == undefined){
return;
};
_local1 = PAUSE_BUTTON;
while (_local1 <= PLAY_BUTTON) {
removeButtonListeners(controls[_local1]);
delete ctrlDataDict[controls[_local1]];
delete controls[_local1];
_local1++;
};
delete ctrlDataDict[controls[PLAY_PAUSE_BUTTON]];
delete controls[PLAY_PAUSE_BUTTON];
}
public function setControl(_arg1:int, _arg2:Sprite):void{
var ctrlData:ControlData;
var index = _arg1;
var ctrl = _arg2;
if (ctrl == controls[index]){
return;
};
switch (index){
case PAUSE_BUTTON:
case PLAY_BUTTON:
resetPlayPause();
break;
case PLAY_PAUSE_BUTTON:
if ((((ctrl == null)) || (!((ctrl.parent == skin_mc))))){
resetPlayPause();
};
if (ctrl != null){
setControl(PAUSE_BUTTON, Sprite(ctrl.getChildByName("pause_mc")));
setControl(PLAY_BUTTON, Sprite(ctrl.getChildByName("play_mc")));
};
break;
case FULL_SCREEN_BUTTON:
if (ctrl != null){
setControl(FULL_SCREEN_ON_BUTTON, Sprite(ctrl.getChildByName("on_mc")));
setControl(FULL_SCREEN_OFF_BUTTON, Sprite(ctrl.getChildByName("off_mc")));
};
break;
case MUTE_BUTTON:
if (ctrl != null){
setControl(MUTE_ON_BUTTON, Sprite(ctrl.getChildByName("on_mc")));
setControl(MUTE_OFF_BUTTON, Sprite(ctrl.getChildByName("off_mc")));
};
break;
};
if (controls[index] != null){
try {
delete controls[index]["uiMgr"];
} catch(re:ReferenceError) {
};
if (index < NUM_BUTTONS){
removeButtonListeners(controls[index]);
};
delete ctrlDataDict[controls[index]];
delete controls[index];
};
if (ctrl == null){
return;
};
ctrlData = ctrlDataDict[ctrl];
if (ctrlData == null){
ctrlData = new ControlData(this, ctrl, null, index);
ctrlDataDict[ctrl] = ctrlData;
} else {
ctrlData.index = index;
};
if (index >= NUM_BUTTONS){
controls[index] = ctrl;
switch (index){
case SEEK_BAR:
addBarControl(ctrl);
break;
case VOLUME_BAR:
addBarControl(ctrl);
ctrlData.percentage = (_vc.volume * 100);
break;
case BUFFERING_BAR:
if (ctrl.parent == skin_mc){
finishAddBufferingBar();
} else {
ctrl.addEventListener(Event.ENTER_FRAME, finishAddBufferingBar);
};
break;
};
setEnabledAndVisibleForState(index, _vc.state);
} else {
controls[index] = ctrl;
addButtonControl(ctrl);
};
}
flvplayback_internal function bitmapCopyBorder():void{
var _local1:Rectangle;
var _local2:BitmapData;
var _local3:Matrix;
var _local4:Number;
var _local5:Number;
var _local6:Rectangle;
var _local7:int;
var _local8:int;
var _local9:Bitmap;
var _local10:Number;
var _local11:Number;
if ((((border_mc == null)) || ((borderCopy == null)))){
return;
};
_local1 = border_mc.getBounds(skin_mc);
if ((((borderPrevRect == null)) || (!(borderPrevRect.equals(_local1))))){
borderCopy.x = _local1.x;
borderCopy.y = _local1.y;
_local3 = new Matrix(border_mc.scaleX, 0, 0, border_mc.scaleY, 0, 0);
if (borderScale9Rects == null){
_local2 = new BitmapData(_local1.width, _local1.height, true, 0);
_local2.draw(border_mc, _local3, borderColorTransform);
Bitmap(borderCopy.getChildAt(0)).bitmapData = _local2;
} else {
_local4 = 0;
_local5 = 0;
_local6 = new Rectangle(0, 0, 0, 0);
_local7 = 0;
_local8 = 0;
while (_local8 < borderScale9Rects.length) {
if ((_local8 % 3) == 0){
_local4 = 0;
_local5 = (_local5 + _local6.height);
};
if (borderScale9Rects[_local8] == null){
} else {
_local6 = Rectangle(borderScale9Rects[_local8]).clone();
_local3.a = 1;
if ((((((_local8 == 1)) || ((_local8 == 4)))) || ((_local8 == 7)))){
_local10 = ((_local1.width - (_local4 * 2)) / _local6.width);
_local6.x = (_local6.x * _local10);
_local6.width = (_local6.width * _local10);
_local6.width = Math.round(_local6.width);
_local3.a = (_local3.a * _local10);
};
_local3.tx = -(_local6.x);
_local6.x = 0;
_local3.d = 1;
if ((((_local8 >= 3)) && ((_local8 <= 5)))){
_local11 = ((_local1.height - (_local5 * 2)) / _local6.height);
_local6.y = (_local6.y * _local11);
_local6.height = (_local6.height * _local11);
_local6.height = Math.round(_local6.height);
_local3.d = (_local3.d * _local11);
};
_local3.ty = -(_local6.y);
_local6.y = 0;
_local2 = new BitmapData(_local6.width, _local6.height, true, 0);
_local2.draw(border_mc, _local3, borderColorTransform, null, _local6, false);
_local9 = Bitmap(borderCopy.getChildAt(_local7));
_local7++;
_local9.bitmapData = _local2;
_local9.x = _local4;
_local9.y = _local5;
_local4 = (_local4 + _local6.width);
};
_local8++;
};
};
borderPrevRect = _local1;
};
}
flvplayback_internal function createSkin(_arg1:DisplayObject, _arg2:String):DisplayObject{
var stateSkinDesc:*;
var theClass:Class;
var definitionHolder = _arg1;
var skinName = _arg2;
try {
stateSkinDesc = definitionHolder[skinName];
if ((stateSkinDesc is String)){
try {
theClass = Class(definitionHolder.loaderInfo.applicationDomain.getDefinition(stateSkinDesc));
} catch(err1:Error) {
theClass = Class(getDefinitionByName(stateSkinDesc));
};
return (DisplayObject(new (theClass)));
} else {
if ((stateSkinDesc is Class)){
return (new (stateSkinDesc));
} else {
if ((stateSkinDesc is DisplayObject)){
return (stateSkinDesc);
};
};
};
} catch(err2:Error) {
throw (new VideoError(VideoError.MISSING_SKIN_STYLE, skinName));
};
return (null);
}
flvplayback_internal function hookUpCustomComponents():void{
var searchHash:Object;
var doTheSearch:Boolean;
var i:int;
var dispObj:DisplayObject;
var name:String;
var index:int;
var ctrl:Sprite;
searchHash = new Object();
doTheSearch = false;
i = 0;
while (i < NUM_CONTROLS) {
if (controls[i] == null){
searchHash[customComponentClassNames[i]] = i;
doTheSearch = true;
};
i = (i + 1);
};
if (!doTheSearch){
return;
};
i = 0;
while (i < _vc.parent.numChildren) {
dispObj = _vc.parent.getChildAt(i);
name = getQualifiedClassName(dispObj);
if (searchHash[name] != undefined){
if (typeof(searchHash[name]) == "number"){
index = int(searchHash[name]);
try {
ctrl = Sprite(dispObj);
if ((((((index >= NUM_BUTTONS)) || ((ctrl["placeholder_mc"] is DisplayObject)))) && ((ctrl["uiMgr"] == null)))){
setControl(index, ctrl);
searchHash[name] = ctrl;
};
} catch(err:Error) {
};
};
};
i = (i + 1);
};
}
flvplayback_internal function addButtonControl(_arg1:Sprite):void{
var _local2:ControlData;
var _local3:int;
if (_arg1 == null){
return;
};
_local2 = ctrlDataDict[_arg1];
_arg1.mouseChildren = false;
_local3 = _vc.activeVideoPlayerIndex;
_vc.activeVideoPlayerIndex = _vc.visibleVideoPlayerIndex;
_local2.state = NORMAL_STATE;
setEnabledAndVisibleForState(_local2.index, _vc.state);
_arg1.addEventListener(MouseEvent.ROLL_OVER, handleButtonEvent);
_arg1.addEventListener(MouseEvent.ROLL_OUT, handleButtonEvent);
_arg1.addEventListener(MouseEvent.MOUSE_DOWN, handleButtonEvent);
_arg1.addEventListener(MouseEvent.CLICK, handleButtonEvent);
if (_arg1.parent == skin_mc){
skinButtonControl(_arg1);
} else {
_arg1.addEventListener(Event.ENTER_FRAME, skinButtonControl);
};
_vc.activeVideoPlayerIndex = _local3;
}
flvplayback_internal function positionHandle(_arg1:Sprite):void{
var _local2:ControlData;
var _local3:Sprite;
var _local4:ControlData;
var _local5:Number;
var _local6:Number;
if (_arg1 == null){
return;
};
if ((((_arg1["positionHandle"] is Function)) && (_arg1["positionHandle"]()))){
return;
};
_local2 = ctrlDataDict[_arg1];
_local3 = _local2.handle_mc;
if (_local3 == null){
return;
};
_local4 = ctrlDataDict[_local3];
_local5 = (isNaN(_local2.origWidth)) ? _arg1.width : _local2.origWidth;
_local6 = ((_local5 - _local4.rightMargin) - _local4.leftMargin);
_local3.x = ((_arg1.x + _local4.leftMargin) + ((_local6 * _local2.percentage) / 100));
_local3.y = (_arg1.y + _local4.origY);
if (_local2.fullness_mc != null){
positionBar(_arg1, "fullness", _local2.percentage);
};
}
flvplayback_internal function exitFullScreenTakeOver():void{
var fullScreenBG:Sprite;
if (cacheStageAlign == null){
return;
};
_vc.removeEventListener(Event.ADDED_TO_STAGE, handleEvent);
try {
_vc.stage.align = cacheStageAlign;
_vc.stage.scaleMode = cacheStageScaleMode;
if (_vc.parent != cacheFLVPlaybackParent){
cacheFLVPlaybackParent.addChildAt(_vc, cacheFLVPlaybackIndex);
} else {
cacheFLVPlaybackParent.setChildIndex(_vc, cacheFLVPlaybackIndex);
};
if (cacheStageAlign == null){
return;
};
_vc.registrationX = cacheFLVPlaybackLocation.x;
_vc.registrationY = cacheFLVPlaybackLocation.y;
_vc.setSize(cacheFLVPlaybackLocation.width, cacheFLVPlaybackLocation.height);
fullScreenBG = Sprite(_vc.getChildByName("fullScreenBG"));
if (fullScreenBG != null){
_vc.removeChild(fullScreenBG);
};
} catch(err:Error) {
};
_vc.addEventListener(Event.ADDED_TO_STAGE, handleEvent);
cacheStageAlign = null;
cacheStageScaleMode = null;
cacheFLVPlaybackParent = null;
cacheFLVPlaybackIndex = 0;
cacheFLVPlaybackLocation = null;
if (_skinAutoHide != cacheSkinAutoHide){
_skinAutoHide = cacheSkinAutoHide;
setupSkinAutoHide(false);
};
}
flvplayback_internal function positionMaskedFill(_arg1:DisplayObject, _arg2:Number):void{
var ctrlData:ControlData;
var fill:DisplayObject;
var mask:DisplayObject;
var fillData:ControlData;
var maskData:ControlData;
var slideReveal:Boolean;
var maskSprite:Sprite;
var barData:ControlData;
var ctrl = _arg1;
var percent = _arg2;
if (ctrl == null){
return;
};
ctrlData = ctrlDataDict[ctrl];
fill = ctrlData.fill_mc;
if (fill == null){
return;
};
mask = ctrlData.mask_mc;
if (ctrlData.mask_mc == null){
try {
var _local4 = ctrl["mask_mc"];
mask = _local4;
ctrlData.mask_mc = _local4;
} catch(re:ReferenceError) {
ctrlData.mask_mc = null;
};
if (ctrlData.mask_mc == null){
maskSprite = new Sprite();
_local4 = maskSprite;
mask = _local4;
ctrlData.mask_mc = _local4;
maskSprite.graphics.beginFill(0xFFFFFF);
maskSprite.graphics.drawRect(0, 0, 1, 1);
maskSprite.graphics.endFill();
barData = ctrlDataDict[fill];
maskSprite.x = barData.origX;
maskSprite.y = barData.origY;
maskSprite.width = barData.origWidth;
maskSprite.height = barData.origHeight;
maskSprite.visible = false;
fill.parent.addChild(maskSprite);
fill.mask = maskSprite;
};
if (ctrlData.mask_mc != null){
calcBarMargins(ctrl, "mask", true);
};
};
fillData = ctrlDataDict[fill];
maskData = ctrlDataDict[mask];
try {
slideReveal = fill["slideReveal"];
} catch(re:ReferenceError) {
slideReveal = false;
};
if (fill.parent == ctrl){
if (slideReveal){
fill.x = ((maskData.origX - fillData.origWidth) + ((fillData.origWidth * percent) / 100));
} else {
mask.width = ((fillData.origWidth * percent) / 100);
};
} else {
if (fill.parent == ctrl.parent){
if (slideReveal){
mask.x = (ctrl.x + maskData.leftMargin);
mask.y = (ctrl.y + maskData.topMargin);
mask.width = ((ctrl.width - maskData.rightMargin) - maskData.leftMargin);
mask.height = ((ctrl.height - maskData.topMargin) - maskData.bottomMargin);
fill.x = ((mask.x - fillData.origWidth) + ((maskData.origWidth * percent) / 100));
fill.y = (ctrl.y + fillData.topMargin);
} else {
fill.x = (ctrl.x + fillData.leftMargin);
fill.y = (ctrl.y + fillData.topMargin);
mask.x = fill.x;
mask.y = fill.y;
mask.width = ((((ctrl.width - fillData.rightMargin) - fillData.leftMargin) * percent) / 100);
mask.height = ((ctrl.height - fillData.topMargin) - fillData.bottomMargin);
};
};
};
}
flvplayback_internal function calcPercentageFromHandle(_arg1:Sprite):void{
var _local2:ControlData;
var _local3:Sprite;
var _local4:ControlData;
var _local5:Number;
var _local6:Number;
var _local7:Number;
if (_arg1 == null){
return;
};
_local2 = ctrlDataDict[_arg1];
if ((((_arg1["calcPercentageFromHandle"] is Function)) && (_arg1["calcPercentageFromHandle"]()))){
if (_local2.percentage < 0){
_local2.percentage = 0;
};
if (_local2.percentage > 100){
_local2.percentage = 100;
};
return;
};
_local3 = _local2.handle_mc;
if (_local3 == null){
return;
};
_local4 = ctrlDataDict[_local3];
_local5 = (isNaN(_local2.origWidth)) ? _arg1.width : _local2.origWidth;
_local6 = ((_local5 - _local4.rightMargin) - _local4.leftMargin);
_local7 = (_local3.x - (_arg1.x + _local4.leftMargin));
_local2.percentage = ((_local7 / _local6) * 100);
if (_local2.percentage < 0){
_local2.percentage = 0;
};
if (_local2.percentage > 100){
_local2.percentage = 100;
};
if (_local2.fullness_mc != null){
positionBar(_arg1, "fullness", _local2.percentage);
};
}
flvplayback_internal function skinAutoHideHitTest(_arg1:TimerEvent, _arg2:Boolean=true):void{
var visibleVP:VideoPlayer;
var hit:Boolean;
var e = _arg1;
var doFade = _arg2;
try {
if (!__visible){
skin_mc.visible = false;
} else {
if (_vc.stage != null){
visibleVP = _vc.getVideoPlayer(_vc.visibleVideoPlayerIndex);
hit = visibleVP.hitTestPoint(_vc.stage.mouseX, _vc.stage.mouseY, true);
if (((((_fullScreen) && (_fullScreenTakeOver))) && (!((e == null))))){
if ((((_vc.stage.mouseX == _skinAutoHideMouseX)) && ((_vc.stage.mouseY == _skinAutoHideMouseY)))){
if ((getTimer() - _skinAutoHideLastMotionTime) > _skinAutoHideMotionTimeout){
hit = false;
};
} else {
_skinAutoHideLastMotionTime = getTimer();
_skinAutoHideMouseX = _vc.stage.mouseX;
_skinAutoHideMouseY = _vc.stage.mouseY;
};
};
if (((!(hit)) && (!((border_mc == null))))){
hit = border_mc.hitTestPoint(_vc.stage.mouseX, _vc.stage.mouseY, true);
if (((((hit) && (_fullScreen))) && (_fullScreenTakeOver))){
_skinAutoHideLastMotionTime = getTimer();
};
};
if (((!(doFade)) || ((_skinFadingMaxTime <= 0)))){
_skinFadingTimer.stop();
skin_mc.visible = hit;
skin_mc.alpha = 1;
} else {
if (((((((hit) && (skin_mc.visible))) && (((!(_skinFadingTimer.running)) || (_skinFadingIn))))) || (((!(hit)) && (((!(skin_mc.visible)) || (((_skinFadingTimer.running) && (!(_skinFadingIn)))))))))){
} else {
_skinFadingTimer.stop();
_skinFadingIn = hit;
if (((_skinFadingIn) && ((skin_mc.alpha == 1)))){
skin_mc.alpha = 0;
};
_skinFadeStartTime = getTimer();
_skinFadingTimer.start();
skin_mc.visible = true;
};
};
};
};
} catch(se:SecurityError) {
_skinAutoHideTimer.stop();
_skinFadingTimer.stop();
skin_mc.visible = __visible;
skin_mc.alpha = 1;
};
}
flvplayback_internal function handleRelease(_arg1:int):void{
var _local2:int;
_local2 = _vc.activeVideoPlayerIndex;
_vc.activeVideoPlayerIndex = _vc.visibleVideoPlayerIndex;
if (_arg1 == SEEK_BAR){
seekBarListener(null);
} else {
if (_arg1 == VOLUME_BAR){
volumeBarListener(null);
};
};
stopHandleDrag(controls[_arg1]);
_vc.activeVideoPlayerIndex = _local2;
if (_arg1 == SEEK_BAR){
_vc._scrubFinish();
};
}
flvplayback_internal function setTwoButtonHolderSkin(_arg1:int, _arg2:int, _arg3:String, _arg4:int, _arg5:String):Sprite{
var _local6:Sprite;
var _local7:Sprite;
var _local8:ControlData;
_local7 = new Sprite();
_local8 = new ControlData(this, _local7, null, _arg1);
ctrlDataDict[_local7] = _local8;
skin_mc.addChild(_local7);
_local6 = setupButtonSkin(_arg2);
_local6.name = _arg3;
_local6.visible = true;
_local7.addChild(_local6);
_local6 = setupButtonSkin(_arg4);
_local6.name = _arg5;
_local6.visible = false;
_local7.addChild(_local6);
return (_local7);
}
public function set seekBarInterval(_arg1:Number):void{
if (_seekBarTimer.delay == _arg1){
return;
};
_seekBarTimer.delay = _arg1;
}
flvplayback_internal function layoutControl(_arg1:DisplayObject):void{
var _local2:ControlData;
var _local3:Rectangle;
var _local4:Sprite;
var _local5:Rectangle;
if (_arg1 == null){
return;
};
_local2 = ctrlDataDict[_arg1];
if (_local2 == null){
return;
};
if (_local2.avatar == null){
return;
};
_local3 = calcLayoutControl(_arg1);
_arg1.x = _local3.x;
_arg1.y = _local3.y;
_arg1.width = _local3.width;
_arg1.height = _local3.height;
switch (_local2.index){
case SEEK_BAR:
case VOLUME_BAR:
if (((!((_local2.hit_mc == null))) && ((_local2.hit_mc.parent == skin_mc)))){
_local4 = _local2.hit_mc;
_local5 = calcLayoutControl(_local4);
_local4.x = _local5.x;
_local4.y = _local5.y;
_local4.width = _local5.width;
_local4.height = _local5.height;
};
if (_local2.progress_mc != null){
if (isNaN(_progressPercent)){
_progressPercent = (_vc.isRTMP) ? 100 : 0;
};
positionBar(Sprite(_arg1), "progress", _progressPercent);
};
positionHandle(Sprite(_arg1));
break;
case BUFFERING_BAR:
positionMaskedFill(_arg1, 100);
break;
};
}
public function set fullScreenSkinDelay(_arg1:int):void{
_skinAutoHideMotionTimeout = _arg1;
}
flvplayback_internal function captureMouseEvent(_arg1:MouseEvent):void{
_arg1.stopPropagation();
}
flvplayback_internal function handleMouseUp(_arg1:MouseEvent):void{
var _local2:Sprite;
var _local3:ControlData;
_local2 = controls[mouseCaptureCtrl];
if (_local2 != null){
_local3 = ctrlDataDict[_local2];
_local3.state = (_local2.hitTestPoint(_arg1.stageX, _arg1.stageY, true)) ? OVER_STATE : NORMAL_STATE;
skinButtonControl(_local2);
switch (mouseCaptureCtrl){
case SEEK_BAR_HANDLE:
case SEEK_BAR_HIT:
handleRelease(SEEK_BAR);
break;
case VOLUME_BAR_HANDLE:
case VOLUME_BAR_HIT:
handleRelease(VOLUME_BAR);
break;
};
};
_arg1.currentTarget.removeEventListener(MouseEvent.MOUSE_DOWN, captureMouseEvent, true);
_arg1.currentTarget.removeEventListener(MouseEvent.MOUSE_OUT, captureMouseEvent, true);
_arg1.currentTarget.removeEventListener(MouseEvent.MOUSE_OVER, captureMouseEvent, true);
_arg1.currentTarget.removeEventListener(MouseEvent.MOUSE_UP, handleMouseUp);
_arg1.currentTarget.removeEventListener(MouseEvent.ROLL_OUT, captureMouseEvent, true);
_arg1.currentTarget.removeEventListener(MouseEvent.ROLL_OVER, captureMouseEvent, true);
}
public function set visible(_arg1:Boolean):void{
if (__visible == _arg1){
return;
};
__visible = _arg1;
if (!__visible){
skin_mc.visible = false;
} else {
setupSkinAutoHide(false);
};
}
public function get bufferingDelayInterval():Number{
return (_bufferingDelayTimer.delay);
}
public function set fullScreenBackgroundColor(_arg1:uint):void{
if (_fullScreenBgColor != _arg1){
_fullScreenBgColor = _arg1;
if (_vc){
};
};
}
public function get fullScreenTakeOver():Boolean{
return (_fullScreenTakeOver);
}
public function set skin(_arg1:String):void{
var _local2:String;
if (_arg1 == null){
removeSkin();
_skin = null;
_skinReady = true;
} else {
_local2 = String(_arg1);
if (_arg1 == _skin){
return;
};
removeSkin();
_skin = String(_arg1);
_skinReady = (_skin == "");
if (!_skinReady){
downloadSkin();
};
};
}
public function set volumeBarInterval(_arg1:Number):void{
if (_volumeBarTimer.delay == _arg1){
return;
};
_volumeBarTimer.delay = _arg1;
}
flvplayback_internal function setSkin(_arg1:int, _arg2:DisplayObject):void{
var _local3:Sprite;
var _local4:ControlData;
var _local5:String;
if (_arg1 >= NUM_CONTROLS){
return;
};
if (_arg1 < NUM_BUTTONS){
_local3 = setupButtonSkin(_arg1);
skin_mc.addChild(_local3);
_local4 = ctrlDataDict[_local3];
} else {
switch (_arg1){
case PLAY_PAUSE_BUTTON:
_local3 = setTwoButtonHolderSkin(_arg1, PLAY_BUTTON, "play_mc", PAUSE_BUTTON, "pause_mc");
_local4 = ctrlDataDict[_local3];
break;
case FULL_SCREEN_BUTTON:
_local3 = setTwoButtonHolderSkin(_arg1, FULL_SCREEN_ON_BUTTON, "on_mc", FULL_SCREEN_OFF_BUTTON, "off_mc");
_local4 = ctrlDataDict[_local3];
break;
case MUTE_BUTTON:
_local3 = setTwoButtonHolderSkin(_arg1, MUTE_ON_BUTTON, "on_mc", MUTE_OFF_BUTTON, "off_mc");
_local4 = ctrlDataDict[_local3];
break;
case SEEK_BAR:
case VOLUME_BAR:
_local5 = skinClassPrefixes[_arg1];
_local3 = Sprite(createSkin(skinTemplate, _local5));
if (_local3 != null){
skin_mc.addChild(_local3);
_local4 = new ControlData(this, _local3, null, _arg1);
ctrlDataDict[_local3] = _local4;
_local4.progress_mc = setupBarSkinPart(_local3, _arg2, skinTemplate, (_local5 + "Progress"), "progress_mc");
_local4.fullness_mc = setupBarSkinPart(_local3, _arg2, skinTemplate, (_local5 + "Fullness"), "fullness_mc");
_local4.hit_mc = Sprite(setupBarSkinPart(_local3, _arg2, skinTemplate, (_local5 + "Hit"), "hit_mc"));
_local4.handle_mc = Sprite(setupBarSkinPart(_local3, _arg2, skinTemplate, (_local5 + "Handle"), "handle_mc", true));
_local3.width = _arg2.width;
_local3.height = _arg2.height;
};
break;
case BUFFERING_BAR:
_local5 = skinClassPrefixes[_arg1];
_local3 = Sprite(createSkin(skinTemplate, _local5));
if (_local3 != null){
skin_mc.addChild(_local3);
_local4 = new ControlData(this, _local3, null, _arg1);
ctrlDataDict[_local3] = _local4;
_local4.fill_mc = setupBarSkinPart(_local3, _arg2, skinTemplate, (_local5 + "Fill"), "fill_mc");
_local3.width = _arg2.width;
_local3.height = _arg2.height;
};
break;
};
};
_local4.avatar = _arg2;
ctrlDataDict[_local3] = _local4;
delayedControls[_arg1] = _local3;
}
public function set bufferingBarHidesAndDisablesOthers(_arg1:Boolean):void{
_bufferingBarHides = _arg1;
}
flvplayback_internal function handleSoundEvent(_arg1:SoundEvent):void{
var _local2:Sprite;
var _local3:ControlData;
if (((_isMuted) && ((_arg1.soundTransform.volume > 0)))){
_isMuted = false;
setEnabledAndVisibleForState(MUTE_OFF_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[MUTE_OFF_BUTTON]);
setEnabledAndVisibleForState(MUTE_ON_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[MUTE_ON_BUTTON]);
};
_local2 = controls[VOLUME_BAR];
if (_local2 != null){
_local3 = ctrlDataDict[_local2];
_local3.percentage = ((_isMuted) ? cachedSoundLevel : _arg1.soundTransform.volume * 100);
if (_local3.percentage < 0){
_local3.percentage = 0;
} else {
if (_local3.percentage > 100){
_local3.percentage = 100;
};
};
positionHandle(_local2);
};
}
flvplayback_internal function stopHandleDrag(_arg1:Sprite):void{
var ctrlData:ControlData;
var handle:Sprite;
var ctrl = _arg1;
if (ctrl == null){
return;
};
ctrlData = ctrlDataDict[ctrl];
try {
if ((((ctrl["stopHandleDrag"] is Function)) && (ctrl["stopHandleDrag"]()))){
ctrlData.isDragging = false;
return;
};
} catch(re:ReferenceError) {
};
handle = ctrlData.handle_mc;
if (handle == null){
return;
};
handle.stopDrag();
ctrlData.isDragging = false;
}
public function set skinBackgroundAlpha(_arg1:Number):void{
if (borderAlpha != _arg1){
borderAlpha = _arg1;
borderColorTransform.alphaOffset = (0xFF * _arg1);
borderPrevRect = null;
layoutSkin();
};
}
public function getControl(_arg1:int):Sprite{
return (controls[_arg1]);
}
public function set volumeBarScrubTolerance(_arg1:Number):void{
_volumeBarScrubTolerance = _arg1;
}
flvplayback_internal function calcBarMargins(_arg1:DisplayObject, _arg2:String, _arg3:Boolean):void{
var ctrlData:ControlData;
var bar:DisplayObject;
var barData:ControlData;
var ctrl = _arg1;
var type = _arg2;
var symmetricMargins = _arg3;
if (ctrl == null){
return;
};
ctrlData = ctrlDataDict[ctrl];
bar = ctrlData[(type + "_mc")];
if (bar == null){
try {
bar = ctrl[(type + "_mc")];
} catch(re:ReferenceError) {
bar = null;
};
if (bar == null){
return;
};
ctrlData[(type + "_mc")] = bar;
};
barData = ctrlDataDict[bar];
if (barData == null){
barData = new ControlData(this, bar, ctrl, -1);
ctrlDataDict[bar] = barData;
};
barData.leftMargin = getNumberPropSafe(ctrl, (type + "LeftMargin"));
if (((isNaN(barData.leftMargin)) && ((bar.parent == ctrl.parent)))){
barData.leftMargin = (bar.x - ctrl.x);
};
barData.rightMargin = getNumberPropSafe(ctrl, (type + "RightMargin"));
if (isNaN(barData.rightMargin)){
if (symmetricMargins){
barData.rightMargin = barData.leftMargin;
} else {
if (bar.parent == ctrl.parent){
barData.rightMargin = (((ctrl.width - bar.width) - bar.x) + ctrl.x);
};
};
};
barData.topMargin = getNumberPropSafe(ctrl, (type + "TopMargin"));
if (((isNaN(barData.topMargin)) && ((bar.parent == ctrl.parent)))){
barData.topMargin = (bar.y - ctrl.y);
};
barData.bottomMargin = getNumberPropSafe(ctrl, (type + "BottomMargin"));
if (isNaN(barData.bottomMargin)){
if (symmetricMargins){
barData.bottomMargin = barData.topMargin;
} else {
if (bar.parent == ctrl.parent){
barData.bottomMargin = (((ctrl.height - bar.height) - bar.y) + ctrl.y);
};
};
};
barData.origX = getNumberPropSafe(ctrl, (type + "X"));
if (isNaN(barData.origX)){
if (bar.parent == ctrl.parent){
barData.origX = (bar.x - ctrl.x);
} else {
if (bar.parent == ctrl){
barData.origX = bar.x;
};
};
};
barData.origY = getNumberPropSafe(ctrl, (type + "Y"));
if (isNaN(barData.origY)){
if (bar.parent == ctrl.parent){
barData.origY = (bar.y - ctrl.y);
} else {
if (bar.parent == ctrl){
barData.origY = bar.y;
};
};
};
barData.origWidth = bar.width;
barData.origHeight = bar.height;
barData.origScaleX = bar.scaleX;
barData.origScaleY = bar.scaleY;
}
public function set skinBackgroundColor(_arg1:uint):void{
if (borderColor != _arg1){
borderColor = _arg1;
borderColorTransform.redOffset = ((borderColor >> 16) & 0xFF);
borderColorTransform.greenOffset = ((borderColor >> 8) & 0xFF);
borderColorTransform.blueOffset = (borderColor & 0xFF);
borderPrevRect = null;
layoutSkin();
};
}
flvplayback_internal function handleLoad(_arg1:Event):void{
var i:int;
var dispObj:DisplayObject;
var index:Number;
var e = _arg1;
try {
skin_mc = new Sprite();
if (e != null){
skinTemplate = Sprite(skinLoader.content);
};
layout_mc = skinTemplate;
customClips = new Array();
delayedControls = new Array();
i = 0;
while (i < layout_mc.numChildren) {
dispObj = layout_mc.getChildAt(i);
index = layoutNameToIndexMappings[dispObj.name];
if (!isNaN(index)){
setSkin(int(index), dispObj);
} else {
if (dispObj.name != "video_mc"){
setCustomClip(dispObj);
};
};
i = (i + 1);
};
skinLoadDelayCount = 0;
_vc.addEventListener(Event.ENTER_FRAME, finishLoad);
} catch(err:Error) {
_vc.skinError(err.message);
removeSkin();
};
}
flvplayback_internal function finishAddBufferingBar(_arg1:Event=null):void{
var _local2:Sprite;
if (_arg1 != null){
_arg1.currentTarget.removeEventListener(Event.ENTER_FRAME, finishAddBufferingBar);
};
_local2 = controls[BUFFERING_BAR];
calcBarMargins(_local2, "fill", true);
fixUpBar(_local2, "fill", _local2, "fill_mc");
positionMaskedFill(_local2, 100);
}
flvplayback_internal function handleButtonEvent(_arg1:MouseEvent):void{
var ctrlData:ControlData;
var topLevel:DisplayObject;
var e = _arg1;
ctrlData = ctrlDataDict[e.currentTarget];
switch (e.type){
case MouseEvent.ROLL_OVER:
ctrlData.state = OVER_STATE;
break;
case MouseEvent.ROLL_OUT:
ctrlData.state = NORMAL_STATE;
break;
case MouseEvent.MOUSE_DOWN:
ctrlData.state = DOWN_STATE;
mouseCaptureCtrl = ctrlData.index;
switch (mouseCaptureCtrl){
case SEEK_BAR_HANDLE:
case SEEK_BAR_HIT:
case VOLUME_BAR_HANDLE:
case VOLUME_BAR_HIT:
dispatchMessage(ctrlData.index);
break;
};
topLevel = _vc.stage;
try {
topLevel.addEventListener(MouseEvent.MOUSE_DOWN, captureMouseEvent, true);
} catch(se:SecurityError) {
topLevel = _vc.root;
topLevel.addEventListener(MouseEvent.MOUSE_DOWN, captureMouseEvent, true);
};
topLevel.addEventListener(MouseEvent.MOUSE_OUT, captureMouseEvent, true);
topLevel.addEventListener(MouseEvent.MOUSE_OVER, captureMouseEvent, true);
topLevel.addEventListener(MouseEvent.MOUSE_UP, handleMouseUp);
topLevel.addEventListener(MouseEvent.ROLL_OUT, captureMouseEvent, true);
topLevel.addEventListener(MouseEvent.ROLL_OVER, captureMouseEvent, true);
break;
case MouseEvent.CLICK:
switch (mouseCaptureCtrl){
case SEEK_BAR_HANDLE:
case SEEK_BAR_HIT:
case VOLUME_BAR_HANDLE:
case VOLUME_BAR_HIT:
break;
default:
dispatchMessage(ctrlData.index);
break;
};
return;
};
skinButtonControl(e.currentTarget);
}
flvplayback_internal function applySkinState(_arg1:ControlData, _arg2:DisplayObject):void{
if (_arg2 != _arg1.currentState_mc){
if (_arg1.currentState_mc != null){
_arg1.currentState_mc.visible = false;
};
_arg1.currentState_mc = _arg2;
_arg1.currentState_mc.visible = true;
};
}
flvplayback_internal function handleLoadErrorEvent(_arg1:ErrorEvent):void{
_skinReady = true;
_vc.skinError(_arg1.toString());
}
flvplayback_internal function addBarControl(_arg1:Sprite):void{
var _local2:ControlData;
_local2 = ctrlDataDict[_arg1];
_local2.isDragging = false;
_local2.percentage = 0;
if ((((_arg1.parent == skin_mc)) && (!((skin_mc == null))))){
finishAddBarControl(_arg1);
} else {
_arg1.addEventListener(Event.REMOVED_FROM_STAGE, cleanupHandle);
_arg1.addEventListener(Event.ENTER_FRAME, finishAddBarControl);
};
}
flvplayback_internal function handleEvent(_arg1:Event):void{
var e = _arg1;
switch (e.type){
case Event.ADDED_TO_STAGE:
_fullScreen = false;
if (_vc.stage != null){
try {
_fullScreen = (_vc.stage.displayState == StageDisplayState.FULL_SCREEN);
_vc.stage.addEventListener(FullScreenEvent.FULL_SCREEN, handleFullScreenEvent);
} catch(se:SecurityError) {
};
};
setEnabledAndVisibleForState(FULL_SCREEN_OFF_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[FULL_SCREEN_OFF_BUTTON]);
setEnabledAndVisibleForState(FULL_SCREEN_ON_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[FULL_SCREEN_ON_BUTTON]);
if (((_fullScreen) && (_fullScreenTakeOver))){
enterFullScreenTakeOver();
} else {
if (!_fullScreen){
exitFullScreenTakeOver();
};
};
layoutSkin();
setupSkinAutoHide(false);
break;
};
}
flvplayback_internal function skinButtonControl(_arg1:Object):void{
var ctrl:Sprite;
var ctrlData:ControlData;
var e:Event;
var ctrlOrEvent = _arg1;
if (ctrlOrEvent == null){
return;
};
if ((ctrlOrEvent is Event)){
e = Event(ctrlOrEvent);
ctrl = Sprite(e.currentTarget);
ctrl.removeEventListener(Event.ENTER_FRAME, skinButtonControl);
} else {
ctrl = Sprite(ctrlOrEvent);
};
ctrlData = ctrlDataDict[ctrl];
if (ctrlData == null){
return;
};
try {
if (ctrl["placeholder_mc"] != undefined){
ctrl.removeChild(ctrl["placeholder_mc"]);
ctrl["placeholder_mc"] = null;
};
} catch(re:ReferenceError) {
};
if (ctrlData.state_mc == null){
ctrlData.state_mc = new Array();
};
if (ctrlData.state_mc[NORMAL_STATE] == undefined){
ctrlData.state_mc[NORMAL_STATE] = setupButtonSkinState(ctrl, ctrl, buttonSkinLinkageIDs[NORMAL_STATE], null);
};
if (((ctrlData.enabled) && (_controlsEnabled))){
if (ctrlData.state_mc[ctrlData.state] == undefined){
ctrlData.state_mc[ctrlData.state] = setupButtonSkinState(ctrl, ctrl, buttonSkinLinkageIDs[ctrlData.state], ctrlData.state_mc[NORMAL_STATE]);
};
if (ctrlData.state_mc[ctrlData.state] != ctrlData.currentState_mc){
if (ctrlData.currentState_mc != null){
ctrlData.currentState_mc.visible = false;
};
ctrlData.currentState_mc = ctrlData.state_mc[ctrlData.state];
ctrlData.currentState_mc.visible = true;
};
applySkinState(ctrlData, ctrlData.state_mc[ctrlData.state]);
} else {
ctrlData.state = NORMAL_STATE;
if (ctrlData.disabled_mc == null){
ctrlData.disabled_mc = setupButtonSkinState(ctrl, ctrl, "disabledLinkageID", ctrlData.state_mc[NORMAL_STATE]);
};
applySkinState(ctrlData, ctrlData.disabled_mc);
};
}
public function set controlsEnabled(_arg1:Boolean):void{
var _local2:int;
if (_controlsEnabled == _arg1){
return;
};
_controlsEnabled = _arg1;
_local2 = 0;
while (_local2 < NUM_BUTTONS) {
skinButtonControl(controls[_local2]);
_local2++;
};
}
flvplayback_internal function setupSkinAutoHide(_arg1:Boolean):void{
if (((_skinAutoHide) && (!((skin_mc == null))))){
skinAutoHideHitTest(null, _arg1);
_skinAutoHideTimer.start();
} else {
if (skin_mc != null){
if (((((((_arg1) && ((_skinFadingMaxTime > 0)))) && (((!(skin_mc.visible)) || ((skin_mc.alpha < 1)))))) && (__visible))){
_skinFadingTimer.stop();
_skinFadeStartTime = getTimer();
_skinFadingIn = true;
if (skin_mc.alpha == 1){
skin_mc.alpha = 0;
};
_skinFadingTimer.start();
} else {
if (_skinFadingMaxTime <= 0){
_skinFadingTimer.stop();
skin_mc.alpha = 1;
};
};
skin_mc.visible = __visible;
};
_skinAutoHideTimer.stop();
};
}
flvplayback_internal function finishAddBarControl(_arg1:Object):void{
var ctrl:Sprite;
var ctrlData:ControlData;
var e:Event;
var ctrlOrEvent = _arg1;
if (ctrlOrEvent == null){
return;
};
if ((ctrlOrEvent is Event)){
e = Event(ctrlOrEvent);
ctrl = Sprite(e.currentTarget);
ctrl.removeEventListener(Event.ENTER_FRAME, finishAddBarControl);
} else {
ctrl = Sprite(ctrlOrEvent);
};
ctrlData = ctrlDataDict[ctrl];
try {
if ((ctrl["addBarControl"] is Function)){
var _local3 = ctrl;
_local3["addBarControl"]();
};
} catch(re:ReferenceError) {
};
ctrlData.origWidth = ctrl.width;
ctrlData.origHeight = ctrl.height;
fixUpBar(ctrl, "progress", ctrl, "progress_mc");
calcBarMargins(ctrl, "progress", false);
if (ctrlData.progress_mc != null){
fixUpBar(ctrl, "progressBarFill", ctrlData.progress_mc, "fill_mc");
calcBarMargins(ctrlData.progress_mc, "fill", false);
calcBarMargins(ctrlData.progress_mc, "mask", false);
if (isNaN(_progressPercent)){
_progressPercent = (_vc.isRTMP) ? 100 : 0;
};
positionBar(ctrl, "progress", _progressPercent);
};
fixUpBar(ctrl, "fullness", ctrl, "fullness_mc");
calcBarMargins(ctrl, "fullness", false);
if (ctrlData.fullness_mc != null){
fixUpBar(ctrl, "fullnessBarFill", ctrlData.fullness_mc, "fill_mc");
calcBarMargins(ctrlData.fullness_mc, "fill", false);
calcBarMargins(ctrlData.fullness_mc, "mask", false);
};
fixUpBar(ctrl, "hit", ctrl, "hit_mc");
fixUpBar(ctrl, "handle", ctrl, "handle_mc");
calcBarMargins(ctrl, "handle", true);
switch (ctrlData.index){
case SEEK_BAR:
setControl(SEEK_BAR_HANDLE, ctrlData.handle_mc);
if (ctrlData.hit_mc != null){
setControl(SEEK_BAR_HIT, ctrlData.hit_mc);
};
break;
case VOLUME_BAR:
setControl(VOLUME_BAR_HANDLE, ctrlData.handle_mc);
if (ctrlData.hit_mc != null){
setControl(VOLUME_BAR_HIT, ctrlData.hit_mc);
};
break;
};
positionHandle(ctrl);
}
public function get skin():String{
return (_skin);
}
public function get fullScreenBackgroundColor():uint{
return (_fullScreenBgColor);
}
flvplayback_internal function startHandleDrag(_arg1:Sprite):void{
var ctrlData:ControlData;
var handle:Sprite;
var handleData:ControlData;
var theY:Number;
var theWidth:Number;
var bounds:Rectangle;
var ctrl = _arg1;
if (ctrl == null){
return;
};
ctrlData = ctrlDataDict[ctrl];
try {
if ((((ctrl["startHandleDrag"] is Function)) && (ctrl["startHandleDrag"]()))){
ctrlData.isDragging = true;
return;
};
} catch(re:ReferenceError) {
};
handle = ctrlData.handle_mc;
if (handle == null){
return;
};
handleData = ctrlDataDict[handle];
theY = (ctrl.y + handleData.origY);
theWidth = (isNaN(ctrlData.origWidth)) ? ctrl.width : ctrlData.origWidth;
bounds = new Rectangle((ctrl.x + handleData.leftMargin), theY, (theWidth - handleData.rightMargin), 0);
handle.startDrag(false, bounds);
ctrlData.isDragging = true;
}
flvplayback_internal function setupBarSkinPart(_arg1:Sprite, _arg2:DisplayObject, _arg3:Sprite, _arg4:String, _arg5:String, _arg6:Boolean=false):DisplayObject{
var part:DisplayObject;
var partAvatar:DisplayObject;
var ctrlData:ControlData;
var partData:ControlData;
var ctrl = _arg1;
var avatar = _arg2;
var definitionHolder = _arg3;
var skinName = _arg4;
var partName = _arg5;
var required = _arg6;
try {
part = ctrl[partName];
} catch(re:ReferenceError) {
part = null;
};
if (part == null){
try {
part = createSkin(definitionHolder, skinName);
} catch(ve:VideoError) {
if (required){
throw (ve);
};
};
if (part != null){
skin_mc.addChild(part);
part.x = ctrl.x;
part.y = ctrl.y;
partAvatar = layout_mc.getChildByName((skinName + "_mc"));
if (partAvatar != null){
if (partName == "hit_mc"){
ctrlData = ctrlDataDict[ctrl];
partData = new ControlData(this, part, controls[ctrlData.index], -1);
partData.avatar = partAvatar;
ctrlDataDict[part] = partData;
} else {
part.x = (part.x + (partAvatar.x - avatar.x));
part.y = (part.y + (partAvatar.y - avatar.y));
part.width = partAvatar.width;
part.height = partAvatar.height;
};
};
};
};
if (((required) && ((part == null)))){
throw (new VideoError(VideoError.MISSING_SKIN_STYLE, skinName));
};
return (part);
}
public function get skinBackgroundAlpha():Number{
return (borderAlpha);
}
public function get volumeBarScrubTolerance():Number{
return (_volumeBarScrubTolerance);
}
public function get skinBackgroundColor():uint{
return (borderColor);
}
public function get controlsEnabled():Boolean{
return (_controlsEnabled);
}
flvplayback_internal function handleIVPEvent(_arg1:IVPEvent):void{
var _local2:uint;
var _local3:int;
var _local4:VideoEvent;
var _local5:Sprite;
var _local6:ControlData;
var _local7:VideoProgressEvent;
var _local8:VideoPlayerState;
var _local9:Number;
var _local10:Number;
var _local11:Number;
if (_arg1.vp != _vc.visibleVideoPlayerIndex){
return;
};
_local2 = _vc.activeVideoPlayerIndex;
_vc.activeVideoPlayerIndex = _vc.visibleVideoPlayerIndex;
switch (_arg1.type){
case VideoEvent.STATE_CHANGE:
_local4 = VideoEvent(_arg1);
if (_local4.state == VideoState.BUFFERING){
if (!_bufferingOn){
_bufferingDelayTimer.reset();
_bufferingDelayTimer.start();
};
} else {
_bufferingDelayTimer.reset();
_bufferingOn = false;
};
if (_local4.state == VideoState.LOADING){
_progressPercent = (_vc.getVideoPlayer(_arg1.vp).isRTMP) ? 100 : 0;
_local3 = SEEK_BAR;
while (_local3 <= VOLUME_BAR) {
_local5 = controls[_local3];
if (controls[_local3] == null){
} else {
_local6 = ctrlDataDict[_local5];
if (_local6.progress_mc != null){
positionBar(_local5, "progress", _progressPercent);
};
};
_local3++;
};
};
_local3 = 0;
while (_local3 < NUM_CONTROLS) {
if (controls[_local3] == undefined){
} else {
setEnabledAndVisibleForState(_local3, _local4.state);
if (_local3 < NUM_BUTTONS){
skinButtonControl(controls[_local3]);
};
};
_local3++;
};
break;
case VideoEvent.READY:
case MetadataEvent.METADATA_RECEIVED:
_local3 = 0;
while (_local3 < NUM_CONTROLS) {
if (controls[_local3] == undefined){
} else {
setEnabledAndVisibleForState(_local3, _vc.state);
if (_local3 < NUM_BUTTONS){
skinButtonControl(controls[_local3]);
};
};
_local3++;
};
if (_vc.getVideoPlayer(_arg1.vp).isRTMP){
_progressPercent = 100;
_local3 = SEEK_BAR;
while (_local3 <= VOLUME_BAR) {
_local5 = controls[_local3];
if (_local5 == null){
} else {
_local6 = ctrlDataDict[_local5];
if (_local6.progress_mc != null){
positionBar(_local5, "progress", _progressPercent);
};
};
_local3++;
};
};
break;
case VideoEvent.PLAYHEAD_UPDATE:
if (((((((!((controls[SEEK_BAR] == undefined))) && (!(_vc.isLive)))) && (!(isNaN(_vc.totalTime))))) && (!((_vc.getVideoPlayer(_vc.visibleVideoPlayerIndex).state == VideoState.SEEKING))))){
_local4 = VideoEvent(_arg1);
_local10 = ((_local4.playheadTime / _vc.totalTime) * 100);
if (_local10 < 0){
_local10 = 0;
} else {
if (_local10 > 100){
_local10 = 100;
};
};
_local5 = controls[SEEK_BAR];
_local6 = ctrlDataDict[_local5];
_local6.percentage = _local10;
positionHandle(_local5);
};
break;
case VideoProgressEvent.PROGRESS:
_local7 = VideoProgressEvent(_arg1);
_progressPercent = ((_local7.bytesTotal)<=0) ? 100 : ((_local7.bytesLoaded / _local7.bytesTotal) * 100);
_local8 = _vc.videoPlayerStates[_arg1.vp];
_local9 = _local8.minProgressPercent;
if (((!(isNaN(_local9))) && ((_local9 > _progressPercent)))){
_progressPercent = _local9;
};
if (!isNaN(_vc.totalTime)){
_local11 = ((_vc.playheadTime / _vc.totalTime) * 100);
if (_local11 > _progressPercent){
_progressPercent = _local11;
_local8.minProgressPercent = _progressPercent;
};
};
_local3 = SEEK_BAR;
while (_local3 <= VOLUME_BAR) {
_local5 = controls[_local3];
if (_local5 == null){
} else {
_local6 = ctrlDataDict[_local5];
if (_local6.progress_mc != null){
positionBar(_local5, "progress", _progressPercent);
};
};
_local3++;
};
break;
};
_vc.activeVideoPlayerIndex = _local2;
}
flvplayback_internal function setupButtonSkinState(_arg1:Sprite, _arg2:Sprite, _arg3:String, _arg4:DisplayObject=null):DisplayObject{
var stateSkin:DisplayObject;
var ctrl = _arg1;
var definitionHolder = _arg2;
var skinName = _arg3;
var defaultSkin = _arg4;
try {
stateSkin = createSkin(definitionHolder, skinName);
} catch(ve:VideoError) {
if (defaultSkin != null){
stateSkin = null;
} else {
throw (ve);
};
};
if (stateSkin != null){
stateSkin.visible = false;
ctrl.addChild(stateSkin);
} else {
if (defaultSkin != null){
stateSkin = defaultSkin;
};
};
return (stateSkin);
}
flvplayback_internal function layoutSkin():void{
var video_mc:DisplayObject;
var i:int;
var borderRect:Rectangle;
var forceSkinAutoHide:Boolean;
var minWidth:Number;
var vidWidth:Number;
var minHeight:Number;
var vidHeight:Number;
if (layout_mc == null){
return;
};
if (skinLoadDelayCount < 2){
return;
};
video_mc = layout_mc["video_mc"];
if (video_mc == null){
throw (new Error("No layout_mc.video_mc"));
};
placeholderLeft = video_mc.x;
placeholderRight = (video_mc.x + video_mc.width);
placeholderTop = video_mc.y;
placeholderBottom = (video_mc.y + video_mc.height);
videoLeft = (_vc.x - _vc.registrationX);
videoRight = (videoLeft + _vc.width);
videoTop = (_vc.y - _vc.registrationY);
videoBottom = (videoTop + _vc.height);
if (((((_fullScreen) && (_fullScreenTakeOver))) && (!((border_mc == null))))){
borderRect = calcLayoutControl(border_mc);
forceSkinAutoHide = false;
if ((((borderRect.width > 0)) && ((borderRect.height > 0)))){
if (borderRect.x < 0){
placeholderLeft = (placeholderLeft + (videoLeft - borderRect.x));
forceSkinAutoHide = true;
};
if ((borderRect.x + borderRect.width) > _vc.registrationWidth){
placeholderRight = (placeholderRight + ((borderRect.x + borderRect.width) - videoRight));
forceSkinAutoHide = true;
};
if (borderRect.y < 0){
placeholderTop = (placeholderTop + (videoTop - borderRect.y));
forceSkinAutoHide = true;
};
if ((borderRect.y + borderRect.height) > _vc.registrationHeight){
placeholderBottom = (placeholderBottom + ((borderRect.y + borderRect.height) - videoBottom));
forceSkinAutoHide = true;
};
if (forceSkinAutoHide){
_skinAutoHide = true;
setupSkinAutoHide(true);
};
};
};
try {
if (!isNaN(layout_mc["minWidth"])){
minWidth = layout_mc["minWidth"];
vidWidth = (videoRight - videoLeft);
if ((((minWidth > 0)) && ((minWidth > vidWidth)))){
videoLeft = (videoLeft - ((minWidth - vidWidth) / 2));
videoRight = (minWidth + videoLeft);
};
};
} catch(re1:ReferenceError) {
};
try {
if (!isNaN(layout_mc["minHeight"])){
minHeight = layout_mc["minHeight"];
vidHeight = (videoBottom - videoTop);
if ((((minHeight > 0)) && ((minHeight > vidHeight)))){
videoTop = (videoTop - ((minHeight - vidHeight) / 2));
videoBottom = (minHeight + videoTop);
};
};
} catch(re2:ReferenceError) {
};
i = 0;
while (i < customClips.length) {
layoutControl(customClips[i]);
if (customClips[i] == border_mc){
bitmapCopyBorder();
};
i = (i + 1);
};
i = 0;
while (i < NUM_CONTROLS) {
layoutControl(controls[i]);
i = (i + 1);
};
}
public function set bufferingDelayInterval(_arg1:Number):void{
if (_bufferingDelayTimer.delay == _arg1){
return;
};
_bufferingDelayTimer.delay = _arg1;
}
flvplayback_internal function setEnabledAndVisibleForState(_arg1:int, _arg2:String):void{
var _local3:int;
var _local4:String;
var _local5:Sprite;
var _local6:ControlData;
var _local7:Boolean;
var _local8:ControlData;
var _local9:ControlData;
var _local10:ControlData;
var _local11:ControlData;
_local3 = _vc.activeVideoPlayerIndex;
_vc.activeVideoPlayerIndex = _vc.visibleVideoPlayerIndex;
_local4 = _arg2;
if ((((_local4 == VideoState.BUFFERING)) && (!(_bufferingOn)))){
_local4 = VideoState.PLAYING;
};
_local5 = controls[_arg1];
if (_local5 == null){
return;
};
_local6 = ctrlDataDict[_local5];
if (_local6 == null){
return;
};
switch (_arg1){
case VOLUME_BAR:
case VOLUME_BAR_HANDLE:
case VOLUME_BAR_HIT:
_local6.enabled = true;
break;
case FULL_SCREEN_ON_BUTTON:
_local6.enabled = !(_fullScreen);
if (controls[FULL_SCREEN_BUTTON] != undefined){
_local5.visible = _local6.enabled;
};
break;
case FULL_SCREEN_OFF_BUTTON:
_local6.enabled = _fullScreen;
if (controls[FULL_SCREEN_BUTTON] != undefined){
_local5.visible = _local6.enabled;
};
break;
case MUTE_ON_BUTTON:
_local6.enabled = !(_isMuted);
if (controls[MUTE_BUTTON] != undefined){
_local5.visible = _local6.enabled;
};
break;
case MUTE_OFF_BUTTON:
_local6.enabled = _isMuted;
if (controls[MUTE_BUTTON] != undefined){
_local5.visible = _local6.enabled;
};
break;
default:
switch (_local4){
case VideoState.LOADING:
case VideoState.CONNECTION_ERROR:
_local6.enabled = false;
break;
case VideoState.DISCONNECTED:
_local6.enabled = ((!((_vc.source == null))) && (!((_vc.source == ""))));
break;
case VideoState.SEEKING:
break;
default:
_local6.enabled = true;
break;
};
break;
};
switch (_arg1){
case SEEK_BAR:
switch (_local4){
case VideoState.STOPPED:
case VideoState.PLAYING:
case VideoState.PAUSED:
case VideoState.REWINDING:
case VideoState.SEEKING:
_local6.enabled = true;
break;
case VideoState.BUFFERING:
_local6.enabled = ((!(_bufferingBarHides)) || ((controls[BUFFERING_BAR] == undefined)));
break;
default:
_local6.enabled = false;
break;
};
if (_local6.enabled){
_local6.enabled = !(isNaN(_vc.totalTime));
};
if (_local6.handle_mc != null){
_local8 = ctrlDataDict[_local6.handle_mc];
_local8.enabled = _local6.enabled;
_local6.handle_mc.visible = _local8.enabled;
};
if (_local6.hit_mc != null){
_local9 = ctrlDataDict[_local6.hit_mc];
_local9.enabled = _local6.enabled;
_local6.hit_mc.visible = _local9.enabled;
};
_local7 = ((((((!(_bufferingBarHides)) || (_local6.enabled))) || ((controls[BUFFERING_BAR] == undefined)))) || (!(controls[BUFFERING_BAR].visible)));
_local5.visible = _local7;
if (_local6.progress_mc != null){
_local6.progress_mc.visible = _local7;
_local10 = ctrlDataDict[_local6.progress_mc];
if (_local10.fill_mc != null){
_local10.fill_mc.visible = _local7;
};
};
if (_local6.fullness_mc != null){
_local6.fullness_mc.visible = _local7;
_local11 = ctrlDataDict[_local6.fullness_mc];
if (_local11.fill_mc != null){
_local11.fill_mc.visible = _local7;
};
};
break;
case BUFFERING_BAR:
switch (_local4){
case VideoState.STOPPED:
case VideoState.PLAYING:
case VideoState.PAUSED:
case VideoState.REWINDING:
case VideoState.SEEKING:
_local6.enabled = false;
break;
default:
_local6.enabled = true;
break;
};
_local5.visible = _local6.enabled;
if (_local6.fill_mc != null){
_local6.fill_mc.visible = _local6.enabled;
};
break;
case PAUSE_BUTTON:
switch (_local4){
case VideoState.DISCONNECTED:
case VideoState.STOPPED:
case VideoState.PAUSED:
case VideoState.REWINDING:
_local6.enabled = false;
break;
case VideoState.PLAYING:
_local6.enabled = true;
break;
case VideoState.BUFFERING:
_local6.enabled = ((!(_bufferingBarHides)) || ((controls[BUFFERING_BAR] == undefined)));
break;
};
if (controls[PLAY_PAUSE_BUTTON] != undefined){
_local5.visible = _local6.enabled;
};
break;
case PLAY_BUTTON:
switch (_local4){
case VideoState.PLAYING:
_local6.enabled = false;
break;
case VideoState.STOPPED:
case VideoState.PAUSED:
_local6.enabled = true;
break;
case VideoState.BUFFERING:
_local6.enabled = ((!(_bufferingBarHides)) || ((controls[BUFFERING_BAR] == undefined)));
break;
};
if (controls[PLAY_PAUSE_BUTTON] != undefined){
_local5.visible = !(controls[PAUSE_BUTTON].visible);
};
break;
case STOP_BUTTON:
switch (_local4){
case VideoState.DISCONNECTED:
case VideoState.STOPPED:
_local6.enabled = false;
break;
case VideoState.PAUSED:
case VideoState.PLAYING:
case VideoState.BUFFERING:
_local6.enabled = true;
break;
};
break;
case BACK_BUTTON:
case FORWARD_BUTTON:
switch (_local4){
case VideoState.BUFFERING:
_local6.enabled = ((!(_bufferingBarHides)) || ((controls[BUFFERING_BAR] == undefined)));
break;
};
};
_local5.mouseEnabled = _local6.enabled;
_vc.activeVideoPlayerIndex = _local3;
}
flvplayback_internal function cleanupHandle(_arg1:Object):void{
var e:Event;
var ctrl:Sprite;
var ctrlData:ControlData;
var ctrlOrEvent = _arg1;
try {
if ((ctrlOrEvent is Event)){
e = Event(ctrlOrEvent);
};
ctrl = ((e == null)) ? Sprite(ctrlOrEvent) : Sprite(e.currentTarget);
ctrlData = ctrlDataDict[ctrl];
if ((((ctrlData == null)) || ((e == null)))){
ctrl.removeEventListener(Event.REMOVED_FROM_STAGE, cleanupHandle, false);
if (ctrlData == null){
return;
};
};
ctrl.removeEventListener(Event.ENTER_FRAME, finishAddBarControl);
if (ctrlData.handle_mc != null){
if (ctrlData.handle_mc.parent != null){
ctrlData.handle_mc.parent.removeChild(ctrlData.handle_mc);
};
delete ctrlDataDict[ctrlData.handle_mc];
ctrlData.handle_mc = null;
};
if (ctrlData.hit_mc != null){
if (ctrlData.hit_mc.parent != null){
ctrlData.hit_mc.parent.removeChild(ctrlData.hit_mc);
};
delete ctrlDataDict[ctrlData.hit_mc];
ctrlData.hit_mc = null;
};
} catch(err:Error) {
};
}
flvplayback_internal function enterFullScreenTakeOver():void{
var fullScreenBG:Sprite;
if (((!(_fullScreen)) || (!((cacheStageAlign == null))))){
return;
};
_vc.removeEventListener(Event.ADDED_TO_STAGE, handleEvent);
try {
cacheStageAlign = _vc.stage.align;
cacheStageScaleMode = _vc.stage.scaleMode;
cacheFLVPlaybackParent = _vc.parent;
cacheFLVPlaybackIndex = _vc.parent.getChildIndex(_vc);
cacheFLVPlaybackLocation = new Rectangle(_vc.registrationX, _vc.registrationY, _vc.registrationWidth, _vc.registrationHeight);
_vc.stage.align = StageAlign.TOP_LEFT;
_vc.stage.scaleMode = StageScaleMode.NO_SCALE;
if (_vc.stage != _vc.parent){
_vc.stage.addChild(_vc);
} else {
_vc.stage.setChildIndex(_vc, (_vc.stage.numChildren - 1));
};
_vc.registrationX = 0;
_vc.registrationY = 0;
_vc.setSize(_vc.stage.stageWidth, _vc.stage.stageHeight);
fullScreenBG = Sprite(_vc.getChildByName("fullScreenBG"));
if (fullScreenBG == null){
fullScreenBG = new Sprite();
fullScreenBG.name = "fullScreenBG";
_vc.addChildAt(fullScreenBG, 0);
} else {
_vc.setChildIndex(fullScreenBG, 0);
};
fullScreenBG.graphics.beginFill(_fullScreenBgColor);
fullScreenBG.graphics.drawRect(0, 0, _vc.stage.stageWidth, _vc.stage.stageHeight);
} catch(err:Error) {
};
_vc.addEventListener(Event.ADDED_TO_STAGE, handleEvent);
}
public function set seekBarScrubTolerance(_arg1:Number):void{
_seekBarScrubTolerance = _arg1;
}
public function set fullScreenTakeOver(_arg1:Boolean):void{
if (_fullScreenTakeOver != _arg1){
_fullScreenTakeOver = _arg1;
if (_fullScreenTakeOver){
enterFullScreenTakeOver();
} else {
exitFullScreenTakeOver();
};
};
}
public function get seekBarScrubTolerance():Number{
return (_seekBarScrubTolerance);
}
flvplayback_internal static function getBooleanPropSafe(_arg1:Object, _arg2:String):Boolean{
var boolProp:*;
var obj = _arg1;
var propName = _arg2;
try {
boolProp = obj[propName];
return (Boolean(boolProp));
} catch(re:ReferenceError) {
};
return (false);
}
flvplayback_internal static function initLayoutNameToIndexMappings():void{
var _local1:int;
layoutNameToIndexMappings = new Object();
_local1 = 0;
while (_local1 < layoutNameArray.length) {
if (layoutNameArray[_local1] != null){
layoutNameToIndexMappings[layoutNameArray[_local1]] = _local1;
};
_local1++;
};
}
flvplayback_internal static function getNumberPropSafe(_arg1:Object, _arg2:String):Number{
var numProp:*;
var obj = _arg1;
var propName = _arg2;
try {
numProp = obj[propName];
return (Number(numProp));
} catch(re:ReferenceError) {
};
return (NaN);
}
}
}//package fl.video
Section 103
//VideoAlign (fl.video.VideoAlign)
package fl.video {
public final class VideoAlign {
public static const CENTER:String = "center";
public static const LEFT:String = "left";
public static const BOTTOM_RIGHT:String = "bottomRight";
public static const BOTTOM:String = "bottom";
public static const TOP_LEFT:String = "topLeft";
public static const TOP_RIGHT:String = "topRight";
public static const TOP:String = "top";
public static const BOTTOM_LEFT:String = "bottomLeft";
public static const RIGHT:String = "right";
}
}//package fl.video
Section 104
//VideoError (fl.video.VideoError)
package fl.video {
public class VideoError extends Error {
private var _code:uint;
public static const INVALID_SOURCE:uint = 1004;
flvplayback_internal static const ERROR_MSG:Array = ["Unable to make connection to server or to find FLV on server", "No matching cue point found", "Illegal cue point", "Invalid seek", "Invalid source", "Invalid xml", "No bitrate match, must be no default flv", "Cannot delete default VideoPlayer", "VideoPlayer.iNCManagerClass has not been set or its value is invalid", "Null url parameter sent to load()", "Skin is missing a required style definition or its value is invalid", "Unsupported property"];
public static const NULL_URL_LOAD:uint = 1009;
public static const INVALID_XML:uint = 1005;
flvplayback_internal static const BASE_ERROR_CODE:uint = 1000;
public static const DELETE_DEFAULT_PLAYER:uint = 1007;
public static const SHORT_VERSION:String = "2.0";
public static const UNSUPPORTED_PROPERTY:uint = 1011;
public static const ILLEGAL_CUE_POINT:uint = 1002;
public static const INVALID_SEEK:uint = 1003;
public static const NO_CONNECTION:uint = 1000;
public static const MISSING_SKIN_STYLE:uint = 1010;
public static const INCMANAGER_CLASS_UNSET:uint = 1008;
public static const NO_BITRATE_MATCH:uint = 1006;
public static const VERSION:String = "2.0.0.37";
public function VideoError(_arg1:uint, _arg2:String=null){
super((((("" + _arg1) + ": ") + ERROR_MSG[(_arg1 - BASE_ERROR_CODE)]) + ((_arg2)==null) ? "" : (": " + _arg2)));
name = "VideoError";
_code = _arg1;
}
public function get code():uint{
return (_code);
}
}
}//package fl.video
Section 105
//VideoEvent (fl.video.VideoEvent)
package fl.video {
import flash.events.*;
public class VideoEvent extends Event implements IVPEvent {
private var _vp:uint;
private var _playheadTime:Number;
private var _state:String;
public static const FAST_FORWARD:String = "fastForward";
public static const READY:String = "ready";
public static const SKIN_LOADED:String = "skinLoaded";
public static const SCRUB_FINISH:String = "scrubFinish";
public static const BUFFERING_STATE_ENTERED:String = "bufferingStateEntered";
public static const STOPPED_STATE_ENTERED:String = "stoppedStateEntered";
public static const AUTO_REWOUND:String = "autoRewound";
public static const SCRUB_START:String = "scrubStart";
public static const PLAYHEAD_UPDATE:String = "playheadUpdate";
public static const SEEKED:String = "seeked";
public static const PLAYING_STATE_ENTERED:String = "playingStateEntered";
public static const CLOSE:String = "close";
public static const PAUSED_STATE_ENTERED:String = "pausedStateEntered";
public static const COMPLETE:String = "complete";
public static const REWIND:String = "rewind";
public static const STATE_CHANGE:String = "stateChange";
public function VideoEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:String=null, _arg5:Number=NaN, _arg6:uint=0){
super(_arg1, _arg2, _arg3);
_state = _arg4;
_playheadTime = _arg5;
_vp = _arg6;
}
public function set playheadTime(_arg1:Number):void{
_playheadTime = _arg1;
}
public function get playheadTime():Number{
return (_playheadTime);
}
public function get state():String{
return (_state);
}
public function get vp():uint{
return (_vp);
}
override public function clone():Event{
return (new VideoEvent(type, bubbles, cancelable, state, playheadTime, vp));
}
public function set state(_arg1:String):void{
_state = _arg1;
}
public function set vp(_arg1:uint):void{
_vp = _arg1;
}
}
}//package fl.video
Section 106
//VideoPlayer (fl.video.VideoPlayer)
package fl.video {
import flash.events.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.utils.*;
public class VideoPlayer extends Video {
protected var _align:String;
protected var _registrationWidth:Number;
flvplayback_internal var _updateProgressTimer:Timer;
flvplayback_internal var _atEndCheckPlayhead:Number;
flvplayback_internal var _hiddenForResize:Boolean;
flvplayback_internal var startProgressTime:Number;
protected var _volume:Number;
flvplayback_internal var _invalidSeekTime:Boolean;
flvplayback_internal var _readyDispatched:Boolean;
flvplayback_internal var lastUpdateTimeStuckCount:Number;
protected var _ns:NetStream;
protected var _isLive:Boolean;
flvplayback_internal var _bufferState:String;
protected var _streamLength:Number;
flvplayback_internal var _rtmpDoSeekTimer:Timer;
protected var _contentPath:String;
flvplayback_internal var lastUpdateTimeStuckCountMax:int;// = 5
protected var _metadata:Object;
protected var __visible:Boolean;
flvplayback_internal var autoResizeMetadataDelayMax:Number;// = 5
protected var _scaleMode:String;
flvplayback_internal var _lastUpdateTime:Number;
flvplayback_internal var _sawPlayStop:Boolean;
flvplayback_internal var _atEnd:Boolean;
flvplayback_internal var _sawSeekNotify:Boolean;
flvplayback_internal var _idleTimeoutTimer:Timer;
flvplayback_internal var _prevVideoWidth:int;
protected var _registrationX:Number;
protected var _registrationY:Number;
protected var _bufferTime:Number;
flvplayback_internal var _cachedState:String;
flvplayback_internal var totalDownloadTime:Number;
flvplayback_internal var _cachedPlayheadTime:Number;
protected var _autoPlay:Boolean;
protected var _autoRewind:Boolean;
flvplayback_internal var _invalidSeekRecovery:Boolean;
flvplayback_internal var _hiddenRewindPlayheadTime:Number;
flvplayback_internal var _prevVideoHeight:int;
protected var _ncMgr:INCManager;
protected var _soundTransform:SoundTransform;
flvplayback_internal var _httpDoSeekCount:Number;
flvplayback_internal var oldRegistrationBounds:Rectangle;
flvplayback_internal var _cmdQueue:Array;
flvplayback_internal var _updateTimeTimer:Timer;
flvplayback_internal var httpDoSeekMaxCount:Number;// = 4
flvplayback_internal var _startingPlay:Boolean;
flvplayback_internal var baselineProgressTime:Number;
flvplayback_internal var _autoResizeTimer:Timer;
flvplayback_internal var _autoResizeDone:Boolean;
flvplayback_internal var _httpDoSeekTimer:Timer;
protected var _state:String;
protected var _videoWidth:int;
flvplayback_internal var _finishAutoResizeTimer:Timer;
flvplayback_internal var _currentPos:Number;
flvplayback_internal var oldBounds:Rectangle;
protected var _videoHeight:int;
flvplayback_internal var waitingForEnough:Boolean;
flvplayback_internal var _delayedBufferingTimer:Timer;
protected var _registrationHeight:Number;
flvplayback_internal var _hiddenForResizeMetadataDelay:Number;
flvplayback_internal var autoResizePlayheadTimeout:Number;// = 0.5
flvplayback_internal var _rtmpDoStopAtEndTimer:Timer;
flvplayback_internal var totalProgressTime:Number;
flvplayback_internal static const DEFAULT_HTTP_DO_SEEK_MAX_COUNT:Number = 4;
flvplayback_internal static const FINISH_AUTO_RESIZE_INTERVAL:Number = 250;
flvplayback_internal static const DEFAULT_AUTO_RESIZE_PLAYHEAD_TIMEOUT:Number = 0.5;
flvplayback_internal static const DEFAULT_AUTO_RESIZE_METADATA_DELAY_MAX:Number = 5;
public static const SHORT_VERSION:String = "2.0";
flvplayback_internal static const HTTP_DO_SEEK_INTERVAL:Number = 250;
flvplayback_internal static const RTMP_DO_SEEK_INTERVAL:Number = 100;
flvplayback_internal static const HTTP_DELAYED_BUFFERING_INTERVAL:Number = 100;
public static const DEFAULT_UPDATE_TIME_INTERVAL:Number = 250;
flvplayback_internal static const AUTO_RESIZE_INTERVAL:Number = 100;
flvplayback_internal static const DEFAULT_LAST_UPDATE_TIME_STUCK_COUNT_MAX:int = 5;
flvplayback_internal static const RTMP_DO_STOP_AT_END_INTERVAL:Number = 500;
public static const DEFAULT_IDLE_TIMEOUT_INTERVAL:Number = 300000;
public static const VERSION:String = "2.0.0.37";
public static const DEFAULT_UPDATE_PROGRESS_INTERVAL:Number = 250;
public static var iNCManagerClass:Object = "fl.video.NCManager";
flvplayback_internal static var BUFFER_FLUSH:String = "bufferFlush";
flvplayback_internal static var BUFFER_FULL:String = "bufferFull";
flvplayback_internal static var BUFFER_EMPTY:String = "bufferEmpty";
public function VideoPlayer(_arg1:int=320, _arg2:int=240){
autoResizePlayheadTimeout = DEFAULT_AUTO_RESIZE_PLAYHEAD_TIMEOUT;
autoResizeMetadataDelayMax = DEFAULT_AUTO_RESIZE_METADATA_DELAY_MAX;
httpDoSeekMaxCount = DEFAULT_HTTP_DO_SEEK_MAX_COUNT;
lastUpdateTimeStuckCountMax = DEFAULT_LAST_UPDATE_TIME_STUCK_COUNT_MAX;
super(_arg1, _arg2);
_registrationX = x;
_registrationY = y;
_registrationWidth = _arg1;
_registrationHeight = _arg2;
_state = VideoState.DISCONNECTED;
_cachedState = _state;
_bufferState = BUFFER_EMPTY;
_sawPlayStop = false;
_cachedPlayheadTime = 0;
_metadata = null;
_startingPlay = false;
_invalidSeekTime = false;
_invalidSeekRecovery = false;
_currentPos = 0;
_atEnd = false;
_streamLength = 0;
_cmdQueue = new Array();
_readyDispatched = false;
_autoResizeDone = false;
_lastUpdateTime = NaN;
lastUpdateTimeStuckCount = 0;
_sawSeekNotify = false;
_hiddenForResize = false;
_hiddenForResizeMetadataDelay = 0;
_videoWidth = -1;
_videoHeight = -1;
_prevVideoWidth = 0;
_prevVideoHeight = 0;
_updateTimeTimer = new Timer(DEFAULT_UPDATE_TIME_INTERVAL);
_updateTimeTimer.addEventListener(TimerEvent.TIMER, doUpdateTime);
_updateProgressTimer = new Timer(DEFAULT_UPDATE_PROGRESS_INTERVAL);
_updateProgressTimer.addEventListener(TimerEvent.TIMER, doUpdateProgress);
_idleTimeoutTimer = new Timer(DEFAULT_IDLE_TIMEOUT_INTERVAL, 1);
_idleTimeoutTimer.addEventListener(TimerEvent.TIMER, doIdleTimeout);
_autoResizeTimer = new Timer(AUTO_RESIZE_INTERVAL);
_autoResizeTimer.addEventListener(TimerEvent.TIMER, doAutoResize);
_rtmpDoStopAtEndTimer = new Timer(RTMP_DO_STOP_AT_END_INTERVAL);
_rtmpDoStopAtEndTimer.addEventListener(TimerEvent.TIMER, rtmpDoStopAtEnd);
_rtmpDoSeekTimer = new Timer(RTMP_DO_SEEK_INTERVAL);
_rtmpDoSeekTimer.addEventListener(TimerEvent.TIMER, rtmpDoSeek);
_httpDoSeekTimer = new Timer(HTTP_DO_SEEK_INTERVAL);
_httpDoSeekTimer.addEventListener(TimerEvent.TIMER, httpDoSeek);
_httpDoSeekCount = 0;
_finishAutoResizeTimer = new Timer(FINISH_AUTO_RESIZE_INTERVAL, 1);
_finishAutoResizeTimer.addEventListener(TimerEvent.TIMER, finishAutoResize);
_delayedBufferingTimer = new Timer(HTTP_DELAYED_BUFFERING_INTERVAL);
_delayedBufferingTimer.addEventListener(TimerEvent.TIMER, doDelayedBuffering);
_isLive = false;
_align = VideoAlign.CENTER;
_scaleMode = VideoScaleMode.MAINTAIN_ASPECT_RATIO;
_autoPlay = true;
_autoRewind = false;
_bufferTime = 0.1;
_soundTransform = new SoundTransform();
_volume = _soundTransform.volume;
__visible = true;
_contentPath = "";
waitingForEnough = false;
baselineProgressTime = NaN;
startProgressTime = NaN;
totalDownloadTime = NaN;
totalProgressTime = NaN;
}
public function get playheadTime():Number{
var _local1:Number;
_local1 = ((_ns)==null) ? _currentPos : _ns.time;
if (((!((_metadata == null))) && (!((_metadata.audiodelay == undefined))))){
_local1 = (_local1 - _metadata.audiodelay);
if (_local1 < 0){
_local1 = 0;
};
};
return (_local1);
}
public function stop():void{
if (!isXnOK()){
if ((((((_state == VideoState.CONNECTION_ERROR)) || ((_ncMgr == null)))) || ((_ncMgr.netConnection == null)))){
throw (new VideoError(VideoError.NO_CONNECTION));
};
return;
} else {
if (_state == VideoState.EXEC_QUEUED_CMD){
_state = _cachedState;
} else {
if (!stateResponsive){
queueCmd(QueuedCommand.STOP);
return;
};
execQueuedCmds();
};
};
if ((((_state == VideoState.STOPPED)) || ((_ns == null)))){
return;
};
if (_ncMgr.isRTMP){
if (((_autoRewind) && (!(_isLive)))){
_currentPos = 0;
_play(0, 0);
_state = VideoState.STOPPED;
setState(VideoState.REWINDING);
} else {
closeNS(true);
setState(VideoState.STOPPED);
};
} else {
_pause(true);
if (_autoRewind){
_seek(0);
_state = VideoState.STOPPED;
setState(VideoState.REWINDING);
} else {
setState(VideoState.STOPPED);
};
};
}
flvplayback_internal function execQueuedCmds():void{
var nextCmd:Object;
while ((((((_cmdQueue.length > 0)) && (((((stateResponsive) || ((_state == VideoState.DISCONNECTED)))) || ((_state == VideoState.CONNECTION_ERROR)))))) && (((!((_cmdQueue[0].url == null))) || (((!((_state == VideoState.DISCONNECTED))) && (!((_state == VideoState.CONNECTION_ERROR))))))))) {
try {
nextCmd = _cmdQueue.shift();
_cachedState = _state;
_state = VideoState.EXEC_QUEUED_CMD;
switch (nextCmd.type){
case QueuedCommand.PLAY:
play(nextCmd.url, nextCmd.time, nextCmd.isLive);
break;
case QueuedCommand.LOAD:
load(nextCmd.url, nextCmd.time, nextCmd.isLive);
break;
case QueuedCommand.PAUSE:
pause();
break;
case QueuedCommand.STOP:
stop();
break;
case QueuedCommand.SEEK:
seek(nextCmd.time);
break;
case QueuedCommand.PLAY_WHEN_ENOUGH:
playWhenEnoughDownloaded();
break;
};
} finally {
if (_state == VideoState.EXEC_QUEUED_CMD){
_state = _cachedState;
};
};
};
}
public function setScale(_arg1:Number, _arg2:Number):void{
super.scaleX = _arg1;
super.scaleY = _arg2;
_registrationWidth = width;
_registrationHeight = height;
switch (_scaleMode){
case VideoScaleMode.MAINTAIN_ASPECT_RATIO:
case VideoScaleMode.NO_SCALE:
startAutoResize();
break;
default:
super.x = _registrationX;
super.y = _registrationY;
break;
};
}
public function set playheadTime(_arg1:Number):void{
seek(_arg1);
}
override public function get videoWidth():int{
if (_readyDispatched){
_videoWidth = super.videoWidth;
};
return (_videoWidth);
}
public function get scaleMode():String{
return (_scaleMode);
}
public function get progressInterval():Number{
return (_updateProgressTimer.delay);
}
public function set align(_arg1:String):void{
if (_align != _arg1){
switch (_arg1){
case VideoAlign.CENTER:
case VideoAlign.TOP:
case VideoAlign.LEFT:
case VideoAlign.BOTTOM:
case VideoAlign.RIGHT:
case VideoAlign.TOP_LEFT:
case VideoAlign.TOP_RIGHT:
case VideoAlign.BOTTOM_LEFT:
case VideoAlign.BOTTOM_RIGHT:
break;
default:
return;
};
_align = _arg1;
switch (_scaleMode){
case VideoScaleMode.MAINTAIN_ASPECT_RATIO:
case VideoScaleMode.NO_SCALE:
startAutoResize();
break;
};
};
}
public function set scaleMode(_arg1:String):void{
if (_scaleMode != _arg1){
switch (_arg1){
case VideoScaleMode.MAINTAIN_ASPECT_RATIO:
case VideoScaleMode.NO_SCALE:
case VideoScaleMode.EXACT_FIT:
break;
default:
return;
};
_scaleMode = _arg1;
startAutoResize();
};
}
public function get source():String{
return (_contentPath);
}
flvplayback_internal function doUpdateTime(_arg1:TimerEvent=null):void{
var _local2:Number;
_local2 = playheadTime;
if (_local2 != _atEndCheckPlayhead){
_atEndCheckPlayhead = NaN;
};
switch (_state){
case VideoState.STOPPED:
case VideoState.PAUSED:
case VideoState.DISCONNECTED:
case VideoState.CONNECTION_ERROR:
_updateTimeTimer.stop();
break;
case VideoState.PLAYING:
case VideoState.BUFFERING:
if (((((((((!((_ncMgr == null))) && (!(_ncMgr.isRTMP)))) && ((_lastUpdateTime == _local2)))) && (!((_ns == null))))) && ((_ns.bytesLoaded == _ns.bytesTotal)))){
if (lastUpdateTimeStuckCount > lastUpdateTimeStuckCountMax){
lastUpdateTimeStuckCount = 0;
httpDoStopAtEnd();
} else {
lastUpdateTimeStuckCount++;
};
};
};
if (_lastUpdateTime != _local2){
dispatchEvent(new VideoEvent(VideoEvent.PLAYHEAD_UPDATE, false, false, _state, _local2));
_lastUpdateTime = _local2;
lastUpdateTimeStuckCount = 0;
};
}
flvplayback_internal function rtmpNetStatus(_arg1:NetStatusEvent):void{
if (_state == VideoState.CONNECTION_ERROR){
return;
};
switch (_arg1.info.code){
case "NetStream.Play.Stop":
if (_startingPlay){
return;
};
switch (_state){
case VideoState.RESIZING:
if (_hiddenForResize){
finishAutoResize();
};
break;
case VideoState.LOADING:
case VideoState.STOPPED:
case VideoState.PAUSED:
break;
default:
_sawPlayStop = true;
break;
};
break;
case "NetStream.Buffer.Empty":
switch (_bufferState){
case BUFFER_FULL:
if (_sawPlayStop){
rtmpDoStopAtEnd();
} else {
if (_state == VideoState.PLAYING){
setState(VideoState.BUFFERING);
};
};
break;
};
_bufferState = BUFFER_EMPTY;
_sawPlayStop = false;
break;
case "NetStream.Buffer.Flush":
if (((_sawSeekNotify) && ((_state == VideoState.SEEKING)))){
_bufferState = BUFFER_EMPTY;
_sawPlayStop = false;
setStateFromCachedState(false);
doUpdateTime();
execQueuedCmds();
};
if (((_sawPlayStop) && ((((_bufferState == BUFFER_EMPTY)) || ((((_ns.bufferTime <= 0.1)) && ((_ns.bufferLength <= 0.1)))))))){
_cachedPlayheadTime = playheadTime;
_rtmpDoStopAtEndTimer.reset();
_rtmpDoStopAtEndTimer.start();
};
switch (_bufferState){
case BUFFER_EMPTY:
if (!_hiddenForResize){
if ((((((_state == VideoState.LOADING)) && ((_cachedState == VideoState.PLAYING)))) || ((_state == VideoState.BUFFERING)))){
setState(VideoState.PLAYING);
} else {
if (_cachedState == VideoState.BUFFERING){
_cachedState = VideoState.PLAYING;
};
};
};
_bufferState = BUFFER_FLUSH;
break;
default:
if (_state == VideoState.BUFFERING){
setStateFromCachedState();
};
break;
};
break;
case "NetStream.Buffer.Full":
if (((_sawSeekNotify) && ((_state == VideoState.SEEKING)))){
_bufferState = BUFFER_EMPTY;
_sawPlayStop = false;
setStateFromCachedState(false);
doUpdateTime();
execQueuedCmds();
};
switch (_bufferState){
case BUFFER_EMPTY:
_bufferState = BUFFER_FULL;
if (!_hiddenForResize){
if ((((((_state == VideoState.LOADING)) && ((_cachedState == VideoState.PLAYING)))) || ((_state == VideoState.BUFFERING)))){
setState(VideoState.PLAYING);
} else {
if (_cachedState == VideoState.BUFFERING){
_cachedState = VideoState.PLAYING;
};
};
if (_rtmpDoStopAtEndTimer.running){
_sawPlayStop = true;
_rtmpDoStopAtEndTimer.reset();
};
};
break;
case BUFFER_FLUSH:
_bufferState = BUFFER_FULL;
if (_rtmpDoStopAtEndTimer.running){
_sawPlayStop = true;
_rtmpDoStopAtEndTimer.reset();
};
break;
};
if (_state == VideoState.BUFFERING){
setStateFromCachedState();
};
break;
case "NetStream.Pause.Notify":
if ((((_state == VideoState.RESIZING)) && (_hiddenForResize))){
finishAutoResize();
};
break;
case "NetStream.Unpause.Notify":
if (_state == VideoState.PAUSED){
_state = VideoState.PLAYING;
setState(VideoState.BUFFERING);
} else {
_cachedState = VideoState.PLAYING;
};
break;
case "NetStream.Play.Start":
_rtmpDoStopAtEndTimer.reset();
_bufferState = BUFFER_EMPTY;
_sawPlayStop = false;
if (_startingPlay){
_startingPlay = false;
_cachedPlayheadTime = playheadTime;
} else {
if (_state == VideoState.PLAYING){
setState(VideoState.BUFFERING);
};
};
break;
case "NetStream.Play.Reset":
_rtmpDoStopAtEndTimer.reset();
if (_state == VideoState.REWINDING){
_rtmpDoSeekTimer.reset();
if ((((playheadTime == 0)) || ((playheadTime < _cachedPlayheadTime)))){
setStateFromCachedState();
} else {
_cachedPlayheadTime = playheadTime;
_rtmpDoSeekTimer.start();
};
};
break;
case "NetStream.Seek.Notify":
if (playheadTime != _cachedPlayheadTime){
setStateFromCachedState(false);
doUpdateTime();
execQueuedCmds();
} else {
_sawSeekNotify = true;
_rtmpDoSeekTimer.start();
};
break;
case "Netstream.Play.UnpublishNotify":
break;
case "Netstream.Play.PublishNotify":
break;
case "NetStream.Play.StreamNotFound":
if (!_ncMgr.connectAgain()){
setState(VideoState.CONNECTION_ERROR);
};
break;
case "NetStream.Play.Failed":
case "NetStream.Failed":
setState(VideoState.CONNECTION_ERROR);
break;
};
}
public function set progressInterval(_arg1:Number):void{
_updateProgressTimer.delay = _arg1;
}
flvplayback_internal function onCuePoint(_arg1:Object):void{
if (((!(_hiddenForResize)) || (((!(isNaN(_hiddenRewindPlayheadTime))) && ((playheadTime < _hiddenRewindPlayheadTime)))))){
dispatchEvent(new MetadataEvent(MetadataEvent.CUE_POINT, false, false, _arg1));
};
}
flvplayback_internal function createINCManager():void{
var theClass:Class;
theClass = null;
try {
if ((iNCManagerClass is String)){
theClass = Class(getDefinitionByName(String(iNCManagerClass)));
} else {
if ((iNCManagerClass is Class)){
theClass = Class(iNCManagerClass);
};
};
} catch(e:Error) {
theClass = null;
};
if (theClass == null){
throw (new VideoError(VideoError.INCMANAGER_CLASS_UNSET, iNCManagerClass.toString()));
};
_ncMgr = new (theClass);
_ncMgr.videoPlayer = this;
}
flvplayback_internal function doAutoResize(_arg1:TimerEvent=null):void{
var _local2:Number;
var _local3:Number;
if (_autoResizeTimer.running){
switch (_state){
case VideoState.RESIZING:
case VideoState.LOADING:
break;
case VideoState.DISCONNECTED:
case VideoState.CONNECTION_ERROR:
_autoResizeTimer.reset();
return;
default:
if (!stateResponsive){
return;
};
};
if (((((((((!((super.videoWidth == _prevVideoWidth))) || (!((super.videoHeight == _prevVideoHeight))))) || ((_bufferState == BUFFER_FULL)))) || ((_bufferState == BUFFER_FLUSH)))) || ((_ns.time > autoResizePlayheadTimeout)))){
if (((((_hiddenForResize) && ((_metadata == null)))) && ((_hiddenForResizeMetadataDelay < autoResizeMetadataDelayMax)))){
_hiddenForResizeMetadataDelay++;
return;
};
_videoWidth = super.videoWidth;
_videoHeight = super.videoHeight;
_autoResizeTimer.reset();
} else {
return;
};
};
if (_autoResizeDone){
setState(_cachedState);
return;
};
oldBounds = new Rectangle(x, y, width, height);
oldRegistrationBounds = new Rectangle(registrationX, registrationY, registrationWidth, registrationHeight);
_autoResizeDone = true;
switch (_scaleMode){
case VideoScaleMode.NO_SCALE:
super.width = _videoWidth;
super.height = _videoHeight;
break;
case VideoScaleMode.EXACT_FIT:
super.width = registrationWidth;
super.height = registrationHeight;
break;
case VideoScaleMode.MAINTAIN_ASPECT_RATIO:
default:
_local2 = ((_videoWidth * _registrationHeight) / _videoHeight);
_local3 = ((_videoHeight * _registrationWidth) / _videoWidth);
if (_local3 < _registrationHeight){
super.width = _registrationWidth;
super.height = _local3;
} else {
if (_local2 < _registrationWidth){
super.width = _local2;
super.height = _registrationHeight;
} else {
super.width = _registrationWidth;
super.height = _registrationHeight;
};
};
};
switch (_align){
case VideoAlign.CENTER:
case VideoAlign.TOP:
case VideoAlign.BOTTOM:
default:
super.x = (_registrationX + ((_registrationWidth - width) / 2));
break;
case VideoAlign.LEFT:
case VideoAlign.TOP_LEFT:
case VideoAlign.BOTTOM_LEFT:
super.x = _registrationX;
break;
case VideoAlign.RIGHT:
case VideoAlign.TOP_RIGHT:
case VideoAlign.BOTTOM_RIGHT:
super.x = (_registrationX + (_registrationWidth - width));
break;
};
switch (_align){
case VideoAlign.CENTER:
case VideoAlign.LEFT:
case VideoAlign.RIGHT:
default:
super.y = (_registrationY + ((_registrationHeight - height) / 2));
break;
case VideoAlign.TOP:
case VideoAlign.TOP_LEFT:
case VideoAlign.TOP_RIGHT:
super.y = _registrationY;
break;
case VideoAlign.BOTTOM:
case VideoAlign.BOTTOM_LEFT:
case VideoAlign.BOTTOM_RIGHT:
super.y = (_registrationY + (_registrationHeight - height));
break;
};
if (_hiddenForResize){
_hiddenRewindPlayheadTime = playheadTime;
if (_state == VideoState.LOADING){
_cachedState = VideoState.PLAYING;
};
if (!_ncMgr.isRTMP){
_pause(true);
_seek(0);
_finishAutoResizeTimer.reset();
_finishAutoResizeTimer.start();
} else {
if (!_isLive){
_currentPos = 0;
_play(0, 0);
setState(VideoState.RESIZING);
} else {
if (_autoPlay){
_finishAutoResizeTimer.reset();
_finishAutoResizeTimer.start();
} else {
finishAutoResize();
};
};
};
} else {
dispatchEvent(new AutoLayoutEvent(AutoLayoutEvent.AUTO_LAYOUT, false, false, oldBounds, oldRegistrationBounds));
};
}
public function get totalTime():Number{
return (_streamLength);
}
public function get ncMgr():INCManager{
if (_ncMgr == null){
createINCManager();
};
return (_ncMgr);
}
public function set volume(_arg1:Number):void{
var _local2:SoundTransform;
_local2 = soundTransform;
_local2.volume = _arg1;
soundTransform = _local2;
}
flvplayback_internal function _play(_arg1:int=0, _arg2:int=-1):void{
waitingForEnough = false;
_rtmpDoStopAtEndTimer.reset();
_startingPlay = true;
_ns.play(_ncMgr.streamName, (_isLive) ? -1 : _arg1, _arg2);
}
flvplayback_internal function finishAutoResize(_arg1:TimerEvent=null):void{
if (stateResponsive){
return;
};
_hiddenForResize = false;
super.visible = __visible;
volume = _volume;
dispatchEvent(new AutoLayoutEvent(AutoLayoutEvent.AUTO_LAYOUT, false, false, oldBounds, oldRegistrationBounds));
if (_autoPlay){
if (_ncMgr.isRTMP){
if (!_isLive){
_currentPos = 0;
_play(0);
};
if (_state == VideoState.RESIZING){
setState(VideoState.LOADING);
_cachedState = VideoState.PLAYING;
};
} else {
waitingForEnough = true;
_cachedState = _state;
_state = VideoState.PAUSED;
checkReadyForPlay(bytesLoaded, bytesTotal);
if (waitingForEnough){
_state = _cachedState;
setState(VideoState.PAUSED);
} else {
_cachedState = VideoState.PLAYING;
};
};
} else {
setState(VideoState.STOPPED);
};
}
public function set soundTransform(_arg1:SoundTransform):void{
if (_arg1 == null){
return;
};
if (_hiddenForResize){
_volume = _arg1.volume;
};
_soundTransform = new SoundTransform();
_soundTransform.volume = (_hiddenForResize) ? 0 : _arg1.volume;
_soundTransform.leftToLeft = _arg1.leftToLeft;
_soundTransform.leftToRight = _arg1.leftToRight;
_soundTransform.rightToLeft = _arg1.rightToLeft;
_soundTransform.rightToRight = _arg1.rightToRight;
if (_ns != null){
_ns.soundTransform = _soundTransform;
};
}
flvplayback_internal function httpDoSeek(_arg1:TimerEvent):void{
var _local2:Boolean;
_local2 = (((_state == VideoState.REWINDING)) || ((_state == VideoState.SEEKING)));
if (((((_local2) && ((_httpDoSeekCount < httpDoSeekMaxCount)))) && ((((_cachedPlayheadTime == playheadTime)) || (_invalidSeekTime))))){
_httpDoSeekCount++;
return;
};
_httpDoSeekCount = 0;
_httpDoSeekTimer.reset();
if (!_local2){
return;
};
setStateFromCachedState(false);
if (_invalidSeekTime){
_invalidSeekTime = false;
_invalidSeekRecovery = true;
seek(playheadTime);
} else {
doUpdateTime();
execQueuedCmds();
};
}
public function get bytesLoaded():uint{
if ((((_ns == null)) || (_ncMgr.isRTMP))){
return (uint.MIN_VALUE);
};
return (_ns.bytesLoaded);
}
override public function set height(_arg1:Number):void{
super.height = (_registrationHeight = _arg1);
switch (_scaleMode){
case VideoScaleMode.MAINTAIN_ASPECT_RATIO:
case VideoScaleMode.NO_SCALE:
startAutoResize();
break;
default:
super.height = _arg1;
break;
};
}
flvplayback_internal function httpNetStatus(_arg1:NetStatusEvent):void{
switch (_arg1.info.code){
case "NetStream.Play.Stop":
_delayedBufferingTimer.reset();
if (_invalidSeekTime){
_invalidSeekTime = false;
_invalidSeekRecovery = true;
setState(_cachedState);
seek(playheadTime);
} else {
switch (_state){
case VideoState.PLAYING:
case VideoState.BUFFERING:
case VideoState.SEEKING:
httpDoStopAtEnd();
break;
};
};
break;
case "NetStream.Seek.InvalidTime":
if (_invalidSeekRecovery){
_invalidSeekTime = false;
_invalidSeekRecovery = false;
setState(_cachedState);
seek(0);
} else {
_invalidSeekTime = true;
};
break;
case "NetStream.Buffer.Empty":
_bufferState = BUFFER_EMPTY;
if (_state == VideoState.PLAYING){
_delayedBufferingTimer.reset();
_delayedBufferingTimer.start();
};
break;
case "NetStream.Buffer.Full":
case "NetStream.Buffer.Flush":
_delayedBufferingTimer.reset();
_bufferState = BUFFER_FULL;
if (!_hiddenForResize){
if ((((((_state == VideoState.LOADING)) && ((_cachedState == VideoState.PLAYING)))) || ((_state == VideoState.BUFFERING)))){
setState(VideoState.PLAYING);
} else {
if (_cachedState == VideoState.BUFFERING){
_cachedState = VideoState.PLAYING;
};
};
};
break;
case "NetStream.Seek.Notify":
_invalidSeekRecovery = false;
switch (_state){
case VideoState.SEEKING:
case VideoState.REWINDING:
if (!_httpDoSeekTimer.running){
_httpDoSeekCount = 0;
_httpDoSeekTimer.start();
};
break;
};
break;
case "NetStream.Play.StreamNotFound":
setState(VideoState.CONNECTION_ERROR);
break;
};
}
public function get netConnection():NetConnection{
if (_ncMgr != null){
return (_ncMgr.netConnection);
};
return (null);
}
public function set bufferTime(_arg1:Number):void{
_bufferTime = _arg1;
if (_ns != null){
_ns.bufferTime = _bufferTime;
};
}
flvplayback_internal function onMetaData(_arg1:Object):void{
if (_metadata != null){
return;
};
_metadata = _arg1;
if (isNaN(_streamLength)){
_streamLength = _arg1.duration;
};
if (_videoWidth < 0){
_videoWidth = _arg1.width;
};
if (_videoHeight < 0){
_videoHeight = _arg1.height;
};
dispatchEvent(new MetadataEvent(MetadataEvent.METADATA_RECEIVED, false, false, _arg1));
}
flvplayback_internal function queueCmd(_arg1:Number, _arg2:String=null, _arg3:Boolean=false, _arg4:Number=NaN):void{
_cmdQueue.push(new QueuedCommand(_arg1, _arg2, _arg3, _arg4));
}
public function set registrationHeight(_arg1:Number):void{
height = _arg1;
}
override public function get visible():Boolean{
if (!_hiddenForResize){
__visible = super.visible;
};
return (__visible);
}
public function seek(_arg1:Number):void{
if (_invalidSeekTime){
return;
};
if (((isNaN(_arg1)) || ((_arg1 < 0)))){
throw (new VideoError(VideoError.INVALID_SEEK));
};
if (!isXnOK()){
if ((((((_state == VideoState.CONNECTION_ERROR)) || ((_ncMgr == null)))) || ((_ncMgr.netConnection == null)))){
throw (new VideoError(VideoError.NO_CONNECTION));
};
flushQueuedCmds();
queueCmd(QueuedCommand.SEEK, null, false, _arg1);
setState(VideoState.LOADING);
_cachedState = VideoState.LOADING;
_ncMgr.reconnect();
return;
} else {
if (_state == VideoState.EXEC_QUEUED_CMD){
_state = _cachedState;
} else {
if (!stateResponsive){
queueCmd(QueuedCommand.SEEK, null, false, _arg1);
return;
};
execQueuedCmds();
};
};
if (_ns == null){
_createStream();
};
if (((_atEnd) && ((_arg1 < playheadTime)))){
_atEnd = false;
};
switch (_state){
case VideoState.PLAYING:
_state = VideoState.BUFFERING;
case VideoState.BUFFERING:
case VideoState.PAUSED:
_seek(_arg1);
setState(VideoState.SEEKING);
break;
case VideoState.STOPPED:
if (_ncMgr.isRTMP){
_play(0);
_pause(true);
};
_seek(_arg1);
_state = VideoState.PAUSED;
setState(VideoState.SEEKING);
break;
};
}
public function get state():String{
return (_state);
}
public function set autoRewind(_arg1:Boolean):void{
_autoRewind = _arg1;
}
override public function set scaleX(_arg1:Number):void{
super.scaleX = _arg1;
_registrationWidth = width;
switch (_scaleMode){
case VideoScaleMode.MAINTAIN_ASPECT_RATIO:
case VideoScaleMode.NO_SCALE:
startAutoResize();
break;
};
}
override public function set scaleY(_arg1:Number):void{
super.scaleY = _arg1;
_registrationHeight = height;
switch (_scaleMode){
case VideoScaleMode.MAINTAIN_ASPECT_RATIO:
case VideoScaleMode.NO_SCALE:
startAutoResize();
break;
};
}
public function get registrationWidth():Number{
return (_registrationWidth);
}
flvplayback_internal function flushQueuedCmds():void{
while (_cmdQueue.length > 0) {
_cmdQueue.pop();
};
}
public function get registrationX():Number{
return (_registrationX);
}
flvplayback_internal function _setUpStream():void{
if (((!(isNaN(_ncMgr.streamLength))) && ((_ncMgr.streamLength >= 0)))){
_streamLength = _ncMgr.streamLength;
};
_videoWidth = ((_ncMgr.streamWidth)>=0) ? _ncMgr.streamWidth : -1;
_videoHeight = ((_ncMgr.streamHeight)>=0) ? _ncMgr.streamHeight : -1;
if (!_hiddenForResize){
__visible = super.visible;
super.visible = false;
_volume = volume;
volume = 0;
_hiddenForResize = true;
};
_hiddenForResizeMetadataDelay = 0;
_play(0);
if (_currentPos > 0){
_seek(_currentPos);
_currentPos = 0;
};
_autoResizeTimer.reset();
_autoResizeTimer.start();
}
public function get registrationY():Number{
return (_registrationY);
}
flvplayback_internal function httpDoStopAtEnd():void{
if ((((_atEndCheckPlayhead == playheadTime)) && (!((playheadTime == 0))))){
_atEnd = false;
_seek(0);
return;
};
_atEndCheckPlayhead = NaN;
_atEnd = true;
if (isNaN(_streamLength)){
_streamLength = _ns.time;
};
_pause(true);
setState(VideoState.STOPPED);
if (_state != VideoState.STOPPED){
return;
};
doUpdateTime();
if (_state != VideoState.STOPPED){
return;
};
dispatchEvent(new VideoEvent(VideoEvent.COMPLETE, false, false, _state, playheadTime));
if (_state != VideoState.STOPPED){
return;
};
if (_autoRewind){
_atEnd = false;
_pause(true);
_seek(0);
setState(VideoState.REWINDING);
};
}
public function ncConnected():void{
if ((((_ncMgr == null)) || ((_ncMgr.netConnection == null)))){
setState(VideoState.CONNECTION_ERROR);
} else {
_createStream();
_setUpStream();
};
}
override public function set visible(_arg1:Boolean):void{
__visible = _arg1;
if (!_hiddenForResize){
super.visible = __visible;
};
}
public function load(_arg1:String, _arg2:Number=NaN, _arg3:Boolean=false):void{
if (_arg1 == null){
throw (new VideoError(VideoError.NULL_URL_LOAD));
};
if (_state == VideoState.EXEC_QUEUED_CMD){
_state = _cachedState;
} else {
if (((((!(stateResponsive)) && (!((_state == VideoState.DISCONNECTED))))) && (!((_state == VideoState.CONNECTION_ERROR))))){
queueCmd(QueuedCommand.LOAD, _arg1, _arg3, _arg2);
return;
};
execQueuedCmds();
};
_autoPlay = false;
_load(_arg1, _arg2, _arg3);
}
override public function set x(_arg1:Number):void{
var _local2:Number;
if (this.x != _arg1){
_local2 = (_arg1 - this.x);
super.x = _arg1;
_registrationX = (_registrationX + _local2);
};
}
override public function set y(_arg1:Number):void{
var _local2:Number;
if (this.y != _arg1){
_local2 = (_arg1 - this.y);
super.y = _arg1;
_registrationY = (_registrationY + _local2);
};
}
flvplayback_internal function _pause(_arg1:Boolean):void{
_atEndCheckPlayhead = playheadTime;
_rtmpDoStopAtEndTimer.reset();
if (_arg1){
_ns.pause();
} else {
_ns.resume();
};
}
public function get playheadUpdateInterval():Number{
return (_updateTimeTimer.delay);
}
flvplayback_internal function doDelayedBuffering(_arg1:TimerEvent):void{
switch (_state){
case VideoState.LOADING:
case VideoState.RESIZING:
break;
case VideoState.PLAYING:
_delayedBufferingTimer.reset();
if (((((((((!(isNaN(totalTime))) && ((totalTime > 0)))) && ((bytesLoaded > 0)))) && ((bytesLoaded < uint.MAX_VALUE)))) && ((bytesLoaded < bytesTotal)))){
pause();
if (_state == VideoState.PAUSED){
waitingForEnough = true;
playWhenEnoughDownloaded();
};
} else {
setState(VideoState.BUFFERING);
};
break;
default:
_delayedBufferingTimer.reset();
break;
};
}
public function get align():String{
return (_align);
}
public function set registrationWidth(_arg1:Number):void{
width = _arg1;
}
public function get stateResponsive():Boolean{
switch (_state){
case VideoState.STOPPED:
case VideoState.PLAYING:
case VideoState.PAUSED:
case VideoState.BUFFERING:
return (true);
default:
return (false);
};
}
public function get volume():Number{
return (soundTransform.volume);
}
public function get soundTransform():SoundTransform{
var _local1:SoundTransform;
if (_ns != null){
_soundTransform = _ns.soundTransform;
};
_local1 = new SoundTransform();
_local1.volume = (_hiddenForResize) ? _volume : _soundTransform.volume;
_local1.leftToLeft = _soundTransform.leftToLeft;
_local1.leftToRight = _soundTransform.leftToRight;
_local1.rightToLeft = _soundTransform.rightToLeft;
_local1.rightToRight = _soundTransform.rightToRight;
return (_local1);
}
public function get bufferTime():Number{
if (_ns != null){
_bufferTime = _ns.bufferTime;
};
return (_bufferTime);
}
public function get metadata():Object{
return (_metadata);
}
public function play(_arg1:String=null, _arg2:Number=NaN, _arg3:Boolean=false):void{
if (_arg1 != null){
if (_state == VideoState.EXEC_QUEUED_CMD){
_state = _cachedState;
} else {
if (((((!(stateResponsive)) && (!((_state == VideoState.DISCONNECTED))))) && (!((_state == VideoState.CONNECTION_ERROR))))){
queueCmd(QueuedCommand.PLAY, _arg1, _arg3, _arg2);
return;
};
execQueuedCmds();
};
_autoPlay = true;
_load(_arg1, _arg2, _arg3);
return;
};
if (!isXnOK()){
if ((((((_state == VideoState.CONNECTION_ERROR)) || ((_ncMgr == null)))) || ((_ncMgr.netConnection == null)))){
throw (new VideoError(VideoError.NO_CONNECTION));
};
flushQueuedCmds();
queueCmd(QueuedCommand.PLAY);
setState(VideoState.LOADING);
_cachedState = VideoState.LOADING;
_ncMgr.reconnect();
return;
} else {
if (_state == VideoState.EXEC_QUEUED_CMD){
_state = _cachedState;
} else {
if (!stateResponsive){
queueCmd(QueuedCommand.PLAY);
return;
};
execQueuedCmds();
};
};
if (_ns == null){
_createStream();
};
switch (_state){
case VideoState.BUFFERING:
if (_ncMgr.isRTMP){
_play(0);
if (_atEnd){
_atEnd = false;
_currentPos = 0;
setState(VideoState.REWINDING);
} else {
if (_currentPos > 0){
_seek(_currentPos);
_currentPos = 0;
};
};
};
case VideoState.PLAYING:
return;
case VideoState.STOPPED:
if (_ncMgr.isRTMP){
if (_isLive){
_play(-1);
setState(VideoState.BUFFERING);
} else {
_play(0);
if (_atEnd){
_atEnd = false;
_currentPos = 0;
_state = VideoState.BUFFERING;
setState(VideoState.REWINDING);
} else {
if (_currentPos > 0){
_seek(_currentPos);
_currentPos = 0;
setState(VideoState.BUFFERING);
} else {
setState(VideoState.BUFFERING);
};
};
};
} else {
_pause(false);
if (_atEnd){
_atEnd = false;
_seek(0);
_state = VideoState.BUFFERING;
setState(VideoState.REWINDING);
} else {
if (_bufferState == BUFFER_EMPTY){
setState(VideoState.BUFFERING);
} else {
setState(VideoState.PLAYING);
};
};
};
break;
case VideoState.PAUSED:
_pause(false);
if (!_ncMgr.isRTMP){
if (_bufferState == BUFFER_EMPTY){
setState(VideoState.BUFFERING);
} else {
setState(VideoState.PLAYING);
};
} else {
setState(VideoState.BUFFERING);
};
break;
};
}
public function get isLive():Boolean{
return (_isLive);
}
flvplayback_internal function setStateFromCachedState(_arg1:Boolean=true):void{
switch (_cachedState){
case VideoState.PLAYING:
case VideoState.PAUSED:
case VideoState.BUFFERING:
setState(_cachedState, _arg1);
break;
default:
setState(VideoState.STOPPED, _arg1);
break;
};
}
public function get idleTimeout():Number{
return (_idleTimeoutTimer.delay);
}
public function get registrationHeight():Number{
return (_registrationHeight);
}
public function ncReconnected():void{
if ((((_ncMgr == null)) || ((_ncMgr.netConnection == null)))){
setState(VideoState.CONNECTION_ERROR);
} else {
_ns = null;
_state = VideoState.STOPPED;
execQueuedCmds();
};
}
flvplayback_internal function startAutoResize():void{
switch (_state){
case VideoState.DISCONNECTED:
case VideoState.CONNECTION_ERROR:
return;
default:
_autoResizeDone = false;
if (((stateResponsive) && (((((((((!((super.videoWidth == 0))) || (!((super.videoHeight == 0))))) || ((_bufferState == BUFFER_FULL)))) || ((_bufferState == BUFFER_FLUSH)))) || ((_ns.time > autoResizePlayheadTimeout)))))){
doAutoResize();
} else {
_autoResizeTimer.reset();
_autoResizeTimer.start();
break;
};
};
}
flvplayback_internal function setState(_arg1:String, _arg2:Boolean=true):void{
var _local3:String;
if (_arg1 == _state){
return;
};
_hiddenRewindPlayheadTime = NaN;
_cachedState = _state;
_cachedPlayheadTime = playheadTime;
_state = _arg1;
_local3 = _state;
dispatchEvent(new VideoEvent(VideoEvent.STATE_CHANGE, false, false, _local3, playheadTime));
if (!_readyDispatched){
switch (_local3){
case VideoState.STOPPED:
case VideoState.PLAYING:
case VideoState.PAUSED:
case VideoState.BUFFERING:
_readyDispatched = true;
dispatchEvent(new VideoEvent(VideoEvent.READY, false, false, _local3, playheadTime));
break;
};
};
switch (_cachedState){
case VideoState.REWINDING:
dispatchEvent(new VideoEvent(VideoEvent.AUTO_REWOUND, false, false, _local3, playheadTime));
if (((_ncMgr.isRTMP) && ((_local3 == VideoState.STOPPED)))){
closeNS();
};
break;
};
switch (_local3){
case VideoState.STOPPED:
case VideoState.PAUSED:
if (_ncMgr.isRTMP){
_idleTimeoutTimer.reset();
_idleTimeoutTimer.start();
};
break;
case VideoState.SEEKING:
case VideoState.REWINDING:
_bufferState = BUFFER_EMPTY;
_sawPlayStop = false;
_idleTimeoutTimer.reset();
break;
case VideoState.PLAYING:
case VideoState.BUFFERING:
_updateTimeTimer.start();
_idleTimeoutTimer.reset();
break;
case VideoState.LOADING:
case VideoState.RESIZING:
_idleTimeoutTimer.reset();
break;
};
if (_arg2){
execQueuedCmds();
};
}
flvplayback_internal function _seek(_arg1:Number):void{
_rtmpDoStopAtEndTimer.reset();
if (((((!((_metadata == null))) && (!((_metadata.audiodelay == undefined))))) && (((isNaN(_streamLength)) || (((_arg1 + _metadata.audiodelay) < _streamLength)))))){
_arg1 = (_arg1 + _metadata.audiodelay);
};
_ns.seek(_arg1);
_invalidSeekTime = false;
_bufferState = BUFFER_EMPTY;
_sawPlayStop = false;
_sawSeekNotify = false;
}
public function get autoRewind():Boolean{
return (_autoRewind);
}
flvplayback_internal function doIdleTimeout(_arg1:TimerEvent):void{
close();
}
public function playWhenEnoughDownloaded():void{
if (((!((_ncMgr == null))) && (_ncMgr.isRTMP))){
play();
return;
};
if (!isXnOK()){
throw (new VideoError(VideoError.NO_CONNECTION));
};
if (_state == VideoState.EXEC_QUEUED_CMD){
_state = _cachedState;
} else {
if (!stateResponsive){
queueCmd(QueuedCommand.PLAY_WHEN_ENOUGH);
return;
};
execQueuedCmds();
};
waitingForEnough = true;
checkReadyForPlay(bytesLoaded, bytesTotal);
}
flvplayback_internal function rtmpDoSeek(_arg1:TimerEvent):void{
if (((!((_state == VideoState.REWINDING))) && (!((_state == VideoState.SEEKING))))){
_rtmpDoSeekTimer.reset();
_sawSeekNotify = false;
} else {
if (playheadTime != _cachedPlayheadTime){
_rtmpDoSeekTimer.reset();
_sawSeekNotify = false;
setStateFromCachedState(false);
doUpdateTime();
execQueuedCmds();
};
};
}
public function get netStream():NetStream{
return (_ns);
}
override public function get videoHeight():int{
if (_readyDispatched){
_videoHeight = super.videoHeight;
};
return (_videoHeight);
}
public function set registrationX(_arg1:Number):void{
var _local2:Number;
if (_registrationX != _arg1){
_local2 = (_arg1 - _registrationX);
_registrationX = _arg1;
this.x = (this.x + _local2);
};
}
public function set registrationY(_arg1:Number):void{
var _local2:Number;
if (_registrationY != _arg1){
_local2 = (_arg1 - _registrationY);
_registrationY = _arg1;
this.y = (this.y + _local2);
};
}
flvplayback_internal function doUpdateProgress(_arg1:TimerEvent):void{
var _local2:uint;
var _local3:uint;
if (_ns == null){
return;
};
_local2 = _ns.bytesLoaded;
_local3 = _ns.bytesTotal;
if (_local3 < uint.MAX_VALUE){
dispatchEvent(new VideoProgressEvent(VideoProgressEvent.PROGRESS, false, false, _local2, _local3));
};
if ((((((_state == VideoState.DISCONNECTED)) || ((_state == VideoState.CONNECTION_ERROR)))) || ((_local2 >= _local3)))){
_updateProgressTimer.stop();
};
checkEnoughDownloaded(_local2, _local3);
}
override public function set width(_arg1:Number):void{
super.width = (_registrationWidth = _arg1);
switch (_scaleMode){
case VideoScaleMode.MAINTAIN_ASPECT_RATIO:
case VideoScaleMode.NO_SCALE:
startAutoResize();
break;
default:
super.width = _arg1;
break;
};
}
public function get isRTMP():Boolean{
if (_ncMgr == null){
return (false);
};
return (_ncMgr.isRTMP);
}
public function get bytesTotal():uint{
if ((((_ns == null)) || (_ncMgr.isRTMP))){
return (uint.MAX_VALUE);
};
return (_ns.bytesTotal);
}
public function setSize(_arg1:Number, _arg2:Number):void{
super.width = (_registrationWidth = _arg1);
super.height = (_registrationHeight = _arg2);
switch (_scaleMode){
case VideoScaleMode.MAINTAIN_ASPECT_RATIO:
case VideoScaleMode.NO_SCALE:
startAutoResize();
break;
default:
super.x = _registrationX;
super.y = _registrationY;
break;
};
}
flvplayback_internal function isXnOK():Boolean{
if (_state == VideoState.LOADING){
return (true);
};
if (_state == VideoState.CONNECTION_ERROR){
return (false);
};
if (_state != VideoState.DISCONNECTED){
if ((((((_ncMgr == null)) || ((_ncMgr.netConnection == null)))) || (!(_ncMgr.netConnection.connected)))){
setState(VideoState.DISCONNECTED);
return (false);
};
return (true);
};
return (false);
}
flvplayback_internal function _createStream():void{
var _local1:NetStream;
_ns = null;
_local1 = new NetStream(_ncMgr.netConnection);
if (_ncMgr.isRTMP){
_local1.addEventListener(NetStatusEvent.NET_STATUS, rtmpNetStatus);
} else {
_local1.addEventListener(NetStatusEvent.NET_STATUS, httpNetStatus);
};
_local1.client = new VideoPlayerClient(this);
_local1.bufferTime = _bufferTime;
_local1.soundTransform = soundTransform;
_ns = _local1;
attachNetStream(_ns);
}
flvplayback_internal function checkReadyForPlay(_arg1:uint, _arg2:uint):void{
var _local3:Number;
if (_arg1 >= _arg2){
waitingForEnough = false;
_cachedState = _state;
_state = VideoState.EXEC_QUEUED_CMD;
play();
execQueuedCmds();
return;
};
if (isNaN(baselineProgressTime)){
return;
};
if (((isNaN(totalTime)) || ((totalTime < 0)))){
waitingForEnough = false;
_cachedState = _state;
_state = VideoState.EXEC_QUEUED_CMD;
play();
execQueuedCmds();
} else {
if (totalDownloadTime > 1.5){
_local3 = ((totalProgressTime - baselineProgressTime) / totalDownloadTime);
if ((totalTime - playheadTime) > ((totalTime - totalProgressTime) / _local3)){
waitingForEnough = false;
_cachedState = _state;
_state = VideoState.EXEC_QUEUED_CMD;
play();
execQueuedCmds();
};
};
};
}
flvplayback_internal function closeNS(_arg1:Boolean=false):void{
if (_ns != null){
if (_arg1){
_updateTimeTimer.reset();
doUpdateTime();
_currentPos = _ns.time;
};
_ns.removeEventListener(NetStatusEvent.NET_STATUS, rtmpNetStatus);
_ns.removeEventListener(NetStatusEvent.NET_STATUS, httpNetStatus);
_ns.close();
_ns = null;
};
}
flvplayback_internal function _load(_arg1:String, _arg2:Number, _arg3:Boolean):void{
var _local4:Boolean;
_prevVideoWidth = super.videoWidth;
_prevVideoHeight = super.videoHeight;
_autoResizeDone = false;
_cachedPlayheadTime = 0;
_bufferState = BUFFER_EMPTY;
_sawPlayStop = false;
_metadata = null;
_startingPlay = false;
_invalidSeekTime = false;
_invalidSeekRecovery = false;
_isLive = _arg3;
_contentPath = _arg1;
_currentPos = 0;
_streamLength = (((isNaN(_arg2)) || ((_arg2 <= 0)))) ? NaN : _arg2;
_atEnd = false;
_readyDispatched = false;
_lastUpdateTime = NaN;
lastUpdateTimeStuckCount = 0;
_sawSeekNotify = false;
waitingForEnough = false;
baselineProgressTime = NaN;
startProgressTime = NaN;
totalDownloadTime = NaN;
totalProgressTime = NaN;
_updateTimeTimer.reset();
_updateProgressTimer.reset();
_idleTimeoutTimer.reset();
_autoResizeTimer.reset();
_rtmpDoStopAtEndTimer.reset();
_rtmpDoSeekTimer.reset();
_httpDoSeekTimer.reset();
_finishAutoResizeTimer.reset();
_delayedBufferingTimer.reset();
closeNS(false);
if (_ncMgr == null){
createINCManager();
};
_local4 = _ncMgr.connectToURL(_contentPath);
setState(VideoState.LOADING);
_cachedState = VideoState.LOADING;
if (_local4){
_createStream();
_setUpStream();
};
if (!_ncMgr.isRTMP){
_updateProgressTimer.start();
};
}
flvplayback_internal function rtmpDoStopAtEnd(_arg1:TimerEvent=null):void{
if (_rtmpDoStopAtEndTimer.running){
switch (_state){
case VideoState.DISCONNECTED:
case VideoState.CONNECTION_ERROR:
_rtmpDoStopAtEndTimer.reset();
return;
};
if ((((_arg1 == null)) || ((_cachedPlayheadTime == playheadTime)))){
_rtmpDoStopAtEndTimer.reset();
} else {
_cachedPlayheadTime = playheadTime;
return;
};
};
if ((((((_atEndCheckPlayhead == playheadTime)) && (!(_isLive)))) && (!((playheadTime == 0))))){
_atEnd = false;
_currentPos = 0;
_play(0);
return;
};
_atEndCheckPlayhead = NaN;
_bufferState = BUFFER_EMPTY;
_sawPlayStop = false;
_atEnd = true;
setState(VideoState.STOPPED);
if (_state != VideoState.STOPPED){
return;
};
doUpdateTime();
if (_state != VideoState.STOPPED){
return;
};
dispatchEvent(new VideoEvent(VideoEvent.COMPLETE, false, false, _state, playheadTime));
if (_state != VideoState.STOPPED){
return;
};
if (((((_autoRewind) && (!(_isLive)))) && (!((playheadTime == 0))))){
_atEnd = false;
_currentPos = 0;
_play(0, 0);
setState(VideoState.REWINDING);
} else {
closeNS();
};
}
public function set idleTimeout(_arg1:Number):void{
_idleTimeoutTimer.delay = _arg1;
}
public function set playheadUpdateInterval(_arg1:Number):void{
_updateTimeTimer.delay = _arg1;
}
flvplayback_internal function checkEnoughDownloaded(_arg1:uint, _arg2:uint):void{
if ((((_arg1 == 0)) || ((_arg2 == uint.MAX_VALUE)))){
return;
};
if (((isNaN(totalTime)) || ((totalTime <= 0)))){
if (((waitingForEnough) && (stateResponsive))){
waitingForEnough = false;
_cachedState = _state;
_state = VideoState.EXEC_QUEUED_CMD;
play();
execQueuedCmds();
};
return;
};
if (_arg1 >= _arg2){
if (waitingForEnough){
waitingForEnough = false;
_cachedState = _state;
_state = VideoState.EXEC_QUEUED_CMD;
play();
execQueuedCmds();
};
return;
};
if (isNaN(baselineProgressTime)){
baselineProgressTime = ((_arg1 / _arg2) * totalTime);
};
if (isNaN(startProgressTime)){
startProgressTime = getTimer();
} else {
totalDownloadTime = ((getTimer() - startProgressTime) / 1000);
totalProgressTime = ((_arg1 / _arg2) * totalTime);
if (waitingForEnough){
checkReadyForPlay(_arg1, _arg2);
};
};
}
public function close():void{
closeNS(true);
if (((!((_ncMgr == null))) && (_ncMgr.isRTMP))){
_ncMgr.close();
};
setState(VideoState.DISCONNECTED);
dispatchEvent(new VideoEvent(VideoEvent.CLOSE, false, false, _state, playheadTime));
}
public function pause():void{
if (!isXnOK()){
if ((((((_state == VideoState.CONNECTION_ERROR)) || ((_ncMgr == null)))) || ((_ncMgr.netConnection == null)))){
throw (new VideoError(VideoError.NO_CONNECTION));
};
return;
} else {
if (_state == VideoState.EXEC_QUEUED_CMD){
_state = _cachedState;
} else {
if (!stateResponsive){
queueCmd(QueuedCommand.PAUSE);
return;
};
execQueuedCmds();
};
};
if ((((((_state == VideoState.PAUSED)) || ((_state == VideoState.STOPPED)))) || ((_ns == null)))){
return;
};
_pause(true);
setState(VideoState.PAUSED);
}
}
}//package fl.video
Section 107
//VideoPlayerClient (fl.video.VideoPlayerClient)
package fl.video {
public dynamic class VideoPlayerClient {
private var _owner:VideoPlayer;
public function VideoPlayerClient(_arg1:VideoPlayer){
_owner = _arg1;
}
public function get owner():VideoPlayer{
return (_owner);
}
public function onCuePoint(_arg1:Object, ... _args):void{
_owner.onCuePoint(_arg1);
}
public function onMetaData(_arg1:Object, ... _args):void{
_owner.onMetaData(_arg1);
}
}
}//package fl.video
Section 108
//VideoPlayerState (fl.video.VideoPlayerState)
package fl.video {
public class VideoPlayerState {
public var autoPlay:Boolean;
public var isWaiting:Boolean;
public var isLiveSet:Boolean;
public var index:int;
public var prevState:String;
public var preSeekTime:Number;
public var minProgressPercent:Number;
public var url:String;
public var totalTime:Number;
public var owner:VideoPlayer;
public var isLive:Boolean;
public var cmdQueue:Array;
public var totalTimeSet:Boolean;
public function VideoPlayerState(_arg1:VideoPlayer, _arg2:int){
this.owner = _arg1;
this.index = _arg2;
this.url = "";
this.isLive = false;
this.isLiveSet = true;
this.totalTime = NaN;
this.totalTimeSet = true;
this.autoPlay = (_arg2 == 0);
this.isWaiting = false;
this.preSeekTime = NaN;
this.cmdQueue = null;
}
}
}//package fl.video
Section 109
//VideoProgressEvent (fl.video.VideoProgressEvent)
package fl.video {
import flash.events.*;
public class VideoProgressEvent extends ProgressEvent implements IVPEvent {
private var _vp:uint;
public static const PROGRESS:String = "progress";
public function VideoProgressEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:uint=0, _arg5:uint=0, _arg6:uint=0){
super(_arg1, _arg2, _arg3, _arg4, _arg5);
_vp = _arg6;
}
override public function clone():Event{
return (new VideoProgressEvent(type, bubbles, cancelable, bytesLoaded, bytesTotal, vp));
}
public function set vp(_arg1:uint):void{
_vp = _arg1;
}
public function get vp():uint{
return (_vp);
}
}
}//package fl.video
Section 110
//VideoScaleMode (fl.video.VideoScaleMode)
package fl.video {
public final class VideoScaleMode {
public static const EXACT_FIT:String = "exactFit";
public static const MAINTAIN_ASPECT_RATIO:String = "maintainAspectRatio";
public static const NO_SCALE:String = "noScale";
}
}//package fl.video
Section 111
//VideoState (fl.video.VideoState)
package fl.video {
public final class VideoState {
public static const CONNECTION_ERROR:String = "connectionError";
public static const BUFFERING:String = "buffering";
public static const SEEKING:String = "seeking";
public static const STOPPED:String = "stopped";
public static const PAUSED:String = "paused";
public static const RESIZING:String = "resizing";
public static const PLAYING:String = "playing";
public static const DISCONNECTED:String = "disconnected";
public static const LOADING:String = "loading";
public static const REWINDING:String = "rewinding";
flvplayback_internal static var EXEC_QUEUED_CMD:String = "execQueuedCmd";
}
}//package fl.video
Section 112
//AirPowerUp (AirPowerUp)
package {
import flash.media.*;
public dynamic class AirPowerUp extends Sound {
}
}//package
Section 113
//App (App)
package {
import flash.display.*;
import flash.events.*;
import com.rawkins.games.dolphinOlympics.*;
import com.rawkins.fx.*;
public dynamic class App extends SimpleGame {
public var practiceState:Freeswim;
public var level:Level;
public var player:Player;
public var helpScreen:MovieClip;
public var anim:Anim;
public function App():void{
level = new Level();
player = new Player();
player.x = 320;
player.y = 240;
level.buildLevel();
level.addChild(player);
level.y = 0;
level.pause();
helpScreen = new HelpScreen();
helpScreen.x = (helpScreen.x + 50);
helpScreen.y = (helpScreen.y + 50);
anim = new Anim();
super();
}
override public function initGame(_arg1:Event=null):void{
super.mainState = new Freestyle(this, level);
practiceState = new Freeswim(this, level);
super.introState = new TitleScreen(this);
super.gameState.changeState(introState);
}
override public function endGame(_arg1:Event=null):void{
super.endGame();
}
public function practiceGame(_arg1:Event=null):void{
super.gameState.changeState(practiceState);
}
public function showHelp(_arg1:Event=null):void{
helpScreen.alpha = 0;
addChild(helpScreen);
anim.fade("in", helpScreen, 20);
}
}
}//package
Section 114
//Arrow (Arrow)
package {
import flash.display.*;
public dynamic class Arrow extends MovieClip {
}
}//package
Section 115
//BackButton (BackButton)
package {
import flash.display.*;
public dynamic class BackButton extends SimpleButton {
}
}//package
Section 116
//Ball (Ball)
package {
import flash.display.*;
public dynamic class Ball extends MovieClip {
}
}//package
Section 117
//CellRenderer_disabledSkin (CellRenderer_disabledSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_disabledSkin extends MovieClip {
}
}//package
Section 118
//CellRenderer_downSkin (CellRenderer_downSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_downSkin extends MovieClip {
}
}//package
Section 119
//CellRenderer_overSkin (CellRenderer_overSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_overSkin extends MovieClip {
}
}//package
Section 120
//CellRenderer_selectedDisabledSkin (CellRenderer_selectedDisabledSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedDisabledSkin extends MovieClip {
}
}//package
Section 121
//CellRenderer_selectedDownSkin (CellRenderer_selectedDownSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedDownSkin extends MovieClip {
}
}//package
Section 122
//CellRenderer_selectedOverSkin (CellRenderer_selectedOverSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedOverSkin extends MovieClip {
}
}//package
Section 123
//CellRenderer_selectedUpSkin (CellRenderer_selectedUpSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedUpSkin extends MovieClip {
}
}//package
Section 124
//CellRenderer_upSkin (CellRenderer_upSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_upSkin extends MovieClip {
}
}//package
Section 125
//Cloud1 (Cloud1)
package {
import flash.display.*;
public dynamic class Cloud1 extends MovieClip {
}
}//package
Section 126
//Cloud2 (Cloud2)
package {
import flash.display.*;
public dynamic class Cloud2 extends MovieClip {
}
}//package
Section 127
//Cloud3 (Cloud3)
package {
import flash.display.*;
public dynamic class Cloud3 extends MovieClip {
}
}//package
Section 128
//ComboBox_disabledSkin (ComboBox_disabledSkin)
package {
import flash.display.*;
public dynamic class ComboBox_disabledSkin extends MovieClip {
}
}//package
Section 129
//ComboBox_downSkin (ComboBox_downSkin)
package {
import flash.display.*;
public dynamic class ComboBox_downSkin extends MovieClip {
}
}//package
Section 130
//ComboBox_overSkin (ComboBox_overSkin)
package {
import flash.display.*;
public dynamic class ComboBox_overSkin extends MovieClip {
}
}//package
Section 131
//ComboBox_upSkin (ComboBox_upSkin)
package {
import flash.display.*;
public dynamic class ComboBox_upSkin extends MovieClip {
}
}//package
Section 132
//ComboExtended (ComboExtended)
package {
import flash.display.*;
public dynamic class ComboExtended extends MovieClip {
}
}//package
Section 133
//Diner (Diner)
package {
import flash.display.*;
public dynamic class Diner extends Sprite {
}
}//package
Section 134
//DolphinChirp1 (DolphinChirp1)
package {
import flash.media.*;
public dynamic class DolphinChirp1 extends Sound {
}
}//package
Section 135
//EndButton (EndButton)
package {
import flash.display.*;
public dynamic class EndButton extends SimpleButton {
}
}//package
Section 136
//EveningSky (EveningSky)
package {
import flash.display.*;
public dynamic class EveningSky extends MovieClip {
}
}//package
Section 137
//Explosion (Explosion)
package {
import flash.media.*;
public dynamic class Explosion extends Sound {
}
}//package
Section 138
//FireworkSound (FireworkSound)
package {
import flash.media.*;
public dynamic class FireworkSound extends Sound {
}
}//package
Section 139
//Floor1 (Floor1)
package {
import flash.display.*;
public dynamic class Floor1 extends Sprite {
}
}//package
Section 140
//Floor2 (Floor2)
package {
import flash.display.*;
public dynamic class Floor2 extends Sprite {
}
}//package
Section 141
//Floor3 (Floor3)
package {
import flash.display.*;
public dynamic class Floor3 extends Sprite {
}
}//package
Section 142
//Floor4 (Floor4)
package {
import flash.display.*;
public dynamic class Floor4 extends MovieClip {
}
}//package
Section 143
//Floor5 (Floor5)
package {
import flash.display.*;
public dynamic class Floor5 extends MovieClip {
}
}//package
Section 144
//Floor6 (Floor6)
package {
import flash.display.*;
public dynamic class Floor6 extends MovieClip {
}
}//package
Section 145
//FloorBase (FloorBase)
package {
import flash.display.*;
public dynamic class FloorBase extends MovieClip {
}
}//package
Section 146
//focusRectSkin (focusRectSkin)
package {
import flash.display.*;
public dynamic class focusRectSkin extends MovieClip {
}
}//package
Section 147
//FPSCounter (FPSCounter)
package {
import flash.display.*;
import flash.text.*;
public dynamic class FPSCounter extends MovieClip {
public var fps:TextField;
public var bar:MovieClip;
public var lowestValue:TextField;
}
}//package
Section 148
//FreestyleUI (FreestyleUI)
package {
import flash.display.*;
public dynamic class FreestyleUI extends MovieClip {
}
}//package
Section 149
//FreestyleUI_labels (FreestyleUI_labels)
package {
import flash.display.*;
public dynamic class FreestyleUI_labels extends MovieClip {
}
}//package
Section 150
//FreestyleUI_text (FreestyleUI_text)
package {
import flash.display.*;
import flash.text.*;
public dynamic class FreestyleUI_text extends MovieClip {
public var time_txt:TextField;
public var score_txt:TextField;
public var liveScore_txt:TextField;
}
}//package
Section 151
//FreeswimButton (FreeswimButton)
package {
import flash.display.*;
public dynamic class FreeswimButton extends SimpleButton {
}
}//package
Section 152
//FullReef1 (FullReef1)
package {
import flash.display.*;
public dynamic class FullReef1 extends Sprite {
}
}//package
Section 153
//FullReef2 (FullReef2)
package {
import flash.display.*;
public dynamic class FullReef2 extends Sprite {
}
}//package
Section 154
//HelpButton (HelpButton)
package {
import flash.display.*;
public dynamic class HelpButton extends SimpleButton {
}
}//package
Section 155
//HelpScreen (HelpScreen)
package {
import fl.video.*;
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.utils.*;
import flash.filters.*;
import flash.system.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
public dynamic class HelpScreen extends MovieClip {
public var prev_btn:SimpleButton;
public var sampleVideo:FLVPlayback;
public var close_btn:SimpleButton;
public var next_btn:SimpleButton;
public var __setPropDict:Dictionary;
public var currentPage;
public var nextPage;
public var prevPage;
public function HelpScreen(){
__setPropDict = new Dictionary(true);
super();
addFrameScript(0, frame1, 5, frame6, 10, frame11, 15, frame16, 16, frame17, 17, frame18, 18, frame19, 19, frame20, 20, frame21, 21, frame22, 22, frame23, 23, frame24, 24, frame25, 25, frame26, 26, frame27, 27, frame28, 28, frame29, 29, frame30, 30, frame31, 31, frame32, 32, frame33, 33, frame34, 34, frame35, 35, frame36, 36, frame37, 37, frame38, 38, frame39, 39, frame40, 40, frame41, 41, frame42, 42, frame43, 43, frame44, 44, frame45, 45, frame46, 46, frame47, 47, frame48, 48, frame49, 49, frame50, 50, frame51, 51, frame52, 52, frame53, 53, frame54, 54, frame55, 55, frame56, 56, frame57, 57, frame58, 58, frame59, 59, frame60, 60, frame61, 61, frame62, 62, frame63, 63, frame64, 64, frame65, 65, frame66);
}
public function onKey(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.ESCAPE){
onClose(_arg1);
};
}
public function onNext(_arg1:Event):void{
gotoAndStop(nextPage);
}
public function onPrev(_arg1:Event):void{
gotoAndStop(prevPage);
}
public function onClose(_arg1:Event):void{
if (parent != null){
if (((!((sampleVideo == null))) && (sampleVideo.playing))){
sampleVideo.pause();
};
parent.removeChild(this);
};
}
function __setProp_sampleVideo_HelpScreen_content_15(){
if ((((__setPropDict[sampleVideo] == undefined)) || (!((((int(__setPropDict[sampleVideo]) >= 16)) && ((int(__setPropDict[sampleVideo]) <= 66))))))){
__setPropDict[sampleVideo] = currentFrame;
try {
sampleVideo["componentInspectorSetting"] = true;
} catch(e:Error) {
};
sampleVideo.align = "center";
sampleVideo.autoPlay = true;
sampleVideo.scaleMode = "maintainAspectRatio";
sampleVideo.skin = "SkinOverPlaySeekStop.swf";
sampleVideo.skinAutoHide = true;
sampleVideo.skinBackgroundAlpha = 0.85;
sampleVideo.skinBackgroundColor = 4697035;
sampleVideo.source = "http://www.rawkins.com/games/do2/38mill.flv";
sampleVideo.volume = 1;
try {
sampleVideo["componentInspectorSetting"] = false;
} catch(e:Error) {
};
};
}
function frame1(){
stop();
currentPage = "page1";
nextPage = "page2";
prevPage = "page1";
next_btn.addEventListener(MouseEvent.CLICK, onNext);
prev_btn.addEventListener(MouseEvent.CLICK, onPrev);
prev_btn.visible = false;
next_btn.visible = true;
close_btn.addEventListener(MouseEvent.CLICK, onClose);
addEventListener(KeyboardEvent.KEY_DOWN, onKey);
}
function frame6(){
stop();
currentPage = "page2";
nextPage = "page3";
prevPage = "page1";
prev_btn.visible = true;
next_btn.visible = true;
}
function frame11(){
stop();
currentPage = "page3";
prevPage = "page2";
nextPage = "page4";
prev_btn.visible = true;
next_btn.visible = true;
}
function frame16(){
__setProp_sampleVideo_HelpScreen_content_15();
stop();
next_btn.visible = false;
currentPage = "page4";
prevPage = "page3";
}
function frame17(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame18(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame19(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame20(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame21(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame22(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame23(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame24(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame25(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame26(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame27(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame28(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame29(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame30(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame31(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame32(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame33(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame34(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame35(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame36(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame37(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame38(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame39(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame40(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame41(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame42(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame43(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame44(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame45(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame46(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame47(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame48(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame49(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame50(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame51(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame52(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame53(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame54(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame55(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame56(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame57(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame58(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame59(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame60(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame61(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame62(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame63(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame64(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame65(){
__setProp_sampleVideo_HelpScreen_content_15();
}
function frame66(){
__setProp_sampleVideo_HelpScreen_content_15();
}
}
}//package
Section 156
//HighJump_UI_labels (HighJump_UI_labels)
package {
import flash.display.*;
public dynamic class HighJump_UI_labels extends MovieClip {
}
}//package
Section 157
//HighJump_UI_text (HighJump_UI_text)
package {
import flash.display.*;
import flash.text.*;
public dynamic class HighJump_UI_text extends MovieClip {
public var time_txt:TextField;
public var height_txt:TextField;
public var liveScore_txt:TextField;
}
}//package
Section 158
//hitzone (hitzone)
package {
import flash.display.*;
public dynamic class hitzone extends MovieClip {
}
}//package
Section 159
//Impact (Impact)
package {
import flash.media.*;
public dynamic class Impact extends Sound {
}
}//package
Section 160
//Jupiter (Jupiter)
package {
import flash.display.*;
public dynamic class Jupiter extends Sprite {
}
}//package
Section 161
//List_skin (List_skin)
package {
import flash.display.*;
public dynamic class List_skin extends MovieClip {
}
}//package
Section 162
//Mars (Mars)
package {
import flash.display.*;
public dynamic class Mars extends Sprite {
}
}//package
Section 163
//MenuButton (MenuButton)
package {
import flash.display.*;
public dynamic class MenuButton extends SimpleButton {
}
}//package
Section 164
//MochiAd (MochiAd)
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return ("1.5");
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
mc.removeEventListener(Event.ENTER_FRAME, f);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function showPreloaderAd(_arg1:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var options = _arg1;
var DEFAULTS:Object = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, ad_started:function ():void{
this.clip.stop();
}, ad_finished:function ():void{
this.clip.play();
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
var ad_msec:Number = 11000;
var ad_timeout:Number = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time:Number = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
options.ad_finished();
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
var bar:MovieClip = createEmptyMovieClip(chk, "_mochiad_bar", 4);
bar.x = 10;
bar.y = (h - 20);
var bar_color:Number = options.color;
delete options.color;
var bar_background:Number = options.background;
delete options.background;
var bar_outline:Number = options.outline;
delete options.outline;
var backing_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 1);
var backing:Object = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
var inside_mc:MovieClip = createEmptyMovieClip(bar, "_inside", 2);
var inside:Object = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
var outline_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 3);
var outline:Object = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local2:MovieClip;
var _local1:Number = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
_local2 = this.parent.parent;
MochiAd.unload(_local2);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object = mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local11:Number;
var _local1:Object = this.parent.parent.root;
if (!_local1){
delete this["onEnterFrame"];
return;
};
var _local2:Object = this.parent._mochiad_ctr;
var _local3:Number = (getTimer() - this.started);
var _local4:Boolean;
var _local5:Number = _local1.loaderInfo.bytesTotal;
var _local6:Number = _local1.loaderInfo.bytesLoaded;
var _local7:Number = ((100 * _local6) / _local5);
var _local8:Number = ((100 * _local3) / chk.ad_msec);
var _local9:Object = this._mochiad_bar._inside;
var _local10:Number = Math.min(100, Math.min(((_local7) || (0)), _local8));
_local10 = Math.max(this.last_pcnt, _local10);
this.last_pcnt = _local10;
_local9.scaleX = (_local10 * 0.01);
if (!chk.showing){
_local11 = _local2.loaderInfo.bytesTotal;
if ((((_local11 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local3 > chk.ad_timeout){
_local4 = true;
};
};
};
if ((((_local3 > chk.ad_msec)) || (this.parent._mochiad_ctr_failed))){
_local4 = true;
};
if ((((((_local5 > 0)) && ((_local6 >= _local5)))) && (_local4))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showTimedAd(_arg1:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var options = _arg1;
var DEFAULTS:Object = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
this.clip.stop();
}, ad_finished:function ():void{
this.clip.play();
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
var ad_msec:Number = 11000;
var ad_timeout:Number = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time:Number = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
options.ad_finished();
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local2:MovieClip;
var _local1:Number = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
_local2 = this.parent.parent;
MochiAd.unload(_local2);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object = mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
chk["onEnterFrame"] = function ():void{
var _local4:Number;
var _local1:Object = this.parent._mochiad_ctr;
var _local2:Number = (getTimer() - this.started);
var _local3:Boolean;
if (!chk.showing){
_local4 = _local1.loaderInfo.bytesTotal;
if ((((_local4 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
_local3 = true;
};
};
};
if ((((_local2 > chk.ad_msec)) || (this.parent._mochiad_ctr_failed))){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _allowDomains(_arg1:String):String{
var _local2:String = _arg1.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function _loadCommunicator(_arg1:Object):MovieClip{
var mc:MovieClip;
var k:String;
var lc:LocalConnection;
var name:String;
var req:URLRequest;
var loader:Loader;
var options = _arg1;
var DEFAULTS:Object = {com_server:"http://x.mochiads.com/com/1/", method:"loadCommunicator", depth:10337, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
var clip:Object = options.clip;
var clipname:String = ("_mochiad_com_" + options.id);
if (!MochiAd._isNetworkAvailable()){
return (null);
};
if (clip[clipname]){
return (clip[clipname]);
};
var server:String = (options.com_server + options.id);
MochiAd._allowDomains(server);
delete options.id;
delete options.com_server;
var depth:Number = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, clipname, depth);
var lv:URLVariables = new URLVariables();
for (k in options) {
lv[k] = options[k];
};
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.name = name;
mc.lc = lc;
lv.lc = name;
mc._id = 0;
mc._queue = [];
mc.rpcResult = function (_arg1:Object):void{
_arg1 = parseInt(_arg1.toString());
var _local3:Array = mc._callbacks[_arg1];
if (typeof(_local3) == "undefined"){
return;
};
delete mc._callbacks[_arg1];
var _local4:Array = [];
var _local5:Number = 2;
while (_local5 < _local3.length) {
_local4.push(_local3[_local5]);
_local5++;
};
_local5 = 1;
while (_local5 < arguments.length) {
_local4.push(arguments[_local5]);
_local5++;
};
var _local6:Object = _local3[1];
var _local7:Object = _local3[0];
if (((_local7) && ((typeof(_local6) == "string")))){
_local6 = _local7[_local6];
};
if (typeof(_local6) == "function"){
_local6.apply(_local7, _local4);
};
};
mc._didConnect = function (_arg1:String):void{
var _local5:Array;
mc._endpoint = _arg1;
var _local2:Array = mc._queue;
delete mc._queue;
var _local3:Function = mc.doSend;
var _local4:Number = 0;
while (_local4 < _local2.length) {
_local5 = _local2[_local4];
_local3.apply(this, _local5);
_local4++;
};
};
mc.doSend = function (_arg1:Array, _arg2:Object, _arg3:Object):void{
var _local7:Array;
var _local8:Number;
if (mc._endpoint == null){
_local7 = [];
_local8 = 0;
while (_local8 < arguments.length) {
_local7.push(arguments[_local8]);
_local8++;
};
mc._queue.push(_local7);
return;
};
mc._id = (mc._id + 1);
var _local5:Number = mc._id;
mc._callbacks[_local5] = [_arg2, ((_arg3) || (_arg2))];
var _local6:LocalConnection = new LocalConnection();
_local6.send(mc._endpoint, "rpc", _local5, _arg1);
};
mc._callbacks = {};
mc._callbacks[0] = [mc, "_didConnect"];
lv.st = getTimer();
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader = new Loader();
loader.load(req);
mc.addChild(loader);
mc._mochiad_com = loader;
return (mc);
}
public static function fetchHighScores(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["fetchHighScores", _arg1], _arg2, _arg3);
return (true);
}
public static function sendHighScore(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["sendHighScore", _arg1], _arg2, _arg3);
return (true);
}
public static function load(_arg1:Object):MovieClip{
var mc:MovieClip;
var k:String;
var v:Object;
var options = _arg1;
var DEFAULTS:Object = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
var clip:Object = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
if (clip._mochiad_loaded){
return (null);
};
var depth:Number = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
var wh:Array = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
var lv:URLVariables = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
if (clip.loaderInfo.loaderURL.indexOf("http") != 0){
options.no_page = true;
};
var server:String = lv.server;
delete lv.server;
var hostname:String = _allowDomains(server);
mc["onEnterFrame"] = function ():void{
if (!this._mochiad_ctr){
delete this["onEnterFrame"];
MochiAd.unload(this.parent);
};
};
doOnEnterFrame(mc);
var lc:LocalConnection = new LocalConnection();
lc.client = mc;
var name:String = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
lv.lc = name;
lv.st = getTimer();
var loader:Loader = new Loader();
var f:Function = function (_arg1:Object):void{
mc._mochiad_ctr_failed = true;
};
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
var req:URLRequest = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
_arg1.removeChild(_arg1._mochiad);
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local6:Array;
var _local3:Object = _arg2.getBounds(_arg2.root);
var _local4:Number = 0;
var _local5:Number = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
var _local3:Object = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
return (_local3);
}
}
}//package
Section 165
//Moon (Moon)
package {
import flash.display.*;
public dynamic class Moon extends Sprite {
}
}//package
Section 166
//morning_sky (morning_sky)
package {
import flash.display.*;
public dynamic class morning_sky extends Sprite {
}
}//package
Section 167
//MuteButton (MuteButton)
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.utils.*;
import flash.filters.*;
import flash.system.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
public dynamic class MuteButton extends MovieClip {
public function MuteButton(){
addFrameScript(0, frame1, 4, frame5);
}
function frame1(){
stop();
}
function frame5(){
stop();
}
}
}//package
Section 168
//Nebula (Nebula)
package {
import flash.display.*;
public dynamic class Nebula extends Sprite {
}
}//package
Section 169
//Neptune (Neptune)
package {
import flash.display.*;
public dynamic class Neptune extends Sprite {
}
}//package
Section 170
//NightSky (NightSky)
package {
import flash.display.*;
public dynamic class NightSky extends MovieClip {
}
}//package
Section 171
//PlayAgainButton (PlayAgainButton)
package {
import flash.display.*;
public dynamic class PlayAgainButton extends SimpleButton {
}
}//package
Section 172
//Pluto (Pluto)
package {
import flash.display.*;
public dynamic class Pluto extends Sprite {
}
}//package
Section 173
//PowerDown (PowerDown)
package {
import flash.media.*;
public dynamic class PowerDown extends Sound {
}
}//package
Section 174
//Reef (Reef)
package {
import flash.display.*;
public dynamic class Reef extends MovieClip {
}
}//package
Section 175
//Reef1 (Reef1)
package {
import flash.display.*;
public dynamic class Reef1 extends Sprite {
}
}//package
Section 176
//Reef2 (Reef2)
package {
import flash.display.*;
public dynamic class Reef2 extends Sprite {
}
}//package
Section 177
//RestartButton (RestartButton)
package {
import flash.display.*;
public dynamic class RestartButton extends SimpleButton {
}
}//package
Section 178
//ResumeButton (ResumeButton)
package {
import flash.display.*;
public dynamic class ResumeButton extends SimpleButton {
}
}//package
Section 179
//roundFrame (roundFrame)
package {
import flash.display.*;
public dynamic class roundFrame extends MovieClip {
}
}//package
Section 180
//Saturn (Saturn)
package {
import flash.display.*;
public dynamic class Saturn extends Sprite {
}
}//package
Section 181
//SchoolBell (SchoolBell)
package {
import flash.media.*;
public dynamic class SchoolBell extends Sound {
}
}//package
Section 182
//ScoreBoardBG (ScoreBoardBG)
package {
import flash.display.*;
public dynamic class ScoreBoardBG extends Sprite {
}
}//package
Section 183
//ScoreButton (ScoreButton)
package {
import flash.display.*;
public dynamic class ScoreButton extends SimpleButton {
}
}//package
Section 184
//ScoresButton (ScoresButton)
package {
import flash.display.*;
public dynamic class ScoresButton extends SimpleButton {
}
}//package
Section 185
//ScrollArrowDown_disabledSkin (ScrollArrowDown_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_disabledSkin extends MovieClip {
}
}//package
Section 186
//ScrollArrowDown_downSkin (ScrollArrowDown_downSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_downSkin extends MovieClip {
}
}//package
Section 187
//ScrollArrowDown_overSkin (ScrollArrowDown_overSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_overSkin extends MovieClip {
}
}//package
Section 188
//ScrollArrowDown_upSkin (ScrollArrowDown_upSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_upSkin extends MovieClip {
}
}//package
Section 189
//ScrollArrowUp_disabledSkin (ScrollArrowUp_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_disabledSkin extends MovieClip {
}
}//package
Section 190
//ScrollArrowUp_downSkin (ScrollArrowUp_downSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_downSkin extends MovieClip {
}
}//package
Section 191
//ScrollArrowUp_overSkin (ScrollArrowUp_overSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_overSkin extends MovieClip {
}
}//package
Section 192
//ScrollArrowUp_upSkin (ScrollArrowUp_upSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_upSkin extends MovieClip {
}
}//package
Section 193
//ScrollBar_thumbIcon (ScrollBar_thumbIcon)
package {
import flash.display.*;
public dynamic class ScrollBar_thumbIcon extends MovieClip {
}
}//package
Section 194
//ScrollThumb_downSkin (ScrollThumb_downSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_downSkin extends MovieClip {
}
}//package
Section 195
//ScrollThumb_overSkin (ScrollThumb_overSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_overSkin extends MovieClip {
}
}//package
Section 196
//ScrollThumb_upSkin (ScrollThumb_upSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_upSkin extends MovieClip {
}
}//package
Section 197
//ScrollTrack_skin (ScrollTrack_skin)
package {
import flash.display.*;
public dynamic class ScrollTrack_skin extends MovieClip {
}
}//package
Section 198
//scrollZone (scrollZone)
package {
import flash.display.*;
public dynamic class scrollZone extends MovieClip {
}
}//package
Section 199
//Seashore (Seashore)
package {
import flash.media.*;
public dynamic class Seashore extends Sound {
}
}//package
Section 200
//SimpleGame (SimpleGame)
package {
import flash.display.*;
import flash.events.*;
import com.rawkins.fsm.*;
import flash.text.*;
import flash.utils.*;
import com.rawkins.sg.*;
public dynamic class SimpleGame extends MovieClip {
public var gameState:StateMachine;
public var mainState:MainState;
public var endState:EndState;
public var introState:IntroState;
public var centerX;
public var centerY;
private var debug_txt:TextField;
private var checkStage:Timer;
protected var allowLocal:Boolean;// = false
protected var enableDomainCheck:Boolean;// = true
public function SimpleGame(){
this.addEventListener(Event.ADDED_TO_STAGE, handleAddedToStage);
}
private function onStageCheck(_arg1:TimerEvent):void{
if (stage != null){
checkStage.stop();
checkStage.removeEventListener(TimerEvent.TIMER, onStageCheck);
checkStage = null;
initSG();
};
}
private function handleAddedToStage(_arg1:Event):void{
initSG();
}
public function initSG():void{
centerX = 320;
centerY = 240;
gameState = new StateMachine();
mainState = new MainState(this);
introState = new IntroState(this);
endState = new EndState(this);
addEventListener(Event.ENTER_FRAME, mainLoop);
initGame();
}
public function initGame(_arg1:Event=null):void{
gameState.changeState(introState);
}
public function startGame(_arg1:Event=null):void{
gameState.changeState(mainState);
}
public function endGame(_arg1:Event=null):void{
gameState.changeState(endState);
}
public function mainLoop(_arg1:Event):void{
gameState.update();
}
public function onDomain(_arg1:String):Boolean{
var _local4:uint;
var _local5:String;
var _local2:String = loaderInfo.loaderURL;
var _local3:String = _local2.substr(0, _local2.indexOf(":"));
if (_local3 == "http"){
_local4 = _local2.indexOf("//");
_local5 = _local2.substr((_local4 + 2), ((_local2.indexOf("/", (_local4 + 2)) - _local4) - 2));
_local5 = _local5.toLowerCase();
if (_local5.indexOf(_arg1) != -1){
return (true);
};
return (false);
//unresolved jump
};
if ((((_local3 == "file")) && (allowLocal))){
return (true);
};
if (allowLocal){
return (true);
};
return (false);
}
}
}//package
Section 201
//SkipButton (SkipButton)
package {
import flash.display.*;
public dynamic class SkipButton extends SimpleButton {
}
}//package
Section 202
//SpaceDolphin (SpaceDolphin)
package {
import flash.media.*;
public dynamic class SpaceDolphin extends Sound {
}
}//package
Section 203
//SpaceLoop1 (SpaceLoop1)
package {
import flash.media.*;
public dynamic class SpaceLoop1 extends Sound {
}
}//package
Section 204
//SplashSound (SplashSound)
package {
import flash.media.*;
public dynamic class SplashSound extends Sound {
}
}//package
Section 205
//StarBurst (StarBurst)
package {
import flash.display.*;
public dynamic class StarBurst extends MovieClip {
}
}//package
Section 206
//starfield (starfield)
package {
import flash.display.*;
public dynamic class starfield extends MovieClip {
}
}//package
Section 207
//StarPic (StarPic)
package {
import flash.display.*;
public dynamic class StarPic extends Sprite {
}
}//package
Section 208
//StarPic2 (StarPic2)
package {
import flash.display.*;
public dynamic class StarPic2 extends MovieClip {
}
}//package
Section 209
//StartButton (StartButton)
package {
import flash.display.*;
public dynamic class StartButton extends SimpleButton {
}
}//package
Section 210
//sun (sun)
package {
import flash.display.*;
public dynamic class sun extends MovieClip {
}
}//package
Section 211
//SunnySky (SunnySky)
package {
import flash.display.*;
public dynamic class SunnySky extends MovieClip {
}
}//package
Section 212
//TextInput_disabledSkin (TextInput_disabledSkin)
package {
import flash.display.*;
public dynamic class TextInput_disabledSkin extends MovieClip {
}
}//package
Section 213
//TextInput_upSkin (TextInput_upSkin)
package {
import flash.display.*;
public dynamic class TextInput_upSkin extends MovieClip {
}
}//package
Section 214
//Underwater (Underwater)
package {
import flash.media.*;
public dynamic class Underwater extends Sound {
}
}//package
Section 215
//Uranus (Uranus)
package {
import flash.display.*;
public dynamic class Uranus extends Sprite {
}
}//package
Section 216
//Water (Water)
package {
import flash.display.*;
public dynamic class Water extends MovieClip {
}
}//package
Section 217
//water_blur (water_blur)
package {
import flash.display.*;
public dynamic class water_blur extends MovieClip {
}
}//package
Section 218
//WaterPowerUp (WaterPowerUp)
package {
import flash.media.*;
public dynamic class WaterPowerUp extends Sound {
}
}//package
Section 219
//WaterRays (WaterRays)
package {
import flash.display.*;
public dynamic class WaterRays extends MovieClip {
}
}//package
Section 220
//Waves (Waves)
package {
import flash.display.*;
public dynamic class Waves extends Sprite {
}
}//package
Section 221
//WindUI (WindUI)
package {
import flash.display.*;
import flash.text.*;
public dynamic class WindUI extends Sprite {
public var wind_txt:TextField;
public var windVane:WindVane;
}
}//package
Section 222
//WindVane (WindVane)
package {
import flash.display.*;
public dynamic class WindVane extends Sprite {
}
}//package