Section 1
//JSON (com.adobe.serialization.json.JSON)
package com.adobe.serialization.json {
public class JSON {
public static function decode(_arg1:String){
var _local2:JSONDecoder = new JSONDecoder(_arg1);
return (_local2.getValue());
}
public static function encode(_arg1:Object):String{
var _local2:JSONEncoder = new JSONEncoder(_arg1);
return (_local2.getString());
}
}
}//package com.adobe.serialization.json
Section 2
//JSONDecoder (com.adobe.serialization.json.JSONDecoder)
package com.adobe.serialization.json {
public class JSONDecoder {
private var value;
private var tokenizer:JSONTokenizer;
private var token:JSONToken;
public function JSONDecoder(_arg1:String){
tokenizer = new JSONTokenizer(_arg1);
nextToken();
value = parseValue();
}
private function parseObject():Object{
var _local2:String;
var _local1:Object = new Object();
nextToken();
if (token.type == JSONTokenType.RIGHT_BRACE){
return (_local1);
};
while (true) {
if (token.type == JSONTokenType.STRING){
_local2 = String(token.value);
nextToken();
if (token.type == JSONTokenType.COLON){
nextToken();
_local1[_local2] = parseValue();
nextToken();
if (token.type == JSONTokenType.RIGHT_BRACE){
return (_local1);
};
if (token.type == JSONTokenType.COMMA){
nextToken();
} else {
tokenizer.parseError(("Expecting } or , but found " + token.value));
};
} else {
tokenizer.parseError(("Expecting : but found " + token.value));
};
} else {
tokenizer.parseError(("Expecting string but found " + token.value));
};
};
return (null);
}
private function parseValue():Object{
if (token == null){
tokenizer.parseError("Unexpected end of input");
};
switch (token.type){
case JSONTokenType.LEFT_BRACE:
return (parseObject());
case JSONTokenType.LEFT_BRACKET:
return (parseArray());
case JSONTokenType.STRING:
case JSONTokenType.NUMBER:
case JSONTokenType.TRUE:
case JSONTokenType.FALSE:
case JSONTokenType.NULL:
return (token.value);
default:
tokenizer.parseError(("Unexpected " + token.value));
};
return (null);
}
private function nextToken():JSONToken{
return ((token = tokenizer.getNextToken()));
}
public function getValue(){
return (value);
}
private function parseArray():Array{
var _local1:Array = new Array();
nextToken();
if (token.type == JSONTokenType.RIGHT_BRACKET){
return (_local1);
};
while (true) {
_local1.push(parseValue());
nextToken();
if (token.type == JSONTokenType.RIGHT_BRACKET){
return (_local1);
};
if (token.type == JSONTokenType.COMMA){
nextToken();
} else {
tokenizer.parseError(("Expecting ] or , but found " + token.value));
};
};
return (null);
}
}
}//package com.adobe.serialization.json
Section 3
//JSONEncoder (com.adobe.serialization.json.JSONEncoder)
package com.adobe.serialization.json {
import flash.utils.*;
public class JSONEncoder {
private var jsonString:String;
public function JSONEncoder(_arg1){
jsonString = convertToString(_arg1);
}
private function escapeString(_arg1:String):String{
var _local3:String;
var _local6:String;
var _local7:String;
var _local2 = "";
var _local4:Number = _arg1.length;
var _local5:int;
while (_local5 < _local4) {
_local3 = _arg1.charAt(_local5);
switch (_local3){
case "\"":
_local2 = (_local2 + "\\\"");
break;
case "\\":
_local2 = (_local2 + "\\\\");
break;
case "\b":
_local2 = (_local2 + "\\b");
break;
case "\f":
_local2 = (_local2 + "\\f");
break;
case "\n":
_local2 = (_local2 + "\\n");
break;
case "\r":
_local2 = (_local2 + "\\r");
break;
case "\t":
_local2 = (_local2 + "\\t");
break;
default:
if (_local3 < " "){
_local6 = _local3.charCodeAt(0).toString(16);
_local7 = ((_local6.length == 2)) ? "00" : "000";
_local2 = (_local2 + (("\\u" + _local7) + _local6));
} else {
_local2 = (_local2 + _local3);
};
};
_local5++;
};
return ((("\"" + _local2) + "\""));
}
private function arrayToString(_arg1:Array):String{
var _local2 = "";
var _local3:int;
while (_local3 < _arg1.length) {
if (_local2.length > 0){
_local2 = (_local2 + ",");
};
_local2 = (_local2 + convertToString(_arg1[_local3]));
_local3++;
};
return ((("[" + _local2) + "]"));
}
public function getString():String{
return (jsonString);
}
private function objectToString(_arg1:Object):String{
var value:Object;
var key:String;
var exposed:XMLList;
var v:XML;
var o = _arg1;
var s = "";
var classInfo:XML = describeType(o);
if (classInfo.@name.toString() == "Object"){
for (key in o) {
value = o[key];
if ((value is Function)){
} else {
if (value == null){
} else {
if (s.length > 0){
s = (s + ",");
};
s = (s + ((escapeString(key) + ":") + convertToString(value)));
};
};
};
} else {
exposed = classInfo.*.((hasOwnProperty("metadata")) && ((metadata.@name == "Value")));
for each (v in exposed) {
if (o[v.@name] != null){
if (s.length > 0){
s = (s + ",");
};
s = (s + ((((v.metadata.arg.@key == "name")) ? v.metadata.arg.@value : escapeString(v.@name.toString()) + ":") + convertToString(o[v.@name])));
};
};
};
return ((("{" + s) + "}"));
}
private function convertToString(_arg1):String{
if ((_arg1 is String)){
return (escapeString((_arg1 as String)));
};
if ((_arg1 is Number)){
return ((isFinite((_arg1 as Number))) ? _arg1.toString() : "null");
} else {
if ((_arg1 is Boolean)){
return ((_arg1) ? "true" : "false");
} else {
if ((_arg1 is Array)){
return (arrayToString((_arg1 as Array)));
};
if ((((_arg1 is Object)) && (!((_arg1 == null))))){
return (objectToString(_arg1));
};
};
};
return ("null");
}
}
}//package com.adobe.serialization.json
Section 4
//JSONParseError (com.adobe.serialization.json.JSONParseError)
package com.adobe.serialization.json {
public class JSONParseError extends Error {
private var _location:int;
private var _text:String;
public function JSONParseError(_arg1:String="", _arg2:int=0, _arg3:String=""){
super(_arg1);
_location = _arg2;
_text = _arg3;
}
public function get location():int{
return (_location);
}
public function get text():String{
return (_text);
}
}
}//package com.adobe.serialization.json
Section 5
//JSONToken (com.adobe.serialization.json.JSONToken)
package com.adobe.serialization.json {
public class JSONToken {
private var _value:Object;
private var _type:int;
public function JSONToken(_arg1:int=-1, _arg2:Object=null){
_type = _arg1;
_value = _arg2;
}
public function get value():Object{
return (_value);
}
public function get type():int{
return (_type);
}
public function set type(_arg1:int):void{
_type = _arg1;
}
public function set value(_arg1:Object):void{
_value = _arg1;
}
}
}//package com.adobe.serialization.json
Section 6
//JSONTokenizer (com.adobe.serialization.json.JSONTokenizer)
package com.adobe.serialization.json {
public class JSONTokenizer {
private var loc:int;
private var ch:String;
private var obj:Object;
private var jsonString:String;
public function JSONTokenizer(_arg1:String){
jsonString = _arg1;
loc = 0;
nextChar();
}
private function skipComments():void{
if (ch == "/"){
nextChar();
switch (ch){
case "/":
do {
nextChar();
} while (((!((ch == "\n"))) && (!((ch == "")))));
nextChar();
break;
case "*":
nextChar();
while (true) {
if (ch == "*"){
nextChar();
if (ch == "/"){
nextChar();
break;
};
} else {
nextChar();
};
if (ch == ""){
parseError("Multi-line comment not closed");
};
};
break;
default:
parseError((("Unexpected " + ch) + " encountered (expecting '/' or '*' )"));
};
};
}
private function isDigit(_arg1:String):Boolean{
return ((((_arg1 >= "0")) && ((_arg1 <= "9"))));
}
private function readString():JSONToken{
var _local3:String;
var _local4:int;
var _local1:JSONToken = new JSONToken();
_local1.type = JSONTokenType.STRING;
var _local2 = "";
nextChar();
while (((((!((ch == "\""))) && (!((ch == "'"))))) && (!((ch == ""))))) {
if (ch == "\\"){
nextChar();
switch (ch){
case "\"":
_local2 = (_local2 + "\"");
break;
case "'":
_local2 = (_local2 + "'");
break;
case "/":
_local2 = (_local2 + "/");
break;
case "\\":
_local2 = (_local2 + "\\");
break;
case "b":
_local2 = (_local2 + "\b");
break;
case "f":
_local2 = (_local2 + "\f");
break;
case "n":
_local2 = (_local2 + "\n");
break;
case "r":
_local2 = (_local2 + "\r");
break;
case "t":
_local2 = (_local2 + "\t");
break;
case "u":
_local3 = "";
_local4 = 0;
while (_local4 < 4) {
if (!isHexDigit(nextChar())){
parseError((" Excepted a hex digit, but found: " + ch));
};
_local3 = (_local3 + ch);
_local4++;
};
_local2 = (_local2 + String.fromCharCode(parseInt(_local3, 16)));
break;
default:
_local2 = (_local2 + ("\\" + ch));
};
} else {
_local2 = (_local2 + ch);
};
nextChar();
};
if (ch == ""){
parseError("Unterminated string literal");
};
nextChar();
_local1.value = _local2;
return (_local1);
}
private function nextChar():String{
return ((ch = jsonString.charAt(loc++)));
}
public function getNextToken():JSONToken{
var _local2:String;
var _local3:String;
var _local4:String;
var _local1:JSONToken = new JSONToken();
skipIgnored();
switch (ch){
case "{":
_local1.type = JSONTokenType.LEFT_BRACE;
_local1.value = "{";
nextChar();
break;
case "}":
_local1.type = JSONTokenType.RIGHT_BRACE;
_local1.value = "}";
nextChar();
break;
case "[":
_local1.type = JSONTokenType.LEFT_BRACKET;
_local1.value = "[";
nextChar();
break;
case "]":
_local1.type = JSONTokenType.RIGHT_BRACKET;
_local1.value = "]";
nextChar();
break;
case ",":
_local1.type = JSONTokenType.COMMA;
_local1.value = ",";
nextChar();
break;
case ":":
_local1.type = JSONTokenType.COLON;
_local1.value = ":";
nextChar();
break;
case "t":
_local2 = ((("t" + nextChar()) + nextChar()) + nextChar());
if (_local2 == "true"){
_local1.type = JSONTokenType.TRUE;
_local1.value = true;
nextChar();
} else {
parseError(("Expecting 'true' but found " + _local2));
};
break;
case "f":
_local3 = (((("f" + nextChar()) + nextChar()) + nextChar()) + nextChar());
if (_local3 == "false"){
_local1.type = JSONTokenType.FALSE;
_local1.value = false;
nextChar();
} else {
parseError(("Expecting 'false' but found " + _local3));
};
break;
case "n":
_local4 = ((("n" + nextChar()) + nextChar()) + nextChar());
if (_local4 == "null"){
_local1.type = JSONTokenType.NULL;
_local1.value = null;
nextChar();
} else {
parseError(("Expecting 'null' but found " + _local4));
};
break;
case "\"":
_local1 = readString();
break;
case "'":
_local1 = readString();
break;
default:
if (((isDigit(ch)) || ((ch == "-")))){
_local1 = readNumber();
} else {
if (ch == ""){
return (null);
};
parseError((("Unexpected " + ch) + " encountered"));
};
};
return (_local1);
}
private function skipWhite():void{
while (isWhiteSpace(ch)) {
nextChar();
};
}
public function parseError(_arg1:String):void{
throw (new JSONParseError(_arg1, loc, jsonString));
}
private function isWhiteSpace(_arg1:String):Boolean{
return ((((((((_arg1 == " ")) || ((_arg1 == "\t")))) || ((_arg1 == "\n")))) || ((_arg1 == "\r"))));
}
private function skipIgnored():void{
skipWhite();
skipComments();
skipWhite();
}
private function isHexDigit(_arg1:String):Boolean{
var _local2:String = _arg1.toUpperCase();
return (((isDigit(_arg1)) || ((((_local2 >= "A")) && ((_local2 <= "F"))))));
}
private function readNumber():JSONToken{
var _local1:JSONToken = new JSONToken();
_local1.type = JSONTokenType.NUMBER;
var _local2 = "";
if (ch == "-"){
_local2 = (_local2 + "-");
nextChar();
};
if (!isDigit(ch)){
parseError("Expecting a digit");
};
if (ch == "0"){
_local2 = (_local2 + ch);
nextChar();
if (isDigit(ch)){
parseError("A digit cannot immediately follow 0");
};
} else {
while (isDigit(ch)) {
_local2 = (_local2 + ch);
nextChar();
};
};
if (ch == "."){
_local2 = (_local2 + ".");
nextChar();
if (!isDigit(ch)){
parseError("Expecting a digit");
};
while (isDigit(ch)) {
_local2 = (_local2 + ch);
nextChar();
};
};
if ((((ch == "e")) || ((ch == "E")))){
_local2 = (_local2 + "e");
nextChar();
if ((((ch == "+")) || ((ch == "-")))){
_local2 = (_local2 + ch);
nextChar();
};
if (!isDigit(ch)){
parseError("Scientific notation number needs exponent value");
};
while (isDigit(ch)) {
_local2 = (_local2 + ch);
nextChar();
};
};
var _local3:Number = Number(_local2);
if (((isFinite(_local3)) && (!(isNaN(_local3))))){
_local1.value = _local3;
return (_local1);
};
parseError((("Number " + _local3) + " is not valid!"));
return (null);
}
}
}//package com.adobe.serialization.json
Section 7
//JSONTokenType (com.adobe.serialization.json.JSONTokenType)
package com.adobe.serialization.json {
public class JSONTokenType {
public static const NUMBER:int = 11;
public static const FALSE:int = 8;
public static const RIGHT_BRACKET:int = 4;
public static const NULL:int = 9;
public static const TRUE:int = 7;
public static const RIGHT_BRACE:int = 2;
public static const UNKNOWN:int = -1;
public static const COMMA:int = 0;
public static const LEFT_BRACKET:int = 3;
public static const STRING:int = 10;
public static const LEFT_BRACE:int = 1;
public static const COLON:int = 6;
}
}//package com.adobe.serialization.json
Section 8
//StringUtil (com.adobe.utils.StringUtil)
package com.adobe.utils {
public class StringUtil {
public static function beginsWith(_arg1:String, _arg2:String):Boolean{
return ((_arg2 == _arg1.substring(0, _arg2.length)));
}
public static function trim(_arg1:String):String{
return (StringUtil.ltrim(StringUtil.rtrim(_arg1)));
}
public static function stringsAreEqual(_arg1:String, _arg2:String, _arg3:Boolean):Boolean{
if (_arg3){
return ((_arg1 == _arg2));
};
return ((_arg1.toUpperCase() == _arg2.toUpperCase()));
}
public static function replace(_arg1:String, _arg2:String, _arg3:String):String{
var _local9:Number;
var _local4:String = new String();
var _local5:Boolean;
var _local6:Number = _arg1.length;
var _local7:Number = _arg2.length;
var _local8:Number = 0;
while (_local8 < _local6) {
if (_arg1.charAt(_local8) == _arg2.charAt(0)){
_local5 = true;
_local9 = 0;
while (_local9 < _local7) {
if (_arg1.charAt((_local8 + _local9)) != _arg2.charAt(_local9)){
_local5 = false;
break;
};
_local9++;
};
//unresolved if
_local4 = (_local4 + _arg3);
_local8 = (_local8 + (_local7 - 1));
} else {
_local4 = (_local4 + _arg1.charAt(_local8));
};
_local8++;
};
return (_local4);
}
public static function rtrim(_arg1:String):String{
var _local2:Number = _arg1.length;
var _local3:Number = _local2;
while (_local3 > 0) {
if (_arg1.charCodeAt((_local3 - 1)) > 32){
return (_arg1.substring(0, _local3));
};
_local3--;
};
return ("");
}
public static function endsWith(_arg1:String, _arg2:String):Boolean{
return ((_arg2 == _arg1.substring((_arg1.length - _arg2.length))));
}
public static function stringHasValue(_arg1:String):Boolean{
return (((!((_arg1 == null))) && ((_arg1.length > 0))));
}
public static function remove(_arg1:String, _arg2:String):String{
return (StringUtil.replace(_arg1, _arg2, ""));
}
public static function ltrim(_arg1:String):String{
var _local2:Number = _arg1.length;
var _local3:Number = 0;
while (_local3 < _local2) {
if (_arg1.charCodeAt(_local3) > 32){
return (_arg1.substring(_local3));
};
_local3++;
};
return ("");
}
}
}//package com.adobe.utils
Section 9
//Config (org.flowplayer.config.Config)
package org.flowplayer.config {
import org.flowplayer.model.*;
import flash.display.*;
import org.flowplayer.util.*;
public class Config {
private var _audioVersion:String;
private var config:Object;
private var _controlsVersion:String;
private var _playerSwfName:String;
public var logFilter:String;
private var _pluginBuilder:PluginBuilder;
private var _playlistBuilder:PlaylistBuilder;
private var playList:Playlist;
private var _loadables:Array;
public function Config(_arg1:Object, _arg2:String, _arg3:String, _arg4:String){
Assert.notNull(_arg1, "No configuration provided.");
this.config = _arg1;
_playerSwfName = _arg2;
_playlistBuilder = new PlaylistBuilder(playerId, _arg1.playlist, _arg1.clip);
_controlsVersion = _arg3;
_audioVersion = _arg4;
}
public function createClips(_arg1:Array=null):Array{
return (_playlistBuilder.createClips(_arg1));
}
public function getPlaylist():Playlist{
if (!playList){
playList = _playlistBuilder.createPlaylist();
};
return (playList);
}
private function get useBufferingAnimation():Boolean{
if (!config.hasOwnProperty("buffering")){
return (true);
};
return (config["buffering"]);
}
public function getLogConfiguration():LogConfiguration{
if (!config.log){
return (new LogConfiguration());
};
return ((new PropertyBinder(new LogConfiguration(), null).copyProperties(config.log) as LogConfiguration));
}
private function setProperty(_arg1:String, _arg2:Object, _arg3:Object):void{
if (!_arg2[_arg1]){
_arg2[_arg1] = _arg3;
};
}
public function get licenseKey():String{
return (config.key);
}
public function get showErrors():Boolean{
if (!config.hasOwnProperty("showErrors")){
return (true);
};
return (config["showErrors"]);
}
public function getLogo():Logo{
return ((viewObjectBuilder.getDisplayProperties(getObject("logo"), "logo", Logo) as Logo));
}
public function get playerId():String{
return (this.config.playerId);
}
public function createClip(_arg1:Object):Clip{
return (_playlistBuilder.createClip(_arg1));
}
public function get contextMenu():Array{
return ((getObject("contextMenu") as Array));
}
public function getPlugin(_arg1:DisplayObject, _arg2:String, _arg3:Object):PluginModel{
return (viewObjectBuilder.getPlugin(_arg1, _arg2, _arg3));
}
public function getScreenProperties():DisplayProperties{
return (viewObjectBuilder.getScreen(getObject("screen")));
}
private function get viewObjectBuilder():PluginBuilder{
if (_pluginBuilder == null){
_pluginBuilder = new PluginBuilder(_playerSwfName, _controlsVersion, _audioVersion, this, config.plugins, config);
};
return (_pluginBuilder);
}
public function get canvasStyle():Object{
var _local1:Object = getObject("canvas");
if (!_local1){
_local1 = new Object();
};
setProperty("backgroundGradient", _local1, [0.3, 0]);
setProperty("border", _local1, "0px");
setProperty("backgroundColor", _local1, "transparent");
setProperty("borderRadius", _local1, "0");
return (_local1);
}
public function createCuepoints(_arg1:Array, _arg2:String, _arg3:Number):Array{
return (_playlistBuilder.createCuepointGroup(_arg1, _arg2, _arg3));
}
public function getPlayButtonOverlay():PlayButtonOverlay{
var _local1:PlayButtonOverlay = (viewObjectBuilder.getDisplayProperties(getObject("play"), "play", PlayButtonOverlay) as PlayButtonOverlay);
if (_local1){
_local1.buffering = useBufferingAnimation;
};
return (_local1);
}
public function getObject(_arg1:String):Object{
return (config[_arg1]);
}
public function getLoadables():Array{
if (!_loadables){
_loadables = viewObjectBuilder.createLoadables(config.plugins, getPlaylist());
};
return (_loadables);
}
}
}//package org.flowplayer.config
Section 10
//ConfigLoader (org.flowplayer.config.ConfigLoader)
package org.flowplayer.config {
import org.flowplayer.util.*;
import com.adobe.serialization.json.*;
import org.flowplayer.*;
public class ConfigLoader {
private static var log:Log = new Log(ConfigLoader);
flow_internal static function parseConfig(_arg1:Object, _arg2:String, _arg3:String, _arg4:String):Config{
if (!_arg1){
return (new Config({}, _arg2, _arg3, _arg4));
};
var _local5:Object = ((_arg1 is String)) ? JSON.decode((_arg1 as String)) : _arg1;
return (new Config(_local5, _arg2, _arg3, _arg4));
}
}
}//package org.flowplayer.config
Section 11
//ExternalInterfaceHelper (org.flowplayer.config.ExternalInterfaceHelper)
package org.flowplayer.config {
import org.flowplayer.model.*;
import org.flowplayer.util.*;
import flash.utils.*;
import flash.external.*;
public class ExternalInterfaceHelper {
private static var log:Log = new Log("org.flowplayer.config::ExternalInterfaceHelper");
public static function initializeInterface(_arg1:Callable, _arg2:Object):void{
var xml:XML;
var exposedNode:XML;
var callable = _arg1;
var plugin = _arg2;
if (!ExternalInterface.available){
return;
};
xml = describeType(plugin);
var exposed:XMLList = xml.*.((hasOwnProperty("metadata")) && ((metadata.@name == "External")));
log.info(("Number of exposed methods and accessors: " + exposed.length()));
for each (exposedNode in exposed) {
log.debug(("processing exposed method or accessor " + exposedNode));
addMethods(callable, exposedNode, plugin);
};
}
private static function addMethods(_arg1:Callable, _arg2:XML, _arg3:Object):void{
var _local5:String;
var _local4:String = _arg2.@name;
log.debug(((("------------" + _local4) + ", has return value ") + !((_arg2.@returnType == "void"))));
if (_arg2.name() == "method"){
_arg1.addMethod(PluginMethod.method(_local4, _local4, !((_arg2.@returnType == "void"))));
} else {
if (_arg2.name() == "accessor"){
_local5 = (_local4.charAt(0).toUpperCase() + _local4.substring(1));
if (_arg2.@access == "readwrite"){
_arg1.addMethod(PluginMethod.getter(("get" + _local5), _local4));
_arg1.addMethod(PluginMethod.setter(("set" + _local5), _local4));
} else {
if (_arg2.@access == "readonly"){
_arg1.addMethod(PluginMethod.getter(("get" + _local5), _local4));
} else {
_arg1.addMethod(PluginMethod.setter(("set" + _local5), _local4));
};
};
};
};
}
public static function addCallback(_arg1:String, _arg2:Function):void{
var methodName = _arg1;
var func = _arg2;
try {
ExternalInterface.addCallback(methodName, func);
} catch(error:Error) {
log.error(("Unable to register callback for " + error));
};
}
}
}//package org.flowplayer.config
Section 12
//PlaylistBuilder (org.flowplayer.config.PlaylistBuilder)
package org.flowplayer.config {
import org.flowplayer.model.*;
import org.flowplayer.util.*;
import org.flowplayer.config.*;
class PlaylistBuilder {
private var clipObjects:Array;
private var log:Log;
private var _commonClip:Object;
private var _playerId:String;
function PlaylistBuilder(_arg1:String, _arg2:Array, _arg3:Object){
log = new Log(this);
super();
_playerId = _arg1;
this.clipObjects = ((_arg2) || ([]));
_commonClip = _arg3;
}
private function roundTime(_arg1:int, _arg2:Number):int{
return ((Math.round(((_arg1 * _arg2) / 100)) * 100));
}
private function setDefaults(_arg1:Object):void{
var _local2:String;
if (_arg1 == _commonClip){
return;
};
for (_local2 in _commonClip) {
if (_arg1[_local2] == undefined){
_arg1[_local2] = _commonClip[_local2];
};
};
}
public function createCuepointGroup(_arg1:Array, _arg2:String, _arg3:Number):Array{
var _local6:Object;
var _local7:Object;
var _local4:Array = new Array();
var _local5:Number = 0;
while (_local5 < _arg1.length) {
_local6 = _arg1[_local5];
_local7 = createCuepoint(_local6, _arg2, _arg3);
_local4.push(_local7);
_local5++;
};
return (_local4);
}
public function createClips(_arg1:Array):Array{
var _local4:Object;
var _local2:Array = new Array();
var _local3:Number = 0;
while (_local3 < _arg1.length) {
_local4 = _arg1[_local3];
if ((_local4 is String)){
_local4 = {url:_local4};
};
_local2.push(createClip(_local4));
_local3++;
};
return (_local2);
}
public function createClip(_arg1:Object):Clip{
var _local6:Number;
if (!_arg1){
return (null);
};
if ((_arg1 is String)){
_arg1 = {url:_arg1};
};
setDefaults(_arg1);
var _local2:String = _arg1.url;
var _local3:String = _arg1.baseUrl;
var _local4:String = _local2;
if (URLUtil.isCompleteURLWithProtocol(_local2)){
_local6 = _local2.lastIndexOf("/");
_local3 = _local2.substring(0, _local6);
_local4 = _local2.substring((_local6 + 1));
};
var _local5:Clip = Clip.create(_local4, _local3);
return ((new PropertyBinder(_local5, "customProperties").copyProperties(_arg1) as Clip));
}
public function createPlaylist():Playlist{
var _local1:Clip;
if (_commonClip){
_local1 = createClip(_commonClip);
};
var _local2:Playlist = new Playlist(_local1);
if (((clipObjects) && ((clipObjects.length > 0)))){
_local2.setClips(createClips(clipObjects));
} else {
if (_commonClip){
_local2.addClip(createClip(_commonClip));
};
};
return (_local2);
}
private function createCuepoint(_arg1:Object, _arg2:String, _arg3:Number):Object{
var _local5:String;
if ((_arg1 is Number)){
return (new Cuepoint(roundTime((_arg1 as int), _arg3), _arg2));
};
if (!_arg1.hasOwnProperty("time")){
throw (new Error(("Cuepoint does not have time: " + _arg1)));
};
var _local4:Object = Cuepoint.createDynamic(roundTime(_arg1.time, _arg3), _arg2);
for (_local5 in _arg1) {
if (_local5 != "time"){
_local4[_local5] = _arg1[_local5];
};
};
return (_local4);
}
}
}//package org.flowplayer.config
Section 13
//PluginBuilder (org.flowplayer.config.PluginBuilder)
package org.flowplayer.config {
import org.flowplayer.model.*;
import flash.display.*;
import org.flowplayer.util.*;
import org.flowplayer.config.*;
class PluginBuilder {
private var _controlsVersion:String;
private var log:Log;
private var _playerSwfName:String;
private var _audioVersion:String;
private var _skinObjects:Object;
private var _config:Config;
private var _pluginObjects:Object;
function PluginBuilder(_arg1:String, _arg2:String, _arg3:String, _arg4:Config, _arg5:Object, _arg6:Object){
log = new Log(this);
super();
_playerSwfName = _arg1;
_config = _arg4;
_pluginObjects = ((_arg5) || (new Object()));
_skinObjects = ((_arg6) || (new Object()));
_controlsVersion = _arg2;
_audioVersion = _arg3;
}
private function getPlayerVersion():String{
var _local1:String = getVersionFromSwfName("flowplayer");
if (_local1){
return (_local1);
};
return (getVersionFromSwfName("flowplayer.commercial"));
}
private function getScreenDefaults():Object{
var _local1:Object = new Object();
_local1.left = "50%";
_local1.bottom = "50%";
_local1.width = "100%";
_local1.height = "100%";
_local1.name = "screen";
_local1.zIndex = 0;
return (_local1);
}
public function createLoadables(_arg1:Object, _arg2:Playlist):Array{
var _local4:String;
var _local5:Loadable;
var _local3:Array = new Array();
for (_local4 in _arg1) {
if (!isObjectDisabled(_local4, _pluginObjects)){
log.debug(((("creating loadable for '" + _local4) + "', ") + _arg1[_local4]));
_local5 = new Loadable(_local4, _config);
new PropertyBinder(_local5, "config").copyProperties(_arg1[_local4]);
_local3.push(_local5);
};
};
createLoadable("controls", _local3, _controlsVersion);
if (_arg2.hasType(ClipType.AUDIO)){
createLoadable("audio", _local3, _audioVersion);
};
return (_local3);
}
private function findLoadable(_arg1:String, _arg2:Array):Loadable{
var _local4:Loadable;
var _local3:Number = 0;
while (_local3 < _arg2.length) {
_local4 = _arg2[_local3];
if (_local4.name == _arg1){
return (_local4);
};
_local3++;
};
return (null);
}
private function clearOpposite(_arg1:String, _arg2:String, _arg3:DisplayProperties, _arg4:Object):void{
if (((_arg3.position[_arg1].hasValue()) && (_arg4.hasOwnProperty(_arg2)))){
delete _arg4[_arg2];
} else {
if (((_arg3.position[_arg2].hasValue()) && (_arg4.hasOwnProperty(_arg1)))){
delete _arg4[_arg1];
};
};
}
private function createLoadable(_arg1:String, _arg2:Array, _arg3:String):void{
if (isObjectDisabled(_arg1, _pluginObjects)){
log.debug((_arg1 + " is disabled"));
return;
};
var _local4:Loadable = findLoadable(_arg1, _arg2);
if (!_local4){
_local4 = new Loadable(_arg1, _config);
_arg2.push(_local4);
} else {
log.debug((_arg1 + " was found in configuration, will not automatically add it into loadables"));
};
if (!_local4.url){
_local4.url = getLoadableUrl(_arg1, _arg3);
};
}
public function getDisplayProperties(_arg1:Object, _arg2:String, _arg3:Class=null):DisplayProperties{
if (isObjectDisabled(_arg2, _skinObjects)){
log.debug((_arg2 + " is disabled"));
return (null);
};
var _local4:DisplayProperties = (_arg3) ? (new (_arg3) as DisplayProperties) : new DisplayPropertiesImpl();
if (_arg1){
new PropertyBinder(_local4, null).copyProperties(_arg1);
};
_local4.name = _arg2;
return (_local4);
}
private function getLoadableUrl(_arg1:String, _arg2:String):String{
var _local3:String = getPlayerVersion();
if (_local3){
return ((((("flowplayer." + _arg1) + "-") + _arg2) + ".swf"));
};
return ((("flowplayer." + _arg1) + ".swf"));
}
private function isObjectDisabled(_arg1:String, _arg2:Object):Boolean{
if (!_arg2.hasOwnProperty(_arg1)){
return (false);
};
var _local3:Object = _arg2[_arg1];
return ((_local3 == null));
}
private function getVersionFromSwfName(_arg1:String):String{
if (_playerSwfName.indexOf(_arg1) != 0){
return (null);
};
if (_playerSwfName.indexOf(".swf") < (_arg1 + "-").length){
return (null);
};
return (_playerSwfName.substring((_playerSwfName.indexOf("-") + 1), _playerSwfName.indexOf(".swf")));
}
public function getScreen(_arg1:Object):DisplayProperties{
log.warn(("getScreen " + _arg1));
var _local2:DisplayProperties = new DisplayPropertiesImpl(null, "screen", false);
new PropertyBinder(_local2, null).copyProperties(getScreenDefaults());
if (_arg1){
log.info("setting screen properties specified in configuration");
new PropertyBinder(_local2, null).copyProperties(_arg1);
};
_local2.zIndex = 0;
return (_local2);
}
public function getPlugin(_arg1:DisplayObject, _arg2:String, _arg3:Object):PluginModel{
var _local5:Object;
var _local4:DisplayPluginModel = (new PropertyBinder(new DisplayPluginModelImpl(_arg1, _arg2, false), "config").copyProperties(_arg3, true) as DisplayPluginModel);
log.debug(((_arg2 + " position specified in config ") + _local4.position));
if ((_arg1 is Plugin)){
log.debug((_arg2 + " implements Pluggable, querying defaultConfig"));
_local5 = Plugin(_arg1).getDefaultConfig();
if (_local5){
fixPositionSettings(_local4, _local5);
if (((!(((_arg3) && (_arg3.hasOwnProperty("opacity"))))) && (_local5.hasOwnProperty("opacity")))){
_local4.opacity = _local5["opacity"];
};
_local4 = (new PropertyBinder(_local4, "config").copyProperties(_local5, false) as DisplayPluginModel);
log.debug(((((_arg2 + " position after applying defaults ") + _local4.position) + ", zIndex ") + _local4.zIndex));
};
};
return (_local4);
}
private function fixPositionSettings(_arg1:DisplayProperties, _arg2:Object):void{
clearOpposite("bottom", "top", _arg1, _arg2);
clearOpposite("left", "right", _arg1, _arg2);
}
}
}//package org.flowplayer.config
Section 14
//VersionInfo (org.flowplayer.config.VersionInfo)
package org.flowplayer.config {
public class VersionInfo {
private static const VERSION_NUMBER:String = (((("3" + ".") + "0") + ".") + "3");
private static const VERSION_INFO:String;
public static function get commercial():Boolean{
return (false);
}
public static function get audioVersion():String{
return ("3.0.2");
}
public static function versionInfo():String{
return (VERSION_INFO);
}
public static function get version():Array{
//unresolved jump
//unresolved jump
return ([new int("0"), new int("3"), "commercial", "free", ""]);
}
public static function get controlsVersion():String{
return ("3.0.3");
}
//unresolved jump
//unresolved jump
"Flowplayer commercial version ".VERSION_INFO = (("Flowplayer free version " + VERSION_NUMBER) + ("") ? ("-" + "") : "");
}
}//package org.flowplayer.config
Section 15
//AbstractDurationTrackingController (org.flowplayer.controller.AbstractDurationTrackingController)
package org.flowplayer.controller {
import org.flowplayer.model.*;
import org.flowplayer.controller.*;
import flash.events.*;
import org.flowplayer.util.*;
class AbstractDurationTrackingController implements MediaController {
protected var durationTracker:PlayTimeTracker;
protected var log:Log;
private var _playlist:Playlist;
private var _volumeController:VolumeController;
function AbstractDurationTrackingController(_arg1:VolumeController, _arg2:Playlist){
log = new Log(this);
super();
_volumeController = _arg1;
_playlist = _arg2;
}
final public function stopBuffering():void{
doStopBuffering();
}
protected function get bufferStart():Number{
return (0);
}
private function stop(_arg1:ClipEvent, _arg2:Boolean):void{
log.debug(("stop " + durationTracker));
if (durationTracker){
durationTracker.stop();
durationTracker.time = 0;
};
doStop(_arg1, _arg2);
}
public function get time():Number{
if (!durationTracker){
return (0);
};
var _local1:Number = durationTracker.time;
return (Math.min(_local1, clip.duration));
}
protected function get clip():Clip{
return (_playlist.current);
}
protected function doLoad(_arg1:ClipEvent, _arg2:Clip, _arg3:Boolean=false):void{
}
protected function get playlist():Playlist{
return (_playlist);
}
protected function get allowRandomSeek():Boolean{
return (false);
}
private function onPause(_arg1:ClipEvent):void{
durationTracker.stop();
}
protected function doResume(_arg1:ClipEvent):void{
}
private function seekTo(_arg1:ClipEvent, _arg2:Number):void{
doSeekTo(_arg1, _arg2);
durationTracker.time = _arg2;
}
protected function get bufferEnd():Number{
return (0);
}
final private function durationReached(_arg1:TimerEvent):void{
log.info("durationReached()");
durationTracker.removeEventListener(TimerEvent.TIMER_COMPLETE, durationReached);
onDurationReached();
if (clip.duration > 0){
log.debug("dispatching FINISH from durationTracking");
clip.dispatchBeforeEvent(new ClipEvent(ClipEventType.FINISH));
};
}
protected function get fileSize():Number{
return (0);
}
private function load(_arg1:ClipEvent, _arg2:Clip, _arg3:Boolean=false):void{
_arg2.onPause(onPause);
createDurationTracker(_arg2);
doLoad(_arg1, _arg2, _arg3);
}
protected function doPause(_arg1:ClipEvent):void{
}
final protected function dispatchPlayEvent(_arg1:ClipEvent):void{
clip.dispatchEvent(_arg1);
}
private function resume(_arg1:ClipEvent):void{
if (((durationTracker) && (durationTracker.durationReached))){
log.debug("resume(): duration has been reached");
return;
};
durationTracker.start();
doResume(_arg1);
}
private function createDurationTracker(_arg1:Clip):void{
if (durationTracker){
durationTracker.stop();
};
durationTracker = new PlayTimeTracker(_arg1, this);
durationTracker.addEventListener(TimerEvent.TIMER_COMPLETE, durationReached);
durationTracker.start();
}
protected function doStop(_arg1:ClipEvent, _arg2:Boolean):void{
}
private function pause(_arg1:ClipEvent):void{
durationTracker.stop();
doPause(_arg1);
}
final public function getStatus(_arg1:State):Status{
return (new Status(_arg1, clip, time, bufferStart, bufferEnd, fileSize, _volumeController.muted, _volumeController.volume, allowRandomSeek));
}
final public function onEvent(_arg1:ClipEventType, _arg2:Array=null):void{
if (_arg1 == ClipEventType.BEGIN){
load(new ClipEvent(_arg1), clip, (_arg2) ? _arg2[0] : false);
} else {
if (_arg1 == ClipEventType.PAUSE){
pause(new ClipEvent(_arg1));
} else {
if (_arg1 == ClipEventType.RESUME){
resume(new ClipEvent(_arg1));
} else {
if (_arg1 == ClipEventType.STOP){
stop((_arg1) ? new ClipEvent(_arg1) : null, _arg2[0]);
} else {
if (_arg1 == ClipEventType.SEEK){
seekTo(new ClipEvent(_arg1), _arg2[0]);
};
};
};
};
};
}
protected function doStopBuffering():void{
}
protected function doSeekTo(_arg1:ClipEvent, _arg2:Number):void{
}
protected function onDurationReached():void{
}
}
}//package org.flowplayer.controller
Section 16
//BufferingState (org.flowplayer.controller.BufferingState)
package org.flowplayer.controller {
import org.flowplayer.model.*;
import org.flowplayer.controller.*;
import flash.utils.*;
class BufferingState extends PlayState {
private var _nextStateAfterBufferFull:PlayState;
function BufferingState(_arg1:State, _arg2:Playlist, _arg3:PlayListController, _arg4:Dictionary){
super(_arg1, _arg2, _arg3, _arg4);
}
override function stopBuffering():void{
log.debug("stopBuffering() called");
stop();
getMediaController().stopBuffering();
}
override function get status():Status{
return (getMediaController().getStatus(state));
}
override function play():void{
log.debug("play()");
stop();
bufferingState.nextStateAfterBufferFull = playingState;
if (onEvent(ClipEventType.BEGIN, getMediaController(), [false])){
playList.current.played = true;
changeState(bufferingState);
};
}
override function pause():void{
if (onEvent(ClipEventType.PAUSE)){
changeState(pausedState);
};
}
override protected function setEventListeners(_arg1:ClipEventSupport, _arg2:Boolean=true):void{
if (_arg2){
_arg1.onBufferFull(moveState);
_arg1.onPause(moveState);
_arg1.onError(onError);
} else {
_arg1.unbind(moveState);
_arg1.unbind(onError);
};
}
private function onError(_arg1:ClipEvent):void{
getMediaController().onEvent(ClipEventType.STOP);
}
public function set nextStateAfterBufferFull(_arg1:PlayState):void{
this._nextStateAfterBufferFull = _arg1;
}
private function moveState(_arg1:ClipEvent):void{
log.debug(("moving to state " + _nextStateAfterBufferFull));
playListController.setPlayState(_nextStateAfterBufferFull);
}
}
}//package org.flowplayer.controller
Section 17
//ClipImageLoader (org.flowplayer.controller.ClipImageLoader)
package org.flowplayer.controller {
import org.flowplayer.model.*;
import org.flowplayer.controller.*;
class ClipImageLoader implements ResourceLoader {
private var _clip:Clip;
private var _loader:ResourceLoader;
function ClipImageLoader(_arg1:ResourceLoader, _arg2:Clip){
_loader = _arg1;
_clip = _arg2;
}
public function addTextResourceUrl(_arg1:String):void{
_loader.addTextResourceUrl(_arg1);
}
public function getContent(_arg1:String=null):Object{
return (_loader.getContent(_clip.completeUrl));
}
public function load(_arg1:String=null, _arg2:Function=null):void{
_loader.load(_arg1, _arg2);
}
public function clear():void{
_loader.clear();
}
public function loadClip(_arg1:Clip, _arg2:Function):void{
var imageLoader:ClipImageLoader;
var clip = _arg1;
var onLoadComplete = _arg2;
_clip = clip;
imageLoader = this;
load(clip.completeUrl, function (_arg1:ResourceLoader):void{
onLoadComplete(imageLoader);
});
}
public function set completeListener(_arg1:Function):void{
_loader.completeListener = _arg1;
}
public function addBinaryResourceUrl(_arg1:String):void{
_loader.addBinaryResourceUrl(_arg1);
}
}
}//package org.flowplayer.controller
Section 18
//EndedState (org.flowplayer.controller.EndedState)
package org.flowplayer.controller {
import org.flowplayer.model.*;
import org.flowplayer.controller.*;
import flash.utils.*;
class EndedState extends PlayState {
function EndedState(_arg1:State, _arg2:Playlist, _arg3:PlayListController, _arg4:Dictionary){
super(_arg1, _arg2, _arg3, _arg4);
}
}
}//package org.flowplayer.controller
Section 19
//ImageController (org.flowplayer.controller.ImageController)
package org.flowplayer.controller {
import org.flowplayer.model.*;
import org.flowplayer.controller.*;
import flash.display.*;
class ImageController extends AbstractDurationTrackingController implements MediaController {
private var _loader:ClipImageLoader;
function ImageController(_arg1:ResourceLoader, _arg2:VolumeController, _arg3:Playlist){
super(_arg2, _arg3);
_loader = new ClipImageLoader(_arg1, null);
}
override protected function doLoad(_arg1:ClipEvent, _arg2:Clip, _arg3:Boolean=false):void{
log.info(("Starting to load " + _arg2));
_loader.loadClip(_arg2, onLoadComplete);
dispatchPlayEvent(_arg1);
}
private function onLoadComplete(_arg1:ClipImageLoader):void{
clip.setContent((_arg1.getContent() as DisplayObject));
clip.originalHeight = _arg1.getContent().height;
clip.originalWidth = _arg1.getContent().width;
log.info(((((((("image loaded " + clip) + ", content ") + _arg1.getContent()) + ", width ") + clip.originalWidth) + ", height ") + clip.originalHeight));
clip.dispatch(ClipEventType.BUFFER_FULL);
if (clip.duration == 0){
clip.dispatchBeforeEvent(new ClipEvent(ClipEventType.FINISH));
};
}
override protected function doResume(_arg1:ClipEvent):void{
dispatchPlayEvent(_arg1);
}
override protected function doPause(_arg1:ClipEvent):void{
dispatchPlayEvent(_arg1);
}
override protected function get allowRandomSeek():Boolean{
return (true);
}
override protected function doStop(_arg1:ClipEvent, _arg2:Boolean):void{
dispatchPlayEvent(_arg1);
}
override protected function doSeekTo(_arg1:ClipEvent, _arg2:Number):void{
if (_arg1){
dispatchPlayEvent(new ClipEvent(ClipEventType.SEEK, _arg2));
};
}
}
}//package org.flowplayer.controller
Section 20
//MediaController (org.flowplayer.controller.MediaController)
package org.flowplayer.controller {
import org.flowplayer.model.*;
public interface MediaController {
function getStatus(_arg1:State):Status;
function onEvent(_arg1:ClipEventType, _arg2:Array=null):void;
function get time():Number;
function stopBuffering():void;
}
}//package org.flowplayer.controller
Section 21
//MediaControllerFactory (org.flowplayer.controller.MediaControllerFactory)
package org.flowplayer.controller {
import org.flowplayer.model.*;
import org.flowplayer.view.*;
import org.flowplayer.controller.*;
import flash.utils.*;
import org.flowplayer.config.*;
import org.flowplayer.*;
class MediaControllerFactory {
private var _playerEventDispatcher:PlayerEventDispatcher;
private var _streamProviders:Dictionary;
private var _config:Config;
private var _loader:ResourceLoader;
private var _volumeController:VolumeController;
private var _videoController:MediaController;
private var _imageController:ImageController;
private static var _instance:MediaControllerFactory;
function MediaControllerFactory(_arg1:Dictionary, _arg2:PlayerEventDispatcher, _arg3:Config, _arg4:ResourceLoader){
_streamProviders = _arg1;
_instance = this;
_playerEventDispatcher = _arg2;
_volumeController = new VolumeController(_playerEventDispatcher);
_config = _arg3;
_loader = _arg4;
}
public function getProvider(_arg1:Clip):StreamProvider{
var _local2:StreamProvider = _streamProviders[_arg1.provider];
if (!_local2){
_arg1.dispatchError(ClipError.PROVIDER_NOT_LOADED, ("Provider '" + _arg1.provider));
return (null);
};
_local2.volumeController = getVolumeController();
return (_local2);
}
flow_internal function getVolumeController():VolumeController{
return (_volumeController);
}
flow_internal function getMediaController(_arg1:Clip, _arg2:Playlist):MediaController{
var _local3:ClipType = _arg1.type;
if ((((_local3 == ClipType.VIDEO)) || ((_local3 == ClipType.AUDIO)))){
return (getStreamProviderController(_arg2));
};
if (_local3 == ClipType.IMAGE){
return (getImageController(_arg2));
};
throw (new Error(("No media controller found for clip type " + _local3)));
}
function addProvider(_arg1:ProviderModel):void{
_streamProviders[_arg1.name] = _arg1.getProviderObject();
}
private function getImageController(_arg1:Playlist):MediaController{
if (!_imageController){
_imageController = new ImageController(_loader, getVolumeController(), _arg1);
};
return (_imageController);
}
private function getStreamProviderController(_arg1:Playlist):MediaController{
if (!_videoController){
_videoController = new StreamProviderController(this, getVolumeController(), _config, _arg1);
};
return (_videoController);
}
}
}//package org.flowplayer.controller
Section 22
//NetStreamCallbacks (org.flowplayer.controller.NetStreamCallbacks)
package org.flowplayer.controller {
public interface NetStreamCallbacks {
function onPlayStatus(_arg1:Object):void;
function onImageData(_arg1:Object):void;
function onCaption(_arg1:String, _arg2:Number):void;
function onLastSecond(_arg1:Object):void;
function onXMPData(_arg1:Object):void;
function onFCSubscribe(_arg1:Object):void;
function RtmpSampleAccess(_arg1:Object):void;
function onCaptionInfo(_arg1:Object):void;
function onBWDone():void;
function onTextData(_arg1:Object):void;
function onCuePoint(_arg1:Object):void;
function onMetaData(_arg1:Object):void;
}
}//package org.flowplayer.controller
Section 23
//NetStreamClient (org.flowplayer.controller.NetStreamClient)
package org.flowplayer.controller {
import org.flowplayer.model.*;
import org.flowplayer.controller.*;
import org.flowplayer.util.*;
import org.flowplayer.config.*;
class NetStreamClient implements NetStreamCallbacks {
private var log:Log;
private var _metadataDispatched:Boolean;
private var _config:Config;
private var _clip:Clip;
function NetStreamClient(_arg1:Clip, _arg2:Config){
log = new Log(this);
super();
_clip = _arg1;
_config = _arg2;
}
public function onPlayStatus(_arg1:Object):void{
}
public function onXMPData(_arg1:Object):void{
}
public function RtmpSampleAccess(_arg1:Object):void{
}
public function onFCSubscribe(_arg1:Object):void{
}
public function onCuePoint(_arg1:Object):void{
}
public function onCaptionInfo(_arg1:Object):void{
}
public function onBWDone():void{
}
public function onImageData(_arg1:Object):void{
}
private function dispatchMetaData():void{
if (!_metadataDispatched){
_clip.dispatch(ClipEventType.METADATA);
};
_metadataDispatched = true;
}
public function onLastSecond(_arg1:Object):void{
}
public function onCaption(_arg1:String, _arg2:Number):void{
}
public function onTextData(_arg1:Object):void{
}
public function onMetaData(_arg1:Object):void{
var _local3:String;
log.info(("onMetaData, current clip " + _clip));
if (_clip.metaData){
dispatchMetaData();
return;
};
log.debug((("onMetaData, data for clip " + _clip) + ":"));
var _local2:Object = new Object();
for (_local3 in _arg1) {
log.debug(((_local3 + ": ") + _arg1[_local3]));
_local2[_local3] = _arg1[_local3];
};
_clip.metaData = _local2;
if (_local2.cuePoints){
log.debug("clip has embedded cuepoints");
_clip.addCuepoints(_config.createCuepoints(_local2.cuePoints, "embedded", _clip.cuepointMultiplier));
};
dispatchMetaData();
}
}
}//package org.flowplayer.controller
Section 24
//NetStreamControllingStreamProvider (org.flowplayer.controller.NetStreamControllingStreamProvider)
package org.flowplayer.controller {
import org.flowplayer.model.*;
import org.flowplayer.view.*;
import flash.display.*;
import flash.events.*;
import org.flowplayer.util.*;
import flash.utils.*;
import org.flowplayer.config.*;
import flash.net.*;
import flash.media.*;
import org.flowplayer.*;
import flash.errors.*;
public class NetStreamControllingStreamProvider implements StreamProvider {
private var _silentSeek:Boolean;
private var _model:PluginModel;
private var _playlist:Playlist;
private var _pauseAfterStart:Boolean;
private var _started:Boolean;
protected var log:Log;
private var _paused:Boolean;
private var _config:Config;
private var _connection:NetConnection;
private var _startedClip:Clip;
private var _volumeController:VolumeController;
private var _seekTarget:Number;
private var _stopping:Boolean;
private var _seekTargetWaitTimer:Timer;
private var _netStream:NetStream;
public function NetStreamControllingStreamProvider(){
log = new Log(this);
super();
}
public function onConfig(_arg1:PluginModel):void{
}
public function get bufferStart():Number{
return (0);
}
public function get allowRandomSeek():Boolean{
return (false);
}
final protected function addConnectionStatusListener(_arg1:NetConnection):void{
_arg1.addEventListener(NetStatusEvent.NET_STATUS, _onNetStatus);
}
flow_internal function set playerConfig(_arg1:Config):void{
_config = _arg1;
}
final public function pause(_arg1:ClipEvent):void{
_paused = true;
doPause(_netStream, _arg1);
}
final public function stop(_arg1:ClipEvent, _arg2:Boolean=false):void{
log.debug("stop called");
if (!_netStream){
return;
};
doStop(_arg1, _netStream, _arg2);
}
public function onBWDone(... _args):void{
}
protected function canDispatchStreamNotFound():Boolean{
return (true);
}
protected function getConnectUrl(_arg1:Clip):String{
return (null);
}
protected function doLoad(_arg1:ClipEvent, _arg2:NetStream, _arg3:Clip):void{
_arg2.client = new NetStreamClient(_arg3, _config);
_arg2.play(getClipUrl(_arg3));
}
public function attachStream(_arg1:DisplayObject):void{
Video(_arg1).attachNetStream(_netStream);
}
public function get seekTarget():Number{
return (_seekTarget);
}
protected function doPause(_arg1:NetStream, _arg2:ClipEvent=null):void{
if (!_arg1){
return;
};
_arg1.pause();
if (_arg2){
dispatchEvent(_arg2);
};
}
final protected function get paused():Boolean{
return (_paused);
}
private function _onNetStatus(_arg1:NetStatusEvent):void{
log.info("_onNetStatus, code: ", _arg1.info.code);
if (_stopping){
log.info("_onNetStatus(), _stopping == true and will not process the event any further");
return;
};
if (_arg1.info.code == "NetConnection.Connect.Success"){
createNetStream();
start(null, clip, _pauseAfterStart);
} else {
if (_arg1.info.code == "NetStream.Buffer.Empty"){
dispatchPlayEvent(ClipEventType.BUFFER_EMPTY);
} else {
if (_arg1.info.code == "NetStream.Buffer.Full"){
dispatchPlayEvent(ClipEventType.BUFFER_FULL);
} else {
if (_arg1.info.code == "NetConnection.Connect.Success"){
dispatchPlayEvent(ClipEventType.CONNECT);
} else {
if (_arg1.info.code == "NetStream.Play.Start"){
if (((!(_paused)) && (canDispatchBegin()))){
log.debug("dispatching onBegin");
clip.dispatchEvent(new ClipEvent(ClipEventType.BEGIN));
};
} else {
if (_arg1.info.code == "NetStream.Play.Stop"){
} else {
if (_arg1.info.code == "NetStream.Seek.Notify"){
if (!silentSeek){
startSeekTargetWait();
};
silentSeek = false;
} else {
if (_arg1.info.code == "NetStream.Seek.InvalidTime"){
} else {
if ((((((_arg1.info.code == "NetStream.Play.StreamNotFound")) || ((_arg1.info.code == "NetConnection.Connect.Rejected")))) || ((_arg1.info.code == "NetConnection.Connect.Failed")))){
if (canDispatchStreamNotFound()){
clip.dispatchError(ClipError.STREAM_NOT_FOUND, _arg1.info.code);
};
};
};
};
};
};
};
};
};
};
onNetStatus(_arg1);
}
final public function resume(_arg1:ClipEvent):void{
_paused = false;
_stopping = false;
doResume(_netStream, _arg1);
}
private function doStop(_arg1:ClipEvent, _arg2:NetStream, _arg3:Boolean=false):void{
log.debug("doStop");
_stopping = true;
if (_arg3){
_startedClip = null;
log.debug("doStop(), closing netStream and connection");
_arg2.close();
if (_connection){
_connection.close();
_connection = null;
};
clip.setContent(null);
} else {
silentSeek = true;
_arg2.client = new NullNetStreamClient();
_arg2.pause();
_arg2.seek(0);
};
dispatchEvent(_arg1);
}
final protected function dispatchEvent(_arg1:ClipEvent):void{
if (!_arg1){
return;
};
log.debug(("dispatching " + _arg1));
clip.dispatchEvent(_arg1);
}
private function startSeekTargetWait():void{
if (_seekTarget < 0){
return;
};
if (((_seekTargetWaitTimer) && (_seekTargetWaitTimer.running))){
return;
};
log.debug("starting seek target wait timer");
_seekTargetWaitTimer = new Timer(200);
_seekTargetWaitTimer.addEventListener(TimerEvent.TIMER, onSeekTargetWait);
_seekTargetWaitTimer.start();
}
protected function onMetaData(_arg1:ClipEvent):void{
log.info("in NetStreamControllingStremProvider.onStart");
clip.dispatch(ClipEventType.START, _pauseAfterStart);
if (_pauseAfterStart){
log.info("seeking to frame zero");
seek(null, 0);
dispatchPlayEvent(ClipEventType.PAUSE);
_pauseAfterStart = false;
};
}
final protected function get clip():Clip{
return (_playlist.current);
}
protected function get netConnection():NetConnection{
return (_connection);
}
protected function canDispatchBegin():Boolean{
return (true);
}
public function onLoad(_arg1:Flowplayer):void{
}
private function start(_arg1:ClipEvent, _arg2:Clip, _arg3:Boolean=false):void{
var event = _arg1;
var clip = _arg2;
var pauseAfterStart = _arg3;
log.debug(((("start called with clip " + clip) + ", pauseAfterStart ") + pauseAfterStart));
try {
doLoad(event, _netStream, clip);
_started = true;
} catch(e:SecurityError) {
dispatchError(ClipError.STREAM_LOAD_FAILED, ("cannot access the video file (try loosening Flash security settings): " + e.message));
} catch(e:IOError) {
dispatchError(ClipError.STREAM_LOAD_FAILED, ("cannot load the video file, incorrect URL?: " + e.message));
} catch(e:Error) {
dispatchError(ClipError.STREAM_LOAD_FAILED, ("cannot play video: " + e.message));
};
if (pauseAfterStart){
log.info("pausing to first frame!");
doPause(_netStream, null);
};
}
private function dispatchPlayEvent(_arg1:ClipEventType, _arg2:Object=null):void{
dispatchEvent(new ClipEvent(_arg1, _arg2));
}
final protected function get silentSeek():Boolean{
return (_silentSeek);
}
final public function seek(_arg1:ClipEvent, _arg2:Number):void{
silentSeek = (_arg1 == null);
if (Math.abs((_arg2 - _seekTarget)) < 1){
return;
};
log.debug(((("seekTo " + _arg2) + ", previous target was ") + _seekTarget));
_seekTarget = _arg2;
doSeek(_arg1, _netStream, _arg2);
}
final protected function get pauseAfterStart():Boolean{
return (_pauseAfterStart);
}
protected function get started():Boolean{
return (_started);
}
public function get bufferEnd():Number{
if (!_netStream){
return (0);
};
if (!currentClipStarted()){
return (0);
};
return (Math.min(((_netStream.bytesLoaded / _netStream.bytesTotal) * clip.durationFromMetadata), clip.duration));
}
public function get stopping():Boolean{
return (_stopping);
}
public function set config(_arg1:PluginModel):void{
_model = _arg1;
onConfig(_arg1);
}
final protected function get netStream():NetStream{
return (_netStream);
}
protected function isDurationReached():Boolean{
return ((Math.abs((getCurrentPlayheadTime(netStream) - clip.duration)) <= 0.5));
}
protected function doResume(_arg1:NetStream, _arg2:ClipEvent):void{
_arg1.resume();
dispatchEvent(_arg2);
}
public function get fileSize():Number{
if (!_netStream){
return (0);
};
if (!currentClipStarted()){
return (0);
};
return (_netStream.bytesTotal);
}
protected function doSeek(_arg1:ClipEvent, _arg2:NetStream, _arg3:Number):void{
log.debug((("calling netStream.seek(" + _arg3) + ")"));
_arg2.seek(_arg3);
}
public function set playlist(_arg1:Playlist):void{
_playlist = _arg1;
}
private function dispatchError(_arg1:ClipError, _arg2:String):void{
clip.dispatchError(_arg1, _arg2);
}
public function set volumeController(_arg1:VolumeController):void{
_volumeController = _arg1;
}
public function stopBuffering():void{
if (!_netStream){
return;
};
log.debug("stopBuffering, closing netStream");
_netStream.close();
dispatchPlayEvent(ClipEventType.BUFFER_STOP);
}
public function getVideo(_arg1:Clip):DisplayObject{
var _local2:Video = new Video();
_local2.smoothing = _arg1.smoothing;
return (_local2);
}
public function set player(_arg1:Flowplayer):void{
_config = _arg1.config;
onLoad(_arg1);
}
public function get time():Number{
if (!_netStream){
return (0);
};
if (!currentClipStarted()){
return (0);
};
if (!_started){
return (0);
};
return (getCurrentPlayheadTime(netStream));
}
protected function onNetStatus(_arg1:NetStatusEvent):void{
}
protected function getClipUrl(_arg1:Clip):String{
return (_arg1.completeUrl);
}
public function get playlist():Playlist{
return (_playlist);
}
final protected function set silentSeek(_arg1:Boolean):void{
_silentSeek = _arg1;
log.info(("silent mode was set to " + _silentSeek));
}
protected function currentClipStarted():Boolean{
return ((_startedClip == clip));
}
private function createNetStream():void{
_netStream = new NetStream(_connection);
netStream.client = new NetStreamClient(clip, _config);
_netStream.bufferTime = clip.bufferLength;
_volumeController.netStream = _netStream;
_netStream.addEventListener(NetStatusEvent.NET_STATUS, _onNetStatus);
}
protected function getCurrentPlayheadTime(_arg1:NetStream):Number{
return (_arg1.time);
}
protected function connect(_arg1:Clip, ... _args):void{
if (_netStream){
_netStream.close();
_netStream = null;
};
if (_connection){
_connection.close();
_connection = null;
};
_connection = new NetConnection();
_connection.proxyType = "best";
_connection.client = this;
addConnectionStatusListener(_connection);
log.debug(("Connecting to " + getConnectUrl(_arg1)));
if (_args.length > 0){
_connection.connect(getConnectUrl(_arg1), _args);
} else {
_connection.connect(getConnectUrl(_arg1));
};
}
final public function load(_arg1:ClipEvent, _arg2:Clip, _arg3:Boolean=false):void{
var event = _arg1;
var clip = _arg2;
var pauseAfterStart = _arg3;
_paused = false;
_stopping = false;
Assert.notNull(clip, "load(clip): clip cannot be null");
if (pauseAfterStart){
log.info("this clip will pause after start");
};
_pauseAfterStart = pauseAfterStart;
clip.onMetaData(onMetaData, function (_arg1:Clip):Boolean{
return ((_arg1.provider == (_model) ? _model.name : "http"));
});
log.debug(("previously started clip " + _startedClip));
if (((((_startedClip) && ((_startedClip == clip)))) && (_connection))){
log.info("playing previous clip again, reusing existing connection and resuming");
_started = false;
netStream.resume();
start(null, _startedClip, _pauseAfterStart);
} else {
log.debug("will create a new connection");
_startedClip = clip;
connect(clip);
};
}
final protected function set pauseAfterStart(_arg1:Boolean):void{
_pauseAfterStart = _arg1;
}
private function onSeekTargetWait(_arg1:TimerEvent):void{
if (time >= _seekTarget){
_seekTargetWaitTimer.stop();
log.debug("dispatching onSeek");
dispatchPlayEvent(ClipEventType.SEEK, _seekTarget);
_seekTarget = -1;
};
}
}
}//package org.flowplayer.controller
Section 25
//NullNetStreamClient (org.flowplayer.controller.NullNetStreamClient)
package org.flowplayer.controller {
import org.flowplayer.controller.*;
class NullNetStreamClient implements NetStreamCallbacks {
public function onPlayStatus(_arg1:Object):void{
}
public function onXMPData(_arg1:Object):void{
}
public function onCaption(_arg1:String, _arg2:Number):void{
}
public function RtmpSampleAccess(_arg1:Object):void{
}
public function onCaptionInfo(_arg1:Object):void{
}
public function onFCSubscribe(_arg1:Object):void{
}
public function onCuePoint(_arg1:Object):void{
}
public function onBWDone():void{
}
public function onMetaData(_arg1:Object):void{
}
public function onImageData(_arg1:Object):void{
}
public function onLastSecond(_arg1:Object):void{
}
public function onTextData(_arg1:Object):void{
}
}
}//package org.flowplayer.controller
Section 26
//PausedState (org.flowplayer.controller.PausedState)
package org.flowplayer.controller {
import org.flowplayer.model.*;
import org.flowplayer.controller.*;
import flash.utils.*;
class PausedState extends PlayState {
function PausedState(_arg1:State, _arg2:Playlist, _arg3:PlayListController, _arg4:Dictionary){
super(_arg1, _arg2, _arg3, _arg4);
}
override function stopBuffering():void{
log.debug("stopBuffering() called");
stop();
getMediaController().stopBuffering();
}
override function seekTo(_arg1:Number):void{
onEvent(ClipEventType.SEEK, getMediaController(), [_arg1]);
}
override function play():void{
resume();
}
override function resume():void{
log.debug(("resume(), changing to stage " + playingState));
if (onEvent(ClipEventType.RESUME)){
changeState(playingState);
};
}
}
}//package org.flowplayer.controller
Section 27
//PlayingState (org.flowplayer.controller.PlayingState)
package org.flowplayer.controller {
import org.flowplayer.model.*;
import org.flowplayer.controller.*;
import flash.utils.*;
class PlayingState extends PlayState {
function PlayingState(_arg1:State, _arg2:Playlist, _arg3:PlayListController, _arg4:Dictionary){
super(_arg1, _arg2, _arg3, _arg4);
}
override function stopBuffering():void{
log.debug("stopBuffering() called");
stop();
getMediaController().stopBuffering();
}
override function seekTo(_arg1:Number):void{
onEvent(ClipEventType.SEEK, getMediaController(), [_arg1]);
}
override function play():void{
log.debug("play()");
stop();
bufferingState.nextStateAfterBufferFull = playingState;
if (onEvent(ClipEventType.BEGIN, getMediaController(), [false])){
changeState(bufferingState);
playList.current.played = true;
};
}
override function pause():void{
if (onEvent(ClipEventType.PAUSE)){
changeState(pausedState);
};
}
}
}//package org.flowplayer.controller
Section 28
//PlayListController (org.flowplayer.controller.PlayListController)
package org.flowplayer.controller {
import org.flowplayer.model.*;
import org.flowplayer.view.*;
import org.flowplayer.util.*;
import flash.utils.*;
import org.flowplayer.config.*;
import org.flowplayer.*;
public class PlayListController {
private var _streamProviders:Dictionary;
private var log:Log;
private var _playList:Playlist;
private var _state:PlayState;
private var _config:Config;
private var _loader:ResourceLoader;
public function PlayListController(_arg1:Playlist, _arg2:Dictionary, _arg3:Config, _arg4:ResourceLoader){
log = new Log(this);
_playList = _arg1;
_streamProviders = _arg2;
_config = _arg3;
_loader = _arg4;
}
flow_internal function set playerEventDispatcher(_arg1:PlayerEventDispatcher):void{
PlayState.initStates(_playList, this, _streamProviders, _arg1, _config, _loader);
}
flow_internal function addProvider(_arg1:ProviderModel):void{
PlayState.addProvider(_arg1);
}
flow_internal function stopBuffering():Clip{
_state.stopBuffering();
return (_playList.current);
}
flow_internal function stop(_arg1:Boolean=false):Clip{
if (_arg1){
setPlayState(PlayState.waitingState);
} else {
if (_state){
_state.stop();
};
};
if (!_playList){
return (null);
};
return (_playList.current);
}
flow_internal function rewind():Clip{
log.info("rewind()");
setPlayState(PlayState.waitingState);
_playList.toIndex(firstNonSplashClip());
_state.play();
return (_playList.current);
}
flow_internal function set volume(_arg1:Number):void{
_state.volume = _arg1;
}
flow_internal function get muted():Boolean{
return (_state.muted);
}
flow_internal function getPlayState():PlayState{
return (_state);
}
flow_internal function playClips(_arg1:Array):void{
replacePlaylistAndPlay(_arg1);
}
flow_internal function get playlist():Playlist{
return (_playList);
}
flow_internal function seekTo(_arg1:Number):Clip{
log.debug(("seekTo " + _arg1));
if (_arg1 >= 0){
_state.seekTo(_arg1);
} else {
log.warn(("seekTo was called with seconds value " + _arg1));
};
return (_playList.current);
}
flow_internal function setPlaylist(_arg1:Array):void{
close();
_playList.replaceClips2(_arg1);
}
flow_internal function set muted(_arg1:Boolean):void{
_state.muted = _arg1;
}
private function currentIsAudioWithSplash():Boolean{
return ((((((((_playList.current.type == ClipType.AUDIO)) && (_playList.current.image))) && (_playList.previousClip))) && ((_playList.previousClip.type == ClipType.IMAGE))));
}
flow_internal function get volume():Number{
if (!_state){
return (0);
};
return (_state.volume);
}
flow_internal function getState():State{
if (!_state){
return (null);
};
return (_state.state);
}
flow_internal function setPlayState(_arg1:PlayState):void{
log.debug(("moving to state " + _arg1));
if (_state){
_state.active = false;
};
_state = _arg1;
_state.active = true;
}
flow_internal function startBuffering():Clip{
_state.startBuffering();
return (_playList.current);
}
private function replacePlaylistAndPlay(_arg1:Object):void{
stop();
if ((_arg1 is Clip)){
_playList.replaceClips((_arg1 as Clip));
} else {
_playList.replaceClips2((_arg1 as Array));
};
play();
}
flow_internal function isInState(_arg1:PlayState):Boolean{
return ((_state == _arg1));
}
flow_internal function moveTo(_arg1:Function, _arg2:Boolean, _arg3:Boolean):Clip{
var _local4:State = getState();
log.debug(("moveTo() current state is " + _state));
if (_arg3){
_state.stop(true, true);
setPlayState(PlayState.waitingState);
} else {
_state.stop();
};
var _local5:Clip = _arg1();
log.info(("moved in playlist, current clip is " + _playList.current));
log.debug(((("moved in playlist, next clip autoPlay " + _local5.autoPlay) + ", autoBuffering ") + _local5.autoBuffering));
if (_arg2){
log.debug("obeying clip autoPlay & autoBuffeing");
if (_local5.autoPlayNext){
_local5.autoPlayNext = false;
_state.play();
} else {
if (_local5.autoPlay){
_state.play();
} else {
if (_local5.autoBuffering){
_state.startBuffering();
};
};
};
} else {
log.debug("not obeying playlist settings");
if ((((_local4 == State.PAUSED)) || ((_local4 == State.WAITING)))){
_state.startBuffering();
} else {
_state.play();
};
};
return (_local5);
}
flow_internal function resume():Clip{
_state.resume();
return (_playList.current);
}
flow_internal function next(_arg1:Boolean, _arg2:Boolean=false):Clip{
if (!_playList.hasNext()){
return (_playList.current);
};
return (moveTo(_playList.next, _arg1, _arg2));
}
private function firstNonSplashClip():Number{
var _local3:Clip;
var _local4:Clip;
var _local1:Array = _playList.clips;
var _local2:Number = 0;
while (_local2 < _local1.length) {
_local3 = _local1[_local2];
if ((((_local3.type == ClipType.IMAGE)) && ((_local3.duration > 0)))){
return (_local2);
};
if ((((_local3.type == ClipType.IMAGE)) && ((_local2 < (_local1.length - 1))))){
_local4 = (_local1[(_local2 + 1)] as Clip);
if ((((_local4.type == ClipType.AUDIO)) && (_local4.image))){
_local4.autoPlayNext = true;
return (_local2);
};
};
if ((((_local3.type == ClipType.VIDEO)) || ((_local3.type == ClipType.AUDIO)))){
return (_local2);
};
_local2++;
};
return (0);
}
flow_internal function pause():Clip{
_state.pause();
return (_playList.current);
}
flow_internal function previous():Clip{
if (!_playList.hasPrevious()){
return (_playList.current);
};
if (((currentIsAudioWithSplash()) && ((_playList.currentIndex >= 3)))){
_state.stop();
_playList.toIndex((_playList.currentIndex - 2));
_state.play();
return (_playList.current);
};
return (moveTo(_playList.previous, false, false));
}
flow_internal function close():void{
_state.close();
}
flow_internal function get status():Status{
return (_state.status);
}
flow_internal function play(_arg1:Clip=null, _arg2:Number=-1):Clip{
log.debug(((("play() " + _arg1) + ", ") + _arg2));
if (((_arg1) || ((_arg2 >= 0)))){
return (playClip(_arg1, _arg2));
};
if (((!(_playList.hasNext())) && (status.ended))){
return (rewind());
};
_state.play();
return (_playList.current);
}
private function playClip(_arg1:Clip=null, _arg2:Number=undefined):Clip{
if (_arg1){
replacePlaylistAndPlay(_arg1);
return (_arg1);
};
if (_arg2 >= 0){
if ((((_arg2 == _playList.currentIndex)) && (!((getState() == State.WAITING))))){
log.debug("play(): already playing this clip, returning");
return (_playList.current);
};
_state.stop();
if (_playList.toIndex(_arg2) == null){
log.error((("There is no clip at index " + _arg2) + ", cannot play"));
return (_playList.current);
};
_state.play();
};
return (_playList.current);
}
}
}//package org.flowplayer.controller
Section 29
//PlayState (org.flowplayer.controller.PlayState)
package org.flowplayer.controller {
import org.flowplayer.model.*;
import org.flowplayer.view.*;
import org.flowplayer.controller.*;
import org.flowplayer.util.*;
import flash.utils.*;
import org.flowplayer.config.*;
class PlayState {
protected var log:Log;
private var _stateCode:State;
private var _active:Boolean;
protected var playListController:PlayListController;
protected var playList:Playlist;
static var playingState:PlayingState;
static var waitingState:PlayState;
static var pausedState:PausedState;
private static var _controllerFactory:MediaControllerFactory;
static var bufferingState:BufferingState;
static var endedState:EndedState;
function PlayState(_arg1:State, _arg2:Playlist, _arg3:PlayListController, _arg4:Dictionary){
log = new Log(this);
super();
this._stateCode = _arg1;
this.playList = _arg2;
_arg2.onPlaylistReplace(onPlaylistChanged);
this.playListController = _arg3;
}
function stopBuffering():void{
log.debug("cannot stop buffering in this state");
}
protected function changeState(_arg1:PlayState):void{
if (playListController.getPlayState() != _arg1){
playListController.setPlayState(_arg1);
};
}
function stop(_arg1:Boolean=false, _arg2:Boolean=false):void{
log.debug("stop() called");
if (_arg2){
getMediaController().onEvent(null, [_arg1]);
return;
};
if (onEvent(ClipEventType.STOP, getMediaController(), [_arg1])){
changeState(waitingState);
};
}
protected function setEventListeners(_arg1:ClipEventSupport, _arg2:Boolean=true):void{
}
final function set active(_arg1:Boolean):void{
log.debug((" is active: " + _arg1));
_active = _arg1;
if (_arg1){
playList.onBeforeFinish(onClipDone);
} else {
playList.unbind(onClipDone, ClipEventType.FINISH, true);
};
setEventListeners(playList, _arg1);
}
function get state():State{
return (_stateCode);
}
function seekTo(_arg1:Number):void{
log.debug("cannot seek in this state");
}
function set muted(_arg1:Boolean):void{
_controllerFactory.getVolumeController().muted = _arg1;
}
protected function get playListReady():Boolean{
if (((!(playList.current)) || (playList.current.isNullClip))){
log.debug("playlist has nos clips to play, returning");
return (false);
};
return (true);
}
function get volume():Number{
return (_controllerFactory.getVolumeController().volume);
}
protected function onEvent(_arg1:ClipEventType, _arg2:MediaController=null, _arg3:Array=null):Boolean{
Assert.notNull(_arg1, "eventType must be non-null");
if (playList.current.isNullClip){
return (false);
};
if (_arg1.isCancellable){
if (!playList.current.dispatchBeforeEvent(new ClipEvent(_arg1))){
log.info("event default was prevented, will not execute a state change");
return (false);
};
};
log.debug((("calling onEvent(" + _arg1) + ") on media controller"));
((_arg2) || (getMediaController())).onEvent(_arg1, _arg3);
return (true);
}
function startBuffering():void{
log.debug("cannot start buffering in this state");
}
private function onPlaylistChanged(_arg1:ClipEvent):void{
setEventListeners(ClipEventSupport(_arg1.info), false);
if (_active){
setEventListeners(ClipEventSupport(_arg1.target));
};
}
function getMediaController():MediaController{
var _local1:Clip = playList.current;
return (_controllerFactory.getMediaController(_local1, playList));
}
function get muted():Boolean{
return (_controllerFactory.getVolumeController().muted);
}
function dispatchPlayEvent(_arg1:ClipEventType):void{
var _local2:Clip = playList.current;
log.debug(("dispatching " + _arg1));
_local2.dispatch(_arg1);
}
function resume():void{
log.debug("cannot resume in this state");
}
protected function onClipDone(_arg1:ClipEvent):void{
log.info((this + " onClipDone"));
var _local2 = !(_arg1.isDefaultPrevented());
Clip(_arg1.target).dispatchEvent(_arg1);
if (playList.hasNext()){
if (_local2){
log.debug("onClipDone, moving to next clip");
playListController.next(true, true);
} else {
stop(false, true);
changeState(waitingState);
};
} else {
if (_local2){
stop(false, true);
changeState(waitingState);
} else {
playListController.rewind();
};
};
}
function play():void{
log.debug("cannot start playing in this state");
}
function pause():void{
log.debug("cannot pause in this state");
}
function close():void{
if (onEvent(ClipEventType.STOP, getMediaController(), [true])){
changeState(waitingState);
};
}
function get status():Status{
var _local1:Status = getMediaController().getStatus(_stateCode);
return (_local1);
}
function set volume(_arg1:Number):void{
_controllerFactory.getVolumeController().volume = _arg1;
}
static function initStates(_arg1:Playlist, _arg2:PlayListController, _arg3:Dictionary, _arg4:PlayerEventDispatcher, _arg5:Config, _arg6:ResourceLoader):void{
waitingState = new WaitingState(State.WAITING, _arg1, _arg2, _arg3);
endedState = new EndedState(State.ENDED, _arg1, _arg2, _arg3);
playingState = new PlayingState(State.PLAYING, _arg1, _arg2, _arg3);
pausedState = new PausedState(State.PAUSED, _arg1, _arg2, _arg3);
bufferingState = new BufferingState(State.BUFFERING, _arg1, _arg2, _arg3);
_arg2.setPlayState(waitingState);
if (!_controllerFactory){
_controllerFactory = new MediaControllerFactory(_arg3, _arg4, _arg5, _arg6);
};
}
static function addProvider(_arg1:ProviderModel):void{
_controllerFactory.addProvider(_arg1);
}
}
}//package org.flowplayer.controller
Section 30
//PlayTimeTracker (org.flowplayer.controller.PlayTimeTracker)
package org.flowplayer.controller {
import org.flowplayer.model.*;
import org.flowplayer.controller.*;
import flash.events.*;
import org.flowplayer.util.*;
import flash.utils.*;
class PlayTimeTracker extends EventDispatcher {
private var _onLastSecondDispatched:Boolean;
private var log:Log;
private var _timer:Timer;
private var _startTime:int;
private var _storedTime:int;// = 0
private var _controller:MediaController;
private var _clip:Clip;
function PlayTimeTracker(_arg1:Clip, _arg2:MediaController){
log = new Log(this);
super();
_clip = _arg1;
_controller = _arg2;
}
public function stop():void{
if (!_timer){
return;
};
_storedTime = time;
_timer.stop();
log.debug(("stopped at time " + _storedTime));
}
public function get time():Number{
if (!_timer){
return (0);
};
var _local1:Number = getTimer();
var _local2:Number = (_storedTime + ((_local1 - _startTime) / 1000));
if (_clip.type == ClipType.VIDEO){
if ((getTimer() - _startTime) < 2000){
return (_local2);
};
return (_controller.time);
};
if (!_timer.running){
return (_storedTime);
};
return (_local2);
}
private function checkAndFireCuepoints():void{
var _local5:Cuepoint;
var _local1:Number = _controller.time;
var _local2:Number = (Math.round((_local1 * 10)) * 100);
var _local3:Array = collectCuepoints(_clip, _local2);
if (((!(_local3)) || ((_local3.length == 0)))){
return;
};
var _local4:Number = 0;
while (_local4 < _local3.length) {
_local5 = _local3[_local4];
if (!alreadyFired(_local5)){
trace(("firing cuepoint with time " + _local5.time));
_clip.dispatch(ClipEventType.CUEPOINT, _local5);
_local5.lastFireTime = getTimer();
};
_local4++;
};
}
private function collectCuepoints(_arg1:Clip, _arg2:Number):Array{
var _local3:Array = new Array();
var _local4:Number = 5;
while (_local4 >= 0) {
_local3 = _local3.concat(_arg1.getCuepoints((_arg2 - (_local4 * 100))));
_local4--;
};
return (_local3);
}
private function checkProgress(_arg1:TimerEvent):void{
if (!_timer){
return;
};
checkAndFireCuepoints();
if (_clip.live){
return;
};
var _local2:Number = time;
if (!_clip.duration){
if (_local2 > 5){
log.debug("durationless clip, stopping duration tracking");
_timer.stop();
};
return;
};
if (completelyPlayed(_clip)){
stop();
log.info((this + " completely played, dispatching complete"));
log.info(("clip.durationFromMetadata " + _clip.durationFromMetadata));
log.info(("clip.duration " + _clip.duration));
dispatchEvent(new TimerEvent(TimerEvent.TIMER_COMPLETE));
};
if (((!(_onLastSecondDispatched)) && ((_local2 >= (_clip.duration - 1))))){
_clip.dispatch(ClipEventType.LAST_SECOND);
_onLastSecondDispatched = true;
};
}
public function set time(_arg1:Number):void{
log.debug(("setting time to " + _arg1));
_storedTime = _arg1;
_startTime = getTimer();
}
public function start():void{
if (((_timer) && (_timer.running))){
stop();
};
_timer = new Timer(30);
_timer.addEventListener(TimerEvent.TIMER, checkProgress);
_startTime = getTimer();
log.debug(("started at time " + time));
_timer.start();
_onLastSecondDispatched = false;
}
public function get durationReached():Boolean{
return ((((_clip.duration > 0)) && ((time >= _clip.duration))));
}
private function alreadyFired(_arg1:Cuepoint):Boolean{
var _local2:int = _arg1.lastFireTime;
if (!(_local2) > 0){
return (false);
};
return (((getTimer() - _arg1.lastFireTime) < 1000));
}
private function completelyPlayed(_arg1:Clip):Boolean{
if (_arg1.durationFromMetadata > _arg1.duration){
return ((time >= _arg1.duration));
};
return (((_arg1.duration - time) < 0.2));
}
}
}//package org.flowplayer.controller
Section 31
//ResourceLoader (org.flowplayer.controller.ResourceLoader)
package org.flowplayer.controller {
public interface ResourceLoader {
function addTextResourceUrl(_arg1:String):void;
function getContent(_arg1:String=null):Object;
function load(_arg1:String=null, _arg2:Function=null):void;
function set completeListener(_arg1:Function):void;
function clear():void;
function addBinaryResourceUrl(_arg1:String):void;
}
}//package org.flowplayer.controller
Section 32
//ResourceLoaderImpl (org.flowplayer.controller.ResourceLoaderImpl)
package org.flowplayer.controller {
import org.flowplayer.model.*;
import org.flowplayer.view.*;
import flash.display.*;
import flash.events.*;
import org.flowplayer.util.*;
import flash.net.*;
public class ResourceLoaderImpl implements ResourceLoader {
private var _errorHandler:ErrorHandler;
private var _urls:Array;
private var log:Log;
private var _loaders:Object;
private var _loadedCount:Number;
private var _completeListener:Function;
private var _baseUrl:String;
public function ResourceLoaderImpl(_arg1:String, _arg2:ErrorHandler=null){
log = new Log(this);
_loaders = new Object();
_urls = new Array();
super();
_baseUrl = _arg1;
_errorHandler = _arg2;
}
protected function handleError(_arg1:String, _arg2:Error=null):void{
if (_errorHandler){
_errorHandler.handleError(PlayerError.RESOURCE_LOAD_FAILED, (_arg1 + (_arg2) ? (": " + _arg2.message) : ""));
};
}
private function onLoadComplete(_arg1:Event):void{
log.debug(((("onLoadComplete, loaded " + (_loadedCount + 1)) + " resources out of ") + _urls.length));
if (++_loadedCount == _urls.length){
log.debug("onLoadComplete, all resources were loaded");
if (_completeListener != null){
log.debug("calling complete listener function");
_completeListener(this);
};
};
}
public function getContent(_arg1:String=null):Object{
var loader:Object;
var url = _arg1;
try {
loader = _loaders[(url) ? url : _urls[0]];
return (((loader is URLLoader)) ? URLLoader(loader).data : loader);
} catch(e:SecurityError) {
handleError(("cannot access file (try loosening Flash security settings): " + e.message));
};
return (null);
}
private function createURLLoader():URLLoader{
var _local1:URLLoader = new URLLoader();
_local1.addEventListener(Event.COMPLETE, onLoadComplete);
_local1.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
_local1.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError);
return (_local1);
}
private function onSecurityError(_arg1:SecurityErrorEvent):void{
log.error(("SecurityError: " + _arg1.text));
handleError(("cannot access the resource file (try loosening Flash security settings): " + _arg1.text));
}
public function set errorHandler(_arg1:ErrorHandler):void{
_errorHandler = _arg1;
}
public function clear():void{
_urls = new Array();
_loaders = new Array();
}
public function addTextResourceUrl(_arg1:String):void{
_urls.push(_arg1);
_loaders[_arg1] = createURLLoader();
}
public function set completeListener(_arg1:Function):void{
_completeListener = _arg1;
}
private function onIOError(_arg1:IOErrorEvent):void{
log.error(("IOError: " + _arg1.text));
handleError(("Unable to load resources: " + _arg1.text));
}
private function startLoading():void{
var _local1:String;
_loadedCount = 0;
for (_local1 in _loaders) {
log.debug(("startLoading() " + URLUtil.addBaseURL(_baseUrl, _local1)));
_loaders[_local1].load(new URLRequest(URLUtil.addBaseURL(_baseUrl, _local1)));
};
}
public function addBinaryResourceUrl(_arg1:String):void{
_urls.push(_arg1);
_loaders[_arg1] = createLoader();
}
public function load(_arg1:String=null, _arg2:Function=null):void{
if (_arg2 != null){
_completeListener = _arg2;
};
if (_arg1){
clear();
addBinaryResourceUrl(_arg1);
};
if (((!(_urls)) || ((_urls.length == 0)))){
log.debug("nothing to load");
return;
};
startLoading();
}
private function createLoader():Loader{
log.debug("creating new loader");
var _local1:Loader = new Loader();
_local1.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
_local1.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
_local1.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError);
return (_local1);
}
}
}//package org.flowplayer.controller
Section 33
//StreamProvider (org.flowplayer.controller.StreamProvider)
package org.flowplayer.controller {
import org.flowplayer.model.*;
import flash.display.*;
public interface StreamProvider {
function stopBuffering():void;
function stop(_arg1:ClipEvent, _arg2:Boolean=false):void;
function get stopping():Boolean;
function get allowRandomSeek():Boolean;
function attachStream(_arg1:DisplayObject):void;
function load(_arg1:ClipEvent, _arg2:Clip, _arg3:Boolean=true):void;
function get bufferStart():Number;
function set playlist(_arg1:Playlist):void;
function getVideo(_arg1:Clip):DisplayObject;
function resume(_arg1:ClipEvent):void;
function get playlist():Playlist;
function set volumeController(_arg1:VolumeController):void;
function get time():Number;
function pause(_arg1:ClipEvent):void;
function seek(_arg1:ClipEvent, _arg2:Number):void;
function get bufferEnd():Number;
function get fileSize():Number;
}
}//package org.flowplayer.controller
Section 34
//StreamProviderController (org.flowplayer.controller.StreamProviderController)
package org.flowplayer.controller {
import org.flowplayer.model.*;
import org.flowplayer.controller.*;
import flash.display.*;
import org.flowplayer.config.*;
import flash.media.*;
class StreamProviderController extends AbstractDurationTrackingController implements MediaController {
private var _config:Config;
private var _metadataDispatched:Boolean;
private var _controllerFactory:MediaControllerFactory;
function StreamProviderController(_arg1:MediaControllerFactory, _arg2:VolumeController, _arg3:Config, _arg4:Playlist){
var controllerFactory = _arg1;
var volumeController = _arg2;
var config = _arg3;
var playlist = _arg4;
super(volumeController, playlist);
_controllerFactory = controllerFactory;
_config = config;
var filter:Function = function (_arg1:Clip):Boolean{
return ((((_arg1.type == ClipType.VIDEO)) || ((_arg1.type == ClipType.AUDIO))));
};
playlist.onBegin(onBegin, filter, true);
playlist.onBufferFull(onBegin, filter, true);
playlist.onStart(onBegin, filter, true);
}
override protected function get allowRandomSeek():Boolean{
return (getProvider().allowRandomSeek);
}
override protected function doSeekTo(_arg1:ClipEvent, _arg2:Number):void{
durationTracker.time = _arg2;
getProvider().seek(_arg1, _arg2);
}
override protected function get bufferStart():Number{
return (getProvider().bufferStart);
}
private function onBegin(_arg1:ClipEvent):void{
var _local2:Clip = (_arg1.target as Clip);
log.info(("onBegin, initializing content for clip " + _local2));
var _local3:DisplayObject = _local2.getContent();
if (((_local3) && ((_local3 is Video)))){
getProvider(_local2).attachStream(_local3);
} else {
_local3 = getProvider(_local2).getVideo(_local2);
if (((_local3) && ((_local3 is Video)))){
getProvider(_local2).attachStream(_local3);
if (!_local3){
throw (new Error(("No video object available for clip " + _local2)));
};
_local2.setContent(_local3);
};
};
}
override protected function doPause(_arg1:ClipEvent):void{
getProvider().pause(_arg1);
}
override protected function doStop(_arg1:ClipEvent, _arg2:Boolean):void{
getProvider().stop(_arg1, _arg2);
}
override protected function doLoad(_arg1:ClipEvent, _arg2:Clip, _arg3:Boolean=false):void{
_metadataDispatched = false;
getProvider().load(_arg1, _arg2, _arg3);
}
override public function get time():Number{
return (getProvider().time);
}
override protected function doStopBuffering():void{
getProvider().stopBuffering();
}
public function getProvider(_arg1:Clip=null):StreamProvider{
if (!((_arg1) || (clip))){
return (null);
};
var _local2:StreamProvider = _controllerFactory.getProvider(((_arg1) || (clip)));
_local2.playlist = playlist;
return (_local2);
}
override protected function doResume(_arg1:ClipEvent):void{
getProvider().resume(_arg1);
}
override protected function get bufferEnd():Number{
return (getProvider().bufferEnd);
}
override protected function get fileSize():Number{
return (getProvider().fileSize);
}
override protected function onDurationReached():void{
log.debug("pausing silently");
getProvider().pause(null);
}
}
}//package org.flowplayer.controller
Section 35
//WaitingState (org.flowplayer.controller.WaitingState)
package org.flowplayer.controller {
import org.flowplayer.model.*;
import org.flowplayer.controller.*;
import flash.utils.*;
class WaitingState extends PlayState {
function WaitingState(_arg1:State, _arg2:Playlist, _arg3:PlayListController, _arg4:Dictionary){
super(_arg1, _arg2, _arg3, _arg4);
}
override function stopBuffering():void{
log.debug("stopBuffering() called");
getMediaController().stopBuffering();
}
override protected function onClipDone(_arg1:ClipEvent):void{
log.warn("received onClipDone in waiting state??");
}
override function stop(_arg1:Boolean=false, _arg2:Boolean=false):void{
log.debug("cannot stop in waiting state ");
}
override function play():void{
log.debug("play()");
if (!playListReady){
return;
};
bufferingState.nextStateAfterBufferFull = playingState;
if (onEvent(ClipEventType.BEGIN, getMediaController(), [false])){
playList.current.played = true;
changeState(bufferingState);
};
}
override function startBuffering():void{
if (!playListReady){
return;
};
log.debug("startBuffering()");
bufferingState.nextStateAfterBufferFull = pausedState;
if (onEvent(ClipEventType.BEGIN, getMediaController(), [true])){
changeState(bufferingState);
};
}
}
}//package org.flowplayer.controller
Section 36
//VolumeController (org.flowplayer.controller.VolumeController)
package org.flowplayer.controller {
import org.flowplayer.model.*;
import org.flowplayer.view.*;
import flash.events.*;
import org.flowplayer.util.*;
import flash.utils.*;
import flash.net.*;
import flash.media.*;
public class VolumeController {
private var _playerEventDispatcher:PlayerEventDispatcher;
private var log:Log;
private var _storeDelayTimer:Timer;
private var _soundTransform:SoundTransform;
private var _soundChannel:SoundChannel;
private var _muted:Boolean;
private var _storedVolume:SharedObject;
private var _netStream:NetStream;
public function VolumeController(_arg1:PlayerEventDispatcher){
log = new Log(this);
super();
_playerEventDispatcher = _arg1;
_soundTransform = new SoundTransform();
restoreVolume();
_storeDelayTimer = new Timer(2000, 1);
_storeDelayTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerDelayComplete);
}
private function dispatchEvent(_arg1:PlayerEvent):void{
_playerEventDispatcher.dispatchEvent(_arg1);
}
private function getVolume(_arg1:Object):Number{
if (!_arg1){
return (0.5);
};
if ((!(_arg1) is Number)){
return (0.5);
};
if (isNaN((_arg1 as Number))){
return (0.5);
};
if ((_arg1 as Number) > 1){
return (1);
};
if ((_arg1 as Number) < 0){
return (0);
};
return ((_arg1 as Number));
}
private function unMute():Number{
log.debug(("unmuting volume to level " + _soundTransform.volume));
if (dispatchBeforeEvent(PlayerEvent.unMute())){
_muted = false;
setTransform(_soundTransform);
dispatchEvent(PlayerEvent.unMute());
storeVolume(false);
};
return (volume);
}
private function doMute(_arg1:Boolean):void{
log.debug("muting volume");
if (dispatchBeforeEvent(PlayerEvent.mute())){
_muted = true;
setTransform(new SoundTransform(0));
dispatchEvent(PlayerEvent.mute());
if (_arg1){
storeVolume(true);
};
};
}
private function onTimerDelayComplete(_arg1:TimerEvent):void{
storeVolume();
}
private function restoreVolume():void{
_storedVolume = SharedObject.getLocal("org.flowplayer");
_soundTransform.volume = getVolume(_storedVolume.data.volume);
if (_storedVolume.data.volumeMuted){
doMute(false);
};
}
private function dispatchBeforeEvent(_arg1:PlayerEvent):Boolean{
return (_playerEventDispatcher.dispatchBeforeEvent(_arg1));
}
public function get volume():Number{
return ((_soundTransform.volume * 100));
}
private function storeVolume(_arg1:Boolean=false):void{
log.info("persisting volume level");
_storeDelayTimer.stop();
_storedVolume.data.volume = _soundTransform.volume;
_storedVolume.data.volumeMuted = _arg1;
_storedVolume.flush();
}
public function set muted(_arg1:Boolean):void{
if (_arg1){
doMute(true);
} else {
unMute();
};
}
public function set soundChannel(_arg1:SoundChannel):void{
_soundChannel = _arg1;
setTransform((_muted) ? new SoundTransform(0) : _soundTransform);
}
private function setTransform(_arg1:SoundTransform):void{
if (_netStream){
_netStream.soundTransform = _arg1;
};
if (_soundChannel){
_soundChannel.soundTransform = _arg1;
};
}
public function get muted():Boolean{
return (_muted);
}
public function set volume(_arg1:Number):void{
if (this.volume == _arg1){
return;
};
if (dispatchBeforeEvent(PlayerEvent.volume(_arg1))){
if (_arg1 > 100){
_arg1 = 100;
};
if (_arg1 < 0){
volume = 0;
};
_soundTransform.volume = (_arg1 / 100);
if (!_muted){
setTransform(_soundTransform);
};
dispatchEvent(PlayerEvent.volume(this.volume));
if (!_storeDelayTimer.running){
log.info("starting delay timer");
_storeDelayTimer.start();
};
};
}
public function set netStream(_arg1:NetStream):void{
_netStream = _arg1;
setTransform((_muted) ? new SoundTransform(0) : _soundTransform);
}
}
}//package org.flowplayer.controller
Section 37
//AbstractConstraint (org.flowplayer.layout.AbstractConstraint)
package org.flowplayer.layout {
import org.flowplayer.layout.*;
import flash.display.*;
import flash.events.*;
import org.flowplayer.util.*;
class AbstractConstraint extends EventDispatcher {
private var margins:Array;
private var layout:Layout;
private var view:DisplayObject;
function AbstractConstraint(_arg1:DisplayObject, _arg2:Layout, _arg3:Array){
this.layout = _arg2;
this.view = _arg1;
this.margins = _arg3;
if (!this.margins){
this.margins = new Array();
};
}
protected function getContainerHeight():Number{
return (((getContainer() is Stage)) ? Arrange.getStageHeight((getContainer() as Stage)) : getContainer().height);
}
protected function getContainer():DisplayObject{
return (layout.getContainer());
}
public function getConstrainedView():DisplayObject{
return (view);
}
public function setMarginConstraint(_arg1:Number, _arg2:Constraint):void{
margins[_arg1] = _arg2;
}
public function removeMarginConstraint(_arg1:Constraint):void{
var _local2:Number = 0;
while (_local2 < margins.length) {
if (margins[_local2] == _arg1){
margins[_local2] = null;
};
_local2++;
};
}
public function getMarginConstraints():Array{
return (margins);
}
protected function getContainerWidth():Number{
return (((getContainer() is Stage)) ? Arrange.getStageWidth((getContainer() as Stage)) : getContainer().width);
}
}
}//package org.flowplayer.layout
Section 38
//AbstractLayout (org.flowplayer.layout.AbstractLayout)
package org.flowplayer.layout {
import org.flowplayer.model.*;
import org.flowplayer.layout.*;
import flash.display.*;
import flash.events.*;
import org.flowplayer.util.*;
import flash.utils.*;
import flash.geom.*;
class AbstractLayout extends EventDispatcher implements Layout {
private var _listeners:Dictionary;
private var _container:DisplayObjectContainer;
private var log:Log;
private var _constraints:Dictionary;
function AbstractLayout(_arg1:DisplayObjectContainer){
log = new Log(this);
_constraints = new Dictionary();
_listeners = new Dictionary();
super();
this._container = _arg1;
trace(("adding 'render' event listener to container " + _arg1));
if ((_arg1 is Stage)){
_arg1.addEventListener(Event.RESIZE, onContainerResize);
};
}
public function update(_arg1:DisplayObject, _arg2:DisplayProperties):Rectangle{
return (null);
}
public function removeView(_arg1:DisplayObject):void{
if (_listeners[_arg1]){
this.removeEventListener(LayoutEvent.RESIZE, _listeners[_arg1]);
};
delete _listeners[_arg1];
delete _constraints[_arg1];
}
public function getContainer():DisplayObject{
return (_container);
}
public function draw(_arg1:DisplayObject=null):void{
var _local2:Function;
log.info("redrawing layout");
if (_arg1){
_local2 = _listeners[_arg1];
if (_local2 != null){
_local2(new LayoutEvent(LayoutEvent.RESIZE, this));
};
} else {
dispatchEvent(new LayoutEvent(LayoutEvent.RESIZE, this));
};
}
public function getConstraint(_arg1:DisplayObject):Constraint{
return (_constraints[_arg1]);
}
public function addConstraint(_arg1:Constraint, _arg2:Function=null):void{
trace("AbstractLayout.addConstraint");
_constraints[_arg1.getConstrainedView()] = _arg1;
if (_arg2 != null){
_listeners[_arg1.getConstrainedView()] = _arg2;
this.addEventListener(LayoutEvent.RESIZE, _arg2);
};
}
public function getBounds(_arg1:Object):Rectangle{
var _local2:Constraint = _constraints[_arg1];
if (!_local2){
return (null);
};
return (_local2.getBounds());
}
public function addView(_arg1:DisplayObject, _arg2:Function, _arg3:DisplayProperties):void{
}
private function onContainerResize(_arg1:Event):void{
trace("onContainerRender");
draw();
}
protected function get constraints():Dictionary{
return (_constraints);
}
protected function get listeners():Dictionary{
return (_listeners);
}
}
}//package org.flowplayer.layout
Section 39
//Constraint (org.flowplayer.layout.Constraint)
package org.flowplayer.layout {
import flash.display.*;
import flash.geom.*;
public interface Constraint {
function getMarginConstraints():Array;
function getConstrainedView():DisplayObject;
function getBounds():Rectangle;
function setMarginConstraint(_arg1:Number, _arg2:Constraint):void;
function removeMarginConstraint(_arg1:Constraint):void;
}
}//package org.flowplayer.layout
Section 40
//Dimensions (org.flowplayer.layout.Dimensions)
package org.flowplayer.layout {
import org.flowplayer.model.*;
import flash.display.*;
import org.flowplayer.util.*;
public class Dimensions implements Cloneable {
private var _width:Length;
private var _height:Length;
public function Dimensions(){
_width = new Length();
_height = new Length();
super();
}
public function clone():Cloneable{
var _local1:Dimensions = new Dimensions();
_local1._width = (_width.clone() as Length);
_local1._height = (_height.clone() as Length);
return (_local1);
}
public function fillValues(_arg1:DisplayObject):void{
if (_width.px >= 0){
_width.pct = ((_width.px / Arrange.getWidth(_arg1)) * 100);
} else {
if (_width.pct >= 0){
_width.px = ((width.pct / 100) * Arrange.getWidth(_arg1));
};
};
if (_height.px >= 0){
_height.pct = ((_height.px / Arrange.getHeight(_arg1)) * 100);
} else {
if (_height.pct >= 0){
_height.px = ((height.pct / 100) * Arrange.getHeight(_arg1));
};
};
}
public function get width():Length{
return (_width);
}
public function toString():String{
return ((((("(" + _width) + ") x (") + _height) + ")"));
}
public function set heightValue(_arg1:Object):void{
if ((_arg1 is Length)){
_height = (_arg1 as Length);
} else {
_height.value = _arg1;
};
}
public function set widthValue(_arg1:Object):void{
if ((_arg1 is Length)){
_width = (_arg1 as Length);
} else {
_width.value = _arg1;
};
}
public function hasValue(_arg1:String):Boolean{
if (_arg1 == "width"){
return (_width.hasValue());
};
if (_arg1 == "height"){
return (_height.hasValue());
};
return (false);
}
public function get height():Length{
return (_height);
}
}
}//package org.flowplayer.layout
Section 41
//DrawWrapper (org.flowplayer.layout.DrawWrapper)
package org.flowplayer.layout {
import org.flowplayer.view.*;
import flash.display.*;
import org.flowplayer.util.*;
import flash.geom.*;
public class DrawWrapper {
private var log:Log;
private var view:DisplayObject;
public function DrawWrapper(_arg1:DisplayObject){
log = new Log(this);
super();
this.view = _arg1;
}
public function draw(_arg1:LayoutEvent):void{
var _local2:Rectangle = _arg1.layout.getBounds(view);
if (_local2 == null){
log.warn(("Did not get bounds for view " + view));
return;
};
log.debug(("got bounds " + _local2));
view.x = _local2.x;
view.y = _local2.y;
if ((view is AbstractSprite)){
AbstractSprite(view).setSize(_local2.width, _local2.height);
} else {
view.width = _local2.width;
view.height = _local2.height;
};
}
}
}//package org.flowplayer.layout
Section 42
//FixedContraint (org.flowplayer.layout.FixedContraint)
package org.flowplayer.layout {
import org.flowplayer.layout.*;
import flash.display.*;
import flash.geom.*;
class FixedContraint implements Constraint {
private var length:Number;
function FixedContraint(_arg1:Number){
this.length = _arg1;
}
public function getConstrainedView():DisplayObject{
return (null);
}
public function setMarginConstraint(_arg1:Number, _arg2:Constraint):void{
}
public function removeMarginConstraint(_arg1:Constraint):void{
}
public function getMarginConstraints():Array{
return (null);
}
public function getBounds():Rectangle{
return (new Rectangle(0, 0, length, length));
}
}
}//package org.flowplayer.layout
Section 43
//Layout (org.flowplayer.layout.Layout)
package org.flowplayer.layout {
import org.flowplayer.model.*;
import flash.display.*;
import flash.geom.*;
public interface Layout {
function update(_arg1:DisplayObject, _arg2:DisplayProperties):Rectangle;
function getContainer():DisplayObject;
function draw(_arg1:DisplayObject=null):void;
function addView(_arg1:DisplayObject, _arg2:Function, _arg3:DisplayProperties):void;
function removeView(_arg1:DisplayObject):void;
function getBounds(_arg1:Object):Rectangle;
}
}//package org.flowplayer.layout
Section 44
//LayoutEvent (org.flowplayer.layout.LayoutEvent)
package org.flowplayer.layout {
import flash.events.*;
public class LayoutEvent extends Event {
public var layout:Layout;
public static const RESIZE:String = "resize";
public function LayoutEvent(_arg1:String, _arg2:Layout, _arg3:Boolean=false, _arg4:Boolean=true){
super(_arg1, _arg3, _arg4);
this.layout = _arg2;
}
override public function clone():Event{
return (new LayoutEvent(type, layout, bubbles, cancelable));
}
override public function toString():String{
return (formatToString("ResizeEvent", "type", "layout", "bubbles", "cancelable", "eventPhase"));
}
}
}//package org.flowplayer.layout
Section 45
//Length (org.flowplayer.layout.Length)
package org.flowplayer.layout {
import org.flowplayer.model.*;
import org.flowplayer.util.*;
public class Length implements Cloneable {
private var _pct:Number;
private var _px:Number;
private var log:Log;
private var _clearPct:Boolean;
public function Length(_arg1:Object=null){
log = new Log(this);
super();
if (((_arg1) || ((((_arg1 is Number)) && ((Number(_arg1) == 0)))))){
setValue(_arg1);
};
}
public function get px():Number{
return (_px);
}
public function plus(_arg1:Length, _arg2:Function, _arg3:Function):Length{
log.debug(((this + " plus() ") + _arg1));
var _local4:Length = new Length();
if ((((_px >= 0)) && (!(isNaN(_arg1.px))))){
_local4.px = (_px + _arg1.px);
};
if ((((_pct >= 0)) && (!(isNaN(_arg1.pct))))){
_local4.pct = (_pct + _arg1._pct);
};
if ((((_px >= 0)) && (!(isNaN(_arg1.pct))))){
_local4.px = _arg2((_arg3(_px) + _arg1.pct));
};
if ((((_pct >= 0)) && (!(isNaN(_arg1.px))))){
_local4.pct = _arg3((_arg2(_pct) + _arg1.px));
};
log.debug(("plus(), result is " + _local4));
return (_local4);
}
public function toPx(_arg1:Number):Number{
if (_pct >= 0){
return (((_arg1 * _pct) / 100));
};
if (_px >= 0){
return (_px);
};
return (undefined);
}
public function set value(_arg1:Object):void{
setValue(_arg1);
}
public function clone():Cloneable{
var _local1:Length = new Length();
_local1._pct = _pct;
_local1._px = _px;
return (_local1);
}
public function clear():void{
_px = NaN;
_pct = NaN;
}
public function setValue(_arg1:Object):void{
var _local2:String;
if (((_arg1) && ((_arg1 is String)))){
_local2 = (_arg1 as String);
_pct = NumberUtil.decodePercentage(_local2);
_px = NumberUtil.decodePixels(_local2);
log.debug(("set values to " + this));
} else {
_px = (_arg1 as Number);
_pct = NaN;
};
}
public function set px(_arg1:Number):void{
_px = _arg1;
}
public function set pct(_arg1:Number):void{
_pct = _arg1;
}
public function hasValue():Boolean{
return ((((_px >= 0)) || ((_pct >= 0))));
}
public function asObject():Object{
if (_px >= 0){
return (_px);
};
if (_pct >= 0){
return ((_pct + "%"));
};
return (undefined);
}
public function get pct():Number{
return (_pct);
}
public function toString():String{
return ((((("[Dimension] " + _px) + "px -- ") + _pct) + "%"));
}
}
}//package org.flowplayer.layout
Section 46
//LengthMath (org.flowplayer.layout.LengthMath)
package org.flowplayer.layout {
import org.flowplayer.model.*;
import flash.display.*;
import org.flowplayer.util.*;
import com.adobe.utils.*;
public class LengthMath {
private static const log:Log = new Log("org.flowplayer.layout::LengthMath");
public static function sum(_arg1:DisplayProperties, _arg2:Object, _arg3:DisplayObject):DisplayProperties{
var _local4:Number = Arrange.getWidth(_arg3);
var _local5:Number = Arrange.getHeight(_arg3);
addValue(_arg1, _arg2, "alpha");
addValue(_arg1, _arg2, "opacity");
addValue(_arg1, _arg2, "display");
addValue(_arg1, _arg2, "visible");
addValue(_arg1, _arg2, "zIndex");
addDimension("width", _arg1, _arg2, dimToPx(_local4), dimToPct(_local4));
addDimension("height", _arg1, _arg2, dimToPx(_local5), dimToPct(_local5));
log.debug(("sum(): result dimensions " + _arg1.dimensions));
log.debug(("sum(), current position " + _arg1.position));
var _local6:Number = _arg1.dimensions.height.toPx(_local5);
if (hasValue(_arg2, "top")){
_arg1.position.toTop(_local5, _local6);
addPosition("top", _arg1, _arg2, _local6, posToPx(_local6, _local5), posToPct(_local6, _local5));
} else {
if (hasValue(_arg2, "bottom")){
_arg1.position.toBottom(_local5, _local6);
addPosition("bottom", _arg1, _arg2, _local6, posToPx(_local6, _local5), posToPct(_local6, _local5));
};
};
var _local7:Number = _arg1.dimensions.width.toPx(_local4);
if (hasValue(_arg2, "left")){
log.debug("adding to left");
_arg1.position.toLeft(_local4, _local7);
addPosition("left", _arg1, _arg2, _local7, posToPx(_local7, _local4), posToPct(_local7, _local4));
};
if (hasValue(_arg2, "right")){
_arg1.position.toRight(_local4, _local7);
addPosition("right", _arg1, _arg2, _local7, posToPx(_local7, _local4), posToPct(_local7, _local4));
};
log.debug(("sum(): result position " + _arg1.position));
return (_arg1);
}
private static function addDimension(_arg1:String, _arg2:DisplayProperties, _arg3:Object, _arg4:Function, _arg5:Function):void{
var _local6:Object = _arg3[_arg1];
if (!containsValue(_local6)){
return;
};
if (incremental(_local6)){
_arg2[_arg1] = _arg2.dimensions[_arg1].plus(new Length(_local6), _arg4, _arg5);
log.debug(("new dimension is " + _arg2.dimensions[_arg1]));
} else {
_arg2[_arg1] = _local6;
};
}
private static function hasValue(_arg1:Object, _arg2:String):Boolean{
return (containsValue(_arg1[_arg2]));
}
private static function addPosition(_arg1:String, _arg2:DisplayProperties, _arg3:Object, _arg4:Number, _arg5:Function, _arg6:Function):void{
var _local8:Length;
var _local7:Object = _arg3[_arg1];
if (incremental(_local7)){
log.debug(("adding incremental position value " + _local7));
_local8 = _arg2.position[_arg1].plus(new Length(_local7), _arg5, _arg6);
if (_local8.px < 0){
_local8.px = 0;
};
_arg2[_arg1] = _local8;
} else {
_arg2[_arg1] = _local7;
};
}
private static function dimToPx(_arg1:Number):Function{
var containerDim = _arg1;
return (function (_arg1:Number):Number{
return (((containerDim * _arg1) / 100));
});
}
private static function addValue(_arg1:DisplayProperties, _arg2:Object, _arg3:String):void{
if (!containsValue(_arg2[_arg3])){
return;
};
_arg1[_arg3] = _arg2[_arg3];
}
private static function posToPct(_arg1:Number, _arg2:Number):Function{
var dim = _arg1;
var containerDim = _arg2;
return (function (_arg1:Number):Number{
return ((((_arg1 + (dim / 2)) / containerDim) * 100));
});
}
private static function posToPx(_arg1:Number, _arg2:Number):Function{
var dim = _arg1;
var containerDim = _arg2;
return (function (_arg1:Number):Number{
return ((((_arg1 / 100) * containerDim) - (dim / 2)));
});
}
private static function containsValue(_arg1:Object):Boolean{
if ((_arg1 is String)){
return (true);
};
if ((_arg1 is Boolean)){
return (true);
};
var _local2:Boolean = (((_arg1 is Number)) && (!(isNaN((_arg1 as Number)))));
log.debug(((("hasValue? " + _arg1) + ", ") + _local2));
return (_local2);
}
private static function incremental(_arg1:Object):Boolean{
if ((!(_arg1) is String)){
return (false);
};
var _local2:Boolean = ((StringUtil.beginsWith(String(_arg1), "+")) || (StringUtil.beginsWith(String(_arg1), "-")));
log.debug(((("incremental? " + _arg1) + ", ") + _local2));
return (_local2);
}
private static function dimToPct(_arg1:Number):Function{
var containerDim = _arg1;
return (function (_arg1:Number):Number{
return (((_arg1 / containerDim) * 100));
});
}
}
}//package org.flowplayer.layout
Section 47
//MarginConstraint (org.flowplayer.layout.MarginConstraint)
package org.flowplayer.layout {
import org.flowplayer.layout.*;
import flash.display.*;
import org.flowplayer.util.*;
import flash.geom.*;
class MarginConstraint extends AbstractConstraint implements Constraint {
private var log:Log;
private var _dimensions:Dimensions;
function MarginConstraint(_arg1:DisplayObject, _arg2:Layout, _arg3:Array, _arg4:Dimensions){
log = new Log(this);
super(_arg1, _arg2, _arg3);
_dimensions = _arg4;
}
protected function getLeftMargin():Number{
return (getMargin(3, 1, "width", getContainerWidth()));
}
private function getWidth():Number{
return (((_dimensions.width.toPx(getContainerWidth())) || (((getContainerWidth() - getLeftMargin()) - getRightMargin()))));
}
protected function getTopMargin():Number{
return (getMargin(0, 2, "height", getContainerHeight()));
}
protected function getBottomMargin():Number{
return (getMargin(2, 0, "height", getContainerHeight()));
}
public function getBounds():Rectangle{
return (new Rectangle(getLeftMargin(), getTopMargin(), getWidth(), getHeight()));
}
protected function getRightMargin():Number{
return (getMargin(1, 3, "width", getContainerWidth()));
}
private function getMargin(_arg1:Number, _arg2:Number, _arg3:String, _arg4:Number):Number{
var _local6:Constraint;
var _local7:Number;
var _local8:Number;
log.debug(((getConstrainedView() + ", getMargin() ") + _arg1));
var _local5:Constraint = getMarginConstraints()[_arg1];
if (!_local5){
_local6 = getMarginConstraints()[_arg2];
_local7 = _dimensions[_arg3].toPx(_arg4);
if (!_local6){
throw (new Error((getConstrainedView() + ": not enough info to place object on Panel. Need top|bottom and left|right display properties.")));
};
_local8 = (_local6) ? ((_arg4 - _local7) - _local6.getBounds()[_arg3]) : 0;
return (_local8);
//unresolved jump
};
log.debug(((((((getConstrainedView() + ": getMargin(), constraint at margin ") + _arg1) + ": ") + _local5) + ", returns value ") + _local5.getBounds()[_arg3]));
return (_local5.getBounds()[_arg3]);
}
private function getHeight():Number{
return (((_dimensions.height.toPx(getContainerHeight())) || (((getContainerHeight() - getTopMargin()) - getBottomMargin()))));
}
}
}//package org.flowplayer.layout
Section 48
//MarginLayout (org.flowplayer.layout.MarginLayout)
package org.flowplayer.layout {
import org.flowplayer.model.*;
import flash.display.*;
import org.flowplayer.util.*;
import flash.geom.*;
public class MarginLayout extends AbstractLayout implements Layout {
private var log:Log;
public function MarginLayout(_arg1:DisplayObjectContainer){
log = new Log(this);
super(_arg1);
}
private function getMarginConstraint(_arg1:DisplayObject, _arg2:Number, _arg3:DisplayProperties):Constraint{
var _local4:Position = _arg3.position;
if (_arg2 == 0){
if (_local4.top.pct >= 0){
return (new RelativeConstraint(_arg1, _arg3.dimensions.height, getContainer(), _local4.top.pct, "height"));
};
if (_local4.top.px >= 0){
return (new FixedContraint(_local4.top.px));
};
};
if (_arg2 == 1){
if (_local4.right.pct >= 0){
return (new RelativeConstraint(_arg1, _arg3.dimensions.width, getContainer(), _local4.right.pct, "width"));
};
if (_local4.right.px >= 0){
return (new FixedContraint(_local4.right.px));
};
};
if (_arg2 == 2){
if (_local4.bottom.pct >= 0){
return (new RelativeConstraint(_arg1, _arg3.dimensions.height, getContainer(), _local4.bottom.pct, "height"));
};
if (_local4.bottom.px >= 0){
return (new FixedContraint(_local4.bottom.px));
};
};
if (_arg2 == 3){
if (_local4.left.pct >= 0){
return (new RelativeConstraint(_arg1, _arg3.dimensions.width, getContainer(), _local4.left.pct, "width"));
};
if (_local4.left.px >= 0){
return (new FixedContraint(_local4.left.px));
};
};
return (null);
}
override public function update(_arg1:DisplayObject, _arg2:DisplayProperties):Rectangle{
var _local3:MarginConstraint = new MarginConstraint(_arg1, this, null, _arg2.dimensions);
initConstraint(_arg1, _local3, _arg2);
addConstraint(_local3);
return (_local3.getBounds());
}
private function initConstraint(_arg1:DisplayObject, _arg2:MarginConstraint, _arg3:DisplayProperties):void{
var _local4:Number;
var _local5:Constraint;
if (_arg3.position){
_local4 = 0;
while (_local4 < 4) {
_local5 = getMarginConstraint(_arg1, _local4, _arg3);
if (_local5){
_arg2.setMarginConstraint(_local4, _local5);
};
_local4++;
};
};
}
override public function addView(_arg1:DisplayObject, _arg2:Function, _arg3:DisplayProperties):void{
log.debug(((("addView, name " + _arg3.name) + ", position ") + _arg3.position));
var _local4:MarginConstraint = new MarginConstraint(_arg1, this, null, _arg3.dimensions);
initConstraint(_arg1, _local4, _arg3);
addConstraint(_local4, _arg2);
draw(_arg1);
}
}
}//package org.flowplayer.layout
Section 49
//Position (org.flowplayer.layout.Position)
package org.flowplayer.layout {
import org.flowplayer.util.*;
public class Position {
private var log:Log;
private var _bottom:Length;
private var _top:Length;
private var _right:Length;
private var _left:Length;
public function Position(){
log = new Log(this);
_top = new Length();
_right = new Length();
_bottom = new Length();
_left = new Length();
super();
}
public function toBottom(_arg1:Number, _arg2:Number):void{
if (_bottom.hasValue()){
return;
};
if (_top.pct >= 0){
_bottom.pct = (100 - _top.pct);
};
if (_top.px > 0){
_bottom.px = ((_arg1 - _arg2) - _top.px);
};
_top.clear();
}
public function get left():Length{
return (_left);
}
public function set values(_arg1:Array):void{
setValue("_top", _arg1[0]);
setValue("_right", _arg1[1]);
setValue("_bottom", _arg1[2]);
setValue("_left", _arg1[3]);
}
private function getOtherProperty(_arg1:String):String{
if (_arg1 == "_top"){
return ("_bottom");
};
if (_arg1 == "_bottom"){
return ("_top");
};
if (_arg1 == "_left"){
return ("_right");
};
if (_arg1 == "_right"){
return ("_left");
};
throw (new Error(("Trying to set unknown property " + _arg1)));
}
public function set bottomValue(_arg1:Object):void{
setValue("_bottom", _arg1);
}
public function set leftValue(_arg1:Object):void{
setValue("_left", _arg1);
}
public function get top():Length{
return (_top);
}
public function toTop(_arg1:Number, _arg2:Number):void{
if (_top.hasValue()){
return;
};
if (_bottom.pct >= 0){
_top.pct = (100 - _bottom.pct);
};
if (_bottom.px > 0){
_top.px = ((_arg1 - _arg2) - _bottom.px);
};
_bottom.clear();
}
public function get right():Length{
return (_right);
}
public function toRight(_arg1:Number, _arg2:Number):void{
if (_right.hasValue()){
return;
};
if (_left.pct >= 0){
_right.pct = (100 - _left.pct);
};
if (_left.px > 0){
_right.px = ((_arg1 - _arg2) - _left.px);
};
_left.clear();
}
public function get values():Array{
return ([_top.asObject(), _right.asObject(), _bottom.asObject(), _left.asObject()]);
}
public function clone():Position{
var _local1:Position = new Position();
_local1._top = (_top.clone() as Length);
_local1._right = (_right.clone() as Length);
_local1._bottom = (_bottom.clone() as Length);
_local1._left = (_left.clone() as Length);
return (_local1);
}
public function toLeft(_arg1:Number, _arg2:Number):void{
if (_left.hasValue()){
return;
};
if (_right.pct >= 0){
_left.pct = (100 - _right.pct);
};
if (_right.px > 0){
_left.px = ((_arg1 - _arg2) - _right.px);
};
_right.clear();
}
public function set rightValue(_arg1:Object):void{
setValue("_right", _arg1);
}
public function get bottom():Length{
return (_bottom);
}
public function toString():String{
return (((((((("[Margins] left: " + _left) + ", righ ") + _right) + ", top ") + _top) + ", bottom ") + _bottom));
}
private function setValue(_arg1:String, _arg2:Object):void{
if ((_arg2 is Length)){
this[_arg1] = _arg2;
log.debug(((_arg1 + " set to ") + _arg2));
} else {
Length(this[_arg1]).value = _arg2;
};
Length(this[getOtherProperty(_arg1)]).clear();
}
public function hasValue(_arg1:String):Boolean{
if (_arg1 == "top"){
return (_top.hasValue());
};
if (_arg1 == "right"){
return (_right.hasValue());
};
if (_arg1 == "bottom"){
return (_bottom.hasValue());
};
if (_arg1 == "left"){
return (_left.hasValue());
};
return (false);
}
public function set topValue(_arg1:Object):void{
setValue("_top", _arg1);
}
}
}//package org.flowplayer.layout
Section 50
//RelativeConstraint (org.flowplayer.layout.RelativeConstraint)
package org.flowplayer.layout {
import org.flowplayer.layout.*;
import flash.display.*;
import org.flowplayer.util.*;
import flash.geom.*;
class RelativeConstraint implements Constraint {
private var _view:DisplayObject;
private var _length:Length;
private var _marginPercentage:Number;
private var log:Log;
private var _reference:DisplayObject;
private var _viewProperty:String;
function RelativeConstraint(_arg1:DisplayObject, _arg2:Length, _arg3:DisplayObject, _arg4:Number, _arg5:String){
log = new Log(this);
super();
_view = _arg1;
_length = _arg2;
_reference = _arg3;
_marginPercentage = _arg4;
_viewProperty = _arg5;
}
private function getViewLength():Number{
var _local1:Number;
if (_length.pct >= 0){
_local1 = ((getReferenceLength() * _length.pct) / 100);
log.debug(((((("relative length " + _length.pct) + "% out of ") + getReferenceLength()) + " is ") + _local1));
return (_local1);
};
if (_length.px >= 0){
return (_length.px);
};
return (_view[_viewProperty]);
}
public function setMarginConstraint(_arg1:Number, _arg2:Constraint):void{
}
public function getConstrainedView():DisplayObject{
return (null);
}
public function removeMarginConstraint(_arg1:Constraint):void{
}
public function getBounds():Rectangle{
var _local1:Number = getViewLength();
var _local2:Number = (((getReferenceLength() * _marginPercentage) / 100) - (_local1 / 2));
return (new Rectangle(0, 0, _local2, _local2));
}
private function getReferenceLength():Number{
return (((_viewProperty == "width")) ? Arrange.getWidth(_reference) : Arrange.getHeight(_reference));
}
public function getMarginConstraints():Array{
return (null);
}
}
}//package org.flowplayer.layout
Section 51
//AbstractEvent (org.flowplayer.model.AbstractEvent)
package org.flowplayer.model {
import flash.events.*;
import org.flowplayer.util.*;
import org.flowplayer.*;
import flash.external.*;
public class AbstractEvent extends Event {
private var _info2:Object;
private var _info3:Object;
private var _propagationStopped:Boolean;
private var _info:Object;
private var _isDefaultPrevented:Boolean;
private var _target:Object;
private var _eventType:EventType;
public function AbstractEvent(_arg1:EventType, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null){
super(_arg1.name);
this._eventType = _arg1;
this._info = _arg2;
this._info2 = _arg3;
this._info3 = _arg4;
_target = target;
}
public function isCancellable():Boolean{
return (_eventType.isCancellable);
}
protected function get externalEventArgument():Object{
return (target);
}
protected function get externalEventArgument4():Object{
return (_info3);
}
override public function preventDefault():void{
_isDefaultPrevented = true;
}
public function get info2():Object{
return (_info2);
}
public function hasError(_arg1:ErrorCode):Boolean{
return ((_info == _arg1.code));
}
override public function isDefaultPrevented():Boolean{
return (_isDefaultPrevented);
}
override public function get target():Object{
if (_target){
return (_target);
};
return (super.target);
}
public function get info3():Object{
return (_info3);
}
protected function get externalEventArgument2():Object{
return (_info);
}
protected function get externalEventArgument3():Object{
return (_info2);
}
override public function clone():Event{
return (new AbstractEvent(_eventType, _info));
}
flow_internal function fireExternal(_arg1:String, _arg2:Boolean=false):Boolean{
if (!ExternalInterface.available){
return (true);
};
var _local3:Object = ExternalInterface.call("flowplayer.fireEvent", ((_arg1) || (ExternalInterface.objectID)), getExternalName(eventType.name, _arg2), convert(externalEventArgument), convert(externalEventArgument2), externalEventArgument3, externalEventArgument4);
if ((_local3 + "") == "false"){
return (false);
};
return (true);
}
public function set target(_arg1:Object):void{
_target = _arg1;
}
public function isPropagationStopped():Boolean{
return (_propagationStopped);
}
override public function toString():String{
return (formatToString("AbstractEvent", "type", "target"));
}
public function get info():Object{
return (_info);
}
override public function stopPropagation():void{
_propagationStopped = true;
}
public function get eventType():EventType{
return (_eventType);
}
private function convert(_arg1:Object):Object{
return (new ObjectConverter(_arg1).convert());
}
private function getExternalName(_arg1:String, _arg2:Boolean):String{
if (!_arg2){
return (_arg1);
};
if (!(_arg1.indexOf("on")) == 0){
return (("onBefore" + _arg1));
};
return (("onBefore" + _arg1.substr(2)));
}
override public function stopImmediatePropagation():void{
_propagationStopped = true;
}
}
}//package org.flowplayer.model
Section 52
//Callable (org.flowplayer.model.Callable)
package org.flowplayer.model {
public interface Callable {
function invokeMethod(_arg1:String, _arg2:Array=null):Object;
function addMethod(_arg1:PluginMethod):void;
function getMethod(_arg1:String):PluginMethod;
}
}//package org.flowplayer.model
Section 53
//Clip (org.flowplayer.model.Clip)
package org.flowplayer.model {
import flash.display.*;
import org.flowplayer.util.*;
import flash.utils.*;
import flash.media.*;
public class Clip extends ClipEventDispatcher {
private var _fadeOutSpeed:int;
private var _type:ClipType;
private var _bufferLength:int;
private var _linkWindow:String;
private var _cuepointsInNegative:Array;
private var _playlist:Playlist;
private var _content:DisplayObject;
private var _fadeInSpeed:int;
private var _scaling:MediaSize;
private var _provider:String;
private var _cuepoints:Dictionary;
private var _start:Number;
private var _image:Boolean;
private var _accelerated:Boolean;
private var _originalWidth:int;
private var _originalHeight:int;
private var _cuepointMultiplier:Number;
private var _baseUrl:String;
private var _url:String;
private var _autoBuffering:Boolean;
private var _metaData:Object;
private var _live:Boolean;
private var _linkUrl:String;
private var _autoPlay:Boolean;// = true
private var _customProperties:Object;
private var _previousPositives:Array;
private var _played:Boolean;
private var _duration:Number;
private var _smoothing:Boolean;
private var _autoPlayNext:Boolean;// = false
public function Clip(){
_cuepoints = new Dictionary();
_cuepointsInNegative = new Array();
_previousPositives = new Array();
_start = 0;
_bufferLength = 3;
_scaling = MediaSize.FILLED_TO_AVAILABLE_SPACE;
_provider = "http";
_smoothing = true;
_fadeInSpeed = 1000;
_fadeOutSpeed = 1000;
_linkWindow = "_self";
_image = true;
_cuepointMultiplier = 1000;
}
public function set autoPlay(_arg1:Boolean):void{
this._autoPlay = _arg1;
}
public function set customProperties(_arg1:Object):void{
_customProperties = _arg1;
if (((_customProperties) && (_customProperties["cuepoints"]))){
delete _customProperties["cuepoints"];
};
}
public function onClipEvent(_arg1:ClipEvent):void{
log.info(("received onClipEvent, I am commmon clip: " + (this == _playlist.commonClip)));
doDispatchEvent(_arg1, true);
log.debug(((this + ": dispatched play event with target ") + _arg1.target));
}
public function set fadeInSpeed(_arg1:int):void{
_fadeInSpeed = _arg1;
}
public function get fadeInSpeed():int{
return (_fadeInSpeed);
}
public function set scaling(_arg1:MediaSize):void{
this._scaling = _arg1;
}
private function getWidth():int{
if (!_content){
log.warn("Getting width from a clip that does not have content loaded yet, returning zero");
return (0);
};
return (_content.width);
}
public function get linkUrl():String{
return (_linkUrl);
}
public function get autoPlayNext():Boolean{
return (_autoPlayNext);
}
public function set linkWindow(_arg1:String):void{
_linkWindow = _arg1;
}
private function getHeight():int{
if (!_content){
log.warn("Getting height from a clip that does not have content loaded yet, returning zero");
return (0);
};
return (_content.height);
}
public function getCuepoints(_arg1:int):Array{
if (this == commonClip){
return (_cuepoints[_arg1]);
};
var _local2:Array = new Array();
_local2 = ArrayUtil.concat(_local2, _cuepoints[_arg1]);
_local2 = ArrayUtil.concat(_local2, commonClip.getCuepoints(_arg1));
return (_local2);
}
public function get height():int{
return (getHeight());
}
public function get scalingStr():String{
return (this._scaling.value);
}
private function addCommonClipNegativeCuepoints():void{
if (commonClip){
log.debug("adding negative cuepoints from commponClip");
addCuepoints(commonClip.cuepointsInNegative);
} else {
log.debug("there is no commonClip");
};
}
public function get accelerated():Boolean{
return (_accelerated);
}
public function set duration(_arg1:Number):void{
this._duration = _arg1;
log.info(("clip duration set to " + _arg1));
if (!isCommon){
if (duration >= 0){
setNegativeCuepointTimes(_arg1);
};
addCommonClipNegativeCuepoints();
};
}
public function addCuepoints(_arg1:Array):void{
var _local2:Number = 0;
while (_local2 < _arg1.length) {
addCuepoint(_arg1[_local2]);
_local2++;
};
}
public function set linkUrl(_arg1:String):void{
_linkUrl = _arg1;
}
public function set autoPlayNext(_arg1:Boolean):void{
_autoPlayNext = _arg1;
}
public function get fadeOutSpeed():int{
return (_fadeOutSpeed);
}
public function get type():ClipType{
if (((!(_type)) && (_url))){
_type = ClipType.fromFileExtension(_url);
};
if (!_type){
return (ClipType.VIDEO);
};
return (_type);
}
public function getContent():DisplayObject{
return (_content);
}
public function get bufferLength():int{
return (_bufferLength);
}
public function getPlaylist():Playlist{
return (_playlist);
}
public function set height(_arg1:int):void{
if (!_content){
log.warn("Trying to change height of a clip that does not have media content loaded yet");
return;
};
_content.height = _arg1;
}
public function setPlaylist(_arg1:Playlist):void{
_playlist = _arg1;
}
public function set accelerated(_arg1:Boolean):void{
_accelerated = _arg1;
}
public function get metaData():Object{
return (_metaData);
}
public function get originalHeight():int{
if (_type == ClipType.VIDEO){
if (((_metaData) && ((_metaData.height >= 0)))){
return (_metaData.height);
};
if (!_content){
log.warn("Getting originalHeight from a clip that does not have content loaded yet, returning zero");
return (0);
};
return (((_content is Video)) ? (_content as Video).videoHeight : _originalHeight);
};
return (_originalHeight);
}
public function set durationFromMetadata(_arg1:Number):void{
if (!_metaData){
_metaData = new Object();
};
_metaData.duration = _arg1;
}
public function get image():Boolean{
return (_image);
}
public function get start():Number{
return (_start);
}
public function set autoBuffering(_arg1:Boolean):void{
this._autoBuffering = _arg1;
}
public function set fadeOutSpeed(_arg1:int):void{
_fadeOutSpeed = _arg1;
}
public function toString():String{
return ((("[Clip] '" + ((provider == "http")) ? completeUrl : url) + "'"));
}
public function get url():String{
return (_url);
}
public function set type(_arg1:ClipType):void{
_type = _arg1;
}
public function get originalWidth():int{
if (_type == ClipType.VIDEO){
if (((_metaData) && ((_metaData.width >= 0)))){
return (_metaData.width);
};
if (!_content){
log.warn("Getting originalWidth from a clip that does not have content loaded yet, returning zero");
return (0);
};
return (((_content is Video)) ? (_content as Video).videoWidth : _originalWidth);
};
return (_originalWidth);
}
public function get completeUrl():String{
return (URLUtil.completeURL(_baseUrl, _url));
}
public function setCustomProperty(_arg1:String, _arg2:Object):void{
if (!_customProperties){
_customProperties = new Object();
};
_customProperties[_arg1] = _arg2;
}
public function get autoPlay():Boolean{
return (_autoPlay);
}
public function get scaling():MediaSize{
return (this._scaling);
}
public function getCustomProperty(_arg1:String):Object{
if (!_customProperties){
return (null);
};
return (_customProperties[_arg1]);
}
public function get linkWindow():String{
return (_linkWindow);
}
public function get customProperties():Object{
return (_customProperties);
}
public function set width(_arg1:int):void{
if (!_content){
log.warn("Trying to change width of a clip that does not have media content loaded yet");
return;
};
_content.width = _arg1;
}
private function setNegativeCuepointTimes(_arg1:int):void{
var duration = _arg1;
log.debug(((("setNegativeCuepointTimes, transferring " + _cuepointsInNegative.length) + " to timeline duration ") + duration));
_previousPositives.forEach(function (_arg1, _arg2:int, _arg3:Array):void{
removeCuepoint((_arg1 as Cuepoint));
});
_previousPositives = new Array();
_cuepointsInNegative.forEach(function (_arg1, _arg2:int, _arg3:Array):void{
convertToPositive(_arg1);
});
}
public function set bufferLength(_arg1:int):void{
_bufferLength = _arg1;
}
public function get duration():Number{
if (_duration > 0){
return (_duration);
};
var _local1:Number = durationFromMetadata;
if ((((_start > 0)) && ((_local1 > _start)))){
return ((_local1 - _start));
};
return (((_local1) || (0)));
}
public function get typeStr():String{
return ((type) ? type.type : ClipType.VIDEO.type);
}
public function onBeforeClipEvent(_arg1:ClipEvent):void{
log.info(("received onBeforeClipEvent, I am commmon clip: " + (this == _playlist.commonClip)));
doDispatchBeforeEvent(_arg1, true);
log.debug(((this + ": dispatched before event with target ") + _arg1.target));
}
public function set metaData(_arg1:Object):void{
this._metaData = _arg1;
if (((((!((_duration >= 0))) && (_arg1))) && (_arg1.duration))){
setNegativeCuepointTimes(_arg1.duration);
addCommonClipNegativeCuepoints();
};
}
public function get smoothing():Boolean{
return (_smoothing);
}
public function set played(_arg1:Boolean):void{
_played = _arg1;
}
private function convertToPositive(_arg1:Cuepoint):void{
var _local2:Cuepoint = (_arg1.clone() as Cuepoint);
_local2.time = ((duration * 1000) - Math.abs(Cuepoint(_arg1).time));
addCuepoint(_local2);
_previousPositives.push(_local2);
}
public function get durationFromMetadata():Number{
if (_metaData){
return (_metaData.duration);
};
return (0);
}
public function get autoBuffering():Boolean{
return (_autoBuffering);
}
public function set image(_arg1:Boolean):void{
_image = _arg1;
}
public function setContent(_arg1:DisplayObject):void{
if (((((_content) && ((_content is Video)))) && (!(_arg1)))){
log.debug("clearing video content");
Video(_content).clear();
};
this._content = _arg1;
}
public function setType(_arg1:String):void{
this._type = ClipType.resolveType(_arg1);
}
public function set originalHeight(_arg1:int):void{
this._originalHeight = _arg1;
}
public function get isNullClip():Boolean{
return (false);
}
public function set baseUrl(_arg1:String):void{
this._baseUrl = _arg1;
}
public function get isCommon():Boolean{
return ((this == _playlist.commonClip));
}
public function setScaling(_arg1:String):void{
this._scaling = MediaSize.forName(_arg1);
}
public function set start(_arg1:Number):void{
this._start = _arg1;
}
public function set cuepointMultiplier(_arg1:Number):void{
_cuepointMultiplier = _arg1;
}
public function get width():int{
return (getWidth());
}
public function set live(_arg1:Boolean):void{
_live = _arg1;
}
public function get index():int{
return (_playlist.indexOf(this));
}
public function get played():Boolean{
return (_played);
}
private function get commonClip():Clip{
return (_playlist.commonClip);
}
public function get cuepoints():Array{
var _local2:Object;
var _local1:Array = new Array();
for each (_local2 in _cuepoints) {
_local1.push(_local2);
};
return (_local1);
}
public function get baseUrl():String{
return (_baseUrl);
}
private function removeCuepoint(_arg1:Cuepoint):void{
var _local2:Array = _cuepoints[_arg1.time];
if (!_local2){
return;
};
var _local3:int = _local2.indexOf(_arg1);
if (_local3 >= 0){
log.debug(("removing previous negative cuepoint at timeline time " + _arg1.time));
_local2.splice(_local3, 1);
};
}
public function set url(_arg1:String):void{
this._url = _arg1;
}
public function set smoothing(_arg1:Boolean):void{
_smoothing = _arg1;
}
public function set provider(_arg1:String):void{
_provider = _arg1;
}
public function set originalWidth(_arg1:int):void{
this._originalWidth = _arg1;
}
public function get cuepointMultiplier():Number{
return (_cuepointMultiplier);
}
protected function get cuepointsInNegative():Array{
return (_cuepointsInNegative);
}
public function get provider():String{
if (type == ClipType.AUDIO){
return ("audio");
};
return (_provider);
}
public function get live():Boolean{
return (_live);
}
public function addCuepoint(_arg1:Cuepoint):void{
if (!_arg1){
return;
};
if (_arg1.time >= 0){
log.debug(("adding cuepoint to time " + _arg1.time));
if (!_cuepoints[_arg1.time]){
_cuepoints[_arg1.time] = new Array();
};
if ((_cuepoints[_arg1.time] as Array).indexOf(_arg1) >= 0){
return;
};
(_cuepoints[_arg1.time] as Array).push(_arg1);
} else {
log.debug("adding negative cuepoint");
if (duration > 0){
convertToPositive(_arg1);
} else {
_cuepointsInNegative.push(_arg1);
};
};
}
private static function init(_arg1:Clip, _arg2:String, _arg3:String=null):Clip{
_arg1._url = _arg2;
_arg1._baseUrl = _arg3;
_arg1._autoPlay = true;
return (_arg1);
}
public static function create(_arg1:String, _arg2:String=null):Clip{
return (init(new (Clip), _arg1, _arg2));
}
}
}//package org.flowplayer.model
Section 54
//ClipError (org.flowplayer.model.ClipError)
package org.flowplayer.model {
public class ClipError extends ErrorCode {
public static const STREAM_NOT_FOUND:ClipError = new ClipError(ClipEventType.ERROR, 200, "Stream not found");
;
public static const STREAM_LOAD_FAILED:ClipError = new ClipError(ClipEventType.ERROR, 201, "Unable to load stream or clip file");
;
public static const PROVIDER_NOT_LOADED:ClipError = new ClipError(ClipEventType.ERROR, 202, "The provider specified in this clip is not loaded");
;
public function ClipError(_arg1:EventType, _arg2:int, _arg3:String){
super(_arg1, _arg2, _arg3);
}
}
}//package org.flowplayer.model
Section 55
//ClipEvent (org.flowplayer.model.ClipEvent)
package org.flowplayer.model {
import flash.events.*;
public class ClipEvent extends AbstractEvent {
public function ClipEvent(_arg1:EventType, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null){
super(_arg1, _arg2, _arg3, _arg4);
}
override protected function get externalEventArgument2():Object{
if (eventType == ClipEventType.CUEPOINT){
return (Cuepoint(info).callbackId);
};
if ((((((eventType == ClipEventType.START)) || ((eventType == ClipEventType.UPDATE)))) || ((eventType == ClipEventType.METADATA)))){
return (target);
};
return (super.externalEventArgument2);
}
override protected function get externalEventArgument3():Object{
if (eventType == ClipEventType.CUEPOINT){
return (((info is DynamicCuepoint)) ? info : Cuepoint(info).time);
};
return (super.externalEventArgument3);
}
override protected function get externalEventArgument():Object{
if (eventType == ClipEventType.PLAYLIST_REPLACE){
return ((target as ClipEventSupport).clips);
};
if ((target is Clip)){
return (Clip(target).index);
};
return (target);
}
override public function toString():String{
return (formatToString("ClipEvent", "type", "info"));
}
override public function clone():Event{
return (new ClipEvent(eventType, info));
}
}
}//package org.flowplayer.model
Section 56
//ClipEventDispatcher (org.flowplayer.model.ClipEventDispatcher)
package org.flowplayer.model {
import flash.utils.*;
public class ClipEventDispatcher extends EventDispatcher {
public function dispatchEvent(_arg1:ClipEvent):void{
doDispatchEvent(_arg1, false);
}
public function dispatchBeforeEvent(_arg1:AbstractEvent):Boolean{
return (doDispatchBeforeEvent(_arg1, false));
}
public function onAll(_arg1:Function, _arg2:Function=null):void{
setListener(null, _arg1, _arg2);
}
public function onBeforeAll(_arg1:Function, _arg2:Function=null):void{
setListener(null, _arg1, _arg2, true);
}
override protected function get cancellableEvents():Dictionary{
return (ClipEventType.cancellable);
}
public function onStop(_arg1:Function, _arg2:Function=null, _arg3:Boolean=false):void{
setListener(ClipEventType.STOP, _arg1, _arg2, false, _arg3);
}
public function onStart(_arg1:Function, _arg2:Function=null, _arg3:Boolean=false):void{
setListener(ClipEventType.START, _arg1, _arg2, false, _arg3);
}
public function onBeforeBegin(_arg1:Function, _arg2:Function=null, _arg3:Boolean=false):void{
setListener(ClipEventType.BEGIN, _arg1, _arg2, true, _arg3);
}
public function onMetaData(_arg1:Function, _arg2:Function=null, _arg3:Boolean=false):void{
setListener(ClipEventType.METADATA, _arg1, _arg2, false, _arg3);
}
public function onBegin(_arg1:Function, _arg2:Function=null, _arg3:Boolean=false):void{
setListener(ClipEventType.BEGIN, _arg1, _arg2, false, _arg3);
}
public function onBeforeResume(_arg1:Function, _arg2:Function=null, _arg3:Boolean=false):void{
setListener(ClipEventType.RESUME, _arg1, _arg2, true, _arg3);
}
public function onBufferEmpty(_arg1:Function, _arg2:Function=null, _arg3:Boolean=false):void{
setListener(ClipEventType.BUFFER_EMPTY, _arg1, _arg2, false, _arg3);
}
public function onBeforeSeek(_arg1:Function, _arg2:Function=null, _arg3:Boolean=false):void{
setListener(ClipEventType.SEEK, _arg1, _arg2, true, _arg3);
}
public function onPause(_arg1:Function, _arg2:Function=null, _arg3:Boolean=false):void{
setListener(ClipEventType.PAUSE, _arg1, _arg2, false, _arg3);
}
public function onBeforePause(_arg1:Function, _arg2:Function=null, _arg3:Boolean=false):void{
setListener(ClipEventType.PAUSE, _arg1, _arg2, true, _arg3);
}
public function onFinish(_arg1:Function, _arg2:Function=null, _arg3:Boolean=false):void{
setListener(ClipEventType.FINISH, _arg1, _arg2, false, _arg3);
}
public function onConnect(_arg1:Function, _arg2:Function=null, _arg3:Boolean=false):void{
setListener(ClipEventType.CONNECT, _arg1, _arg2, false, _arg3);
}
public function onBeforeStop(_arg1:Function, _arg2:Function=null, _arg3:Boolean=false):void{
setListener(ClipEventType.STOP, _arg1, _arg2, true, _arg3);
}
public function onBufferStop(_arg1:Function, _arg2:Function=null, _arg3:Boolean=false):void{
setListener(ClipEventType.BUFFER_STOP, _arg1, _arg2, false, _arg3);
}
public function onPlaylistReplace(_arg1:Function, _arg2:Boolean=false):void{
setListener(ClipEventType.PLAYLIST_REPLACE, _arg1, null, false, _arg2);
}
public function onLastSecond(_arg1:Function, _arg2:Function=null, _arg3:Boolean=false):void{
setListener(ClipEventType.LAST_SECOND, _arg1, _arg2, false, _arg3);
}
public function onResume(_arg1:Function, _arg2:Function=null, _arg3:Boolean=false):void{
setListener(ClipEventType.RESUME, _arg1, _arg2, false, _arg3);
}
public function onBufferFull(_arg1:Function, _arg2:Function=null, _arg3:Boolean=false):void{
setListener(ClipEventType.BUFFER_FULL, _arg1, _arg2, false, _arg3);
}
public function onError(_arg1:Function, _arg2:Function=null, _arg3:Boolean=false):void{
setListener(ClipEventType.ERROR, _arg1, _arg2, false, _arg3);
}
public function onBeforeFinish(_arg1:Function, _arg2:Function=null, _arg3:Boolean=false):void{
setListener(ClipEventType.FINISH, _arg1, _arg2, true, _arg3);
}
override protected function get allEvents():Dictionary{
return (ClipEventType.all);
}
public function dispatchError(_arg1:ClipError, _arg2:Object=null):void{
doDispatchEvent(new ClipEvent(_arg1.eventType, _arg1.code, _arg1.message, _arg2), false);
}
public function onSeek(_arg1:Function, _arg2:Function=null, _arg3:Boolean=false):void{
setListener(ClipEventType.SEEK, _arg1, _arg2, false, _arg3);
}
public function dispatch(_arg1:ClipEventType, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
doDispatchEvent(new ClipEvent(_arg1, _arg2, _arg3, _arg4), false);
}
public function onCuepoint(_arg1:Function, _arg2:Function=null, _arg3:Boolean=false):void{
setListener(ClipEventType.CUEPOINT, _arg1, _arg2, false, _arg3);
}
}
}//package org.flowplayer.model
Section 57
//ClipEventSupport (org.flowplayer.model.ClipEventSupport)
package org.flowplayer.model {
import org.flowplayer.*;
public class ClipEventSupport extends ClipEventDispatcher {
private var _commonClip:Clip;
private var _clips:Array;
public function ClipEventSupport(_arg1:Clip, _arg2:Array=null){
_commonClip = _arg1;
_clips = _arg2;
}
flow_internal function setClips(_arg1:Array):void{
_clips = _arg1;
}
final public function get clips():Array{
return (_clips);
}
override flow_internal function setListener(_arg1:EventType, _arg2:Function, _arg3:Function=null, _arg4:Boolean=false, _arg5:Boolean=false):void{
var _local6:ClipEventType = (_arg1 as ClipEventType);
if (_local6.playlistIsEventTarget){
super.setListener(_local6, _arg2, _arg3, _arg4, _arg5);
} else {
_commonClip.setListener(_local6, _arg2, _arg3, _arg4, _arg5);
};
}
override function removeListener(_arg1:EventType, _arg2:Function, _arg3:Boolean=false):void{
var _local4:ClipEventType = (_arg1 as ClipEventType);
if (_local4.playlistIsEventTarget){
super.removeListener(_arg1, _arg2, _arg3);
} else {
_commonClip.removeListener(_arg1, _arg2, _arg3);
};
}
public static function typeFilter(_arg1:ClipType):Function{
var type = _arg1;
return (function (_arg1:Clip):Boolean{
return ((_arg1.type == type));
});
}
}
}//package org.flowplayer.model
Section 58
//ClipEventType (org.flowplayer.model.ClipEventType)
package org.flowplayer.model {
import flash.utils.*;
public class ClipEventType extends EventType {
public static const START:ClipEventType = new ClipEventType("onStart");
;
public static const BEGIN:ClipEventType = new ClipEventType("onBegin");
;
public static const CONNECT:ClipEventType = new ClipEventType("onConnect");
;
public static const LAST_SECOND:ClipEventType = new ClipEventType("onLastSecond");
;
public static const UPDATE:ClipEventType = new ClipEventType("onUpdate");
;
public static const STOP:ClipEventType = new ClipEventType("onStop");
;
public static const FINISH:ClipEventType = new ClipEventType("onFinish");
;
public static const PAUSE:ClipEventType = new ClipEventType("onPause");
;
public static const BUFFER_STOP:ClipEventType = new ClipEventType("onBufferStop");
;
public static const PLAYLIST_REPLACE:ClipEventType = new ClipEventType("onPlaylistReplace");
;
public static const ERROR:ClipEventType = new ClipEventType("onError");
;
public static const RESUME:ClipEventType = new ClipEventType("onResume");
;
public static const BUFFER_EMPTY:ClipEventType = new ClipEventType("onBufferEmpty");
;
public static const METADATA:ClipEventType = new ClipEventType("onMetaData");
;
public static const BUFFER_FULL:ClipEventType = new ClipEventType("onBufferFull");
;
public static const SEEK:ClipEventType = new ClipEventType("onSeek");
;
public static const CUEPOINT:ClipEventType = new ClipEventType("onCuepoint");
;
private static var _cancellable:Dictionary = new Dictionary();
private static var _allValues:Dictionary;
public function ClipEventType(_arg1:String){
super(_arg1);
if (!_allValues){
_allValues = new Dictionary();
};
_allValues[_arg1] = this;
}
override public function get isCancellable():Boolean{
return (_cancellable[this.name]);
}
public function toString():String{
return ((("[ClipEventType] '" + name) + "'"));
}
public function get playlistIsEventTarget():Boolean{
return ((this == PLAYLIST_REPLACE));
}
public static function get cancellable():Dictionary{
return (_cancellable);
}
public static function get all():Dictionary{
return (_allValues);
}
_cancellable[BEGIN.name] = BEGIN;
_cancellable[SEEK.name] = SEEK;
_cancellable[PAUSE.name] = PAUSE;
_cancellable[RESUME.name] = RESUME;
_cancellable[STOP.name] = STOP;
_cancellable[FINISH.name] = FINISH;
}
}//package org.flowplayer.model
Section 59
//ClipType (org.flowplayer.model.ClipType)
package org.flowplayer.model {
public class ClipType {
private var _type:String;
public static const AUDIO:ClipType = new ClipType("audio");
;
public static const VIDEO:ClipType = new ClipType("video");
;
public static const IMAGE:ClipType = new ClipType("image");
;
private static var enumCreated:Boolean = true;
public function ClipType(_arg1:String){
if (enumCreated){
throw (new Error("Cannot create ad-hoc ClipType instances"));
};
this._type = _arg1;
}
public function get type():String{
return (_type);
}
public function toString():String{
return ((("ClipType: '" + _type) + "'"));
}
public static function resolveType(_arg1:String):ClipType{
if (["3g2", "3gp", "aac", "f4b", "f4p", "f4v", "flv", "m4a", "m4v", "mov", "mp4", "vp6", "mpeg4", "video"].indexOf(_arg1) >= 0){
return (ClipType.VIDEO);
};
if (["png", "jpg", "jpeg", "gif", "swf", "image"].indexOf(_arg1) >= 0){
return (ClipType.IMAGE);
};
if (_arg1 == "mp3"){
return (ClipType.AUDIO);
};
return (ClipType.VIDEO);
}
public static function fromFileExtension(_arg1:String):ClipType{
var _local2:Number = _arg1.lastIndexOf(".");
var _local3:String = _arg1.toLowerCase();
var _local4:String = _local3.substring((_local2 + 1), _local3.length);
return (resolveType(_local4));
}
}
}//package org.flowplayer.model
Section 60
//Cloneable (org.flowplayer.model.Cloneable)
package org.flowplayer.model {
public interface Cloneable {
function clone():Cloneable;
}
}//package org.flowplayer.model
Section 61
//Cuepoint (org.flowplayer.model.Cuepoint)
package org.flowplayer.model {
public class Cuepoint implements Cloneable {
private var _lastFireTime:int;
private var _time:int;
private var _callbackId:String;
public function Cuepoint(_arg1:int, _arg2:String){
_time = _arg1;
_callbackId = _arg2;
}
public function get callbackId():String{
return (_callbackId);
}
protected function onClone(_arg1:Cuepoint):void{
}
public function toString():String{
return (("[Cuepoint] time " + _time));
}
public function get time():int{
return (_time);
}
public function set lastFireTime(_arg1:int):void{
_lastFireTime = _arg1;
}
public function get lastFireTime():int{
return (_lastFireTime);
}
public function set time(_arg1:int):void{
_time = _arg1;
}
final public function clone():Cloneable{
var _local1:Cuepoint = new Cuepoint(_time, callbackId);
onClone(_local1);
return (_local1);
}
public static function createDynamic(_arg1:int, _arg2:String):Cuepoint{
return (new DynamicCuepoint(_arg1, _arg2));
}
}
}//package org.flowplayer.model
Section 62
//DisplayPluginModel (org.flowplayer.model.DisplayPluginModel)
package org.flowplayer.model {
public interface DisplayPluginModel extends PluginModel, DisplayProperties {
}
}//package org.flowplayer.model
Section 63
//DisplayPluginModelImpl (org.flowplayer.model.DisplayPluginModelImpl)
package org.flowplayer.model {
import flash.display.*;
public class DisplayPluginModelImpl extends DisplayPropertiesImpl implements DisplayPluginModel {
private var _config:Object;
private var _methods:Array;
public function DisplayPluginModelImpl(_arg1:DisplayObject, _arg2:String, _arg3:Boolean=true):void{
_methods = new Array();
super(_arg1, _arg2, _arg3);
}
public function set config(_arg1:Object):void{
_config = _arg1;
}
public function get config():Object{
return (_config);
}
public function getMethod(_arg1:String):PluginMethod{
return (PluginMethodHelper.getMethod(_methods, _arg1));
}
override public function clone():Cloneable{
var _local1:DisplayPluginModelImpl = new DisplayPluginModelImpl(getDisplayObject(), name);
super.copyFields(this, _local1);
_local1._config = _config;
_local1._methods = _methods;
return (_local1);
}
public function set visible(_arg1:Boolean):void{
super.display = (_arg1) ? "block" : "none";
}
public function get methodNames():Array{
return (PluginMethodHelper.methodNames(_methods));
}
public function addMethod(_arg1:PluginMethod):void{
_methods.push(_arg1);
}
public function get methods():Array{
return (_methods);
}
public function invokeMethod(_arg1:String, _arg2:Array=null):Object{
return (PluginMethodHelper.invokePlugin(this, getDisplayObject(), _arg1, _arg2));
}
}
}//package org.flowplayer.model
Section 64
//DisplayProperties (org.flowplayer.model.DisplayProperties)
package org.flowplayer.model {
import org.flowplayer.layout.*;
import flash.display.*;
public interface DisplayProperties extends Identifiable, Cloneable {
function get display():String;
function set display(_arg1:String):void;
function set left(_arg1:Object):void;
function set right(_arg1:Object):void;
function get position():Position;
function set top(_arg1:Object):void;
function getDisplayObject():DisplayObject;
function set width(_arg1:Object):void;
function get dimensions():Dimensions;
function get widthPx():Number;
function get heightPx():Number;
function set zIndex(_arg1:Number):void;
function get opacity():Number;
function set height(_arg1:Object):void;
function set opacity(_arg1:Number):void;
function get zIndex():Number;
function get visible():Boolean;
function get heightPct():Number;
function get widthPct():Number;
function set alpha(_arg1:Number):void;
function set bottom(_arg1:Object):void;
function get alpha():Number;
function setDisplayObject(_arg1:DisplayObject):void;
}
}//package org.flowplayer.model
Section 65
//DisplayPropertiesImpl (org.flowplayer.model.DisplayPropertiesImpl)
package org.flowplayer.model {
import org.flowplayer.layout.*;
import flash.display.*;
public class DisplayPropertiesImpl extends PluginEventDispatcher implements DisplayProperties {
private var _display:String;// = "block"
private var _position:Position;
private var _zIndex:Number;// = -1
private var _displayObject:DisplayObject;
private var _name:String;
private var _dimensions:Dimensions;
private var _alpha:Number;// = 1
public function DisplayPropertiesImpl(_arg1:DisplayObject=null, _arg2:String=null, _arg3:Boolean=true){
_dimensions = new Dimensions();
_position = new Position();
super();
_displayObject = _arg1;
_name = _arg2;
if (!_arg3){
return;
};
alpha = 1;
display = "block";
left = "50%";
top = "50%";
if (_arg1){
width = ((_arg1.width) || ("50%"));
height = ((_arg1.height) || ("50%"));
};
}
public function set display(_arg1:String):void{
_display = _arg1;
}
public function get heightStr():Object{
return (_dimensions.height.asObject());
}
public function get bottomStr():Object{
return (_position.bottom.asObject());
}
protected function copyFields(_arg1:DisplayProperties, _arg2:DisplayPropertiesImpl):void{
_arg2._dimensions = (_arg1.dimensions.clone() as Dimensions);
_arg2._alpha = _arg1.alpha;
_arg2._zIndex = _arg1.zIndex;
_arg2._name = _arg1.name;
_arg2._display = _arg1.display;
_arg2._displayObject = _arg1.getDisplayObject();
_arg2._position = _arg1.position.clone();
}
public function get heightPx():Number{
return (_dimensions.height.px);
}
override public function get name():String{
return (_name);
}
public function set width(_arg1:Object):void{
_dimensions.widthValue = _arg1;
}
public function set left(_arg1:Object):void{
_position.leftValue = _arg1;
}
public function get opacity():Number{
return (alpha);
}
public function set zIndex(_arg1:Number):void{
_zIndex = _arg1;
}
public function set name(_arg1:String):void{
_name = _arg1;
}
public function get position():Position{
return (_position);
}
public function set top(_arg1:Object):void{
_position.topValue = _arg1;
}
public function get topStr():Object{
return (_position.top.asObject());
}
public function set right(_arg1:Object):void{
_position.rightValue = _arg1;
}
public function get heightPct():Number{
return (_dimensions.height.pct);
}
public function get display():String{
return (_display);
}
public function set alpha(_arg1:Number):void{
_alpha = _arg1;
}
public function get widthPct():Number{
return (_dimensions.width.pct);
}
public function get leftStr():Object{
return (_position.left.asObject());
}
public function get dimensions():Dimensions{
return (_dimensions);
}
public function set height(_arg1:Object):void{
_dimensions.heightValue = _arg1;
}
public function set opacity(_arg1:Number):void{
alpha = _arg1;
}
public function get widthObj():Object{
return (_dimensions.width.asObject());
}
public function set bottom(_arg1:Object):void{
_position.bottomValue = _arg1;
}
public function get alpha():Number{
return (_alpha);
}
public function setDisplayObject(_arg1:DisplayObject):void{
_displayObject = _arg1;
}
public function clone():Cloneable{
var _local1:DisplayPropertiesImpl = new DisplayPropertiesImpl();
copyFields(this, _local1);
return (_local1);
}
public function getDisplayObject():DisplayObject{
return (_displayObject);
}
public function toString():String{
return ((("[DisplayPropertiesImpl] '" + _name) + "'"));
}
public function get widthPx():Number{
return (_dimensions.width.px);
}
public function get visible():Boolean{
return ((_display == "block"));
}
public function get rightStr():Object{
return (_position.right.asObject());
}
public function hasValue(_arg1:String):Boolean{
return (((_position.hasValue(_arg1)) || (_dimensions.hasValue(_arg1))));
}
public function get zIndex():Number{
return (_zIndex);
}
public static function fullSize(_arg1:String):DisplayPropertiesImpl{
var _local2:DisplayPropertiesImpl = new (DisplayPropertiesImpl);
_local2.name = _arg1;
_local2.left = "50%";
_local2.top = "50%";
_local2.width = "100%";
_local2.height = "100%";
return (_local2);
}
}
}//package org.flowplayer.model
Section 66
//DynamicCuepoint (org.flowplayer.model.DynamicCuepoint)
package org.flowplayer.model {
import org.flowplayer.model.*;
dynamic class DynamicCuepoint extends Cuepoint {
function DynamicCuepoint(_arg1:int, _arg2:String){
super(_arg1, _arg2);
}
override protected function onClone(_arg1:Cuepoint):void{
var _local2:String;
for (_local2 in this) {
_arg1[_local2] = this[_local2];
};
}
}
}//package org.flowplayer.model
Section 67
//ErrorCode (org.flowplayer.model.ErrorCode)
package org.flowplayer.model {
import org.flowplayer.model.*;
class ErrorCode {
private var _eventType:EventType;
private var _code:int;
private var _message:String;
function ErrorCode(_arg1:EventType, _arg2:int, _arg3:String){
_eventType = _arg1;
_code = _arg2;
_message = _arg3;
}
public function get eventType():EventType{
return (_eventType);
}
public function get message():String{
return (_message);
}
public function get code():int{
return (_code);
}
}
}//package org.flowplayer.model
Section 68
//EventDispatcher (org.flowplayer.model.EventDispatcher)
package org.flowplayer.model {
import org.flowplayer.util.*;
import flash.utils.*;
import org.flowplayer.*;
public class EventDispatcher {
private var _beforeListeners:Dictionary;
protected var log:Log;
private var _listeners:Dictionary;
protected static var _playerId:String;
public function EventDispatcher(){
log = new Log(this);
_beforeListeners = new Dictionary();
_listeners = new Dictionary();
super();
}
private function doRemoveListener(_arg1:Dictionary, _arg2:EventType, _arg3:Function):void{
var _local6:EventListener;
var _local4:Array = _arg1[_arg2];
if (!_local4){
return;
};
var _local5:Number = 0;
while (_local5 < _local4.length) {
_local6 = _local4[_local5];
if (_local6.listener == _arg3){
_local4.splice(_local5, 1);
};
_local5++;
};
}
protected function get cancellableEvents():Dictionary{
throw (new Error("cancellableEvents should be overridden the subclass"));
}
private function hasListener(_arg1:EventType, _arg2:EventListener):Boolean{
var _local5:EventListener;
var _local3:Array = _listeners[_arg1];
if (!_local3){
return (false);
};
var _local4:Number = 0;
while (_local4 < _local3.length) {
_local5 = _local3[_local4];
if (_local5.listener == _arg2.listener){
return (true);
};
_local4++;
};
return (false);
}
private function removeAllEventsListener(_arg1:Function, _arg2:Boolean):void{
var _local3:Object;
for each (_local3 in (_arg2) ? cancellableEvents : allEvents) {
removeListener((_local3 as ClipEventType), _arg1, _arg2);
};
}
private function addAllEventsListener(_arg1:Dictionary, _arg2:EventListener, _arg3:Boolean, _arg4:Boolean=false):void{
var _local5:Object;
log.debug(("addAllEventsListener, beforePhase " + _arg3));
for each (_local5 in _arg1) {
addListener((_local5 as ClipEventType), _arg2, _arg3, _arg4);
};
}
final flow_internal function doDispatchBeforeEvent(_arg1:AbstractEvent, _arg2:Boolean):Boolean{
log.debug(("doDispatchBeforeEvent, fireExternal " + _arg2));
if (!_arg1.isCancellable()){
log.debug("event is not cancellable, will not fire event, propagation is allowed");
return (true);
};
if (_arg1.target == null){
_arg1.target = this;
};
if (_arg2){
dispatchExternalEvent(_arg1, true);
};
_dispatchEvent(_arg1, _beforeListeners);
return (!(_arg1.isDefaultPrevented()));
}
private function _dispatchEvent(_arg1:AbstractEvent, _arg2:Dictionary):void{
var _local5:EventListener;
log.info(((this + " dispatchEvent(), event ") + _arg1));
var _local3:Array = _arg2[_arg1.eventType];
if (!_local3){
log.debug((((this + ": dispatchEvent(): no listeners for event ") + _arg1.eventType) + ((_arg2 == _beforeListeners)) ? " in before phase" : ""));
return;
};
var _local4:Number = 0;
while (_local4 < _local3.length) {
_local5 = _local3[_local4];
if (_local5 == null){
log.error("found null listener");
};
_local5.notify(_arg1);
if (_arg1.isPropagationStopped()){
return;
};
_local4++;
};
}
private function dispatchExternalEvent(_arg1:AbstractEvent, _arg2:Boolean=false):void{
if (!_playerId){
return;
};
var _local3:Boolean = _arg1.fireExternal(_playerId, _arg2);
if (!_local3){
log.debug("preventing default");
_arg1.preventDefault();
};
}
final public function unbind(_arg1:Function, _arg2:EventType=null, _arg3:Boolean=false):void{
if (_arg2){
removeListener(_arg2, _arg1, _arg3);
} else {
removeAllEventsListener(_arg1, _arg3);
};
}
private function addListener(_arg1:EventType, _arg2:EventListener, _arg3:Boolean, _arg4:Boolean=false):void{
log.debug((((this + ": adding listener for event ") + _arg1) + (_arg3) ? " to before phase" : ""));
var _local5:Dictionary = (_arg3) ? _beforeListeners : _listeners;
var _local6:Array = _local5[_arg1];
if (!_local6){
_local6 = new Array();
_local5[_arg1] = _local6;
};
if (!hasListener(_arg1, _arg2)){
if (_arg4){
_local6.splice(0, 0, _arg2);
} else {
_local6.push(_arg2);
};
};
}
function removeListener(_arg1:EventType, _arg2:Function, _arg3:Boolean=false):void{
doRemoveListener((_arg3) ? _beforeListeners : _listeners, _arg1, _arg2);
}
protected function get allEvents():Dictionary{
throw (new Error("allEvents should be overridden the subclass"));
}
final flow_internal function doDispatchEvent(_arg1:AbstractEvent, _arg2:Boolean):void{
if (_arg1.target == null){
_arg1.target = this;
};
if (_arg2){
dispatchExternalEvent(_arg1);
};
_dispatchEvent(_arg1, _listeners);
}
flow_internal function setListener(_arg1:EventType, _arg2:Function, _arg3:Function=null, _arg4:Boolean=false, _arg5:Boolean=false):void{
if (_arg1){
addListener(_arg1, new EventListener(_arg2, _arg3), _arg4, _arg5);
} else {
log.debug(("adding listeners, beforePhase " + _arg4));
addAllEventsListener((_arg4) ? cancellableEvents : allEvents, new EventListener(_arg2, _arg3), _arg4, _arg5);
};
}
public static function set playerId(_arg1:String):void{
_playerId = _arg1;
}
}
}//package org.flowplayer.model
Section 69
//EventListener (org.flowplayer.model.EventListener)
package org.flowplayer.model {
import org.flowplayer.model.*;
import org.flowplayer.util.*;
class EventListener {
private var _listener:Function;
private var log:Log;
private var _clipFilter:Function;
function EventListener(_arg1:Function, _arg2:Function){
log = new Log(this);
super();
_listener = _arg1;
_clipFilter = _arg2;
}
public function notify(_arg1:AbstractEvent):Boolean{
Assert.notNull(_arg1.target, "event target cannot be null");
if (_clipFilter != null){
log.debug(("clip filter returns " + _clipFilter((_arg1.target as Clip))));
};
if (((((!((_clipFilter == null))) && (_arg1.target))) && (!(_clipFilter((_arg1.target as Clip)))))){
log.debug((_arg1 + " was filtered out for this listener"));
return (false);
};
log.debug(("notifying listener for event " + _arg1));
_listener(_arg1);
return (true);
}
public function get listener():Function{
return (_listener);
}
}
}//package org.flowplayer.model
Section 70
//EventType (org.flowplayer.model.EventType)
package org.flowplayer.model {
public class EventType {
private var _name:String;
public function EventType(_arg1:String){
_name = _arg1;
}
public function get isCancellable():Boolean{
throw (new Error("isCancellable() not overridden"));
}
public function get name():String{
return (_name);
}
}
}//package org.flowplayer.model
Section 71
//FontProvider (org.flowplayer.model.FontProvider)
package org.flowplayer.model {
public interface FontProvider {
function get fontFamily():String;
}
}//package org.flowplayer.model
Section 72
//Identifiable (org.flowplayer.model.Identifiable)
package org.flowplayer.model {
public interface Identifiable {
function get name():String;
function set name(_arg1:String):void;
}
}//package org.flowplayer.model
Section 73
//Loadable (org.flowplayer.model.Loadable)
package org.flowplayer.model {
import flash.display.*;
import org.flowplayer.util.*;
import org.flowplayer.config.*;
public class Loadable {
private var _config:Object;
private var _playerConfig:Config;
private var _name:String;
private var _url:String;
private var _plugin:PluginModel;
public function Loadable(_arg1:String, _arg2:Config, _arg3:String=null){
_name = _arg1;
_playerConfig = _arg2;
_url = _arg3;
}
public function toString():String{
return ((("[Loadable] '" + _name) + "'"));
}
public function createProvider(_arg1:Object):ProviderModel{
if (!_plugin){
_plugin = (new PropertyBinder(new ProviderModel(_arg1, _name), "config").copyProperties(_config) as PluginModel);
};
return ((_plugin as ProviderModel));
}
public function get url():String{
return (_url);
}
public function get config():Object{
return (_config);
}
public function get plugin():PluginModel{
return (_plugin);
}
public function createDisplayPlugin(_arg1:DisplayObject):DisplayPluginModel{
if (!_plugin){
_plugin = _playerConfig.getPlugin(_arg1, _name, _config);
};
return ((_plugin as DisplayPluginModel));
}
public function get name():String{
return (_name);
}
public function set config(_arg1:Object):void{
_config = _arg1;
}
public function set url(_arg1:String):void{
_url = _arg1;
}
}
}//package org.flowplayer.model
Section 74
//Logo (org.flowplayer.model.Logo)
package org.flowplayer.model {
public class Logo extends DisplayPropertiesImpl {
private var _scaleMaximum:Number;// = 2
private var _linkUrl:String;
private var _fullscreenOnly:Boolean;// = true
private var _linkWindow:String;
private var _url:String;
private var _displayTime:int;// = 0
private var _fadeSpeed:Number;
public function Logo(){
top = "20";
right = "20";
_linkWindow = "_self";
}
public function get fullscreenOnly():Boolean{
return (_fullscreenOnly);
}
public function get linkWindow():String{
return (_linkWindow);
}
public function set fullscreenOnly(_arg1:Boolean):void{
_fullscreenOnly = _arg1;
}
public function set linkWindow(_arg1:String):void{
_linkWindow = _arg1;
}
public function set fadeSpeed(_arg1:Number):void{
_fadeSpeed = _arg1;
}
public function get linkUrl():String{
return (_linkUrl);
}
public function set displayTime(_arg1:int):void{
_displayTime = _arg1;
}
public function set url(_arg1:String):void{
_url = _arg1;
if (((_url) && ((_url.indexOf(".swf") > 0)))){
width = "6.5%";
height = "6.5%";
};
}
public function get fadeSpeed():Number{
return (_fadeSpeed);
}
public function set scaleMaximum(_arg1:Number):void{
_scaleMaximum = _arg1;
}
public function get url():String{
return (_url);
}
public function set linkUrl(_arg1:String):void{
_linkUrl = _arg1;
}
public function get scaleMaximum():Number{
return (_scaleMaximum);
}
public function get displayTime():int{
return (_displayTime);
}
}
}//package org.flowplayer.model
Section 75
//MediaSize (org.flowplayer.model.MediaSize)
package org.flowplayer.model {
import flash.utils.*;
public class MediaSize {
private var _value:String;
public static const FILLED_TO_AVAILABLE_SPACE:MediaSize = new MediaSize("scale");
;
public static const ORIGINAL:MediaSize = new MediaSize("orig");
;
public static const HALF_FROM_ORIGINAL:MediaSize = new MediaSize("half");
;
public static const FITTED_PRESERVING_ASPECT_RATIO:MediaSize = new MediaSize("fit");
;
public static var ALL_VALUES:Dictionary = new Dictionary();
private static var enumCreated:Boolean = true;
public function MediaSize(_arg1:String){
if (enumCreated){
throw (new Error("Cannot create ad-hoc MediaSize instances"));
};
this._value = _arg1;
}
public function get value():String{
return (_value);
}
public function toString():String{
return ((("[MediaSize] '" + _value) + "'"));
}
public static function forName(_arg1:String):MediaSize{
return (ALL_VALUES[_arg1]);
}
ALL_VALUES[FITTED_PRESERVING_ASPECT_RATIO._value] = FITTED_PRESERVING_ASPECT_RATIO;
ALL_VALUES[HALF_FROM_ORIGINAL._value] = HALF_FROM_ORIGINAL;
ALL_VALUES[ORIGINAL._value] = ORIGINAL;
ALL_VALUES[FILLED_TO_AVAILABLE_SPACE._value] = FILLED_TO_AVAILABLE_SPACE;
}
}//package org.flowplayer.model
Section 76
//NullClip (org.flowplayer.model.NullClip)
package org.flowplayer.model {
import org.flowplayer.model.*;
class NullClip extends Clip {
function NullClip(){
url = "null clip";
autoPlay = false;
autoBuffering = false;
type = ClipType.VIDEO;
}
override public function get isNullClip():Boolean{
return (true);
}
}
}//package org.flowplayer.model
Section 77
//PlayButtonOverlay (org.flowplayer.model.PlayButtonOverlay)
package org.flowplayer.model {
public class PlayButtonOverlay extends DisplayPluginModelImpl {
private var _replayLabel:String;
private var _buffering:Boolean;
private var _fadeSpeed:int;
private var _rotateSpeed:int;
private var _url:String;
private var _label:String;
public function PlayButtonOverlay(){
super(null, "play", false);
top = "45%";
left = "50%";
width = "22%";
height = "22%";
visible = false;
_buffering = true;
_rotateSpeed = 50;
_fadeSpeed = 500;
_replayLabel = "Play again";
}
public function set buffering(_arg1:Boolean):void{
_buffering = _arg1;
}
public function get replayLabel():String{
return (_replayLabel);
}
public function set fadeSpeed(_arg1:int):void{
_fadeSpeed = _arg1;
}
public function set replayLabel(_arg1:String):void{
_replayLabel = _arg1;
}
public function set url(_arg1:String):void{
_url = _arg1;
}
public function set rotateSpeed(_arg1:int):void{
_rotateSpeed = _arg1;
}
public function get buffering():Boolean{
return (_buffering);
}
public function set label(_arg1:String):void{
_label = _arg1;
}
public function get fadeSpeed():int{
return (_fadeSpeed);
}
public function get url():String{
return (_url);
}
public function get label():String{
return (_label);
}
public function get rotateSpeed():int{
if (_rotateSpeed > 100){
return (100);
};
return (_rotateSpeed);
}
}
}//package org.flowplayer.model
Section 78
//PlayerError (org.flowplayer.model.PlayerError)
package org.flowplayer.model {
public class PlayerError extends ErrorCode {
public static const RESOURCE_LOAD_FAILED:PlayerError = new PlayerError(PlayerEventType.ERROR, 303, "Failed to load a resource");
;
public static const PLUGIN_LOAD_FAILED:PlayerError = new PlayerError(PlayerEventType.ERROR, 301, "Unable to load plugin");
;
public static const INIT_FAILED:PlayerError = new PlayerError(PlayerEventType.ERROR, 300, "Player initialization failed");
;
public static const PLUGIN_INVOKE_FAILED:PlayerError = new PlayerError(PlayerEventType.ERROR, 302, "Error when invoking plugin external method");
;
public function PlayerError(_arg1:EventType, _arg2:int, _arg3:String){
super(_arg1, _arg2, _arg3);
}
}
}//package org.flowplayer.model
Section 79
//PlayerEvent (org.flowplayer.model.PlayerEvent)
package org.flowplayer.model {
import flash.events.*;
public class PlayerEvent extends AbstractEvent {
public function PlayerEvent(_arg1:EventType, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null){
super(_arg1, _arg2, _arg3, _arg4);
}
override protected function get externalEventArgument2():Object{
return (info2);
}
override protected function get externalEventArgument3():Object{
return (info3);
}
override protected function get externalEventArgument4():Object{
return (null);
}
override protected function get externalEventArgument():Object{
return (info);
}
override public function toString():String{
return (formatToString("PlayerEvent", "type", "info"));
}
override public function clone():Event{
return (new PlayerEvent(eventType, info));
}
public static function fullscreenExit(_arg1:Object=null):PlayerEvent{
return (new PlayerEvent(PlayerEventType.FULLSCREEN_EXIT, _arg1));
}
public static function unMute(_arg1:Object=null):PlayerEvent{
return (new PlayerEvent(PlayerEventType.UNMUTE, _arg1));
}
public static function keyPress(_arg1:Object=null):PlayerEvent{
return (new PlayerEvent(PlayerEventType.KEYPRESS, _arg1));
}
public static function load(_arg1:Object=null):PlayerEvent{
return (new PlayerEvent(PlayerEventType.LOAD, _arg1));
}
public static function mouseOver(_arg1:Object=null):PlayerEvent{
return (new PlayerEvent(PlayerEventType.MOUSE_OVER, _arg1));
}
public static function mute(_arg1:Object=null):PlayerEvent{
return (new PlayerEvent(PlayerEventType.MUTE, _arg1));
}
public static function volume(_arg1:Object=null):PlayerEvent{
return (new PlayerEvent(PlayerEventType.VOLUME, _arg1));
}
public static function fullscreen(_arg1:Object=null):PlayerEvent{
return (new PlayerEvent(PlayerEventType.FULLSCREEN, _arg1));
}
public static function mouseOut(_arg1:Object=null):PlayerEvent{
return (new PlayerEvent(PlayerEventType.MOUSE_OUT, _arg1));
}
}
}//package org.flowplayer.model
Section 80
//PlayerEventType (org.flowplayer.model.PlayerEventType)
package org.flowplayer.model {
import flash.utils.*;
public class PlayerEventType extends EventType {
public static const FULLSCREEN:PlayerEventType = new PlayerEventType("onFullscreen");
;
public static const KEYPRESS:PlayerEventType = new PlayerEventType("onKeyPress");
;
public static const MOUSE_OVER:PlayerEventType = new PlayerEventType("onMouseOver");
;
public static const MUTE:PlayerEventType = new PlayerEventType("onMute");
;
public static const VOLUME:PlayerEventType = new PlayerEventType("onVolume");
;
public static const LOAD:PlayerEventType = new PlayerEventType("onLoad");
;
public static const FULLSCREEN_EXIT:PlayerEventType = new PlayerEventType("onFullscreenExit");
;
public static const ERROR:PlayerEventType = new PlayerEventType("onError");
;
public static const UNMUTE:PlayerEventType = new PlayerEventType("onUnmute");
;
public static const MOUSE_OUT:PlayerEventType = new PlayerEventType("onMouseOut");
;
private static var _cancellable:Dictionary = new Dictionary();
private static var _allValues:Dictionary;
public function PlayerEventType(_arg1:String){
super(_arg1);
if (!_allValues){
_allValues = new Dictionary();
};
_allValues[_arg1] = this;
}
override public function get isCancellable():Boolean{
return (_cancellable[this.name]);
}
public function toString():String{
return ((("[PlayerEventType] '" + name) + "'"));
}
public static function get cancellable():Dictionary{
return (_cancellable);
}
public static function get all():Dictionary{
return (_allValues);
}
_cancellable[KEYPRESS.name] = KEYPRESS;
_cancellable[MUTE.name] = MUTE;
_cancellable[UNMUTE.name] = UNMUTE;
_cancellable[VOLUME.name] = VOLUME;
_cancellable[FULLSCREEN.name] = FULLSCREEN;
}
}//package org.flowplayer.model
Section 81
//Playlist (org.flowplayer.model.Playlist)
package org.flowplayer.model {
import org.flowplayer.*;
public class Playlist extends ClipEventSupport {
private var _commonClip:Clip;
private var currentPos:Number;
private var _clips:Array;
public function Playlist(_arg1:Clip){
if (_arg1 == null){
_arg1 = new NullClip();
};
super(_arg1);
_commonClip = _arg1;
_commonClip.setPlaylist(this);
initialize();
}
public function replaceClips2(_arg1:Array):void{
doReplace(_arg1);
}
public function getClip(_arg1:Number):Clip{
if (_arg1 == -1){
return (_commonClip);
};
if (_clips.length == 0){
return (new NullClip());
};
return (_clips[_arg1]);
}
public function indexOf(_arg1:Clip):Number{
var _local2:Number = 0;
while (_local2 < _clips.length) {
if (_clips[_local2] == _arg1){
return (_local2);
};
_local2++;
};
return (-1);
}
public function replaceClips(_arg1:Clip):void{
doReplace([_arg1]);
}
private function initialize(_arg1:Array=null):void{
var _local2:Number;
_clips = new Array();
if (_arg1){
_local2 = 0;
while (_local2 < _arg1.length) {
addClip(_arg1[_local2]);
_local2++;
};
};
super.setClips(_clips);
currentPos = 0;
}
public function addClip(_arg1:Clip):void{
_clips.push(_arg1);
_arg1.setPlaylist(this);
if (_arg1 != _commonClip){
_arg1.onAll(_commonClip.onClipEvent);
log.info("adding listener to all before events, common clip listens to other clips");
_arg1.onBeforeAll(_commonClip.onBeforeClipEvent);
};
}
public function toIndex(_arg1:Number):Clip{
if (_arg1 < 0){
return (null);
};
if (_arg1 >= _clips.length){
return (null);
};
var _local2:Clip = _clips[_arg1];
if (_arg1 == currentPos){
return (_local2);
};
currentPos = _arg1;
return (_local2);
}
public function get currentIndex():Number{
return (currentPos);
}
override flow_internal function setClips(_arg1:Array):void{
var _local2:Number = 0;
while (_local2 < _arg1.length) {
addClip(_arg1[_local2]);
_local2++;
};
super.setClips(_arg1);
}
public function get commonClip():Clip{
return (_commonClip);
}
public function get nextClip():Clip{
if (currentPos == (_clips.length - 1)){
return (null);
};
return (_clips[(currentPos + 1)]);
}
public function get length():Number{
return (_clips.length);
}
public function get previousClip():Clip{
if (currentPos == 0){
return (null);
};
return (_clips[(currentPos - 1)]);
}
private function doReplace(_arg1:Array):void{
var _local2:ClipEventSupport = new ClipEventSupport(_commonClip, _clips);
initialize(_arg1);
doDispatchEvent(new ClipEvent(ClipEventType.PLAYLIST_REPLACE, _local2), true);
}
public function toString():String{
return (((("[playList] length " + _clips.length) + ", clips ") + _clips));
}
public function hasNext():Boolean{
return ((currentPos < (length - 1)));
}
public function hasPrevious():Boolean{
return ((currentPos > 0));
}
public function set current(_arg1:Clip):void{
toIndex(indexOf(_arg1));
}
public function next():Clip{
trace(("PlayList.next(), current index = " + currentPos));
if (currentPos == (_clips.length - 1)){
return (null);
};
var _local1:Clip = _clips[++currentPos];
return (_local1);
}
public function previous():Clip{
trace(("PlayList.prev(), current index = " + currentPos));
if (currentPos == 0){
return (null);
};
return (_clips[--currentPos]);
}
public function get current():Clip{
if (_clips.length == 0){
return (new NullClip());
};
return (_clips[currentPos]);
}
public function hasType(_arg1:ClipType):Boolean{
var _local2:Number = 0;
while (_local2 < _clips.length) {
if (Clip(_clips[_local2]).type == _arg1){
return (true);
};
_local2++;
};
return (false);
}
}
}//package org.flowplayer.model
Section 82
//Plugin (org.flowplayer.model.Plugin)
package org.flowplayer.model {
import org.flowplayer.view.*;
public interface Plugin {
function onConfig(_arg1:PluginModel):void;
function getDefaultConfig():Object;
function onLoad(_arg1:Flowplayer):void;
}
}//package org.flowplayer.model
Section 83
//PluginError (org.flowplayer.model.PluginError)
package org.flowplayer.model {
public class PluginError extends ErrorCode {
public static const INIT_FAILED:PluginError = new PluginError(100, "Plugin initialization failed");
;
public function PluginError(_arg1:int, _arg2:String){
super(PluginEventType.ERROR, _arg1, _arg2);
}
}
}//package org.flowplayer.model
Section 84
//PluginEvent (org.flowplayer.model.PluginEvent)
package org.flowplayer.model {
import flash.events.*;
public class PluginEvent extends AbstractEvent {
private var _id:Object;
public static const PLUGIN_EVENT:String = "onPluginEvent";
public function PluginEvent(_arg1:PluginEventType, _arg2:String, _arg3:Object=null, _arg4:Object=null, _arg5:Object=null){
super(_arg1, _arg2, _arg4, _arg5);
_id = _arg3;
}
override protected function get externalEventArgument2():Object{
return (_id);
}
override protected function get externalEventArgument3():Object{
return (info2);
}
override protected function get externalEventArgument4():Object{
return (info3);
}
override protected function get externalEventArgument():Object{
return (info);
}
public function get id():Object{
return (_id);
}
override public function toString():String{
return (formatToString("PluginEvent", "id", "info", "info2"));
}
override public function clone():Event{
return (new PluginEvent((eventType as PluginEventType), info.toString(), _id, info2));
}
override public function hasError(_arg1:ErrorCode):Boolean{
return ((_id == _arg1.code));
}
}
}//package org.flowplayer.model
Section 85
//PluginEventDispatcher (org.flowplayer.model.PluginEventDispatcher)
package org.flowplayer.model {
import flash.utils.*;
public class PluginEventDispatcher extends EventDispatcher {
public function dispatchEvent(_arg1:PluginEvent):void{
doDispatchEvent(_arg1, true);
}
public function dispatchBeforeEvent(_arg1:PluginEvent):Boolean{
return (doDispatchBeforeEvent(_arg1, true));
}
public function onLoad(_arg1:Function):void{
setListener(PluginEventType.LOAD, _arg1);
}
public function onPluginEvent(_arg1:Function):void{
setListener(PluginEventType.PLUGIN_EVENT, _arg1);
}
public function onError(_arg1:Function):void{
setListener(PluginEventType.ERROR, _arg1);
}
public function get name():String{
return (null);
}
override protected function get cancellableEvents():Dictionary{
return (PluginEventType.cancellable);
}
public function dispatchError(_arg1:PluginError, _arg2:Object=null):void{
doDispatchEvent(new PluginEvent((_arg1.eventType as PluginEventType), name, _arg1.code, _arg1.message, _arg2), true);
}
public function dispatch(_arg1:PluginEventType, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
doDispatchEvent(new PluginEvent(_arg1, name, _arg2, _arg3, _arg4), true);
}
override protected function get allEvents():Dictionary{
return (PluginEventType.all);
}
public function dispatchOnLoad():void{
dispatch(PluginEventType.LOAD);
}
}
}//package org.flowplayer.model
Section 86
//PluginEventType (org.flowplayer.model.PluginEventType)
package org.flowplayer.model {
import flash.utils.*;
public class PluginEventType extends EventType {
public static const LOAD:PluginEventType = new PluginEventType("onLoad");
;
public static const ERROR:PluginEventType = new PluginEventType("onError");
;
public static const PLUGIN_EVENT:PluginEventType = new PluginEventType("onPluginEvent");
;
private static var _allValues:Dictionary;
private static var _cancellable:Dictionary = new Dictionary();
public function PluginEventType(_arg1:String){
super(_arg1);
if (!_allValues){
_allValues = new Dictionary();
};
_allValues[_arg1] = this;
}
override public function get isCancellable():Boolean{
return (_cancellable[this.name]);
}
public function toString():String{
return ((("[PluginEventType] '" + name) + "'"));
}
public static function get all():Dictionary{
return (_allValues);
}
public static function get cancellable():Dictionary{
return (_cancellable);
}
_cancellable[PLUGIN_EVENT.name] = PLUGIN_EVENT;
}
}//package org.flowplayer.model
Section 87
//PluginFactory (org.flowplayer.model.PluginFactory)
package org.flowplayer.model {
public interface PluginFactory {
function newPlugin():Object;
}
}//package org.flowplayer.model
Section 88
//PluginMethod (org.flowplayer.model.PluginMethod)
package org.flowplayer.model {
public class PluginMethod {
private var _hasReturnValue:Boolean;
private var _internalName:String;
private var _isSetter:Boolean;
private var _isGetter:Boolean;
private var _externalName:String;
public function PluginMethod(_arg1:String, _arg2:String, _arg3:Boolean=false, _arg4:Boolean=false, _arg5:Boolean=false){
_externalName = _arg1;
_internalName = _arg2;
if (((_isGetter) && (_arg4))){
throw (new Error("PluginMethod cannot be a setter and a getter at the same time"));
};
_isGetter = _arg3;
_isSetter = _arg4;
_hasReturnValue = _arg5;
}
public function get isSetter():Boolean{
return (_isSetter);
}
public function get externalName():String{
return (_externalName);
}
public function get internalName():String{
return (_internalName);
}
public function get isGetter():Boolean{
return (_isGetter);
}
public function set hasReturnValue(_arg1:Boolean):void{
_hasReturnValue = _arg1;
}
public function get hasReturnValue():Boolean{
return (_hasReturnValue);
}
public static function method(_arg1:String, _arg2:String, _arg3:Boolean):PluginMethod{
return (new PluginMethod(_arg1, _arg2, false, false, _arg3));
}
public static function getter(_arg1:String, _arg2:String):PluginMethod{
return (new PluginMethod(_arg1, _arg2, true, false, true));
}
public static function setter(_arg1:String, _arg2:String):PluginMethod{
return (new PluginMethod(_arg1, _arg2, false, true));
}
}
}//package org.flowplayer.model
Section 89
//PluginMethodHelper (org.flowplayer.model.PluginMethodHelper)
package org.flowplayer.model {
import org.flowplayer.model.*;
import org.flowplayer.util.*;
class PluginMethodHelper {
private static var log:Log = new Log("org.flowplayer.model::PluginMethodHelper");
public static function invokePlugin(_arg1:Callable, _arg2:Object, _arg3:String, _arg4:Array):Object{
var _local5:PluginMethod = _arg1.getMethod(_arg3);
if (!_local5){
throw (new Error((("Plugin does not have the specified method '" + _arg3) + "'")));
};
if (_local5.isGetter){
log.debug(((("calling getter '" + _local5.internalName) + "', of callable object ") + _arg1));
return (_arg2[_local5.internalName]);
};
if (_local5.isSetter){
log.debug(((("calling setter '" + _local5.internalName) + "', of callable object ") + _arg1));
_arg2[_local5.internalName] = _arg4[0];
return (undefined);
};
log.debug(((("calling method '" + _local5.internalName) + "', of callable object ") + _arg1));
return (_arg2[_local5.internalName].apply(_arg2, _arg4));
}
public static function methodNames(_arg1:Array):Array{
var _local2:Array = new Array();
var _local3:Number = 0;
while (_local3 < _arg1.length) {
_local2.push(PluginMethod(_arg1[_local3]).externalName);
_local3++;
};
return (_local2);
}
public static function getMethod(_arg1:Array, _arg2:String):PluginMethod{
var _local4:PluginMethod;
var _local3:Number = 0;
while (_local3 < _arg1.length) {
_local4 = _arg1[_local3];
if (_local4.externalName == _arg2){
return (_local4);
};
_local3++;
};
return (null);
}
}
}//package org.flowplayer.model
Section 90
//PluginModel (org.flowplayer.model.PluginModel)
package org.flowplayer.model {
public interface PluginModel extends Identifiable, Callable, Cloneable {
function dispatchEvent(_arg1:PluginEvent):void;
function get config():Object;
function set config(_arg1:Object):void;
function onLoad(_arg1:Function):void;
function unbind(_arg1:Function, _arg2:EventType=null, _arg3:Boolean=false):void;
function onPluginEvent(_arg1:Function):void;
function onError(_arg1:Function):void;
function dispatch(_arg1:PluginEventType, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void;
function dispatchError(_arg1:PluginError, _arg2:Object=null):void;
function dispatchOnLoad():void;
}
}//package org.flowplayer.model
Section 91
//ProviderModel (org.flowplayer.model.ProviderModel)
package org.flowplayer.model {
public class ProviderModel extends PluginEventDispatcher implements PluginModel {
private var _config:Object;
private var _name:String;
private var _providerObject:Object;
private var _methods:Array;
public function ProviderModel(_arg1:Object, _arg2:String){
_methods = new Array();
super();
_name = _arg2;
_providerObject = _arg1;
}
public function set config(_arg1:Object):void{
_config = _arg1;
}
public function getProviderObject():Object{
return (_providerObject);
}
public function get config():Object{
return (_config);
}
override public function get name():String{
return (_name);
}
public function getMethod(_arg1:String):PluginMethod{
return (PluginMethodHelper.getMethod(_methods, _arg1));
}
public function addMethod(_arg1:PluginMethod):void{
_methods.push(_arg1);
}
public function clone():Cloneable{
var _local1:ProviderModel = new ProviderModel(_providerObject, _name);
_local1.config = _config;
_local1.methods = _methods;
return (_local1);
}
public function get methodNames():Array{
return (PluginMethodHelper.methodNames(_methods));
}
public function set methods(_arg1:Array):void{
_methods = _arg1;
}
public function toString():String{
return ((("[Provider] '" + _name) + "'"));
}
public function set name(_arg1:String):void{
_name = _arg1;
}
public function invokeMethod(_arg1:String, _arg2:Array=null):Object{
return (PluginMethodHelper.invokePlugin(this, getProviderObject(), _arg1, _arg2));
}
}
}//package org.flowplayer.model
Section 92
//State (org.flowplayer.model.State)
package org.flowplayer.model {
public class State {
private var _name:String;
private var _code:Number;
public static const BUFFERING:State = new State(2, "Buffering");
;
public static const WAITING:State = new State(1, "Waiting");
;
public static const PAUSED:State = new State(4, "Paused");
;
public static const PLAYING:State = new State(3, "Playing");
;
public static const ENDED:State = new State(5, "Ended");
;
private static var enumCreated:Boolean = true;
public function State(_arg1:Number, _arg2:String){
if (enumCreated){
throw (new Error("Cannot create ad-hoc State instances"));
};
_code = _arg1;
_name = _arg2;
}
public function toString():String{
return ((((("State: " + _code) + ", '") + _name) + "'"));
}
public function get code():Number{
return (_code);
}
}
}//package org.flowplayer.model
Section 93
//Status (org.flowplayer.model.Status)
package org.flowplayer.model {
public class Status {
private var _bufferStart:Number;
private var _allowRandomSeek:Boolean;
private var _state:State;
private var _time:Number;
private var _clip:Clip;
private var _bytesTotal:Number;
private var _volume:Number;
private var _muted:Boolean;
private var _bufferEnd:Number;
public function Status(_arg1:State, _arg2:Clip, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Boolean, _arg8:Number, _arg9:Boolean=false){
_state = _arg1;
_clip = _arg2;
_time = ((_arg3) || (0));
_bufferStart = ((_arg4) || (0));
_bufferEnd = ((_arg5) || (0));
_bytesTotal = ((_arg6) || (0));
_allowRandomSeek = _arg9;
_muted = _arg7;
_volume = _arg8;
}
public function get bufferStart():Number{
return (_bufferStart);
}
public function toString():String{
return ((((((("[PlayStatus] time " + _time) + ", buffer: [") + _bufferStart) + ", ") + _bufferEnd) + "]"));
}
public function get allowRandomSeek():Boolean{
return (_allowRandomSeek);
}
public function get time():Number{
return (_time);
}
public function get clip():Clip{
return (_clip);
}
public function get state():int{
return (_state.code);
}
public function get bufferEnd():Number{
return (_bufferEnd);
}
public function get bytesTotal():Number{
return (_bytesTotal);
}
public function get volume():Number{
return (_volume);
}
public function getState():State{
return (_state);
}
public function set clip(_arg1:Clip):void{
_clip = _arg1;
}
public function get muted():Boolean{
return (_muted);
}
public function get ended():Boolean{
return (((_clip.played) && (((_clip.duration - _time) <= 1))));
}
}
}//package org.flowplayer.model
Section 94
//Arrange (org.flowplayer.util.Arrange)
package org.flowplayer.util {
import flash.display.*;
public class Arrange {
public static function describeBounds(_arg1:DisplayObject):String{
return (((((((("x: " + _arg1.x) + ", y: ") + _arg1.y) + ", width: ") + _arg1.width) + ", height: ") + _arg1.height));
}
public static function positionPercentage(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:int):int{
var _local4:int;
var _local5:int;
if ((((_arg3 == 0)) || ((_arg3 == 2)))){
_local4 = (((_arg1.y + (_arg1.height / 2)) / _arg2.height) * 100);
return (((_arg3 == 0)) ? _local4 : (100 - _local4));
};
if ((((_arg3 == 1)) || ((_arg3 == 3)))){
_local5 = (((_arg1.x + (_arg1.width / 2)) / _arg2.width) * 100);
return (((_arg3 == 3)) ? _local5 : (100 - _local5));
};
return (0);
}
public static function center(_arg1:DisplayObject, _arg2:Number=0, _arg3:Number=0):void{
if (_arg2 > 0){
_arg1.x = ((_arg2 / 2) - (_arg1.width / 2));
};
if (_arg3 > 0){
_arg1.y = ((_arg3 / 2) - (_arg1.height / 2));
};
}
public static function getStageWidth(_arg1:Stage):Number{
return (getStageDimension(_arg1, "width"));
}
public static function getWidth(_arg1:DisplayObject):Number{
if ((_arg1 is Stage)){
return (getStageWidth((_arg1 as Stage)));
};
return (_arg1.width);
}
protected static function getStageDimension(_arg1:Stage, _arg2:String):Number{
if ((((_arg1.displayState == StageDisplayState.FULL_SCREEN)) && (_arg1.fullScreenSourceRect))){
return (_arg1.fullScreenSourceRect[_arg2]);
};
return (((_arg2 == "height")) ? _arg1.stageHeight : _arg1.stageWidth);
}
public static function getHeight(_arg1:DisplayObject):Number{
if ((_arg1 is Stage)){
return (getStageHeight((_arg1 as Stage)));
};
return (_arg1.height);
}
public static function sameSize(_arg1:DisplayObject, _arg2:DisplayObject):void{
if (!_arg1){
return;
};
if (!_arg2){
return;
};
if ((_arg2 is Stage)){
_arg1.width = Stage(_arg2).stageWidth;
_arg1.height = Stage(_arg2).stageHeight;
} else {
_arg1.width = _arg2.width;
_arg1.height = _arg2.height;
};
}
public static function getStageHeight(_arg1:Stage):Number{
return (getStageDimension(_arg1, "height"));
}
}
}//package org.flowplayer.util
Section 95
//ArrayUtil (org.flowplayer.util.ArrayUtil)
package org.flowplayer.util {
import org.flowplayer.*;
public class ArrayUtil {
public static function concat(_arg1:Array, _arg2:Array):Array{
if (_arg2){
return (_arg1.concat(_arg2));
};
return (_arg1);
}
flow_internal static function nonNulls(_arg1:Array):Array{
var _local2:Array = new Array();
var _local3:Number = 0;
while (_local3 < _arg1.length) {
if (_arg1[_local3] != null){
_local2.push(_arg1[_local3]);
};
_local3++;
};
return (_local2);
}
}
}//package org.flowplayer.util
Section 96
//Assert (org.flowplayer.util.Assert)
package org.flowplayer.util {
public class Assert {
public static function notNull(_arg1:Object, _arg2:String="object cannot be null"):void{
if (_arg1 == null){
throw (new Error(_arg2));
};
}
}
}//package org.flowplayer.util
Section 97
//GraphicsUtil (org.flowplayer.util.GraphicsUtil)
package org.flowplayer.util {
import flash.display.*;
import flash.geom.*;
public class GraphicsUtil {
public static function addGradient(_arg1:DisplayObjectContainer, _arg2:int, _arg3:Array, _arg4:Number, _arg5:Number=0, _arg6:Number=0):void{
removeGradient(_arg1);
var _local7:Shape = new Shape();
_local7.name = "_gradient";
_arg1.addChildAt(_local7, _arg2);
_local7.graphics.clear();
beginFill(_local7.graphics, _arg3, _arg1.width, _arg1.height);
GraphicsUtil.drawRoundRectangle(_local7.graphics, _arg5, _arg6, _arg1.width, _arg1.height, _arg4);
_local7.graphics.endFill();
}
private static function beginFill(_arg1:Graphics, _arg2:Array, _arg3:Number, _arg4:Number):void{
var _local5:Array = new Array();
var _local6:Number = 0;
while (_local6 < _arg2.length) {
_local5.push(0xFFFFFF);
_local6++;
};
beginLinearGradientFill(_arg1, _arg3, _arg4, _local5, _arg2);
}
public static function removeGradient(_arg1:DisplayObjectContainer):void{
var _local2:DisplayObject = _arg1.getChildByName("_gradient");
if (_local2){
_arg1.removeChild(_local2);
};
}
public static function drawRoundRectangle(_arg1:Graphics, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):void{
if (_arg6 > 0){
_arg1.drawRoundRect(_arg2, _arg3, _arg4, _arg5, _arg6, _arg6);
} else {
_arg1.drawRect(_arg2, _arg3, _arg4, _arg5);
};
}
public static function beginLinearGradientFill(_arg1:Graphics, _arg2:Number, _arg3:Number, _arg4:Array, _arg5:Array):void{
var _local6:Matrix = new Matrix();
_local6.createGradientBox(_arg2, _arg3, (Math.PI / 2));
var _local7:Array = new Array();
var _local8:int = (0xFF / (_arg4.length - 1));
var _local9:Number = 0;
while (_local9 < _arg4.length) {
_local7.push((_local9 * _local8));
_local9++;
};
_arg1.beginGradientFill(GradientType.LINEAR, _arg4, _arg5, _local7, _local6);
}
public static function beginGradientFill(_arg1:Graphics, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number=1):void{
var _local7:Array = [_arg4, _arg5, _arg4];
var _local8:Matrix = new Matrix();
_local8.createGradientBox(_arg2, _arg3, (Math.PI / 2));
_arg1.beginGradientFill(GradientType.LINEAR, _local7, [_arg6, _arg6, _arg6], [0, 128, 0xFF], _local8);
}
}
}//package org.flowplayer.util
Section 98
//Log (org.flowplayer.util.Log)
package org.flowplayer.util {
import flash.utils.*;
import org.osflash.thunderbolt.*;
public class Log {
private var _enabled:Boolean;// = true
private var _owner:String;
private static const LEVEL_WARN:int = 1;
private static const LEVEL_INFO:int = 2;
private static const LEVEL_ERROR:int = 3;
private static const LEVEL_SUPPRESS:int = 4;
private static const LEVEL_DEBUG:int = 0;
private static var _level:int = 3;
private static var _filter:String = "*";
private static var _instances:Array = new Array();
public function Log(_arg1:Object){
_owner = ((_arg1 is String)) ? (_arg1 as String) : getQualifiedClassName(_arg1);
_instances.push(this);
enable();
}
public function get enabled():Boolean{
return (_enabled);
}
private function enable():void{
_enabled = checkFilterEnables(_owner);
}
public function warn(_arg1:String=null, ... _args):void{
if (!_enabled){
return;
};
if (_level <= LEVEL_WARN){
write(Logger.warn, _arg1, _args);
};
}
public function set enabled(_arg1:Boolean):void{
_enabled = _arg1;
}
public function info(_arg1:String=null, ... _args):void{
if (!_enabled){
return;
};
if (_level <= LEVEL_INFO){
write(Logger.info, _arg1, _args);
};
}
public function error(_arg1:String=null, ... _args):void{
if (!_enabled){
return;
};
if (_level <= LEVEL_ERROR){
write(Logger.error, _arg1, _args);
};
}
private function checkFilterEnables(_arg1:String):Boolean{
var _local2:String;
if (_filter == "*"){
return (true);
};
var _local3:Array = _arg1.split(".");
var _local4:String = _local3[(_local3.length - 1)];
var _local5:int = _local4.indexOf("::");
if (_local5 > 0){
_local2 = _local4.substr((_local5 + 2));
_local3[(_local3.length - 1)] = _local4.substr(0, _local5);
};
var _local6 = "";
var _local7:Number = 0;
while (_local7 < _local3.length) {
_local6 = ((_local7 > 0)) ? ((_local6 + ".") + _local3[_local7]) : _local3[_local7];
if (_filter.indexOf((_local3[_local7] + ".*")) >= 0){
return (true);
};
_local7++;
};
var _local8 = (_filter.indexOf(((_local6 + ".") + _local2)) >= 0);
return (_local8);
}
public function debug(_arg1:String=null, ... _args):void{
if (!_enabled){
return;
};
if (_level <= LEVEL_DEBUG){
write(Logger.debug, _arg1, _args);
};
}
private function write(_arg1:Function, _arg2:String, _arg3:Array):void{
var writeFunc = _arg1;
var msg = _arg2;
var rest = _arg3;
try {
if (rest.length > 0){
writeFunc(((_owner + " : ") + msg), rest);
} else {
writeFunc(((_owner + " : ") + msg));
};
} catch(e:Error) {
trace(msg);
trace(e.message);
};
}
public static function configure(_arg1:LogConfiguration):void{
level = _arg1.level;
filter = _arg1.filter;
var _local2:Number = 0;
while (_local2 < _instances.length) {
Log(_instances[_local2]).enable();
_local2++;
};
}
public static function set level(_arg1:String):void{
if (_arg1 == "debug"){
_level = LEVEL_DEBUG;
} else {
if (_arg1 == "warn"){
_level = LEVEL_WARN;
} else {
if (_arg1 == "info"){
_level = LEVEL_INFO;
} else {
if (_arg1 == "suppress"){
_level = LEVEL_SUPPRESS;
} else {
_level = LEVEL_ERROR;
};
};
};
};
}
public static function set filter(_arg1:String):void{
_filter = _arg1;
}
}
}//package org.flowplayer.util
Section 99
//LogConfiguration (org.flowplayer.util.LogConfiguration)
package org.flowplayer.util {
public class LogConfiguration {
private var _level:String;// = "error"
private var _filter:String;// = "*"
public function set filter(_arg1:String):void{
_filter = _arg1;
}
public function get level():String{
return (_level);
}
public function set level(_arg1:String):void{
_level = _arg1;
}
public function get filter():String{
return (_filter);
}
}
}//package org.flowplayer.util
Section 100
//NumberUtil (org.flowplayer.util.NumberUtil)
package org.flowplayer.util {
public class NumberUtil {
public static function decodePercentage(_arg1:String):Number{
var _local2:Number = evaluate("pct", _arg1);
if (!isNaN(_local2)){
return (_local2);
};
return (evaluate("%", _arg1));
}
private static function evaluate(_arg1:String, _arg2:String):Number{
if (_arg2.indexOf(_arg1) <= 0){
return (NaN);
};
return (Number(_arg2.substring(0, _arg2.indexOf(_arg1))));
}
public static function decodeNonNumbers(_arg1:Number, _arg2:Number=0):Number{
if (isNaN(_arg1)){
return (_arg2);
};
return (_arg1);
}
public static function decodePixels(_arg1:String):Number{
if (_arg1.indexOf("px") < 0){
_arg1 = (_arg1 + "px");
};
var _local2:Number = evaluate("px", _arg1);
if (!isNaN(_local2)){
return (_local2);
};
_local2 = decodePercentage(_arg1);
if (!isNaN(_local2)){
return (NaN);
};
return ((_arg1.substr(0) as Number));
}
}
}//package org.flowplayer.util
Section 101
//ObjectConverter (org.flowplayer.util.ObjectConverter)
package org.flowplayer.util {
import flash.utils.*;
public class ObjectConverter {
private var _input:Object;
public function ObjectConverter(_arg1){
_input = _arg1;
}
private function convertObject(_arg1:Object):Object{
var value:Object;
var key:String;
var exposed:XMLList;
var v:XML;
var key2:String;
var o = _arg1;
var obj:Object = new Object();
var classInfo:XML = describeType(o);
if (classInfo.@name.toString() == "Object"){
for (key in o) {
value = o[key];
if (((!((value == null))) && (!((value is Function))))){
obj[key] = value;
};
};
} else {
exposed = classInfo.*.((hasOwnProperty("metadata")) && ((metadata.@name == "Value")));
for each (v in exposed) {
if (o[v.@name] != null){
key2 = ((v.metadata.arg.@key == "name")) ? v.metadata.arg.@value : v.@name.toString();
obj[key2] = process(o[v.@name]);
};
};
};
return (obj);
}
private function convertArray(_arg1:Array):Array{
var _local2:Array = new Array();
var _local3:int;
while (_local3 < _arg1.length) {
_local2.push(process(_arg1[_local3]));
_local3++;
};
return (_local2);
}
public function convert():Object{
return (process(_input));
}
private function process(_arg1):Object{
if ((_arg1 is String)){
return (_arg1);
};
if ((_arg1 is Number)){
return (_arg1);
};
if ((_arg1 is Boolean)){
return (_arg1);
};
if ((_arg1 is Array)){
return (convertArray((_arg1 as Array)));
};
if ((((_arg1 is Object)) && (!((_arg1 == null))))){
return (convertObject(_arg1));
};
return (_arg1);
}
}
}//package org.flowplayer.util
Section 102
//PropertyBinder (org.flowplayer.util.PropertyBinder)
package org.flowplayer.util {
import flash.utils.*;
public class PropertyBinder {
private var log:Log;
private var object:Object;
private var _extraProps:String;
public function PropertyBinder(_arg1:Object, _arg2:String=null){
log = new Log(this);
super();
log.info(("created for " + getQualifiedClassName(_arg1)));
this.object = _arg1;
_extraProps = _arg2;
}
public function copyProperties(_arg1:Object, _arg2:Boolean=true):Object{
var _local3:String;
if (!_arg1){
return (object);
};
log.debug((("copyProperties, overwrite = " + _arg2) + (_extraProps) ? (", extraprops will be set to " + _extraProps) : ""));
for (_local3 in _arg1) {
if (((_arg2) || (!(hasValue(object, _local3))))){
initProperty(_local3, object, _arg1[_local3]);
};
};
log.debug(("done with " + getQualifiedClassName(object)));
return (object);
}
private function hasValue(_arg1:Object, _arg2:String):Boolean{
if (objHasValue(_arg1, _arg2)){
return (true);
};
if (_extraProps){
return (objHasValue(_arg1[_extraProps], _arg2));
};
return (false);
}
private function configure(_arg1:Object, _arg2:String, _arg3:String, _arg4:Object):void{
var _local5:Object = ((_arg1[_arg2]) || (new Object()));
_local5[_arg3] = _arg4;
_arg1[_arg2] = _local5;
}
private function initProperty(_arg1:String, _arg2:Object, _arg3:Object):void{
var setter:String;
var prop = _arg1;
var objectToPopulate = _arg2;
var value = _arg3;
setter = (("set" + prop.charAt(0).toUpperCase()) + prop.substring(1));
try {
if (objectToPopulate[setter]){
log.debug(("initProperty with setter " + setter));
var _local5 = objectToPopulate;
_local5[setter](value);
};
log.debug((((("successfully initialized property '" + prop) + "' to value '") + value) + "'"));
return;
} catch(e:Error) {
log.debug(("unable to initialize using " + setter));
};
try {
log.debug((("trying to set property '" + prop) + "' directly"));
objectToPopulate[prop] = value;
log.debug((((("successfully initialized property '" + prop) + "' to value '") + value) + "'"));
return;
} catch(e:Error) {
log.debug("unable to set to field / using accessor");
};
if (_extraProps){
log.debug(((((("setting to extraprops " + _extraProps) + ", prop ") + prop) + " value ") + value));
configure(objectToPopulate, ((_extraProps) || ("customProperties")), prop, value);
} else {
log.debug(((("skipping property '" + prop) + "', value ") + value));
};
}
private function objHasValue(_arg1:Object, _arg2:String):Boolean{
var value:Object;
var obj = _arg1;
var prop = _arg2;
try {
value = obj[prop];
if ((value is Number)){
return ((value >= 0));
};
if ((value is Boolean)){
return (true);
};
return (value);
} catch(ignore:Error) {
};
try {
return (obj.hasValue(prop));
} catch(ignore:Error) {
};
return (false);
}
}
}//package org.flowplayer.util
Section 103
//TextUtil (org.flowplayer.util.TextUtil)
package org.flowplayer.util {
import flash.display.*;
import flash.text.*;
import flash.system.*;
public class TextUtil {
private static var log:Log = new Log("org.flowplayer.util::TextUtil");
public static function createTextField(_arg1:Boolean, _arg2:String=null, _arg3:int=12, _arg4:Boolean=false):TextField{
var _local5:TextField = new TextField();
_local5.blendMode = BlendMode.LAYER;
_local5.embedFonts = _arg1;
var _local6:TextFormat = new TextFormat();
if (_arg2){
log.debug(("Creating text field with font: " + _arg2));
_local6.font = _arg2;
_local5.antiAliasType = AntiAliasType.ADVANCED;
} else {
if (Capabilities.os.indexOf("Windows") == 0){
_local6.font = getFont(["Lucida Grande", "Lucida Sans Unicode", "Bitstream Vera", "Verdana", "Arial", "_sans", "_serif"]);
_local6.font = "_sans";
} else {
_local6.font = "Lucida Grande, Lucida Sans Unicode, Bitstream Vera, Verdana, Arial, _sans, _serif";
_local5.antiAliasType = AntiAliasType.ADVANCED;
};
};
_local6.size = _arg3;
_local6.bold = _arg4;
_local6.color = 0xFFFFFF;
_local5.defaultTextFormat = _local6;
return (_local5);
}
private static function getFont(_arg1:Array):String{
var _local4:Number;
var _local2:Array = Font.enumerateFonts(true);
var _local3:Number = 0;
while (_local3 < _arg1.length) {
_local4 = 0;
while (_local4 < _local2.length) {
if (_arg1[_local3] == Font(_local2[_local4]).fontName){
return (_arg1[_local3]);
};
_local4++;
};
_local3++;
};
return (null);
}
}
}//package org.flowplayer.util
Section 104
//URLUtil (org.flowplayer.util.URLUtil)
package org.flowplayer.util {
import flash.display.*;
import flash.external.*;
public class URLUtil {
public static function get pageUrl():String{
var href:String;
var endPos:int;
if (!ExternalInterface.available){
return (null);
};
try {
href = ExternalInterface.call("self.location.href.toString");
endPos = href.indexOf("?");
if (endPos < 0){
endPos = href.lastIndexOf("/");
};
return (href.substring(0, endPos));
} catch(e:Error) {
};
return (null);
}
public static function addBaseURL(_arg1:String, _arg2:String):String{
if (_arg2 == null){
return (null);
};
if (isCompleteURLWithProtocol(_arg2)){
return (_arg2);
};
if (_arg2.indexOf("/") == 0){
return (_arg2);
};
if ((((((_arg1 == "")) || ((_arg1 == null)))) || ((_arg1 == "null")))){
return (_arg2);
};
if (_arg1 != null){
if (_arg1.lastIndexOf("/") == (_arg1.length - 1)){
return ((_arg1 + _arg2));
};
return (((_arg1 + "/") + _arg2));
};
return (_arg2);
}
public static function completeURL(_arg1:String, _arg2:String):String{
return (addBaseURL(((_arg1) || (pageUrl)), _arg2));
}
public static function isCompleteURLWithProtocol(_arg1:String):Boolean{
if (!_arg1){
return (false);
};
return ((_arg1.indexOf("://") > 0));
}
public static function playerBaseUrl(_arg1:LoaderInfo):String{
var _local2:String = _arg1.url;
var _local3:Number = _local2.indexOf(".swf");
_local2 = _local2.substring(0, _local3);
var _local4:Number = _local2.lastIndexOf("/");
return (_local2.substring(0, _local4));
}
public static function localDomain(_arg1:String):Boolean{
if (_arg1.indexOf("http://localhost/") == 0){
return (true);
};
if (_arg1.indexOf("file://") == 0){
return (true);
};
if (_arg1.indexOf("http://127.0.0.1") == 0){
return (true);
};
if (_arg1.indexOf("http://") == 0){
return (false);
};
if (_arg1.indexOf("/") == 0){
return (true);
};
return (false);
}
}
}//package org.flowplayer.util
Section 105
//AbstractSprite (org.flowplayer.view.AbstractSprite)
package org.flowplayer.view {
import org.flowplayer.layout.*;
import flash.display.*;
import org.flowplayer.util.*;
import flash.geom.*;
public class AbstractSprite extends Sprite {
protected var log:Log;
protected var _height:Number;// = 0
protected var _width:Number;// = 0
public function AbstractSprite(){
log = new Log(this);
super();
}
public function setSize(_arg1:Number, _arg2:Number):void{
_width = _arg1;
_height = _arg2;
onResize();
}
public function draw(_arg1:LayoutEvent):void{
var _local2:Rectangle = _arg1.layout.getBounds(this);
setSize(_local2.width, _local2.height);
}
override public function set width(_arg1:Number):void{
setSize(_arg1, height);
}
override public function get width():Number{
return (((_width) || (super.width)));
}
override public function set height(_arg1:Number):void{
setSize(width, _arg1);
}
protected function get managedWidth():Number{
return (_width);
}
protected function onResize():void{
}
protected function get managedHeight():Number{
return (_height);
}
override public function get height():Number{
return (((_height) || (super.height)));
}
}
}//package org.flowplayer.view
Section 106
//Animation (org.flowplayer.view.Animation)
package org.flowplayer.view {
import flash.display.*;
import org.flowplayer.util.*;
import org.goasap.items.*;
public class Animation extends LinearGo {
private var _targetValue:Number;
protected var log:Log;
private var _startValue:Number;
private var _target:DisplayObject;
private var _canceled:Boolean;
private var _tweenProperty:String;
public function Animation(_arg1:DisplayObject, _arg2:String, _arg3:Number, _arg4:Number=500){
log = new Log(this);
super(0, (_arg4 / 1000));
_target = _arg1;
_targetValue = _arg3;
_tweenProperty = _arg2;
useRounding = true;
}
public function get canceled():Boolean{
return (_canceled);
}
public function get tweenProperty():String{
return (_tweenProperty);
}
override protected function onUpdate(_arg1:String):void{
var _local2:Number = (_startValue + ((_targetValue - _startValue) * _position));
_target[_tweenProperty] = ((_tweenProperty == "alpha")) ? _local2 : correctValue(_local2);
if (_target[_tweenProperty] == _targetValue){
log.debug(((((("completed for target " + target) + ", property ") + _tweenProperty) + ", target value was ") + _targetValue));
};
}
protected function startFrom(_arg1:Number):Boolean{
log.debug(("starting with start value " + _arg1));
_startValue = _arg1;
_target[_tweenProperty] = _arg1;
_change = (_targetValue - _startValue);
return (super.start());
}
override public function start():Boolean{
_startValue = _target[_tweenProperty];
log.debug(("starting with start value " + _startValue));
_change = (_targetValue - _startValue);
return (super.start());
}
public function cancel():Boolean{
_canceled = true;
return (stop());
}
override public function toString():String{
return (((((("[Animation] of property '" + _tweenProperty) + "', start ") + _startValue) + ", target ") + _targetValue));
}
protected function get target():DisplayObject{
return (_target);
}
}
}//package org.flowplayer.view
Section 107
//AnimationEngine (org.flowplayer.view.AnimationEngine)
package org.flowplayer.view {
import org.flowplayer.model.*;
import org.flowplayer.layout.*;
import flash.display.*;
import org.flowplayer.util.*;
import flash.utils.*;
import flash.geom.*;
import org.goasap.events.*;
import org.goasap.interfaces.*;
import org.goasap.utils.*;
public class AnimationEngine {
private var log:Log;
private var _panel:Panel;
private var _runningPlayablesByView:Dictionary;
private var _pluginRegistry:PluginRegistry;
private var _canceledByPlayable:Dictionary;
public function AnimationEngine(_arg1:Panel, _arg2:PluginRegistry){
log = new Log(this);
_runningPlayablesByView = new Dictionary();
_canceledByPlayable = new Dictionary();
super();
_panel = _arg1;
_pluginRegistry = _arg2;
}
public function animate(_arg1:DisplayObject, _arg2:Object, _arg3:int=400, _arg4:Function=null):DisplayProperties{
var _local7:DisplayProperties;
var _local5:DisplayProperties = _pluginRegistry.getPluginByDisplay(_arg1);
var _local6 = !((_local5 == null));
if (_local6){
log.debug(("animating plugin " + _local5));
} else {
log.debug(("animating non-plugin displayObject " + _arg1));
};
if (_local6){
log.debug(("current dimensions " + _local5.dimensions));
_local7 = ((_arg2 is DisplayProperties)) ? (_arg2 as DisplayProperties) : LengthMath.sum(_local5, _arg2, _panel.stage);
_arg1.visible = _local7.visible;
if (_arg1.visible){
panelAnimate(_local5.getDisplayObject(), _local7, _arg3, _arg4);
} else {
_panel.removeView(_arg1);
};
_pluginRegistry.updateDisplayProperties(_local7);
} else {
startTweens(_arg1, _arg2.alpha, _arg2.width, _arg2.height, _arg2.x, _arg2.y, _arg3, _arg4);
};
return (_local7);
}
private function createTween(_arg1:String, _arg2:DisplayObject, _arg3:Number, _arg4:int):Animation{
if (isNaN(_arg3)){
return (null);
};
if (_arg2[_arg1] == _arg3){
log.debug((((("view property " + _arg1) + " already in target value ") + _arg3) + ", will not animate"));
return (null);
};
log.debug(((((("creating tween for property " + _arg1) + ", target value is ") + _arg3) + ", current value is ") + _arg2[_arg1]));
return (new Animation(_arg2, _arg1, _arg3, _arg4));
}
public function cancel(_arg1:DisplayObject, _arg2:Animation=null):void{
var _local3:Object;
var _local4:DisplayObject;
var _local5:Animation;
log.debug("cancel");
for (_local3 in _runningPlayablesByView) {
_local4 = (_local3 as DisplayObject);
if (_local4 == _arg1){
_local5 = (_runningPlayablesByView[_local4] as Animation);
if (((((_local5) && (_arg2))) && (!((_local5 == _arg2))))){
if (_arg2.tweenProperty == _local5.tweenProperty){
log.info(((("tween for property " + _local5.tweenProperty) + " was canceled on view ") + _arg1));
_canceledByPlayable[_local5] = true;
_local5.stop();
};
};
};
};
}
private function animateAlpha(_arg1:DisplayObject, _arg2:Number, _arg3:Number=500, _arg4:Function=null, _arg5:Boolean=true):Animation{
var playable:Animation;
var view = _arg1;
var target = _arg2;
var durationMillis = _arg3;
var callback = _arg4;
var updatePanel = _arg5;
Assert.notNull(view, "animateAlpha: view cannot be null");
playable = createTween("alpha", view, target, durationMillis);
if (!playable){
if (callback != null){
callback();
};
return (null);
};
cancel(view, playable);
var plugin:DisplayProperties = _pluginRegistry.getPluginByDisplay(view);
if (((updatePanel) && (plugin))){
log.debug("animateAlpha(): will add/remove from panel");
if (target == 0){
playable.addEventListener(GoEvent.COMPLETE, function (_arg1:GoEvent):void{
if (!_canceledByPlayable[playable]){
log.debug((("removing " + view) + " from panel"));
_panel.removeView(view);
} else {
log.info((("previous fadeout was canceled, will not remove " + view) + " from panel"));
};
});
} else {
if (view.parent != _panel){
_panel.addView(view);
};
};
} else {
log.debug("animateAlpha, view is not added/removed from panel");
};
var tween:Animation = (start(view, playable, callback) as Animation);
if (tween){
_pluginRegistry.updateDisplayPropertiesForDisplay(view, {alpha:target, display:((target == 0)) ? "none" : "block"});
};
return (tween);
}
public function animateProperty(_arg1:DisplayObject, _arg2:String, _arg3:Number, _arg4:int=500, _arg5:Function=null):void{
var _local6:Object = new Object();
_local6[_arg2] = _arg3;
animate(_arg1, _local6, _arg4, _arg5);
}
public function fadeIn(_arg1:DisplayObject, _arg2:Number=500, _arg3:Function=null, _arg4:Boolean=true):Animation{
return (animateAlpha(_arg1, 1, _arg2, _arg3, _arg4));
}
private function startTweens(_arg1:DisplayObject, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:int, _arg8:Function):Array{
var _local9:Array = new Array();
var _local10:Animation = createTween("alpha", _arg1, _arg2, _arg7);
if (_local10){
cancel(_arg1, _local10);
addTween(_local9, _local10);
};
addTween(_local9, createTween("width", _arg1, _arg3, _arg7));
addTween(_local9, createTween("height", _arg1, _arg4, _arg7));
addTween(_local9, createTween("x", _arg1, _arg5, _arg7));
addTween(_local9, createTween("y", _arg1, _arg6, _arg7));
if (_local9.length == 0){
if (_arg8 != null){
_arg8();
};
return (_local9);
};
var _local11:IPlayable = ((_local9.length > 1)) ? new PlayableGroup(_local9) : _local9[0];
start(_arg1, _local11, _arg8);
return (_local9);
}
public function fadeOut(_arg1:DisplayObject, _arg2:Number=500, _arg3:Function=null, _arg4:Boolean=true):Animation{
return (animateAlpha(_arg1, 0, _arg2, _arg3, _arg4));
}
private function panelAnimate(_arg1:DisplayObject, _arg2:DisplayProperties, _arg3:int=500, _arg4:Function=null):void{
Assert.notNull(_arg2.name, "displayProperties.name must be specified");
log.debug(("animate " + _arg1));
if (_arg1.parent != _panel){
_panel.addView(_arg1);
};
var _local5:Rectangle = _panel.update(_arg1, _arg2);
startTweens(_arg1, _arg2.alpha, _local5.width, _local5.height, _local5.x, _local5.y, _arg3, _arg4);
if (_arg3 == 0){
if (_arg2.alpha >= 0){
_arg1.alpha = _arg2.alpha;
};
_panel.draw(_arg1);
};
}
public function fadeTo(_arg1:DisplayObject, _arg2:Number, _arg3:Number=500, _arg4:Function=null, _arg5:Boolean=true):Animation{
return (animateAlpha(_arg1, _arg2, _arg3, _arg4, _arg5));
}
private function onComplete(_arg1:DisplayObject, _arg2:IPlayable, _arg3:Function=null):void{
if (((!((_arg3 == null))) && (!(_canceledByPlayable[_arg2])))){
_arg3();
};
delete _canceledByPlayable[_arg2];
delete _runningPlayablesByView[_arg1];
}
private function addTween(_arg1:Array, _arg2:IPlayable):void{
if (!_arg2){
return;
};
log.debug(("will animate " + _arg2));
_arg1.push(_arg2);
}
private function start(_arg1:DisplayObject, _arg2:IPlayable, _arg3:Function=null):IPlayable{
var view = _arg1;
var playable = _arg2;
var callback = _arg3;
if (playable == null){
return (null);
};
_runningPlayablesByView[view] = playable;
log.debug(("staring animation " + playable));
playable.addEventListener(GoEvent.COMPLETE, function (_arg1:GoEvent):void{
onComplete(view, playable, callback);
});
playable.start();
return (playable);
}
}
}//package org.flowplayer.view
Section 108
//BufferAnimation (org.flowplayer.view.BufferAnimation)
package org.flowplayer.view {
import flash.display.*;
public dynamic class BufferAnimation extends MovieClip {
}
}//package org.flowplayer.view
Section 109
//CanvasLogo (org.flowplayer.view.CanvasLogo)
package org.flowplayer.view {
import flash.display.*;
public dynamic class CanvasLogo extends Sprite {
}
}//package org.flowplayer.view
Section 110
//ClipResizer (org.flowplayer.view.ClipResizer)
package org.flowplayer.view {
import org.flowplayer.model.*;
import org.flowplayer.view.*;
import org.flowplayer.util.*;
import flash.utils.*;
class ClipResizer {
private var log:Log;
private var screen:Screen;
private var resizers:Dictionary;
function ClipResizer(_arg1:Playlist, _arg2:Screen){
log = new Log(this);
super();
this.screen = _arg2;
createResizers(_arg1.clips);
addListeners(_arg1);
}
public function setMaxSize(_arg1:int, _arg2:int):void{
var _local3:MediaResizer;
for each (_local3 in resizers) {
_local3.setMaxSize(_arg1, _arg2);
};
}
private function error(_arg1:String):void{
log.error(_arg1);
throw (new Error(_arg1));
}
public function resizeClip(_arg1:Clip, _arg2:Boolean=false):void{
resizeClipTo(_arg1, _arg1.scaling, _arg2);
}
private function createResizers(_arg1:Array):void{
var clips = _arg1;
resizers = new Dictionary();
clips.forEach(function (_arg1:Clip, _arg2:int, _arg3:Array):void{
log.debug(("creating resizer for clip " + _arg1));
resizers[_arg1] = new MediaResizer(_arg1, screen.width, screen.height);
});
}
private function onPlaylistReplace(_arg1:ClipEvent):void{
log.info("Received onPlaylistChanged");
createResizers(ClipEventSupport(_arg1.target).clips);
}
private function onResize(_arg1:ClipEvent):void{
log.debug(("received event " + _arg1.target));
if ((((Clip(_arg1.target).type == ClipType.IMAGE)) && ((Clip(_arg1.target).getContent() == null)))){
log.warn(("image content not available yet, will not resize: " + _arg1.target));
return;
};
resizeClip((_arg1.target as Clip));
}
private function addListeners(_arg1:ClipEventSupport):void{
_arg1.onStart(onResize);
_arg1.onBufferFull(onResize);
_arg1.onPlaylistReplace(onPlaylistReplace);
}
public function resizeClipTo(_arg1:Clip, _arg2:MediaSize, _arg3:Boolean=false):void{
log.debug(("resizeClipTo, clip " + _arg1));
var _local4:MediaResizer = resizers[_arg1];
if (!_local4){
log.warn(("no resizer defined for " + _arg1));
return;
};
if (_local4.resizeTo(_arg2, _arg3)){
screen.resized(_arg1);
};
}
}
}//package org.flowplayer.view
Section 111
//ContextMenuBuilder (org.flowplayer.view.ContextMenuBuilder)
package org.flowplayer.view {
import flash.events.*;
import org.flowplayer.util.*;
import org.flowplayer.config.*;
import flash.net.*;
import flash.ui.*;
public class ContextMenuBuilder {
private var _menuItems:Array;
private var _playerId:String;
private var log:Log;
public function ContextMenuBuilder(_arg1:String, _arg2:Array){
log = new Log(this);
super();
_playerId = _arg1;
_menuItems = _arg2;
}
private function createMenu():ContextMenu{
var _local1:ContextMenu = new ContextMenu();
_local1.hideBuiltInItems();
return (_local1);
}
private function addItem(_arg1:ContextMenu, _arg2:ContextMenuItem, _arg3:Function=null):void{
_arg1.customItems.push(_arg2);
if (_arg3 != null){
_arg2.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, _arg3);
};
}
private function buildMenu(_arg1:ContextMenu):ContextMenu{
var menu = _arg1;
addItem(menu, new ContextMenuItem("About Flowplayer...", false, true), function (_arg1:ContextMenuEvent):void{
navigateToURL(new URLRequest("http://flowplayer.org"), "_self");
});
addItem(menu, new ContextMenuItem(VersionInfo.versionInfo(), true, false));
return (menu);
}
public function build():ContextMenu{
return (buildMenu(createMenu()));
}
}
}//package org.flowplayer.view
Section 112
//ErrorHandler (org.flowplayer.view.ErrorHandler)
package org.flowplayer.view {
import org.flowplayer.model.*;
public interface ErrorHandler {
function handleError(_arg1:PlayerError, _arg2:Object=null, _arg3:Boolean=true):void;
function showError(_arg1:String):void;
}
}//package org.flowplayer.view
Section 113
//Flowplayer (org.flowplayer.view.Flowplayer)
package org.flowplayer.view {
import org.flowplayer.model.*;
import org.flowplayer.controller.*;
import flash.display.*;
import org.flowplayer.util.*;
import org.flowplayer.config.*;
import flash.external.*;
public class Flowplayer extends FlowplayerBase {
private var _canvas:StyleableSprite;
public function Flowplayer(_arg1:Stage, _arg2:PlayListController, _arg3:PluginRegistry, _arg4:Panel, _arg5:AnimationEngine, _arg6:StyleableSprite, _arg7:ErrorHandler, _arg8:Config, _arg9:FullscreenManager, _arg10:PluginLoader, _arg11:String){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg7, _arg8, _arg9, _arg10, _arg11);
_canvas = _arg6;
}
private function updateClip(_arg1:Object, _arg2:int):void{
var _local3:Clip = _playListController.playlist.getClip(_arg2);
new PropertyBinder(_local3, "customProperties").copyProperties(_arg1);
_local3.dispatch(ClipEventType.UPDATE);
}
private function animate(_arg1:String, _arg2:Object, _arg3:Number=400, _arg4:String=null):Object{
return (style(_arg1, _arg2, true, _arg3, _arg4));
}
private function css(_arg1:String, _arg2:Object=null):Object{
log.debug(("css, plugin " + _arg1));
if (_arg1 == "canvas"){
_canvas.css(_arg2);
return (_arg2);
};
return (style(_arg1, _arg2, false, 0));
}
private function createCallback(_arg1:String, _arg2:Object=null):Function{
var listenerId = _arg1;
var pluginArg = _arg2;
if (!listenerId){
return (null);
};
return (function (_arg1:PluginModel=null):void{
if (((_arg1) || ((pluginArg is PluginModel)))){
PluginModel(((pluginArg) || (_arg1))).dispatch(PluginEventType.PLUGIN_EVENT, listenerId);
} else {
new PluginEvent(PluginEventType.PLUGIN_EVENT, ((pluginArg is DisplayProperties)) ? DisplayProperties(pluginArg).name : pluginArg.toString(), listenerId).fireExternal(_playerId);
};
});
}
private function fadeTo(_arg1:String, _arg2:Number, _arg3:Number=400, _arg4:String=null):void{
var _local5:DisplayProperties = prepareFade(_arg1, true);
_animationEngine.fadeTo(_local5.getDisplayObject(), _arg2, _arg3, createCallback(_arg4, _local5));
}
private function pluginToggle(_arg1:String, _arg2:Object=null):Boolean{
return ((pluginPanelOp(togglePlugin, _arg1, _arg2) as Boolean));
}
private function fadeIn(_arg1:String, _arg2:Number=400, _arg3:String=null):void{
var _local4:DisplayProperties = prepareFade(_arg1, true);
_animationEngine.fadeIn(_local4.getDisplayObject(), _arg2, createCallback(_arg3, _local4));
}
private function fadeOut(_arg1:String, _arg2:Number=400, _arg3:String=null):void{
var _local4:DisplayProperties = prepareFade(_arg1, false);
_animationEngine.fadeOut(_local4.getDisplayObject(), _arg2, createCallback(_arg3, _local4));
}
private function genericPlay(_arg1:Object=null):void{
if (_arg1 == null){
play();
return;
};
if ((_arg1 is Number)){
_playListController.play(null, (_arg1 as Number));
return;
};
if ((_arg1 is Array)){
_playListController.playClips(_config.createClips((_arg1 as Array)));
return;
};
var _local2:Clip = _config.createClip(_arg1);
if (!_local2){
showError((("cannot convert " + _arg1) + " to a clip"));
return;
};
play(_local2);
}
private function genericSeek(_arg1:Object):void{
var _local2:Number = ((_arg1 is String)) ? NumberUtil.decodePercentage((_arg1 as String)) : NaN;
if (isNaN(_local2)){
seek(((_arg1 is String)) ? parseInt((_arg1 as String)) : (_arg1 as Number));
} else {
seekRelative(_local2);
};
}
private function pluginShow(_arg1:String, _arg2:Object=null):void{
pluginPanelOp(showPlugin, _arg1, _arg2);
}
private function style(_arg1:String, _arg2:Object, _arg3:Boolean, _arg4:Number=400, _arg5:String=null):Object{
var _local8:Object;
var _local9:String;
var _local6:Object = _pluginRegistry.getPlugin(_arg1);
checkPlugin(_local6, _arg1, DisplayPluginModel);
log.debug(("going to animate plugin " + _arg1));
var _local7:Object = convert((_arg2) ? _animationEngine.animate(DisplayProperties(_local6).getDisplayObject(), collectDisplayProps(_arg2, _arg3), _arg4, createCallback(_arg5, _local6)) : _local6);
if ((((_local6 is DisplayProperties)) && ((DisplayProperties(_local6).getDisplayObject() is Styleable)))){
_local8 = Styleable(DisplayProperties(_local6).getDisplayObject())[(_arg3) ? "animate" : "css"](_arg2);
for (_local9 in _local8) {
_local7[_local9] = _local8[_local9];
};
};
return (_local7);
}
private function pluginPanelOp(_arg1:Function, _arg2:String, _arg3:Object=null):Object{
var _local4:Object = _pluginRegistry.getPlugin(_arg2);
checkPlugin(_local4, _arg2, DisplayProperties);
return (_arg1(DisplayProperties(_local4).getDisplayObject(), ((_arg3) ? new PropertyBinder(new DisplayPropertiesImpl(), null).copyProperties(_arg3) : _local4 as DisplayProperties)));
}
private function setPlaylist(_arg1:Array):void{
_playListController.setPlaylist(_arg1);
var _local2:Clip = _playListController.playlist.current;
}
private function pluginHide(_arg1:String):void{
var _local2:Object = _pluginRegistry.getPlugin(_arg1);
checkPlugin(_local2, _arg1, DisplayProperties);
hidePlugin(DisplayProperties(_local2).getDisplayObject());
}
private function collectDisplayProps(_arg1:Object, _arg2:Boolean):Object{
var _local5:String;
var _local3:Object = new Object();
var _local4:Array = ["width", "height", "left", "top", "bottom", "right", "opacity"];
if (!_arg2){
_local4 = _local4.concat("display", "zIndex");
};
for (_local5 in _arg1) {
if (_local4.indexOf(_local5) >= 0){
_local3[_local5] = _arg1[_local5];
};
};
return (_local3);
}
private function pluginLoad(_arg1:String, _arg2:String, _arg3:Object=null, _arg4:String=null):void{
var _local5:Loadable = new Loadable(_arg1, _config, _arg2);
if (_arg3){
new PropertyBinder(_local5, "config").copyProperties(_arg3);
};
loadPluginLoadable(_local5, ((_arg4)!=null) ? createCallback(_arg4) : null);
}
private function convert(_arg1:Object):Object{
return (new ObjectConverter(_arg1).convert());
}
private function prepareFade(_arg1:String, _arg2:Boolean):DisplayProperties{
var _local4:DisplayProperties;
var _local3:Object = _pluginRegistry.getPlugin(_arg1);
checkPlugin(_local3, _arg1, DisplayProperties);
if (_arg2){
_local4 = (_local3 as DisplayProperties);
if (((!(_local4.getDisplayObject().parent)) || (!((_local4.getDisplayObject().parent == _panel))))){
_local4.alpha = 0;
};
showPlugin(_local4.getDisplayObject(), _local4);
};
return ((_local3 as DisplayProperties));
}
private function addCuepoints(_arg1:Array, _arg2:int, _arg3:String):void{
var _local4:Clip = _playListController.playlist.getClip(_arg2);
var _local5:Array = _config.createCuepoints(_arg1, _arg3, 1);
if (((!(_local5)) || ((_local5.length == 0)))){
showError(("unable to create cuepoints from " + _arg1));
};
_local4.addCuepoints(_local5);
log.debug(("clip has now cuepoints " + _local4.cuepoints));
}
public function initExternalInterface():void{
var wrapper:WrapperForIE;
if (!ExternalInterface.available){
log.info("ExternalInteface is not available in this runtime. JavaScript access will be disabled.");
};
try {
addCallback("getVersion", function ():Array{
return (version);
});
addCallback("getPlaylist", function ():Array{
return ((convert(playlist.clips) as Array));
});
addCallback("getId", function ():String{
return (id);
});
addCallback("play", genericPlay);
addCallback("startBuffering", function ():void{
startBuffering();
});
addCallback("stopBuffering", function ():void{
stopBuffering();
});
addCallback("isFullscreen", isFullscreen);
addCallback("toggle", toggle);
addCallback("getState", function ():Number{
return (state.code);
});
addCallback("getStatus", function ():Object{
return (convert(status));
});
addCallback("isPlaying", isPlaying);
addCallback("isPaused", isPaused);
wrapper = new WrapperForIE(this);
addCallback("stop", wrapper.fp_stop);
addCallback("pause", wrapper.fp_pause);
addCallback("resume", wrapper.fp_resume);
addCallback("close", wrapper.fp_close);
addCallback("getTime", function ():Number{
return (status.time);
});
addCallback("mute", function ():void{
muted = true;
});
addCallback("unmute", function ():void{
muted = false;
});
addCallback("isMuted", function ():Boolean{
return (muted);
});
addCallback("setVolume", function (_arg1:Number):void{
volume = _arg1;
});
addCallback("getVolume", function ():Number{
return (volume);
});
addCallback("seek", genericSeek);
addCallback("getCurrentClip", function ():Object{
return (new ObjectConverter(currentClip).convert());
});
addCallback("getClip", function (_arg1:Number):Object{
return (convert(playlist.getClip(_arg1)));
});
addCallback("setPlaylist", function (_arg1:Array):void{
setPlaylist(_config.createClips(_arg1));
});
addCallback("showError", showError);
addCallback("loadPlugin", pluginLoad);
addCallback("showPlugin", pluginShow);
addCallback("hidePlugin", pluginHide);
addCallback("togglePlugin", pluginToggle);
addCallback("animate", animate);
addCallback("css", css);
addCallback("reset", reset);
addCallback("fadeIn", fadeIn);
addCallback("fadeOut", fadeOut);
addCallback("fadeTo", fadeTo);
addCallback("getPlugin", function (_arg1:String):Object{
return (new ObjectConverter(_pluginRegistry.getPlugin(_arg1)).convert());
});
addCallback("getRawPlugin", function (_arg1:String):Object{
return (_pluginRegistry.getPlugin(_arg1));
});
addCallback("invoke", invoke);
addCallback("addCuepoints", addCuepoints);
addCallback("updateClip", updateClip);
addCallback("logging", logging);
} catch(e:Error) {
handleError(PlayerError.INIT_FAILED, "Unable to add callback to ExternalInterface");
};
}
private function invoke(_arg1:String, _arg2:String, _arg3:Object=null):Object{
var pluginName = _arg1;
var methodName = _arg2;
var args = _arg3;
var plugin:Callable = (_pluginRegistry.getPlugin(pluginName) as Callable);
checkPlugin(plugin, pluginName, Callable);
try {
log.debug("invoke()");
if (plugin.getMethod(methodName).hasReturnValue){
log.debug("method has a return value");
return (plugin.invokeMethod(methodName, ((args is Array)) ? (args as Array) : [args]));
} else {
log.debug("method does not have a return value");
plugin.invokeMethod(methodName, ((args is Array)) ? (args as Array) : [args]);
};
} catch(e:Error) {
handleError(PlayerError.PLUGIN_INVOKE_FAILED, (((("Error when invoking method '" + methodName) + "', on plugin '") + pluginName) + "'"));
};
return ("undefined");
}
private static function addCallback(_arg1:String, _arg2:Function):void{
ExternalInterfaceHelper.addCallback(("fp_" + _arg1), _arg2);
}
}
}//package org.flowplayer.view
Section 114
//FlowplayerBase (org.flowplayer.view.FlowplayerBase)
package org.flowplayer.view {
import org.flowplayer.model.*;
import org.flowplayer.controller.*;
import flash.display.*;
import org.flowplayer.util.*;
import flash.text.*;
import flash.utils.*;
import org.flowplayer.config.*;
public class FlowplayerBase extends PlayerEventDispatcher implements ErrorHandler {
private var _errorHandler:ErrorHandler;
protected var _panel:Panel;
private var _stage:Stage;
private var _pluginLoader:PluginLoader;
private var _playerSWFBaseURL:String;
protected var _animationEngine:AnimationEngine;
protected var _pluginRegistry:PluginRegistry;
protected var _playListController:PlayListController;
protected var _config:Config;
private var _fullscreenManager:FullscreenManager;
private static var _instance:FlowplayerBase = null;
public function FlowplayerBase(_arg1:Stage, _arg2:PlayListController, _arg3:PluginRegistry, _arg4:Panel, _arg5:AnimationEngine, _arg6:ErrorHandler, _arg7:Config, _arg8:FullscreenManager, _arg9:PluginLoader, _arg10:String){
var _local11:Plugin;
var _local12:PluginFactory;
var _local13:FlowStyleSheet;
var _local14:StyleableSprite;
var _local15:Animation;
super();
Assert.notNull(1);
URLUtil.isCompleteURLWithProtocol("foo");
if (_instance){
log.error("Flowplayer already instantiated");
throw (new Error("Flowplayer already instantiated"));
};
_stage = _arg1;
this._playListController = _arg2;
_pluginRegistry = _arg3;
_panel = _arg4;
_animationEngine = _arg5;
_errorHandler = _arg6;
_config = _arg7;
_fullscreenManager = _arg8;
_arg8.playerEventDispatcher = this;
_pluginLoader = _arg9;
_playerSWFBaseURL = _arg10;
_instance = this;
}
public function get fonts():Array{
return (_pluginRegistry.fonts);
}
public function seek(_arg1:Number):FlowplayerBase{
log.debug((("seek to " + _arg1) + " seconds"));
_playListController.seekTo(_arg1);
return (this);
}
public function stop():FlowplayerBase{
log.debug("stop()");
_playListController.stop();
return (this);
}
public function showPlugin(_arg1:DisplayObject, _arg2:DisplayProperties=null):void{
_arg1.alpha = (_arg2) ? _arg2.alpha : 1;
_arg1.visible = true;
_arg2.display = "block";
if (_arg2.zIndex == -1){
_arg2.zIndex = newPluginZIndex;
};
log.debug(("showPlugin, zIndex is " + _arg2.zIndex));
_panel.addView(_arg1, null, _arg2);
_pluginRegistry.updateDisplayProperties(_arg2);
}
public function showError(_arg1:String):void{
_errorHandler.showError(_arg1);
}
public function isFullscreen():Boolean{
return (_fullscreenManager.isFullscreen);
}
public function hidePlugin(_arg1:DisplayObject):void{
_panel.removeView(_arg1);
var _local2:DisplayProperties = _pluginRegistry.getPluginByDisplay(_arg1);
if (_local2){
_local2.display = "none";
_pluginRegistry.updateDisplayProperties(_local2);
};
}
public function get pluginRegistry():PluginRegistry{
return (_pluginRegistry);
}
public function get state():State{
return (_playListController.getState());
}
protected function loadPluginLoadable(_arg1:Loadable, _arg2:Function=null):void{
var loadable = _arg1;
var callback = _arg2;
var loaderCallback:Function = function ():void{
var _local1:DisplayPluginModel;
log.debug("plugin loaded");
_pluginRegistry.setPlayerToPlugin(loadable.plugin);
if ((loadable.plugin is DisplayPluginModel)){
_local1 = (loadable.plugin as DisplayPluginModel);
if (_local1.visible){
log.debug("adding plugin to panel");
if (_local1.zIndex < 0){
_local1.zIndex = newPluginZIndex;
};
_panel.addView(_local1.getDisplayObject(), null, _local1);
};
} else {
if ((loadable.plugin is ProviderModel)){
_playListController.addProvider((loadable.plugin as ProviderModel));
};
};
if (callback != null){
callback(loadable.plugin);
};
};
_pluginLoader.loadPlugin(loadable, loaderCallback);
}
public function get id():String{
return (_config.playerId);
}
public function get volume():Number{
log.debug("get volume");
return (_playListController.volume);
}
public function isPlaying():Boolean{
return ((((state == State.PLAYING)) || ((state == State.BUFFERING))));
}
public function resume():FlowplayerBase{
log.debug("resume()");
_playListController.resume();
return (this);
}
public function togglePlugin(_arg1:DisplayObject, _arg2:DisplayProperties=null):Boolean{
if (_arg1.parent == _panel){
hidePlugin(_arg1);
return (false);
};
showPlugin(_arg1, _arg2);
return (true);
}
public function toggleFullscreen():FlowplayerBase{
log.debug("toggleFullscreen");
if (dispatchBeforeEvent(PlayerEvent.fullscreen())){
_fullscreenManager.toggleFullscreen();
};
return (this);
}
public function createTextField(_arg1:int=12, _arg2:Boolean=false):TextField{
if (((fonts) && ((fonts.length > 0)))){
return (TextUtil.createTextField(true, fonts[0], _arg1, _arg2));
};
return (TextUtil.createTextField(false, null, _arg1, _arg2));
}
public function set volume(_arg1:Number):void{
_playListController.volume = _arg1;
}
public function loadPlugin(_arg1:String, _arg2:String, _arg3:Function):void{
loadPluginLoadable(new Loadable(_arg1, _config, _arg2), _arg3);
}
public function play(_arg1:Clip=null):FlowplayerBase{
log.debug((("play(" + _arg1) + ")"));
_playListController.play(_arg1);
return (this);
}
public function createLoader():ResourceLoader{
return (new ResourceLoaderImpl((_config.playerId) ? null : _playerSWFBaseURL, this));
}
public function stopBuffering():FlowplayerBase{
log.debug("stopBuffering()");
_playListController.stopBuffering();
return (this);
}
public function handleError(_arg1:PlayerError, _arg2:Object=null, _arg3:Boolean=true):void{
_errorHandler.handleError(_arg1, _arg2);
}
public function get config():Config{
return (_config);
}
private function get newPluginZIndex():Number{
var _local1:DisplayProperties = (_pluginRegistry.getPlugin("play") as DisplayProperties);
if (!_local1){
return (100);
};
return (_local1.zIndex);
}
public function get playlist():Playlist{
return (_playListController.playlist);
}
public function toggle():Boolean{
if (state == State.PAUSED){
resume();
return (true);
};
if (state == State.PLAYING){
pause();
return (false);
};
if (state == State.WAITING){
play();
return (true);
};
return (false);
}
public function set muted(_arg1:Boolean):void{
_playListController.muted = _arg1;
}
public function get version():Array{
var _local1:Class = Class(getDefinitionByName("org.flowplayer.config.VersionInfo"));
return (_local1.version);
}
protected function checkPlugin(_arg1:Object, _arg2:String, _arg3:Class=null):void{
if (!_arg1){
showError((("There is no plugin called '" + _arg2) + "'"));
return;
};
if (((_arg3) && ((!(_arg1) is _arg3)))){
showError(((("Specifiec plugin '" + _arg2) + "' is not an instance of ") + _arg3));
};
}
public function logging(_arg1:String, _arg2:String="*"):void{
var _local3:LogConfiguration = new LogConfiguration();
_local3.level = _arg1;
_local3.filter = _arg2;
Log.configure(_local3);
}
public function startBuffering():FlowplayerBase{
log.debug("startBuffering()");
_playListController.startBuffering();
return (this);
}
private function resetPlugin(_arg1:String, _arg2:Number=500):void{
var _local3:DisplayProperties = (_pluginRegistry.getOriginalProperties(_arg1) as DisplayProperties);
if (_local3){
_animationEngine.animate(_local3.getDisplayObject(), _local3, _arg2);
};
}
public function seekRelative(_arg1:Number):FlowplayerBase{
log.debug(((("seekRelative " + _arg1) + "%, clip is ") + playlist.current));
seek((playlist.current.duration * (_arg1 / 100)));
return (this);
}
public function reset(_arg1:Array=null, _arg2:Number=500):void{
if (!_arg1){
_arg1 = ["controls", "screen"];
};
var _local3:Number = 0;
while (_local3 < _arg1.length) {
resetPlugin(_arg1[_local3], _arg2);
_local3++;
};
}
public function get currentClip():Clip{
return (playlist.current);
}
public function get muted():Boolean{
return (_playListController.muted);
}
public function get animationEngine():AnimationEngine{
return (_animationEngine);
}
public function get status():Status{
return (_playListController.status);
}
public function next():Clip{
log.debug("next()");
return (_playListController.next(false));
}
public function pause():FlowplayerBase{
log.debug("pause()");
_playListController.pause();
return (this);
}
public function previous():Clip{
log.debug("previous()");
return (_playListController.previous());
}
public function isPaused():Boolean{
return ((state == State.PAUSED));
}
public function close():FlowplayerBase{
log.debug("close()");
_playListController.close();
return (this);
}
}
}//package org.flowplayer.view
Section 115
//FlowplayerLogo (org.flowplayer.view.FlowplayerLogo)
package org.flowplayer.view {
import flash.display.*;
public dynamic class FlowplayerLogo extends Sprite {
}
}//package org.flowplayer.view
Section 116
//FlowStyleSheet (org.flowplayer.view.FlowStyleSheet)
package org.flowplayer.view {
import org.flowplayer.layout.*;
import org.flowplayer.util.*;
import flash.text.*;
public class FlowStyleSheet {
private var log:Log;
private var _styleSheet:StyleSheet;
private var _styleName:String;
static const ROOT_STYLE_PROPS:Array = ["padding", "backgroundColor", "backgroundGradient", "border", "borderColor", "borderRadius", "borderWidth", "backgroundImage", "backgroundRepeat", "background"];
public function FlowStyleSheet(_arg1:String, _arg2:String=null){
log = new Log(this);
super();
_styleName = _arg1;
_styleSheet = new StyleSheet();
if (_arg2){
parseCSS(_arg2);
};
}
public function get borderWidth():Number{
if (hasProperty("borderWidth")){
return (NumberUtil.decodePixels(rootStyle["borderWidth"]));
};
if (!hasProperty("border")){
return (1);
};
return (NumberUtil.decodePixels(parseShorthand("border")[0]));
}
public function get backgroundGradient():Array{
if (!hasProperty("backgroundGradient")){
return (null);
};
if ((rootStyle["backgroundGradient"] is String)){
return (decodeGradient((rootStyle["backgroundGradient"] as String)));
};
return (rootStyle["backgroundGradient"]);
}
public function addStyleRules(_arg1:String, _arg2:Object):void{
var _local4:String;
var _local3:Object = _styleSheet.getStyle(_arg1);
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
_styleSheet.setStyle(_arg1, null);
_styleSheet.setStyle(_arg1, _local3);
}
public function get backgroundTransparent():Boolean{
if (!hasProperty("backgroundColor")){
return (false);
};
return ((rootStyle["backgroundColor"] == "transparent"));
}
private function colorValue(_arg1:String):uint{
if (!_arg1){
return (0xFFFFFF);
};
return (parseInt(("0x" + _arg1.substr(1))));
}
private function hasProperty(_arg1:String):Boolean{
return (((rootStyle) && (!((rootStyle[_arg1] == undefined)))));
}
private function parseCSS(_arg1:String):void{
_styleSheet.parseCSS(_arg1);
rootStyle = _styleSheet.getStyle(_styleName);
}
public function get padding():Array{
var _local2:Array;
var _local3:Array;
var _local4:Number;
var _local5:String;
var _local6:int;
var _local7:Array;
if (!hasProperty("padding")){
return ([5, 5, 5, 5]);
};
var _local1:String = rootStyle["padding"];
if (_local1.indexOf(" ") > 0){
_local2 = new Array();
_local3 = _local1.split(" ");
_local4 = 0;
while (_local4 < _local3.length) {
_local5 = _local3[_local4];
_local2[_local4] = NumberUtil.decodePixels(_local5);
_local4++;
};
return (_local2);
//unresolved jump
};
_local6 = NumberUtil.decodePixels(_local1);
_local7 = new Array();
_local7.push(_local6);
_local7.push(_local6);
_local7.push(_local6);
_local7.push(_local6);
return (_local7);
}
public function addToRootStyle(_arg1:Object):void{
addStyleRules(_styleName, _arg1);
}
public function get backgroundImage():String{
var _local1:String;
if (hasProperty("backgroundImage")){
_local1 = rootStyle["backgroundImage"];
if (_local1.indexOf("url(") == 0){
return (_local1.substring(4, _local1.indexOf(")")));
};
return ((rootStyle["backgroundImage"] as String));
};
if (hasProperty("background")){
return (find(parseShorthand("background"), "url("));
};
return (null);
}
public function get backgroundColor():uint{
var _local1:Array;
if (hasProperty("backgroundColor")){
return (parseColorValue("backgroundColor"));
};
if (hasProperty("background")){
_local1 = parseShorthand("background");
if (String(_local1[0]).indexOf("#") == 0){
return (colorValue(_local1[0]));
};
};
return (0x333333);
}
public function get borderColor():uint{
if (hasProperty("borderColor")){
return (parseColorValue("borderColor"));
};
if (hasProperty("border")){
return (colorValue(parseShorthand("border")[2]));
};
return (0xFFFFFF);
}
public function get rootStyleName():String{
return (_styleName);
}
public function get borderRadius():int{
if (!hasProperty("borderRadius")){
return (5);
};
return (NumberUtil.decodePixels(rootStyle["borderRadius"]));
}
public function set rootStyle(_arg1:Object):void{
setStyle(_styleName, _arg1);
}
private function parseColorValue(_arg1:String):uint{
var _local2:String = rootStyle[_arg1];
return (colorValue(_local2));
}
public function get backgroundRepeat():Boolean{
if (hasProperty("backgroundRepeat")){
return ((rootStyle["backgroundRepeat"] == "repeat"));
};
if (hasProperty("background")){
return ((parseShorthand("background").indexOf("no-repeat") < 0));
};
return (false);
}
public function get backgroundImageX():Length{
if (!hasProperty("background")){
return (new Length(0));
};
var _local1:Array = parseShorthand("background");
if (_local1.length < 2){
return (null);
};
return (new Length(_local1[(_local1.length - 2)]));
}
public function get backgroundImageY():Length{
if (!hasProperty("background")){
return (new Length(0));
};
var _local1:Array = parseShorthand("background");
if (_local1.length < 1){
return (null);
};
return (new Length(_local1[(_local1.length - 1)]));
}
public function get styleSheet():StyleSheet{
return (_styleSheet);
}
public function setStyle(_arg1:String, _arg2:Object):void{
_styleSheet.setStyle(_arg1, _arg2);
}
public function get rootStyle():Object{
return (_styleSheet.getStyle(_styleName));
}
private function parseShorthand(_arg1:String):Array{
var _local2:String = rootStyle[_arg1];
return (_local2.split(" "));
}
private function find(_arg1:Array, _arg2:String):String{
var _local3:Number = 0;
while (_local3 < _arg1.length) {
if ((((_arg1[_local3] is String)) && ((String(_arg1[_local3]).indexOf(_arg2) == 0)))){
return ((_arg1[_local3] as String));
};
_local3++;
};
return (null);
}
public function getStyle(_arg1:String):Object{
return (_styleSheet.getStyle(_arg1));
}
private function decodeGradient(_arg1:String):Array{
if (_arg1 == "none"){
return (null);
};
if (_arg1 == "high"){
return ([1, 0.5, 0, 0.1, 0.3]);
};
if (_arg1 == "medium"){
return ([0.6, 0.21, 0.21]);
};
return ([0.4, 0.15, 0.15]);
}
public static function isRootStyleProperty(_arg1:String):Boolean{
return ((ROOT_STYLE_PROPS.indexOf(_arg1) >= 0));
}
}
}//package org.flowplayer.view
Section 117
//FullscreenManager (org.flowplayer.view.FullscreenManager)
package org.flowplayer.view {
import org.flowplayer.model.*;
import org.flowplayer.view.*;
import flash.display.*;
import flash.events.*;
import org.flowplayer.util.*;
import flash.geom.*;
class FullscreenManager {
private var _playerEventDispatcher:PlayerEventDispatcher;
private var log:Log;
private var _panel:Panel;
private var _animations:AnimationEngine;
private var _screen:Screen;
private var _screenNormalProperties:DisplayProperties;
private var _playlist:Playlist;
private var _pluginRegistry:PluginRegistry;
private var _stage:Stage;
function FullscreenManager(_arg1:Stage, _arg2:Playlist, _arg3:Panel, _arg4:PluginRegistry, _arg5:AnimationEngine){
log = new Log(this);
super();
Assert.notNull(_arg1, "stage cannot be null");
_stage = _arg1;
_stage.addEventListener(FullScreenEvent.FULL_SCREEN, onFullScreen);
_playlist = _arg2;
_panel = _arg3;
_pluginRegistry = _arg4;
_screen = ((_arg4.getPlugin("screen") as DisplayProperties).getDisplayObject() as Screen);
Assert.notNull(_screen, "got null screen from pluginRegistry");
_screen.fullscreenManager = this;
_animations = _arg5;
}
public function set playerEventDispatcher(_arg1:PlayerEventDispatcher):void{
_playerEventDispatcher = _arg1;
}
private function goFullscreen():void{
log.info("entering fullscreen");
var _local1:Clip = _playlist.current;
initializeHwScaling(_local1);
_stage.displayState = StageDisplayState.FULL_SCREEN;
}
private function getFullscreenProperties():DisplayProperties{
var _local2:Number;
var _local3:DisplayProperties;
var _local1:DisplayPluginModel = (_pluginRegistry.getPlugin("controls") as DisplayPluginModel);
if (((_local1) && ((_local1.config.autoHide == "never")))){
log.debug("autoHiding disabled in fullscreen, calculating fullscreen display properties");
_local2 = _local1.getDisplayObject().height;
_local3 = DisplayPropertiesImpl.fullSize("screen");
_local3.bottom = _local2;
_local3.height = ((((_stage.stageHeight - _local2) / _stage.stageHeight) * 100) + "%");
return (_local3);
};
return (DisplayPropertiesImpl.fullSize("screen"));
}
public function get isFullscreen():Boolean{
log.debug(("currently in fulscreen? " + (_stage.displayState == StageDisplayState.FULL_SCREEN)));
return ((_stage.displayState == StageDisplayState.FULL_SCREEN));
}
private function initializeHwScaling(_arg1:Clip):void{
if (_arg1.accelerated){
_stage.fullScreenSourceRect = new Rectangle(0, 0, _arg1.originalWidth, _arg1.originalHeight);
log.info(("harware scaled fullscreen initialized with rectangle " + _stage.fullScreenSourceRect));
} else {
_stage.fullScreenSourceRect = null;
};
}
private function onFullScreen(_arg1:FullScreenEvent):void{
var event = _arg1;
if (event.fullScreen){
_screenNormalProperties = (Cloneable(_pluginRegistry.getPlugin("screen")).clone() as DisplayProperties);
};
_animations.animate(_screen, (event.fullScreen) ? getFullscreenProperties() : _screenNormalProperties, 0, function ():void{
_playerEventDispatcher.dispatchEvent((event.fullScreen) ? PlayerEvent.fullscreen() : PlayerEvent.fullscreenExit());
});
}
public function toggleFullscreen():void{
log.debug("toggleFullsreen");
if (isFullscreen){
exitFullscreen();
} else {
goFullscreen();
};
}
private function exitFullscreen():void{
log.info("exiting fullscreen");
_stage.displayState = StageDisplayState.NORMAL;
}
}
}//package org.flowplayer.view
Section 118
//ImageDisplay (org.flowplayer.view.ImageDisplay)
package org.flowplayer.view {
import org.flowplayer.model.*;
import org.flowplayer.view.*;
import flash.display.*;
class ImageDisplay extends AbstractSprite implements MediaDisplay {
private var image:DisplayObject;
private var _clip:Clip;
function ImageDisplay(_arg1:Clip){
_clip = _arg1;
}
public function init(_arg1:Clip):void{
log.debug("received image to display");
if (image){
removeChild(image);
};
if (!_arg1.getContent()){
return;
};
image = _arg1.getContent();
addChild(image);
}
public function hasContent():Boolean{
return (!((image == null)));
}
override public function toString():String{
return (("[ImageDisplay] for clip " + _clip));
}
}
}//package org.flowplayer.view
Section 119
//LabelHolder (org.flowplayer.view.LabelHolder)
package org.flowplayer.view {
import flash.display.*;
public dynamic class LabelHolder extends Sprite {
}
}//package org.flowplayer.view
Section 120
//LabelHolderRight (org.flowplayer.view.LabelHolderRight)
package org.flowplayer.view {
import flash.display.*;
public dynamic class LabelHolderRight extends Sprite {
}
}//package org.flowplayer.view
Section 121
//LabelPlayButton (org.flowplayer.view.LabelPlayButton)
package org.flowplayer.view {
import org.flowplayer.view.*;
import flash.display.*;
import org.flowplayer.util.*;
import flash.text.*;
import org.flowplayer.*;
import flash.filters.*;
class LabelPlayButton extends AbstractSprite {
private var _player:Flowplayer;
private var _labelHolder:Sprite;
private var _labelHolderLeft:Sprite;
private var _resizeToTextWidth:Boolean;
private var _label:TextField;
private var _labelHolderRight:Sprite;
function LabelPlayButton(_arg1:Flowplayer, _arg2:String, _arg3:Boolean=true){
_player = _arg1;
_resizeToTextWidth = _arg3;
createChildren(_arg2);
}
public function setLabel(_arg1:String, _arg2:Boolean=true):void{
log.debug(("setLabel, changeWidth " + _arg2));
if (_label.text == _arg1){
return;
};
_resizeToTextWidth = _arg2;
_label.text = _arg1;
onResize();
}
private function createChildren(_arg1:String):void{
_labelHolderLeft = new LabelHolderLeft();
addChild(_labelHolderLeft);
_labelHolder = new LabelHolder();
addChild(_labelHolder);
_labelHolderRight = new LabelHolderRight();
addChild(_labelHolderRight);
_label = _player.createTextField();
_label.textColor = 0xFFFFFF;
_label.selectable = false;
_label.autoSize = TextFieldAutoSize.RIGHT;
_label.multiline = false;
_label.text = _arg1;
_label.width = _label.textWidth;
var _local2:GlowFilter = new GlowFilter(0xFFFFFF, 0.3, 4, 4, 3, 3);
var _local3:Array = [_local2];
_label.filters = _local3;
addChild(_label);
}
override protected function onResize():void{
log.debug("arranging label");
_labelHolderRight.height = height;
_labelHolderRight.scaleX = _labelHolderRight.scaleY;
_labelHolderLeft.height = height;
_labelHolderLeft.scaleX = _labelHolderLeft.scaleY;
var _local1:TextFormat = _label.defaultTextFormat;
_local1.size = (_labelHolder.height / 3);
_label.setTextFormat(_local1);
_labelHolder.width = (_resizeToTextWidth) ? (_label.textWidth + 10) : ((width - _labelHolderRight.width) - _labelHolderLeft.width);
_labelHolder.height = height;
Arrange.center(_labelHolder, width, height);
_labelHolderLeft.x = (_labelHolder.x - _labelHolderLeft.width);
_labelHolderRight.x = (_labelHolder.x + _labelHolder.width);
Arrange.center(_labelHolderLeft, 0, height);
Arrange.center(_labelHolderRight, 0, height);
Arrange.center(_label, 0, height);
_label.x = ((_labelHolder.x + (_labelHolder.width / 2)) - (_label.width / 2));
}
}
}//package org.flowplayer.view
Section 122
//Launcher (org.flowplayer.view.Launcher)
package org.flowplayer.view {
import org.flowplayer.model.*;
import org.flowplayer.controller.*;
import flash.display.*;
import flash.events.*;
import org.flowplayer.util.*;
import flash.text.*;
import flash.utils.*;
import org.flowplayer.config.*;
import flash.net.*;
import flash.ui.*;
import org.osflash.thunderbolt.*;
import flash.system.*;
public class Launcher extends StyleableSprite implements ErrorHandler {
private var _panel:Panel;
private var _error:TextField;
private var _screen:Screen;
private var _pluginLoader:PluginLoader;
private var _controlsModel:DisplayPluginModel;
private var _providers:Dictionary;
private var _animationEngine:AnimationEngine;
private var _flowplayer:Flowplayer;
private var _pluginRegistry:PluginRegistry;
private var _pluginsInitialized:Number;// = 0
private var _canvasLogo:Sprite;
private var _config:Config;
private var _playButtonOverlay:PlayButtonOverlay;
private var _numLoadablePlugins:int;// = -1
private var _fullscreenManager:FullscreenManager;
public function Launcher(){
_providers = new Dictionary();
super("#canvas", this);
addEventListener(Event.ADDED_TO_STAGE, initPhase1);
}
private function onMouseOut(_arg1:MouseEvent):void{
_flowplayer.dispatchEvent(PlayerEvent.mouseOut());
}
private function onMouseOver(_arg1:MouseEvent):void{
_flowplayer.dispatchEvent(PlayerEvent.mouseOver());
}
private function createFlashVarsConfig():void{
var _local1:String;
for (_local1 in stage.loaderInfo.parameters) {
log.debug(((_local1 + ": ") + stage.loaderInfo.parameters[_local1]));
};
if (!stage.loaderInfo.parameters){
return;
};
_config = ConfigLoader.parseConfig(stage.loaderInfo.parameters["config"], playerSwfName(), VersionInfo.controlsVersion, VersionInfo.audioVersion);
}
private function getLoadablePluginCount():int{
if (_numLoadablePlugins == -1){
_numLoadablePlugins = countLoadablePlugins();
};
return (_numLoadablePlugins);
}
private function createScreen():void{
_screen = new Screen(_config.getPlaylist(), _animationEngine, _playButtonOverlay, _pluginRegistry);
var _local1:DisplayProperties = _config.getScreenProperties();
initView(_screen, _local1, null, false);
if (_playButtonOverlay){
PlayButtonOverlayView(_playButtonOverlay.getDisplayObject()).setScreen(_screen, hasClip);
};
}
private function useExternalInterfade():Boolean{
log.debug(("useExternalInteface: " + !((_config.playerId == null))));
return (!((_config.playerId == null)));
}
private function playerSwfName():String{
var _local1:String = loaderInfo.url;
var _local2:Number = _local1.lastIndexOf("/");
return (_local1.substring((_local2 + 1), (_local1.indexOf(".swf") + 4)));
}
private function createPanel():void{
_panel = new Panel();
addChild(_panel);
}
private function addPluginsToPanel(_arg1:PluginRegistry):void{
var _local2:Object;
var _local3:DisplayPluginModel;
for each (_local2 in _arg1.plugins) {
if ((_local2 is DisplayPluginModel)){
_local3 = (_local2 as DisplayPluginModel);
log.debug(((((("adding plugin '" + _local3.name) + "' to panel: ") + _local3.visible) + ", plugin object is ") + _local3.getDisplayObject()));
if (_local3.visible){
if (_local3.zIndex == -1){
_local3.zIndex = (_playButtonOverlay) ? _playButtonOverlay.zIndex : 100;
};
_panel.addView(_local3.getDisplayObject(), undefined, _local3);
};
if (_local3.name == "controls"){
_controlsModel = _local3;
};
};
};
if (_controlsModel){
arrangeCanvasLogo();
};
}
public function showError(_arg1:String):void{
if (!_panel){
return;
};
if (!_config.showErrors){
return;
};
if (((_error) && ((_error.parent == this)))){
removeChild(_error);
};
_error = TextUtil.createTextField(false);
_error.background = true;
_error.backgroundColor = 0;
_error.textColor = 0xFFFFFF;
_error.autoSize = TextFieldAutoSize.CENTER;
_error.multiline = true;
_error.wordWrap = true;
_error.text = _arg1;
_error.selectable = true;
_error.width = (stage.stageWidth - 40);
Arrange.center(_error, stage.stageWidth, stage.stageHeight);
addChild(_error);
createErrorMessageHideTimer();
}
private function validateLicenseKey():Boolean{
try {
return (LicenseKey.validate((useExternalInterfade()) ? null : root.loaderInfo.url, _flowplayer.version, _config.licenseKey));
} catch(e:Error) {
log.warn("License key not accepted, will show flowplayer logo");
};
return (false);
}
private function addScreenToPanel():void{
var _local1:DisplayProperties = (_pluginRegistry.getPlugin("screen") as DisplayProperties);
_local1.display = "none";
_local1.getDisplayObject().visible = false;
_panel.addView(_local1.getDisplayObject(), null, _local1);
}
private function addListeners():void{
_screen.addEventListener(MouseEvent.CLICK, onViewClicked);
addEventListener(MouseEvent.ROLL_OVER, onMouseOver);
addEventListener(MouseEvent.ROLL_OUT, onMouseOut);
graphics.beginFill(0, 0);
graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);
graphics.endFill();
}
private function get hasClip():Boolean{
var _local1:Clip = _config.getPlaylist().current;
var _local2:Boolean = ((!(_local1.isNullClip)) && (((_local1.url) || (!((_local1.provider == "http"))))));
return (_local2);
}
private function onClipError(_arg1:ClipEvent):void{
doHandleError((((((((_arg1.info + ", ") + _arg1.info2) + ", ") + _arg1.info3) + ", clip: '") + Clip(_arg1.target)) + "'"));
}
private function createFlowplayer(_arg1:PlayListController):void{
_flowplayer = new Flowplayer(stage, _arg1, _pluginRegistry, _panel, _animationEngine, this, this, _config, _fullscreenManager, _pluginLoader, URLUtil.playerBaseUrl(loaderInfo));
_arg1.playerEventDispatcher = _flowplayer;
}
private function countLoadablePlugins():int{
var _local4:PluginModel;
var _local5:Boolean;
var _local1:Number = 0;
var _local2:Array = _config.getLoadables();
var _local3:Number = 0;
while (_local3 < _local2.length) {
_local4 = Loadable(_local2[_local3]).plugin;
_local5 = (((((_local4 is DisplayPluginModel)) && ((DisplayPluginModel(_local4).getDisplayObject() is Plugin)))) || ((((_local4 is ProviderModel)) && ((ProviderModel(_local4).getProviderObject() is Plugin)))));
if (_local5){
log.debug(("will wait for onLoad from plugin " + _local4));
_local1++;
} else {
log.debug(("will NOT wait for onLoad from plugin " + Loadable(_local2[_local3]).plugin));
};
_local3++;
};
return ((_local1 + (_playButtonOverlay) ? 1 : 0));
}
private function loadPluginsIfConfigured():void{
var _local1:Array = _config.getLoadables();
log.info("will load following plugins: ");
var _local2:Number = 0;
while (_local2 < _local1.length) {
log.info(("" + _local1[_local2]));
_local2++;
};
_pluginLoader = new PluginLoader(URLUtil.playerBaseUrl(loaderInfo), _pluginRegistry, this, useExternalInterfade(), onPluginLoad, onPluginLoadError);
_pluginLoader.addEventListener(Event.COMPLETE, initPhase2);
if (_local1.length == 0){
log.debug("configuration has no plugins");
initPhase2();
} else {
log.debug("loading plugins and providers");
_pluginLoader.load(_local1);
};
}
override protected function onRedraw():void{
if (((bgImageHolder) && ((getChildIndex(bgImageHolder) > getChildIndex(_panel))))){
swapChildren(bgImageHolder, _panel);
};
}
private function createNewLoader():ResourceLoader{
return (new ResourceLoaderImpl((_config.playerId) ? null : URLUtil.playerBaseUrl(loaderInfo), this));
}
private function arrangeScreen():void{
var _local2:Boolean;
var _local3:Number;
var _local1:DisplayProperties = (_pluginRegistry.getPlugin("screen") as DisplayProperties);
if (((((_controlsModel) && (_controlsModel.visible))) && (!(screenTopOrBottomConfigured())))){
_local2 = ((_config.getObject("screen")) && (_config.getObject("screen").hasOwnProperty("height")));
if (((isControlsAlwaysAutoHide()) || ((_controlsModel.position.bottom.px > 0)))){
_local1.bottom = 0;
if (!_local2){
_local1.height = "100%";
};
} else {
_local3 = _controlsModel.getDisplayObject().height;
_local1.bottom = _local3;
if (!_local2){
_local1.height = ((((stage.stageHeight - _local3) / stage.stageHeight) * 100) + "%");
};
};
};
log.debug(("arranging screen to pos " + _local1.position));
_local1.display = "block";
_local1.getDisplayObject().visible = true;
_pluginRegistry.updateDisplayProperties(_local1);
_panel.update(_local1.getDisplayObject(), _local1);
_panel.draw(_local1.getDisplayObject());
}
private function checkPluginsInitialized():void{
var _local1:int = getLoadablePluginCount();
if (++_pluginsInitialized == _local1){
log.info("all plugins initialized");
initPhase3();
};
log.info((((_pluginsInitialized + " out of ") + _local1) + " plugins initialized"));
}
public function handleError(_arg1:PlayerError, _arg2:Object=null, _arg3:Boolean=true):void{
if (_flowplayer){
_flowplayer.dispatchError(_arg1, _arg2);
} else {
new PlayerEventDispatcher().dispatchError(_arg1, _arg2);
};
doHandleError((((_arg1.code + ": ") + _arg1.message) + (_arg2) ? (": " + _arg2) : ""), _arg3);
}
private function hideErrorMessage(_arg1:TimerEvent=null):void{
var event = _arg1;
if (((_error) && ((_error.parent == this)))){
if (_animationEngine){
_animationEngine.fadeOut(_error, 1000, function ():void{
removeChild(_error);
});
} else {
removeChild(_error);
};
};
}
private function doHandleError(_arg1:String, _arg2:Boolean=true):void{
if (((_config) && (_config.playerId))){
Logger.error(_arg1);
};
showError(_arg1);
if (_flowplayer){
_flowplayer.stop();
};
if (((_arg2) && (Capabilities.isDebugger))){
throw (new Error(_arg1));
};
}
private function initPhase2(_arg1:Event=null):void{
_pluginLoader.removeEventListener(Event.COMPLETE, this.initPhase2);
log.debug("creating PlayListController");
_providers = _pluginLoader.providers;
var _local2:PlayListController = createPlayListController();
addPlayListListeners();
createFullscreenManager(_local2.playlist);
log.debug("creating Flowplayer API");
createFlowplayer(_local2);
addScreenToPanel();
if (!validateLicenseKey()){
createLogoForCanvas();
resizeCanvasLogo();
};
log.debug("creating logo");
createLogo();
contextMenu = new ContextMenuBuilder(_config.playerId, _config.contextMenu).build();
log.debug("initializing ExternalInterface");
if (useExternalInterfade()){
_flowplayer.initExternalInterface();
};
log.debug("calling onLoad to plugins");
_pluginRegistry.onLoad(_flowplayer);
}
private function initPhase3(_arg1:Event=null):void{
log.debug("Adding visible plugins to panel");
addPluginsToPanel(_pluginRegistry);
log.debug("arranging screen");
arrangeScreen();
log.debug("dispatching onLoad");
if (useExternalInterfade()){
_flowplayer.dispatchEvent(PlayerEvent.load("player"));
};
log.debug("starting configured streams");
startStreams();
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
addListeners();
}
private function createAnimationEngine(_arg1:PluginRegistry):void{
_animationEngine = new AnimationEngine(_panel, _arg1);
}
private function addPlayListListeners():void{
var _local1:Playlist = _config.getPlaylist();
_local1.onError(onClipError);
}
private function initPhase1(_arg1:Event):void{
var event = _arg1;
createFlashVarsConfig();
Log.configure(_config.getLogConfiguration());
if (_config.playerId){
Security.allowDomain(URLUtil.pageUrl);
};
_config.getPlaylist().onBeforeBegin(function (_arg1:ClipEvent):void{
hideErrorMessage();
});
loader = createNewLoader();
rootStyle = _config.canvasStyle;
stage.addEventListener(Event.RESIZE, onStageResize);
setSize(stage.stageWidth, stage.stageHeight);
if (!VersionInfo.commercial){
log.debug("Adding logo to canvas");
createLogoForCanvas();
};
log = new Log(this);
EventDispatcher.playerId = _config.playerId;
log.debug(("security sandbox type: " + Security.sandboxType));
log.info(VersionInfo.versionInfo());
log.debug("creating Panel");
createPanel();
_pluginRegistry = new PluginRegistry(_panel);
log.debug("Creating animation engine");
createAnimationEngine(_pluginRegistry);
log.debug("creating play button overlay");
createPlayButtonOverlay();
log.debug("creating screen");
createScreen();
loadPluginsIfConfigured();
}
private function createPlayListController():PlayListController{
if (!_providers){
_providers = new Dictionary();
};
var _local1:NetStreamControllingStreamProvider = new NetStreamControllingStreamProvider();
_local1.playerConfig = _config;
_providers["http"] = _local1;
return (new PlayListController(_config.getPlaylist(), _providers, _config, createNewLoader()));
}
private function startStreams():void{
var _local1:Boolean;
if (_flowplayer.state != State.WAITING){
log.debug("streams have been started in player.onLoad(), will not start streams here.");
_local1 = false;
};
if (!hasClip){
log.info("Configuration has no clips to play.");
_local1 = false;
};
var _local2:PlayButtonOverlayView = (_playButtonOverlay) ? PlayButtonOverlayView(_playButtonOverlay.getDisplayObject()) : null;
if (_local1){
if (_flowplayer.currentClip.autoPlay){
log.debug("clip is autoPlay");
_flowplayer.play();
} else {
if (_flowplayer.currentClip.autoBuffering){
log.debug("clip is autoBuffering");
_flowplayer.startBuffering();
} else {
if (_local2){
_local2.stopBuffering();
_local2.showButton();
};
};
};
} else {
if (_local2){
_local2.stopBuffering();
};
};
}
private function createPlayButtonOverlay():void{
_playButtonOverlay = _config.getPlayButtonOverlay();
if (!_playButtonOverlay){
return;
};
_playButtonOverlay.onLoad(onPluginLoad);
_playButtonOverlay.onError(onPluginLoadError);
log.debug(("playlist has clips? " + hasClip));
var _local1:PlayButtonOverlayView = new PlayButtonOverlayView(!(playButtonOverlayWidthDefined()), _playButtonOverlay, _pluginRegistry, _config.getPlaylist(), true);
initView(_local1, _playButtonOverlay, null, false);
}
private function onKeyDown(_arg1:KeyboardEvent):void{
log.debug("keydown");
if (_flowplayer.dispatchBeforeEvent(PlayerEvent.keyPress(_arg1.keyCode))){
_flowplayer.dispatchEvent(PlayerEvent.keyPress(_arg1.keyCode));
if (_arg1.keyCode == Keyboard.SPACE){
_flowplayer.toggle();
};
};
}
private function createFullscreenManager(_arg1:Playlist):void{
_fullscreenManager = new FullscreenManager(stage, _arg1, _panel, _pluginRegistry, _animationEngine);
}
private function createLogo():void{
var _local1:Logo = ((_config.getLogo()) || (new Logo()));
var _local2:LogoView = new LogoView(_panel, _local1, _flowplayer);
initView(_local2, _local1, _local2.draw, false);
}
private function isControlsAlwaysAutoHide():Boolean{
if (!_controlsModel){
return (false);
};
if (!_controlsModel.config){
return (false);
};
log.debug("controlsModel.config.auotoHide == always", (_controlsModel.config.autoHide == "always"));
return ((_controlsModel.config.autoHide == "always"));
}
private function onViewClicked(_arg1:MouseEvent):void{
log.debug(((("onViewClicked, target " + _arg1.target) + ", current target ") + _arg1.currentTarget));
if (((_playButtonOverlay) && (isParent(DisplayObject(_arg1.target), _playButtonOverlay.getDisplayObject())))){
_flowplayer.toggle();
return;
};
var _local2:Clip = _flowplayer.playlist.current;
if (_local2.linkUrl){
_flowplayer.pause();
navigateToURL(new URLRequest(_local2.linkUrl), _local2.linkWindow);
} else {
_flowplayer.toggle();
};
}
private function initView(_arg1:DisplayObject, _arg2:DisplayProperties, _arg3:Function=null, _arg4:Boolean=true):void{
if (((!((_arg2.name == "logo"))) || (VersionInfo.commercial))){
_pluginRegistry.registerDisplayPlugin(_arg2, _arg1);
};
if (_arg4){
_panel.addView(_arg1, _arg3, _arg2);
};
if ((_arg2 is Callable)){
ExternalInterfaceHelper.initializeInterface((_arg2 as Callable), _arg1);
};
}
private function createErrorMessageHideTimer():void{
var _local1:Timer = new Timer(4000, 1);
_local1.addEventListener(TimerEvent.TIMER_COMPLETE, hideErrorMessage);
_local1.start();
}
private function arrangeCanvasLogo():void{
if (!_canvasLogo){
return;
};
_canvasLogo.x = 15;
_canvasLogo.y = ((stage.stageHeight - (_controlsModel) ? (_controlsModel.dimensions.height.toPx(stage.stageHeight) + 10) : 10) - _canvasLogo.height);
}
private function onPluginLoadError(_arg1:PluginEvent):void{
if (!_arg1.hasError(PluginError.INIT_FAILED)){
return;
};
var _local2:PluginModel = (_arg1.target as PluginModel);
log.warn(("load/init error on " + _local2));
_pluginRegistry.removePlugin(_local2);
checkPluginsInitialized();
}
private function onStageResize(_arg1:Event=null):void{
setSize(stage.stageWidth, stage.stageHeight);
arrangeCanvasLogo();
}
private function playButtonOverlayWidthDefined():Boolean{
if (!_config.getObject("play")){
return (false);
};
return (_config.getObject("play").hasOwnProperty("width"));
}
private function screenTopOrBottomConfigured():Boolean{
var _local1:Object = _config.getObject("screen");
if (!_local1){
return (false);
};
if (_local1.hasOwnProperty("top")){
return (true);
};
if (_local1.hasOwnProperty("bottom")){
return (true);
};
return (false);
}
private function resizeCanvasLogo():void{
_canvasLogo.alpha = 1;
_canvasLogo.width = 150;
_canvasLogo.scaleY = _canvasLogo.scaleX;
arrangeCanvasLogo();
}
private function onPluginLoad(_arg1:PluginEvent):void{
var _local2:PluginModel = (_arg1.target as PluginModel);
log.info((("plugin " + _local2) + " initialized"));
checkPluginsInitialized();
}
private function isParent(_arg1:DisplayObject, _arg2:DisplayObject):Boolean{
var _local4:DisplayObject;
if (DisplayObject(_arg1).parent == _arg2){
return (true);
};
if (!(_arg2 is DisplayObjectContainer)){
return (false);
};
var _local3:Number = 0;
while (_local3 < DisplayObjectContainer(_arg2).numChildren) {
_local4 = DisplayObjectContainer(_arg2).getChildAt(_local3);
if (isParent(_arg1, _local4)){
return (true);
};
_local3++;
};
return (false);
}
private function createLogoForCanvas():void{
if (_canvasLogo){
return;
};
_canvasLogo = new CanvasLogo();
_canvasLogo.width = 85;
_canvasLogo.scaleY = _canvasLogo.scaleX;
_canvasLogo.alpha = 0.4;
_canvasLogo.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://flowplayer.org"), "_self");
});
_canvasLogo.buttonMode = true;
log.debug("adding logo to display list");
addChild(_canvasLogo);
onStageResize();
}
}
}//package org.flowplayer.view
Section 123
//LicenseKey (org.flowplayer.view.LicenseKey)
package org.flowplayer.view {
class LicenseKey {
public static function validate(_arg1:String, _arg2:Array, _arg3:String):Boolean{
return (true);
}
}
}//package org.flowplayer.view
Section 124
//LogoView (org.flowplayer.view.LogoView)
package org.flowplayer.view {
import org.flowplayer.model.*;
import flash.display.*;
import flash.events.*;
import org.flowplayer.util.*;
import flash.utils.*;
import flash.net.*;
public class LogoView extends AbstractSprite {
private var _player:Flowplayer;
private var _originalProps:DisplayProperties;
private var _panel:Panel;
private var _model:Logo;
private var _image:DisplayObject;
public function LogoView(_arg1:Panel, _arg2:Logo, _arg3:Flowplayer){
_panel = _arg1;
this.model = _arg2;
_originalProps = (_model.clone() as DisplayProperties);
log.debug(("original model dimensions " + _originalProps.dimensions));
_player = _arg3;
setEventListeners();
createLogoImage(new FlowplayerLogo());
}
private function onFullscreen(_arg1:FullScreenEvent):void{
if (_arg1.fullScreen){
show();
} else {
if (_model.fullscreenOnly){
hide(0);
} else {
update();
};
};
}
private function createLogoImage(_arg1:DisplayObject):void{
_image = _arg1;
addChild(_image);
log.debug(("logo shown in fullscreen only " + _model.fullscreenOnly));
if (!_model.fullscreenOnly){
show();
};
onResize();
show();
if (_model.fullscreenOnly){
hide();
};
}
private function hide(_arg1:int=0):void{
log.debug("hiding logo");
if (_arg1 > 0){
_player.animationEngine.fadeOut(this, _arg1, removeFromPanel);
} else {
removeFromPanel();
};
}
private function update():void{
log.debug(("updating " + _model.dimensions));
_panel.update(this, _model);
_panel.draw(this);
}
private function setEventListeners():void{
_panel.stage.addEventListener(FullScreenEvent.FULL_SCREEN, onFullscreen);
if (_model.linkUrl){
addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent):void{
navigateToURL(new URLRequest(_model.linkUrl), _model.linkWindow);
});
buttonMode = true;
};
}
public function set model(_arg1:Logo):void{
_model = new Logo();
_model.fullscreenOnly = _arg1.fullscreenOnly;
_model.height = "10%";
_model.width = "10%";
_model.top = "15";
_model.right = "1";
_model.linkUrl = "http://flowplayer.org";
log.debug(("initial model dimensions " + _model.dimensions));
}
private function removeFromPanel():void{
if (this.parent){
_panel.removeChild(this);
};
}
override protected function onResize():void{
if (_image){
log.debug(("onResize, width " + width));
if (((_model.dimensions.width.hasValue()) && (_model.dimensions.height.hasValue()))){
if (_image.height > _image.width){
_image.height = height;
_image.scaleX = _image.scaleY;
} else {
_image.width = width;
_image.scaleY = _image.scaleX;
};
};
Arrange.center(_image, width, height);
};
}
private function onLogoTimer(_arg1:TimerEvent):void{
if (((!(this.parent)) && ((_panel.stage.displayState == StageDisplayState.NORMAL)))){
return;
};
if (!this.parent){
show();
};
_panel.setChildIndex(this, (_panel.numChildren - 1));
}
private function show():void{
var timer:Timer;
this.alpha = _model.opacity;
this.visible = true;
_model.zIndex = 100;
if (!this.parent){
log.debug(("showing " + _model.dimensions));
_panel.addView(this, null, _model);
if (_model.displayTime > 0){
timer = new Timer((_model.displayTime * 1000), 1);
timer.addEventListener(TimerEvent.TIMER_COMPLETE, function (_arg1:TimerEvent):void{
hide(_model.fadeSpeed);
});
timer.start();
};
} else {
update();
};
}
}
}//package org.flowplayer.view
Section 125
//MediaDisplay (org.flowplayer.view.MediaDisplay)
package org.flowplayer.view {
import org.flowplayer.model.*;
interface MediaDisplay {
function init(_arg1:Clip):void;
function hasContent():Boolean;
}
}//package org.flowplayer.view
Section 126
//MediaDisplayFactory (org.flowplayer.view.MediaDisplayFactory)
package org.flowplayer.view {
import org.flowplayer.model.*;
import flash.display.*;
class MediaDisplayFactory {
private var playList:Playlist;
function MediaDisplayFactory(_arg1:Playlist){
this.playList = _arg1;
}
public function createMediaDisplay(_arg1:Clip):DisplayObject{
var _local2:DisplayObject;
if (_arg1.type == ClipType.VIDEO){
_local2 = new VideoDisplay(_arg1);
};
if ((((_arg1.type == ClipType.IMAGE)) || ((_arg1.type == ClipType.AUDIO)))){
_local2 = new ImageDisplay(_arg1);
};
return (_local2);
}
}
}//package org.flowplayer.view
Section 127
//MediaResizer (org.flowplayer.view.MediaResizer)
package org.flowplayer.view {
import org.flowplayer.model.*;
import org.flowplayer.util.*;
class MediaResizer {
private var _maxWidth:int;
private var log:Log;
private var _maxHeight:int;
private var _currentSizingOption:MediaSize;
private var _clip:Clip;
function MediaResizer(_arg1:Clip, _arg2:int, _arg3:int){
log = new Log(this);
super();
this._clip = _arg1;
this._maxWidth = _arg2;
this._maxHeight = _arg3;
_currentSizingOption = MediaSize.FITTED_PRESERVING_ASPECT_RATIO;
}
public function get origHeight():int{
return (_clip.originalHeight);
}
public function setMaxSize(_arg1:int, _arg2:int):void{
this._maxWidth = _arg1;
this._maxHeight = _arg2;
}
public function get origWidth():int{
return (_clip.originalWidth);
}
private function resizeToFit():Boolean{
if ((((origHeight == 0)) || ((origHeight == 0)))){
log.warn("resizeToFit: original sizes not available, will not resize");
return (false);
};
log.debug("resize to fit");
var _local1:Number = (_maxWidth / origWidth);
if ((_local1 * origHeight) <= _maxHeight){
scale(_local1);
} else {
scale((_maxHeight / origHeight));
};
return (true);
}
public function scale(_arg1:Number):void{
resize((_arg1 * origWidth), (_arg1 * origHeight));
}
private function resizeToOrig(_arg1:Boolean=false):Boolean{
if (_arg1){
resize(origWidth, origHeight);
return (true);
};
if ((((origHeight > _maxHeight)) || ((origWidth > _maxWidth)))){
log.warn("original size bigger that mas size! resizeToOrig() falls to resizeToFit()");
return (resizeToFit());
};
if (((origWidth) && (origHeight))){
log.debug("resize to original size");
resize(origWidth, origHeight);
return (true);
};
log.warn("resizeToOrig() cannot resize to original size because original size is not available");
return (false);
}
public function get currentSize():MediaSize{
return (_currentSizingOption);
}
private function resize(_arg1:int, _arg2:int):void{
_clip.width = _arg1;
_clip.height = _arg2;
}
private function resizeToMax():Boolean{
log.debug("resizing to max size (filling available space)");
resize(_maxWidth, _maxHeight);
return (true);
}
public function resizeTo(_arg1:MediaSize, _arg2:Boolean=false):Boolean{
if (_arg1 == null){
_arg1 = _currentSizingOption;
};
var _local3:Boolean;
if (_arg1 == MediaSize.FITTED_PRESERVING_ASPECT_RATIO){
_local3 = resizeToFit();
} else {
if (_arg1 == MediaSize.HALF_FROM_ORIGINAL){
_local3 = resizeToHalfAvailableSize();
} else {
if (_arg1 == MediaSize.ORIGINAL){
_local3 = resizeToOrig(_arg2);
} else {
if (_arg1 == MediaSize.FILLED_TO_AVAILABLE_SPACE){
_local3 = resizeToMax();
};
};
};
};
_currentSizingOption = _arg1;
return (_local3);
}
private function resizeToHalfAvailableSize():Boolean{
log.debug("resize to half");
scale(((_maxWidth / 2) / origWidth));
return (true);
}
public function toString():String{
return (((((((("[MediaResizer] origWidth: " + origWidth) + ", origHeight: ") + origHeight) + ", maxWidth: ") + _maxWidth) + ", maxHeight: ") + _maxHeight));
}
public function hasOrigSize():Boolean{
return ((((origHeight >= 0)) && ((origWidth >= 0))));
}
}
}//package org.flowplayer.view
Section 128
//Panel (org.flowplayer.view.Panel)
package org.flowplayer.view {
import org.flowplayer.model.*;
import org.flowplayer.layout.*;
import org.flowplayer.view.*;
import flash.display.*;
import flash.events.*;
import org.flowplayer.util.*;
import flash.geom.*;
class Panel extends Sprite {
private var log:Log;
private var layout:Layout;
function Panel(){
log = new Log(this);
super();
addEventListener(Event.ADDED_TO_STAGE, createLayout);
}
private function addChildView(_arg1:DisplayProperties):void{
var _local4:DisplayObject;
log.info(((((("updating Z index of " + _arg1) + ", target Z index is ") + _arg1.zIndex) + ", numChildreb ") + numChildren));
var _local2:int;
while (_local2 < numChildren) {
log.debug(((getChildAt(_local2) + " at ") + _local2));
_local2++;
};
if (_arg1.zIndex < numChildren){
log.debug(("adding child at " + _arg1.zIndex));
_local4 = getChildAt(_arg1.zIndex);
addChildAt(_arg1.getDisplayObject(), _arg1.zIndex);
} else {
addChild(_arg1.getDisplayObject());
};
_arg1.zIndex = getChildIndex(_arg1.getDisplayObject());
log.debug(("Z index updated to " + _arg1.zIndex));
log.debug("child indexes are now: ");
var _local3:int;
while (_local3 < numChildren) {
log.debug(((getChildAt(_local3) + " at ") + _local3));
_local3++;
};
}
public function addView(_arg1:DisplayObject, _arg2:Object=null, _arg3:DisplayProperties=null):void{
var _local4:Function;
if (!_arg3){
_arg3 = new DisplayPropertiesImpl();
_arg3.left = 0;
_arg3.top = 0;
_arg3.width = ((_arg1.width) || ("50%"));
_arg3.height = ((_arg1.height) || ("50%"));
} else {
if (!_arg3.dimensions.height.hasValue()){
_arg3.height = _arg1.height;
};
if (!_arg3.dimensions.width.hasValue()){
_arg3.width = _arg1.width;
};
if (!((_arg3.position.left.hasValue()) || (_arg3.position.right.hasValue()))){
_arg3.left = "50%";
};
if (!((_arg3.position.top.hasValue()) || (_arg3.position.bottom.hasValue()))){
_arg3.top = "50%";
};
};
if (_arg3.zIndex < 0){
_arg3.zIndex = 1;
};
if (_arg2){
_local4 = ((_arg2 is Function)) ? (_arg2 as Function) : _arg1[_arg2];
} else {
_local4 = new DrawWrapper(_arg1).draw;
};
_arg1.alpha = _arg3.alpha;
_arg3.setDisplayObject(_arg1);
addChildView(_arg3);
layout.addView(_arg1, _local4, _arg3);
}
public function update(_arg1:DisplayObject, _arg2:DisplayProperties):Rectangle{
log.debug(("updating zIndex to " + _arg2.zIndex));
if (_arg2.zIndex >= 0){
setChildIndex(_arg1, ((_arg2.zIndex < numChildren)) ? _arg2.zIndex : (numChildren - 1));
};
return (layout.update(_arg1, _arg2));
}
public function draw(_arg1:DisplayObject=null):void{
layout.draw(_arg1);
}
private function createLayout(_arg1:Event):void{
layout = new MarginLayout(stage);
}
public function getZIndex(_arg1:DisplayObject):int{
var view = _arg1;
try {
return (getChildIndex(view));
} catch(e:Error) {
};
return (-1);
}
public function removeView(_arg1:DisplayObject, _arg2:Number=0, _arg3:Boolean=false):void{
log.debug(("removeView " + _arg1));
if (!getChildByName(_arg1.name)){
return;
};
super.removeChild(_arg1);
layout.removeView(_arg1);
}
override public function swapChildren(_arg1:DisplayObject, _arg2:DisplayObject):void{
log.warn("swapChildren on Panel called, overridden here and does nothing");
}
override public function removeChild(_arg1:DisplayObject):DisplayObject{
removeView(_arg1);
return (_arg1);
}
override public function addChild(_arg1:DisplayObject):DisplayObject{
log.debug(("addChild " + _arg1));
if ((_arg1 is Preloader)){
log.warn("adding Preloader to panel??");
};
return (super.addChild(_arg1));
}
}
}//package org.flowplayer.view
Section 129
//PlayButtonOverlayView (org.flowplayer.view.PlayButtonOverlayView)
package org.flowplayer.view {
import org.flowplayer.model.*;
import flash.display.*;
import flash.events.*;
import org.flowplayer.util.*;
import flash.utils.*;
public class PlayButtonOverlayView extends AbstractSprite implements Plugin {
private var _player:Flowplayer;
private var _resizeToTextWidth:Boolean;
private var _screen:Screen;
private var _play:PlayButtonOverlay;
private var _origAlpha:Number;
private var _pluginRegistry:PluginRegistry;
private var _playlist:Playlist;
private var _showButtonInitially:Boolean;
private var _button:DisplayObject;
private var _rotation:Sprite;
private var _tween:Animation;
private var _rotationTimer:Timer;
private var _rotationImage:DisplayObject;
public function PlayButtonOverlayView(_arg1:Boolean, _arg2:PlayButtonOverlay, _arg3:PluginRegistry, _arg4:Playlist, _arg5:Boolean=true){
_resizeToTextWidth = _arg1;
_pluginRegistry = _arg3;
_pluginRegistry.registerDisplayPlugin(_arg2, this);
_play = _arg2;
createChildren();
_playlist = _arg4;
addListeners(_arg4);
buttonMode = true;
_rotationTimer = new Timer(((_arg2.rotateSpeed >= 0)) ? (100 - _arg2.rotateSpeed) : 50);
_rotationTimer.addEventListener(TimerEvent.TIMER, rotate);
if (_arg5){
startBuffering();
};
addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
}
public function onConfig(_arg1:PluginModel):void{
}
private function switchButton(_arg1:DisplayObject):void{
removeChildIfAdded(_button);
_button = _arg1;
addChild(_button);
}
public function showButton(_arg1:ClipEvent=null, _arg2:String=null):void{
log.debug(("showButton(), label " + _arg2));
this.label = ((_arg2) || (_play.label));
if (!_button){
return;
};
if (_rotation.parent == this){
return;
};
addChild(_button);
show();
}
private function hideButton(_arg1:ClipEvent=null):void{
log.debug(("hideButton() " + _button));
removeChildIfAdded(_button);
}
private function createChildren():void{
_rotationImage = new BufferAnimation();
_rotation = new Sprite();
_rotation.addChild(_rotationImage);
createButton();
}
private function restoreOriginalAlpha():void{
alpha = _origAlpha;
var _local1:DisplayProperties = model;
_local1.alpha = _origAlpha;
_pluginRegistry.updateDisplayProperties(_local1);
}
private function addListeners(_arg1:ClipEventSupport):void{
_arg1.onConnect(showButton);
_arg1.onConnect(startBuffering);
_arg1.onBeforeBegin(hideButton);
_arg1.onBeforeBegin(startBuffering);
_arg1.onResume(hide);
_arg1.onPause(stopBuffering);
_arg1.onPause(showButton);
_arg1.onStop(stopBuffering);
_arg1.onStop(showButton);
_arg1.onBeforeFinish(stopBuffering);
_arg1.onBeforeFinish(showReplayButton);
_arg1.onBufferEmpty(startBuffering);
_arg1.onBufferFull(stopBuffering);
_arg1.onBeforeSeek(startBuffering);
_arg1.onSeek(stopBuffering);
_arg1.onBufferStop(stopBuffering);
_arg1.onBufferStop(showButton);
}
private function get model():DisplayPluginModel{
return (DisplayPluginModel(_pluginRegistry.getPlugin("play")));
}
public function getDefaultConfig():Object{
return (null);
}
public function showReplayButton(_arg1:ClipEvent=null):void{
log.info("showReplayButton");
if (((_arg1.isDefaultPrevented()) && (_playlist.hasNext()))){
showButton(null, _play.replayLabel);
return;
};
showButton(null, (_playlist.hasNext()) ? null : _play.replayLabel);
}
override public function set alpha(_arg1:Number):void{
log.debug(((("setting alpha to " + _arg1) + " tween ") + _tween));
super.alpha = _arg1;
if (_button){
_button.alpha = _arg1;
};
_rotation.alpha = _arg1;
}
private function createStandardPlayButton():void{
_button = new PlayOverlay();
addChild(_button);
onResize();
}
public function stopBuffering(_arg1:ClipEvent=null):void{
log.debug("stopBuffering()");
_rotationTimer.stop();
removeChildIfAdded(_rotation);
if (((((!(_tween)) && ((_player.state == State.BUFFERING)))) || ((_player.state == State.BUFFERING)))){
removeChildIfAdded(_button);
};
}
private function hide(_arg1:ClipEvent=null):void{
log.debug("hide()");
if (!this.parent){
return;
};
if (_player){
log.debug(((("fading out with speed " + _play.fadeSpeed) + " current alpha is ") + alpha));
_origAlpha = model.alpha;
_tween = _player.animationEngine.fadeOut(this, _play.fadeSpeed, onFadeOut, false);
} else {
onFadeOut();
};
}
private function arrangeRotation(_arg1:Number, _arg2:Number, _arg3:Number):void{
if (_rotationImage){
_rotationImage.height = _arg3;
_rotationImage.scaleX = _rotationImage.scaleY;
_rotationImage.x = (-(_rotationImage.width) / 2);
_rotationImage.y = (-(_rotationImage.height) / 2);
_rotation.x = ((_arg1 + (_rotationImage.width / 2)) + ((_arg2 - _rotationImage.width) / 2));
_rotation.y = ((_rotationImage.height / 2) + ((_arg3 - _rotationImage.height) / 2));
};
}
private function removeChildIfAdded(_arg1:DisplayObject):void{
if (!_arg1){
return;
};
if (_arg1.parent != this){
return;
};
log.debug(("removing child " + _arg1));
removeChild(_arg1);
}
private function createButton():void{
if (!_play.label){
createStandardPlayButton();
};
}
private function onFadeOut():void{
restoreOriginalAlpha();
if (((_tween) && (_tween.canceled))){
_tween = null;
return;
};
_tween = null;
log.debug("removing this from the screen");
_screen.hidePlay();
}
private function rotate(_arg1:TimerEvent):void{
_rotation.rotation = (_rotation.rotation + 10);
}
private function startBuffering(_arg1:ClipEvent=null):void{
log.debug("startBuffering()");
if (!_play.buffering){
return;
};
if (((_button) && ((_button.parent == this)))){
return;
};
addChild(_rotation);
show();
_rotationTimer.start();
}
public function onLoad(_arg1:Flowplayer):void{
log.debug("onLoad");
_player = _arg1;
if (((_play.label) && (_showButtonInitially))){
showButton(null, _play.label);
};
log.debug("dispatching complete");
_play.dispatch(PluginEventType.LOAD);
}
private function onMouseOut(_arg1:MouseEvent=null):void{
if (!_button){
return;
};
_button.alpha = Math.max(0, (model.alpha - 0.3));
}
public function setScreen(_arg1:Screen, _arg2:Boolean=false):void{
_screen = _arg1;
_showButtonInitially = _arg2;
if (_arg2){
showButton();
};
}
override protected function onResize():void{
log.debug(("onResise " + width));
if (!_button){
return;
};
onMouseOut();
if ((_button is LabelPlayButton)){
AbstractSprite(_button).setSize((width - 15), (height - 15));
} else {
_button.height = height;
_button.scaleX = _button.scaleY;
};
arrangeRotation(0, width, height);
Arrange.center(_button, width, height);
log.debug(("arranged to " + _button.width));
}
public function set label(_arg1:String):void{
if (!_player){
return;
};
log.debug((("set label '" + _arg1) + "'"));
if (((_arg1) && (((!(_button)) || (!((_button is LabelPlayButton))))))){
log.debug("switching to label button ");
switchButton(new LabelPlayButton(_player, _arg1));
};
if (((!(_arg1)) && (((!(_button)) || ((_button is LabelPlayButton)))))){
switchButton(new PlayOverlay());
};
if (_arg1){
LabelPlayButton(_button).setLabel(_arg1, _resizeToTextWidth);
};
onResize();
}
private function onMouseOver(_arg1:MouseEvent):void{
if (!_button){
return;
};
_button.alpha = model.alpha;
}
private function show():void{
if (_tween){
restoreOriginalAlpha();
log.debug("canceling fadeOut tween");
_tween.cancel();
};
if (_screen){
log.debug("calling screen.showPlay");
_screen.showPlay();
};
}
}
}//package org.flowplayer.view
Section 130
//PlayerEventDispatcher (org.flowplayer.view.PlayerEventDispatcher)
package org.flowplayer.view {
import org.flowplayer.model.*;
import flash.utils.*;
public class PlayerEventDispatcher extends EventDispatcher {
public function dispatchEvent(_arg1:PlayerEvent):void{
doDispatchEvent(_arg1, true);
}
public function dispatchBeforeEvent(_arg1:PlayerEvent):Boolean{
return (doDispatchBeforeEvent(_arg1, true));
}
public function onLoad(_arg1:Function):void{
setListener(PlayerEventType.LOAD, _arg1);
}
public function onFullscreen(_arg1:Function):void{
log.debug(("adding listener for fullscreen " + PlayerEventType.FULLSCREEN));
setListener(PlayerEventType.FULLSCREEN, _arg1);
}
override protected function get cancellableEvents():Dictionary{
return (PlayerEventType.cancellable);
}
public function dispatchError(_arg1:PlayerError, _arg2:Object=null):void{
doDispatchEvent(new PlayerEvent(_arg1.eventType, _arg1.code, _arg1.message, _arg2), true);
}
public function onUnmute(_arg1:Function):void{
setListener(PlayerEventType.UNMUTE, _arg1);
}
public function dispatch(_arg1:PlayerEventType, _arg2:Object=null):void{
doDispatchEvent(new PlayerEvent(_arg1, _arg2), true);
}
public function onFullscreenExit(_arg1:Function):void{
setListener(PlayerEventType.FULLSCREEN_EXIT, _arg1);
}
public function onVolume(_arg1:Function):void{
setListener(PlayerEventType.VOLUME, _arg1);
}
override protected function get allEvents():Dictionary{
return (PlayerEventType.all);
}
public function onMute(_arg1:Function):void{
setListener(PlayerEventType.MUTE, _arg1);
}
}
}//package org.flowplayer.view
Section 131
//PlayOverlay (org.flowplayer.view.PlayOverlay)
package org.flowplayer.view {
import flash.display.*;
public dynamic class PlayOverlay extends Sprite {
}
}//package org.flowplayer.view
Section 132
//PluginLoader (org.flowplayer.view.PluginLoader)
package org.flowplayer.view {
import org.flowplayer.model.*;
import org.flowplayer.controller.*;
import flash.display.*;
import flash.events.*;
import org.flowplayer.util.*;
import flash.utils.*;
import org.flowplayer.config.*;
import flash.net.*;
import com.adobe.utils.*;
import flash.system.*;
public class PluginLoader extends EventDispatcher {
private var _errorHandler:ErrorHandler;
private var log:Log;
private var _loadedCount:int;
private var _useExternalInterface:Boolean;
private var _swiffsToLoad:Array;
private var _loadErrorListener:Function;
private var _loadListener:Function;
private var _loadedPlugins:Dictionary;
private var _baseUrl:String;
private var _providers:Dictionary;
private var _callback:Function;
private var _pluginRegistry:PluginRegistry;
private var _loadables:Array;
public function PluginLoader(_arg1:String, _arg2:PluginRegistry, _arg3:ErrorHandler, _arg4:Boolean, _arg5:Function, _arg6:Function){
log = new Log(this);
super();
_baseUrl = _arg1;
_pluginRegistry = _arg2;
_errorHandler = _arg3;
_useExternalInterface = _arg4;
_loadListener = _arg5;
_loadErrorListener = _arg6;
_loadedCount = 0;
}
private function loaded(_arg1:Event):void{
var info:LoaderInfo;
var instanceUsed:Boolean;
var event = _arg1;
info = (event.target as LoaderInfo);
log.debug(("loaded class name " + getQualifiedClassName(info.content)));
instanceUsed = false;
_loadables.forEach(function (_arg1:Loadable, _arg2:int, _arg3:Array):void{
if (((!(_arg1.plugin)) && (hasSwiff(info.url, _arg1.url)))){
log.debug(("this is the swf for loadable " + _arg1));
initializePlugin(_arg1, createPluginInstance(instanceUsed, info.content));
instanceUsed = true;
};
});
if (++_loadedCount == _swiffsToLoad.length){
log.debug((("all plugin SWFs loaded. loaded total " + loadedCount) + " plugins"));
setConfigPlugins();
dispatchEvent(new Event(Event.COMPLETE, true, false));
};
if (_callback != null){
_callback();
};
}
public function get loadedCount():int{
return (_loadedCount);
}
private function hasSwiff(_arg1:String, _arg2:String):Boolean{
var _local3:int = _arg2.lastIndexOf("/");
var _local4:String = ((_local3 >= 0)) ? _arg2.substr(_local3) : _arg2;
return (StringUtil.endsWith(_arg1, _local4));
}
private function createPluginInstance(_arg1:Boolean, _arg2:DisplayObject):Object{
if (_arg2.hasOwnProperty("newPlugin")){
return (_arg2["newPlugin"]());
};
if (!_arg1){
log.debug(("using existing instance " + _arg2));
return (_arg2);
};
var _local3:String = getQualifiedClassName(_arg2);
log.info(("creating new " + _local3));
var _local4:Class = Class(getDefinitionByName(_local3));
return ((new (_local4) as DisplayObject));
}
private function constructUrl(_arg1:String):String{
if (_arg1.indexOf("..") >= 0){
return (_arg1);
};
if (_arg1.indexOf("/") >= 0){
return (_arg1);
};
return (URLUtil.addBaseURL(_baseUrl, _arg1));
}
private function getPluginSwiffUrls(_arg1:Array):Array{
var _local4:Loadable;
var _local2:Array = new Array();
var _local3:Number = 0;
while (_local3 < _arg1.length) {
_local4 = Loadable(_arg1[_local3]);
if (_local2.indexOf(_local4.url) < 0){
_local2.push(constructUrl(_local4.url));
};
_local3++;
};
return (_local2);
}
public function get providers():Dictionary{
return (_providers);
}
public function load(_arg1:Array):void{
var urls:Dictionary;
var loader:Loader;
var url:String;
var plugins = _arg1;
log.debug("load()");
_providers = new Dictionary();
_loadables = plugins;
_swiffsToLoad = getPluginSwiffUrls(plugins);
if (((!(_loadables)) || ((_loadables.length == 0)))){
log.info("Not loading any plugins.");
return;
};
_loadedPlugins = new Dictionary();
_loadedCount = 0;
var loaderContext:LoaderContext = new LoaderContext();
loaderContext.applicationDomain = ApplicationDomain.currentDomain;
if (!URLUtil.localDomain(_baseUrl)){
loaderContext.securityDomain = SecurityDomain.currentDomain;
};
urls = new Dictionary();
var i:Number = 0;
while (i < _swiffsToLoad.length) {
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);
url = _swiffsToLoad[i];
urls[loader.contentLoaderInfo] = url;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (_arg1:IOErrorEvent):void{
onIoError(_arg1, urls);
});
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
log.debug(("starting to load plugin from url " + _swiffsToLoad[i]));
loader.load(new URLRequest(url), loaderContext);
i = (i + 1);
};
}
public function get plugins():Dictionary{
return (_loadedPlugins);
}
private function onIoError(_arg1:IOErrorEvent, _arg2:Dictionary):void{
_errorHandler.handleError(PlayerError.PLUGIN_LOAD_FAILED, ((("Unable to load plugin using url '" + _arg2[LoaderInfo(_arg1.target)]) + "': ") + _arg1.text));
}
private function onProgress(_arg1:ProgressEvent):void{
log.debug("load in progress");
}
public function loadPlugin(_arg1:Loadable, _arg2:Function=null):void{
_callback = _arg2;
load([_arg1]);
}
private function initializePlugin(_arg1:Loadable, _arg2:Object):void{
var _local3:PluginModel;
log.debug(((("initializing plugin for loadable " + _arg1) + ", instance ") + _arg2));
_loadedPlugins[_arg1] = _arg2;
log.debug(("pluginInstance " + _arg2));
if ((_arg2 is FontProvider)){
_pluginRegistry.registerFont(FontProvider(_arg2).fontFamily);
} else {
if ((_arg2 is DisplayObject)){
_local3 = Loadable(_arg1).createDisplayPlugin((_arg2 as DisplayObject));
_pluginRegistry.registerDisplayPlugin((_local3 as DisplayPluginModel), (_arg2 as DisplayObject));
} else {
if ((_arg2 is StreamProvider)){
_local3 = Loadable(_arg1).createProvider(_arg2);
_providers[_local3.name] = _arg2;
_pluginRegistry.registerProvider((_local3 as ProviderModel), _arg2);
} else {
log.error(("unknown plugin type " + _arg2));
};
};
};
if ((_arg2 is Plugin)){
_local3.onLoad(_loadListener);
_local3.onError(_loadErrorListener);
};
if ((((_local3 is Callable)) && (_useExternalInterface))){
ExternalInterfaceHelper.initializeInterface((_local3 as Callable), _arg2);
};
}
public function setConfigPlugins():void{
_loadables.forEach(function (_arg1:Loadable, _arg2:int, _arg3:Array):void{
var _local4:Object = plugins[_arg1];
log.info(((((_arg2 + ": setting config to ") + _local4) + ", ") + _arg1));
if ((_local4 is NetStreamControllingStreamProvider)){
log.debug(("NetStreamControllingStreamProvider(pluginInstance).config = " + _arg1.plugin));
NetStreamControllingStreamProvider(_local4).config = _arg1.plugin;
} else {
if (_local4.hasOwnProperty("onConfig")){
_local4.onConfig(_arg1.plugin);
};
};
});
}
}
}//package org.flowplayer.view
Section 133
//PluginRegistry (org.flowplayer.view.PluginRegistry)
package org.flowplayer.view {
import org.flowplayer.model.*;
import org.flowplayer.controller.*;
import flash.display.*;
import org.flowplayer.util.*;
import flash.utils.*;
public class PluginRegistry {
private var log:Log;
private var _fonts:Array;
private var _panel:Panel;
private var _flowPlayer:FlowplayerBase;
private var _originalProps:Dictionary;
private var _plugins:Dictionary;
private var _providers:Dictionary;
public function PluginRegistry(_arg1:Panel){
log = new Log(this);
_plugins = new Dictionary();
_originalProps = new Dictionary();
_providers = new Dictionary();
_fonts = new Array();
super();
_panel = _arg1;
}
public function getPluginByDisplay(_arg1:DisplayObject):DisplayProperties{
var _local2:DisplayProperties;
for each (_local2 in _plugins) {
if (_local2.getDisplayObject() == _arg1){
updateZIndex(_local2);
return (_local2);
};
};
return (null);
}
public function get fonts():Array{
return (_fonts);
}
function registerFont(_arg1:String):void{
_fonts.push(_arg1);
}
public function updateDisplayProperties(_arg1:DisplayProperties, _arg2:Boolean=false):void{
Assert.notNull(_arg1.name, "displayProperties.name cannot be null");
var _local3:DisplayObject = DisplayProperties(_plugins[_arg1.name]).getDisplayObject();
if (_local3){
_arg1.setDisplayObject(_local3);
};
_plugins[_arg1.name] = _arg1.clone();
if (_arg2){
_originalProps[_arg1.name] = _arg1.clone();
};
}
function removePlugin(_arg1:PluginModel):void{
delete _plugins[_arg1.name];
delete _originalProps[_arg1.name];
delete _providers[_arg1.name];
if ((_arg1 is DisplayPluginModel)){
_panel.removeView(DisplayPluginModel(_arg1).getDisplayObject());
};
}
function setPlayerToPlugin(_arg1:Object):void{
var pluginObj:Object;
var plugin = _arg1;
try {
if ((plugin is DisplayProperties)){
pluginObj = DisplayProperties(plugin).getDisplayObject();
} else {
pluginObj = ProviderModel(plugin).getProviderObject();
};
if ((pluginObj is NetStreamControllingStreamProvider)){
log.debug(("setting player to " + pluginObj));
NetStreamControllingStreamProvider(pluginObj).player = (_flowPlayer as Flowplayer);
} else {
var _local3 = pluginObj;
_local3["onLoad"](_flowPlayer);
};
log.debug(("onLoad() successfully executed for plugin " + plugin));
} catch(e:Error) {
if ((pluginObj is Plugin)){
throw (e);
};
log.warn(("was not able to initialize player to plugin: " + e.message));
};
}
public function getOriginalProperties(_arg1:String):DisplayProperties{
return ((clone(_originalProps[_arg1]) as DisplayProperties));
}
private function clone(_arg1:Object):Object{
return ((((_arg1) && ((_arg1 is Cloneable)))) ? Cloneable(_arg1).clone() : _arg1);
}
public function get providers():Dictionary{
return (_providers);
}
private function setPlayerToPlugins(_arg1:Dictionary):void{
var _local2:Object;
for each (_local2 in _arg1) {
setPlayerToPlugin(_local2);
};
}
function updateDisplayPropertiesForDisplay(_arg1:DisplayObject, _arg2:Object):void{
var _local3:DisplayProperties = getPluginByDisplay(_arg1);
if (_local3){
new PropertyBinder(_local3).copyProperties(_arg2);
updateDisplayProperties(_local3);
};
}
public function get plugins():Dictionary{
return (_plugins);
}
private function updateZIndex(_arg1:DisplayProperties):void{
var _local2:int = _panel.getZIndex(_arg1.getDisplayObject());
if (_local2 >= 0){
_arg1.zIndex = _local2;
};
}
public function getPlugin(_arg1:String):Object{
var _local2:Object = ((_plugins[_arg1]) || (_providers[_arg1]));
log.debug(("found plugin " + _local2));
if ((_local2 is DisplayProperties)){
updateZIndex((_local2 as DisplayProperties));
};
return (clone(_local2));
}
function onLoad(_arg1:FlowplayerBase):void{
_flowPlayer = _arg1;
setPlayerToPlugins(_plugins);
setPlayerToPlugins(_providers);
}
function registerDisplayPlugin(_arg1:DisplayProperties, _arg2:DisplayObject):void{
_arg1.setDisplayObject(_arg2);
_plugins[_arg1.name] = _arg1;
_originalProps[_arg1.name] = _arg1.clone();
}
function registerProvider(_arg1:ProviderModel, _arg2:Object):void{
_providers[_arg1.name] = _arg1;
}
function addPluginEventListener(_arg1:Function):void{
var _local2:Object;
for each (_local2 in _plugins) {
if ((_local2 is PluginModel)){
PluginModel(_local2).onPluginEvent(_arg1);
};
};
}
}
}//package org.flowplayer.view
Section 134
//Preloader (org.flowplayer.view.Preloader)
package org.flowplayer.view {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.utils.*;
public class Preloader extends MovieClip {
private var _percent:TextField;
private var _app:DisplayObject;
public function Preloader(){
stop();
if (loaderInfo.bytesLoaded == loaderInfo.bytesTotal){
init();
return;
};
_percent = new TextField();
var _local1:TextFormat = new TextFormat();
_local1.font = "Lucida Grande, Lucida Sans Unicode, Bitstream Vera, Verdana, Arial, _sans, _serif";
_percent.defaultTextFormat = _local1;
_percent.text = "Loading...";
addChild(_percent);
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
private function init(_arg1:Event=null):void{
if (_percent){
removeChild(_percent);
};
nextFrame();
prepareStage();
var _local2:Class = Class(getDefinitionByName("org.flowplayer.view.Launcher"));
_app = (new (_local2) as DisplayObject);
addChild((_app as DisplayObject));
}
private function onLoadProgress(_arg1:ProgressEvent):void{
var _local2:Number = Math.floor(((_arg1.bytesLoaded * 100) / _arg1.bytesTotal));
graphics.clear();
_percent.text = (_local2 + "%");
_percent.x = ((stage.stageWidth / 2) - (_percent.textWidth / 2));
_percent.y = ((stage.stageHeight / 2) - (_percent.textHeight / 2));
}
private function onAddedToStage(_arg1:Event):void{
loaderInfo.addEventListener(ProgressEvent.PROGRESS, onLoadProgress);
loaderInfo.addEventListener(Event.COMPLETE, init);
}
private function prepareStage():void{
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
}
}
}//package org.flowplayer.view
Section 135
//Screen (org.flowplayer.view.Screen)
package org.flowplayer.view {
import org.flowplayer.model.*;
import org.flowplayer.view.*;
import org.flowplayer.controller.*;
import flash.display.*;
import org.flowplayer.util.*;
import flash.utils.*;
import flash.geom.*;
class Screen extends AbstractSprite {
private var _prevClip:Clip;
private var _displayFactory:MediaDisplayFactory;
private var _displays:Dictionary;
private var _playList:Playlist;
private var _animatioEngine:AnimationEngine;
private var _fullscreenManaer:FullscreenManager;
private var _pluginRegistry:PluginRegistry;
private var _resizer:ClipResizer;
function Screen(_arg1:Playlist, _arg2:AnimationEngine, _arg3:PlayButtonOverlay, _arg4:PluginRegistry){
_displayFactory = new MediaDisplayFactory(_arg1);
_resizer = new ClipResizer(_arg1, this);
createDisplays(_arg1);
addListeners(_arg1);
_playList = _arg1;
_animatioEngine = _arg2;
_pluginRegistry = _arg4;
}
private function arrangePlay():void{
if (playView){
playView.setSize(play.dimensions.width.toPx(this.width), play.dimensions.height.toPx(this.height));
Arrange.center(playView, width, height);
if (playView.parent == this){
setChildIndex(playView, (numChildren - 1));
};
};
}
private function onStart(_arg1:ClipEvent):void{
var _local2:Clip = (_arg1.target as Clip);
if (_local2.isNullClip){
return;
};
var _local3:Boolean = (_arg1.info as Boolean);
if (((((_local3) && (_playList.previousClip))) && ((_playList.previousClip.type == ClipType.IMAGE)))){
log.debug("autoBuffering next clip on a splash image, will not show next display");
setDisplayVisibleIfHidden(_playList.previousClip);
if ((((_local2.type == ClipType.AUDIO)) && (_local2.image))){
return;
};
_local2.onResume(onFirstFrameResume);
return;
};
if (((_playList.previousClip) && ((_local2.type == ClipType.AUDIO)))){
log.debug("this is an audio clip, will check if previous clip was an image that should stay visible");
if ((((_playList.previousClip.type == ClipType.IMAGE)) && (_local2.image))){
log.debug("previous image stays visible");
setDisplayVisibleIfHidden(_playList.previousClip);
} else {
log.debug("hiding all displays for this audio clip");
hideAllDisplays();
};
_prevClip = _local2;
return;
};
setDisplayVisibleIfHidden(_local2);
}
private function showDisplay(_arg1:ClipEvent):void{
log.info("showDisplay()");
var _local2:Clip = (_arg1.target as Clip);
if (_local2.isNullClip){
return;
};
setDisplayVisible(_local2, true);
_prevClip = _local2;
log.info("showDisplay done");
}
private function createDisplays(_arg1:Playlist):void{
var _local4:Clip;
_displays = new Dictionary();
var _local2:Array = _arg1.clips;
var _local3:Number = 0;
while (_local3 < _local2.length) {
_local4 = _local2[_local3];
if (!_local4.isNullClip){
createDisplay(_local4);
};
_local3++;
};
}
public function set mediaController(_arg1:MediaController):void{
}
private function setDisplayVisible(_arg1:Clip, _arg2:Boolean):void{
var disp:DisplayObject;
var clipNow = _arg1;
var visible = _arg2;
disp = _displays[clipNow];
log.debug(((((("display " + disp) + ", ") + disp.name) + ", will be made ") + (visible) ? "visible" : "hidden"));
if (visible){
MediaDisplay(disp).init(clipNow);
disp.visible = true;
disp.alpha = 0;
hideAllDisplays((disp as MediaDisplay));
log.debug(("starting fadeIn for " + disp));
_animatioEngine.animateProperty(disp, "alpha", 1, clipNow.fadeInSpeed);
Arrange.center(disp, width, height);
} else {
if (disp.visible){
_animatioEngine.animateProperty(disp, "alpha", 0, clipNow.fadeOutSpeed, function ():void{
disp.visible = false;
});
return;
};
};
}
private function fallbackDisplayBounds():Rectangle{
return (new Rectangle(0, 0, stage.stageWidth, stage.stageHeight));
}
private function hideAllDisplays(_arg1:MediaDisplay=null):void{
var _local4:Clip;
var _local5:MediaDisplay;
var _local2:Array = _playList.clips;
var _local3:Number = 0;
while (_local3 < _local2.length) {
_local4 = (_local2[_local3] as Clip);
_local5 = _displays[_local4];
if (((!(_arg1)) || (!((_local5 == _arg1))))){
setDisplayVisible((_local2[_local3] as Clip), false);
};
_local3++;
};
}
function showPlay():void{
log.debug("showPlay");
addChild(playView);
playView.visible = true;
playView.alpha = play.alpha;
arrangePlay();
log.debug(("play bounds: " + Arrange.describeBounds(playView)));
log.debug(("play parent: " + playView.parent));
}
private function setDisplayVisibleIfHidden(_arg1:Clip):void{
var _local2:DisplayObject = _displays[_arg1];
if ((((_local2.alpha < 1)) || (!(_local2.visible)))){
setDisplayVisible(_arg1, true);
};
}
function hidePlay():void{
if (playView.parent == this){
removeChild(playView);
};
}
public function getDisplayBounds():Rectangle{
var _local3:Rectangle;
var _local1:Clip = _playList.current;
var _local2:DisplayObject = _displays[_local1];
if (!_local2){
return (fallbackDisplayBounds());
};
if (((!(_local2.visible)) && (_prevClip))){
_local1 = _prevClip;
_local2 = _displays[_local1];
};
if (!((_local2) && (_local2.visible))){
return (fallbackDisplayBounds());
};
if (_local1.width > 0){
_local3 = new Rectangle(_local2.x, _local2.y, _local1.width, _local1.height);
log.debug(((("disp size is " + _local3.width) + " x ") + _local3.height));
return (_local3);
};
return (fallbackDisplayBounds());
}
private function onPlaylistChanged(_arg1:ClipEvent):void{
log.info("onPlaylistChanged()");
_prevClip = null;
removeDisplays(ClipEventSupport(_arg1.info).clips);
createDisplays(Playlist(_arg1.target));
}
public function set fullscreenManager(_arg1:FullscreenManager):void{
_fullscreenManaer = _arg1;
}
private function addListeners(_arg1:ClipEventSupport):void{
_arg1.onPlaylistReplace(onPlaylistChanged);
_arg1.onBufferFull(onBufferFull);
_arg1.onStart(onStart);
}
private function createDisplay(_arg1:Clip):void{
var _local2:DisplayObject = _displayFactory.createMediaDisplay(_arg1);
_local2.width = this.width;
_local2.height = this.height;
_local2.visible = false;
addChild(_local2);
_displays[_arg1] = _local2;
}
private function onFirstFrameResume(_arg1:ClipEvent):void{
var _local2:Clip = (_arg1.target as Clip);
_local2.unbind(onFirstFrameResume);
showDisplay(_arg1);
}
private function removeDisplays(_arg1:Array):void{
var _local2:Number = 0;
while (_local2 < _arg1.length) {
removeChild(_displays[_arg1[_local2]]);
_local2++;
};
}
function resized(_arg1:Clip):void{
var _local2:DisplayObject = _displays[_arg1];
_local2.width = _arg1.width;
_local2.height = _arg1.height;
if (((_arg1.accelerated) && (_fullscreenManaer.isFullscreen))){
log.debug("in hardware accelerated fullscreen, will not center the clip");
_local2.x = 0;
_local2.y = 0;
return;
};
Arrange.center(_local2, width, height);
log.debug(("screen arranged to " + Arrange.describeBounds(this)));
log.info(((("display of clip " + _arg1) + " arranged to ") + Arrange.describeBounds(_local2)));
}
private function get play():DisplayProperties{
return (DisplayProperties(_pluginRegistry.getPlugin("play")));
}
private function onBufferFull(_arg1:ClipEvent):void{
var _local3:MediaDisplay;
var _local2:Clip = (_arg1.target as Clip);
if (_local2.type == ClipType.IMAGE){
showDisplay(_arg1);
};
if (_local2.type == ClipType.VIDEO){
_local3 = _displays[_local2];
_local3.init(_local2);
if (_local2.live){
showDisplay(_arg1);
};
};
}
private function get playView():AbstractSprite{
if (!play){
return (null);
};
return ((play.getDisplayObject() as AbstractSprite));
}
override protected function onResize():void{
log.debug("arrange");
_resizer.setMaxSize(width, height);
resizeClip(_playList.previousClip);
resizeClip(_playList.current);
arrangePlay();
}
private function resizeClip(_arg1:Clip):void{
var _local2:MediaSize;
if (!_arg1){
return;
};
if (!_arg1.getContent()){
log.warn(("clip does not have content, cannot resize. Clip " + _arg1));
};
if (((_arg1) && (_arg1.getContent()))){
if (_fullscreenManaer.isFullscreen){
_local2 = ((_arg1.scaling == MediaSize.ORIGINAL)) ? MediaSize.FITTED_PRESERVING_ASPECT_RATIO : _arg1.scaling;
_resizer.resizeClipTo(_arg1, (_arg1.accelerated) ? MediaSize.ORIGINAL : _local2);
} else {
_resizer.resizeClipTo(_arg1, _arg1.scaling);
};
};
}
}
}//package org.flowplayer.view
Section 136
//Styleable (org.flowplayer.view.Styleable)
package org.flowplayer.view {
public interface Styleable {
function animate(_arg1:Object):Object;
function css(_arg1:Object=null):Object;
}
}//package org.flowplayer.view
Section 137
//StyleableSprite (org.flowplayer.view.StyleableSprite)
package org.flowplayer.view {
import org.flowplayer.layout.*;
import org.flowplayer.controller.*;
import flash.display.*;
import org.flowplayer.util.*;
import flash.utils.*;
public class StyleableSprite extends AbstractSprite implements Styleable {
private var _errorHandler:ErrorHandler;
private var _border:Sprite;
private var _redrawing:Boolean;
private var _image:DisplayObject;
private var _imageHolder:Sprite;
private var _imageMask:DisplayObject;
private var _style:FlowStyleSheet;
private var _loader:ResourceLoader;
public function StyleableSprite(_arg1:String=null, _arg2:ErrorHandler=null, _arg3:ResourceLoader=null){
_errorHandler = _arg2;
_loader = _arg3;
if (((_arg1) && (_arg3))){
_style = new FlowStyleSheet(_arg1);
loadOrDrawBackground();
};
}
override public function setSize(_arg1:Number, _arg2:Number):void{
super.setSize(_arg1, _arg2);
redraw();
}
private function setChildIndexes():void{
if (_imageHolder){
setChildIndex(_imageHolder, 0);
};
}
private function addStyleRules(_arg1:String, _arg2:Object):void{
if (_arg1 == _style.rootStyleName){
_style.addToRootStyle(_arg2);
onSetRootStyle(_style.rootStyle);
loadOrDrawBackground();
} else {
_style.addStyleRules(_arg1, _arg2);
onSetStyleObject(_arg1, _arg2);
};
}
private function arrangeBackgroundImage():void{
var _local1:Length;
var _local2:Length;
if (!_image){
return;
};
createImageHolder();
if (_style.backgroundRepeat){
repeatBackground(_image);
} else {
addBackgroundImage(_image);
_local1 = _style.backgroundImageX;
_local2 = _style.backgroundImageY;
log.debug(("background image xPos " + _local1));
log.debug(("background image yPos " + _local2));
if (_local1.px >= 0){
_imageHolder.x = _local1.px;
} else {
if (_local1.pct > 0){
_imageHolder.x = (((_local1.pct / 100) * width) - (_imageHolder.width / 2));
};
};
if (_local2.px >= 0){
_imageHolder.y = _local2.px;
} else {
if (_local2.pct > 0){
_imageHolder.y = (((_local2.pct / 100) * height) - (_imageHolder.height / 2));
};
};
};
}
public function css(_arg1:Object=null):Object{
var _local3:String;
_redrawing = true;
log.debug(("css " + _arg1));
if (!_arg1){
return (_style.rootStyle);
};
var _local2:Object;
for (_local3 in _arg1) {
if (FlowStyleSheet.ROOT_STYLE_PROPS.indexOf(_local3) >= 0){
if (!_local2){
_local2 = new Object();
};
log.debug(((_local3 + " will affect root style, new value ") + _arg1[_local3]));
_local2[_local3] = _arg1[_local3];
} else {
log.debug(("updating style of " + _local3));
addStyleRules(_local3, _arg1[_local3]);
};
};
if (_local2){
addStyleRules(_style.rootStyleName, _local2);
};
return (_style.rootStyle);
}
protected function onSetStyleObject(_arg1:String, _arg2:Object):void{
}
private function loadBackgroundImage():void{
var _local1:String = _style.backgroundImage;
if (!_local1){
return;
};
if (_local1.indexOf("url(") == 0){
_local1 = _local1.substring(4, (_local1.length - 1));
};
if (!_loader){
throw (new Error("ResourceLoader not available, cannot load backgroundImage"));
};
_loader.load(_local1, onImageLoaded);
}
protected function createMask():Sprite{
var _local1:Sprite = new Sprite();
_local1.graphics.beginFill(0);
GraphicsUtil.drawRoundRectangle(_local1.graphics, 0, 0, width, height, _style.borderRadius);
return (_local1);
}
private function drawBackground():void{
graphics.clear();
if (!_style.backgroundTransparent){
log.debug(("drawing background color " + _style.backgroundColor));
graphics.beginFill(_style.backgroundColor);
GraphicsUtil.drawRoundRectangle(graphics, 0, 0, width, height, _style.borderRadius);
graphics.endFill();
} else {
log.debug("background color is transparent");
};
if (_style.backgroundGradient){
log.debug("adding gradient");
GraphicsUtil.addGradient(this, (_imageHolder) ? getChildIndex(_imageHolder) : 0, _style.backgroundGradient, _style.borderRadius);
} else {
GraphicsUtil.removeGradient(this);
};
}
public function addToRootStyle(_arg1:Object):void{
_style.addToRootStyle(_arg1);
onAddToRootStyle();
loadOrDrawBackground();
}
private function onAddToRootStyle():void{
}
private function createImageHolder():void{
removeBackgroundImage();
_imageHolder = new Sprite();
addChild(_imageHolder);
_imageMask = createMask();
addChild(_imageMask);
_imageHolder.mask = _imageMask;
_imageHolder.x = 0;
_imageHolder.y = 0;
}
private function clone(_arg1:DisplayObject):DisplayObject{
if (!_arg1){
return (null);
};
if ((_arg1 is Bitmap)){
return (new Bitmap(Bitmap(_arg1).bitmapData));
};
if ((_arg1 is Loader)){
return (clone(Loader(_arg1).content));
};
var _local2:Class = (getDefinitionByName(getQualifiedClassName(_arg1)) as Class);
return ((new (_local2) as DisplayObject));
}
final public function set rootStyle(_arg1:Object):void{
log.debug(("setting root style to " + this));
if (!_style){
_style = new FlowStyleSheet(getQualifiedClassName(this));
};
_style.rootStyle = _arg1;
onSetRootStyle(_arg1);
loadOrDrawBackground();
}
private function drawBorder():void{
if (((_border) && ((_border.parent == this)))){
removeChild(_border);
};
if (!(_style.borderWidth) > 0){
return;
};
_border = new Sprite();
addChild(_border);
log.info(("border weight is " + _style.borderWidth));
_border.graphics.lineStyle(_style.borderWidth, _style.borderColor);
GraphicsUtil.drawRoundRectangle(_border.graphics, 0, 0, width, height, _style.borderRadius);
}
private function onImageLoaded(_arg1:ResourceLoader):void{
_image = (_arg1.getContent() as DisplayObject);
log.debug(("received bacground image " + _image));
redraw();
}
final public function set style(_arg1:FlowStyleSheet):void{
log.debug("set style");
_style = _arg1;
onSetStyle(_arg1);
loadOrDrawBackground();
}
public function get redrawing():Boolean{
return (_redrawing);
}
protected function set loader(_arg1:ResourceLoader):void{
log.debug("got loader");
_loader = _arg1;
}
public function animate(_arg1:Object):Object{
return (_style.rootStyle);
}
private function removeBackgroundImage():Boolean{
if (_imageHolder){
log.debug("removing background image");
removeChild(_imageHolder);
_imageHolder = null;
return (true);
};
return (false);
}
private function loadOrDrawBackground():void{
if (_style.backgroundImage){
log.debug(("stylesheet specified a background image " + _style.backgroundImage));
loadBackgroundImage();
} else {
_image = null;
removeBackgroundImage();
redraw();
};
}
protected function onSetRootStyle(_arg1:Object):void{
}
protected function onSetStyle(_arg1:FlowStyleSheet):void{
}
private function repeatBackground(_arg1:DisplayObject):void{
var _local5:int;
var _local6:DisplayObject;
var _local7:DisplayObject;
var _local2:int = Math.round((width / _arg1.width));
var _local3:int = Math.round((height / _arg1.height));
log.debug(((_local2 + ", ") + _local3));
var _local4:int;
while (_local4 <= _local2) {
_local5 = 0;
while (_local5 <= _local3) {
_local6 = clone(_arg1);
if (!_local6){
return;
};
_local7 = addBackgroundImage(_local6);
_local7.x = (_local4 * _arg1.width);
_local7.y = (_local5 * _arg1.height);
log.debug(((("added backgound at " + _local7.x) + ", ") + _local7.y));
_local5++;
};
_local4++;
};
}
final public function get style():FlowStyleSheet{
return (_style);
}
protected function onRedraw():void{
}
private function redraw():void{
if (!style){
onRedraw();
return;
};
drawBackground();
arrangeBackgroundImage();
drawBorder();
setChildIndexes();
onRedraw();
_redrawing = false;
}
protected function get bgImageHolder():Sprite{
return (_imageHolder);
}
private function addBackgroundImage(_arg1:DisplayObject):DisplayObject{
_imageHolder.addChild(_arg1);
return (_arg1);
}
}
}//package org.flowplayer.view
Section 138
//VideoDisplay (org.flowplayer.view.VideoDisplay)
package org.flowplayer.view {
import org.flowplayer.model.*;
import org.flowplayer.view.*;
import flash.display.*;
import org.flowplayer.util.*;
import flash.media.*;
class VideoDisplay extends AbstractSprite implements MediaDisplay {
private var _clip:Clip;
private var _overlay:Sprite;
private var video:Video;
function VideoDisplay(_arg1:Clip){
_clip = _arg1;
createOverlay();
}
override public function toString():String{
return (("[VideoDisplay] for clip " + _clip));
}
public function init(_arg1:Clip):void{
_clip = _arg1;
log.info(("init " + _clip));
if (video){
removeChild(video);
};
video = (_arg1.getContent() as Video);
if (video == null){
log.warn(("no video content in clip " + _arg1));
return;
};
video.width = this.width;
video.height = this.height;
addChild(video);
swapChildren(_overlay, video);
}
private function createOverlay():void{
_overlay = new Sprite();
addChild(_overlay);
_overlay.graphics.beginFill(0, 0);
_overlay.graphics.drawRect(0, 0, 10, 10);
_overlay.graphics.endFill();
}
override protected function onResize():void{
Arrange.sameSize(_overlay, this);
}
override public function set alpha(_arg1:Number):void{
super.alpha = _arg1;
if (video){
video.alpha = _arg1;
log.debug(((("display of + " + _clip) + " new alpha ") + video.alpha));
} else {
log.debug("set alpha() no video available");
};
}
public function hasContent():Boolean{
return (!((video == null)));
}
}
}//package org.flowplayer.view
Section 139
//WrapperForIE (org.flowplayer.view.WrapperForIE)
package org.flowplayer.view {
import org.flowplayer.view.*;
class WrapperForIE {
private var _player:Flowplayer;
function WrapperForIE(_arg1:Flowplayer){
_player = _arg1;
}
public function fp_pause():void{
_player.pause();
}
public function fp_resume():void{
_player.resume();
}
public function fp_stop():void{
_player.stop();
}
public function fp_close():void{
_player.close();
}
}
}//package org.flowplayer.view
Section 140
//flow_internal (org.flowplayer.flow_internal)
package org.flowplayer {
public namespace flow_internal = "http://flowplayer.org/core/internal";
}//package org.flowplayer
Section 141
//LabelHolderLeft (org.flowplayer.LabelHolderLeft)
package org.flowplayer {
import flash.display.*;
public dynamic class LabelHolderLeft extends Sprite {
}
}//package org.flowplayer
Section 142
//DuplicateManagerError (org.goasap.errors.DuplicateManagerError)
package org.goasap.errors {
public class DuplicateManagerError extends Error {
public function DuplicateManagerError(_arg1:String){
super((("An instance of " + _arg1) + " was already added to GoEngine."));
}
}
}//package org.goasap.errors
Section 143
//EasingFormatError (org.goasap.errors.EasingFormatError)
package org.goasap.errors {
public class EasingFormatError extends Error {
public function EasingFormatError(){
super("Easing function not valid.");
}
}
}//package org.goasap.errors
Section 144
//InstanceNotAllowedError (org.goasap.errors.InstanceNotAllowedError)
package org.goasap.errors {
public class InstanceNotAllowedError extends Error {
public function InstanceNotAllowedError(_arg1:String){
super((("Direct use of " + _arg1) + " is not allowed, use subclasses only."));
}
}
}//package org.goasap.errors
Section 145
//GoEvent (org.goasap.events.GoEvent)
package org.goasap.events {
import flash.events.*;
public class GoEvent extends Event {
public var extra;
public static const CYCLE:String = "playableCycle";
public static const START:String = "playableStart";
public static const RESUME:String = "playableResume";
public static const UPDATE:String = "playableUpdate";
public static const STOP:String = "playableStop";
public static const PAUSE:String = "playablePause";
public static const COMPLETE:String = "playableComplete";
public function GoEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
}
}//package org.goasap.events
Section 146
//ILiveManager (org.goasap.interfaces.ILiveManager)
package org.goasap.interfaces {
public interface ILiveManager extends IManager {
function onUpdate(_arg1:int, _arg2:Array, _arg3:Number):void;
}
}//package org.goasap.interfaces
Section 147
//IManageable (org.goasap.interfaces.IManageable)
package org.goasap.interfaces {
public interface IManageable extends IUpdatable {
function isHandling(_arg1:Array):Boolean;
function releaseHandling(... _args):void;
function getActiveTargets():Array;
function getActiveProperties():Array;
}
}//package org.goasap.interfaces
Section 148
//IManager (org.goasap.interfaces.IManager)
package org.goasap.interfaces {
public interface IManager {
function reserve(_arg1:IManageable):void;
function release(_arg1:IManageable):void;
}
}//package org.goasap.interfaces
Section 149
//IPlayable (org.goasap.interfaces.IPlayable)
package org.goasap.interfaces {
public interface IPlayable extends IPlayableBase {
function stop():Boolean;
function pause():Boolean;
function start():Boolean;
function skipTo(_arg1:Number):Boolean;
function resume():Boolean;
}
}//package org.goasap.interfaces
Section 150
//IPlayableBase (org.goasap.interfaces.IPlayableBase)
package org.goasap.interfaces {
import flash.events.*;
public interface IPlayableBase extends IEventDispatcher {
function get playableID();
function get state():String;
function set playableID(_arg1):void;
}
}//package org.goasap.interfaces
Section 151
//IUpdatable (org.goasap.interfaces.IUpdatable)
package org.goasap.interfaces {
public interface IUpdatable {
function update(_arg1:Number):void;
function get pulseInterval():int;
}
}//package org.goasap.interfaces
Section 152
//GoItem (org.goasap.items.GoItem)
package org.goasap.items {
import org.goasap.interfaces.*;
import org.goasap.*;
public class GoItem extends PlayableBase implements IUpdatable {
protected var _pulse:int;
public var useRelative:Boolean;
public var useRounding:Boolean;
public static var defaultUseRounding:Boolean = false;
public static var defaultUseRelative:Boolean = false;
public static var defaultPulseInterval:Number = GoEngine.ENTER_FRAME;
public static var timeMultiplier:Number = 1;
public function GoItem(){
useRounding = defaultUseRounding;
useRelative = defaultUseRelative;
_pulse = defaultPulseInterval;
super();
}
public function correctValue(_arg1:Number):Number{
if (isNaN(_arg1)){
return (0);
};
if (useRounding){
_arg1 = (((_arg1 % 1))==0) ? _arg1 : (((_arg1 % 1))>=0.5) ? (int(_arg1) + 1) : int(_arg1);
return (_arg1);
};
return (_arg1);
}
public function update(_arg1:Number):void{
}
public function set pulseInterval(_arg1:int):void{
if ((((_state == STOPPED)) && ((((_arg1 >= 0)) || ((_arg1 == GoEngine.ENTER_FRAME)))))){
_pulse = _arg1;
};
}
public function get pulseInterval():int{
return (_pulse);
}
}
}//package org.goasap.items
Section 153
//LinearGo (org.goasap.items.LinearGo)
package org.goasap.items {
import flash.utils.*;
import org.goasap.events.*;
import org.goasap.interfaces.*;
import org.goasap.managers.*;
import org.goasap.*;
import org.goasap.errors.*;
public class LinearGo extends GoItem implements IPlayable {
protected var _delay:Number;
protected var _extraEaseParams:Array;
protected var _endTime:Number;
protected var _currentEasing:Function;
protected var _useFrames:Boolean;
protected var _position:Number;
protected var _tweenDuration:Number;
protected var _easeParams:Array;
protected var _started:Boolean;// = false
protected var _easing:Function;
protected var _change:Number;
protected var _startTime:Number;
protected var _currentFrame:int;
protected var _callbacks:Object;
protected var _pauseTime:Number;
protected var _repeater:LinearGoRepeater;
protected var _duration:Number;
public static var defaultDelay:Number = 0;
public static var defaultEasing:Function;
protected static var _useFramesMode:Boolean = false;
public static var defaultDuration:Number = 1;
protected static var _framesBase:Number = 1;
public function LinearGo(_arg1:Number=NaN, _arg2:Number=NaN, _arg3:Function=null, _arg4:Array=null, _arg5:LinearGoRepeater=null, _arg6:Boolean=false, _arg7:Boolean=false, _arg8:Boolean=false, _arg9:Number=NaN){
var delay = _arg1;
var duration = _arg2;
var easing = _arg3;
var extraEasingParams = _arg4;
var repeater = _arg5;
var useRelative = _arg6;
var useRounding = _arg7;
var useFrames = _arg8;
var pulseInterval = _arg9;
_callbacks = new Object();
super();
if (isNaN(defaultDelay)){
defaultDelay = 0;
};
if (isNaN(defaultDuration)){
defaultDuration = 1;
};
try {
this.easing = defaultEasing;
} catch(e1:EasingFormatError) {
defaultEasing = easeOut;
};
if (!isNaN(delay)){
_delay = delay;
} else {
_delay = defaultDelay;
};
if (!isNaN(duration)){
_duration = duration;
} else {
_duration = defaultDuration;
};
try {
this.easing = easing;
} catch(e2:EasingFormatError) {
if (easing != null){
throw (e2);
};
this.easing = defaultEasing;
};
if (extraEasingParams){
_extraEaseParams = extraEasingParams;
};
if (useRelative){
this.useRelative = true;
};
if (useRounding){
this.useRounding = true;
};
_useFrames = ((useFrames) || (_useFramesMode));
if (!isNaN(pulseInterval)){
_pulse = pulseInterval;
};
if (repeater != null){
_repeater = repeater;
} else {
_repeater = new LinearGoRepeater();
};
_repeater.setParent(this);
}
public function set extraEasingParams(_arg1:Array):void{
if ((((((_state == STOPPED)) && ((_arg1 is Array)))) && ((_arg1.length > 0)))){
_extraEaseParams = _arg1;
};
}
public function get delay():Number{
return (_delay);
}
public function set delay(_arg1:Number):void{
if ((((_state == STOPPED)) && ((_arg1 >= 0)))){
_delay = _arg1;
};
}
public function get repeater():LinearGoRepeater{
return (_repeater);
}
public function get useFrames():Boolean{
return (_useFrames);
}
public function addCallback(_arg1:Function, _arg2:String="playableComplete"):void{
if (!_callbacks[_arg2]){
_callbacks[_arg2] = new Array();
};
var _local3:Array = (_callbacks[_arg2] as Array);
if (_local3.indexOf(_arg1) == -1){
_local3.push(_arg1);
};
}
public function get timePosition():Number{
var _local2:uint;
if (_state == STOPPED){
return (0);
};
var _local1:Number = Math.max(0, timeMultiplier);
if (_useFrames){
if (_currentFrame > _framesBase){
_local2 = (_currentFrame - _framesBase);
if (_repeater.direction == -1){
return ((((_duration - 1) - (_local2 % _duration)) + _framesBase));
};
return (((_local2 % _duration) + _framesBase));
};
return (_currentFrame);
};
return ((((getTimer() - _startTime) / 1000) / _local1));
}
public function set useFrames(_arg1:Boolean):void{
if (_state == STOPPED){
_useFrames = _arg1;
};
}
public function get duration():Number{
return (_duration);
}
protected function setup(_arg1:Number):void{
var _local5:Number;
_startTime = _arg1;
var _local2:Number = (Math.max(0, timeMultiplier) * (_useFrames) ? 1 : 1000);
_tweenDuration = (_useFrames) ? (Math.round((_duration * _local2)) - 1) : (_duration * _local2);
_endTime = (_startTime + _tweenDuration);
if (!_started){
_local5 = (_useFrames) ? Math.round((_delay * _local2)) : (_delay * _local2);
_startTime = (_startTime + _local5);
_endTime = (_endTime + _local5);
};
var _local3:Boolean = _repeater.currentCycleHasEasing;
_currentEasing = (_local3) ? _repeater.easingOnCycle : _easing;
var _local4:Array = (_local3) ? _repeater.extraEasingParams : _extraEaseParams;
_change = _repeater.direction;
_position = ((_repeater.direction == -1)) ? 1 : 0;
_easeParams = new Array(0, _position, _change, _tweenDuration);
if (_local4){
_easeParams = _easeParams.concat(_local4);
};
}
public function stop():Boolean{
if ((((_state == STOPPED)) || ((GoEngine.removeItem(this) == false)))){
return (false);
};
_state = STOPPED;
var _local1:Boolean = ((!((_easeParams == null))) && ((_position == (_easeParams[1] + _change))));
reset();
if (!_local1){
dispatch(GoEvent.STOP);
};
return (true);
}
public function set duration(_arg1:Number):void{
if ((((_state == STOPPED)) && ((_arg1 >= 0)))){
_duration = _arg1;
};
}
public function get position():Number{
return (_position);
}
protected function onUpdate(_arg1:String):void{
}
public function get easing():Function{
return (_easing);
}
public function resume():Boolean{
if (_state != PAUSED){
return (false);
};
var _local1:Number = (_useFrames) ? _currentFrame : getTimer();
setup((_local1 - (_pauseTime - _startTime)));
_pauseTime = NaN;
_state = ((_startTime > _local1)) ? PLAYING_DELAY : PLAYING;
dispatch(GoEvent.RESUME);
return (true);
}
public function get extraEasingParams():Array{
return (_extraEaseParams);
}
override public function update(_arg1:Number):void{
if (_state == PAUSED){
return;
};
_currentFrame++;
if (_useFrames){
_arg1 = _currentFrame;
};
if (isNaN(_startTime)){
setup(_arg1);
};
if (_startTime > _arg1){
return;
};
var _local2:String = GoEvent.UPDATE;
if (_arg1 < _endTime){
if (!_started){
_local2 = GoEvent.START;
};
_easeParams[0] = (_arg1 - _startTime);
_position = _currentEasing.apply(null, _easeParams);
} else {
_position = (_easeParams[1] + _change);
_local2 = (_repeater.hasNext()) ? GoEvent.CYCLE : GoEvent.COMPLETE;
};
onUpdate(_local2);
if (!_started){
_state = PLAYING;
_started = true;
dispatch(GoEvent.START);
};
dispatch(GoEvent.UPDATE);
if (_local2 == GoEvent.COMPLETE){
stop();
dispatch(GoEvent.COMPLETE);
} else {
if (_local2 == GoEvent.CYCLE){
_repeater.next();
dispatch(GoEvent.CYCLE);
_startTime = NaN;
};
};
}
public function set easing(_arg1:Function):void{
var type = _arg1;
if (_state == STOPPED){
try {
if ((type(1, 1, 1, 1) is Number)){
_easing = type;
return;
};
} catch(e:Error) {
};
throw (new EasingFormatError());
};
}
public function skipTo(_arg1:Number):Boolean{
var _local3:Number;
var _local4:Number;
if (_state == STOPPED){
if (start() == false){
return (false);
};
};
if (isNaN(_arg1)){
_arg1 = 0;
};
var _local2:Number = (Math.max(0, timeMultiplier) * (_useFrames) ? 1 : 1000);
if (_arg1 < _framesBase){
_repeater.reset();
if (_position > 0){
skipTo(_framesBase);
};
} else {
_arg1 = _repeater.skipTo(_duration, (_arg1 - _framesBase));
};
if (_useFrames){
_local3 = _framesBase;
_local4 = (_currentFrame = Math.round((_arg1 * _local2)));
} else {
_local4 = getTimer();
_local3 = (_local4 - (_arg1 * _local2));
};
setup(_local3);
_state = ((_startTime > _local4)) ? PLAYING_DELAY : PLAYING;
update(_local4);
return (true);
}
public function start():Boolean{
stop();
if (GoEngine.addItem(this) == false){
return (false);
};
reset();
_state = ((_delay > 0)) ? PLAYING_DELAY : PLAYING;
return (true);
}
public function removeCallback(_arg1:Function, _arg2:String="playableComplete"):void{
var _local3:Array = (_callbacks[_arg2] as Array);
if (_local3){
while (_local3.indexOf(_arg1) > -1) {
_local3.splice(_local3.indexOf(_arg1), 1);
};
};
}
protected function reset():void{
_position = 0;
_change = 1;
_repeater.reset();
_currentFrame = (_framesBase - 1);
_currentEasing = _easing;
_easeParams = null;
_started = false;
_pauseTime = NaN;
_startTime = NaN;
}
public function get currentFrame():uint{
return (_currentFrame);
}
public function pause():Boolean{
if ((((_state == STOPPED)) || ((_state == PAUSED)))){
return (false);
};
_state = PAUSED;
_pauseTime = (_useFrames) ? _currentFrame : getTimer();
dispatch(GoEvent.PAUSE);
return (true);
}
protected function dispatch(_arg1:String):void{
var _local3:Function;
var _local2:Array = (_callbacks[_arg1] as Array);
if (_local2){
for each (_local3 in _local2) {
_local3();
};
};
if (hasEventListener(_arg1)){
dispatchEvent(new GoEvent(_arg1));
};
}
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 1)) + _arg2));
}
public static function easeNone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function setupUseFramesMode(_arg1:Boolean=true, _arg2:Boolean=false):void{
GoItem.defaultPulseInterval = GoEngine.ENTER_FRAME;
_useFramesMode = _arg1;
if (_arg2){
_framesBase = 0;
};
}
}
}//package org.goasap.items
Section 154
//LinearGoRepeater (org.goasap.managers.LinearGoRepeater)
package org.goasap.managers {
public class LinearGoRepeater extends Repeater {
protected var _reverseOnCycle:Boolean;// = false
protected var _extraEasingParams:Array;
protected var _easingOnCycle:Function;
public function LinearGoRepeater(_arg1:uint=1, _arg2:Boolean=true, _arg3:Function=null, _arg4:Array=null){
super(_arg1);
_reverseOnCycle = _arg2;
_easingOnCycle = _arg3;
_extraEasingParams = _arg4;
}
public function get extraEasingParams():Array{
return (_extraEasingParams);
}
public function set extraEasingParams(_arg1:Array):void{
if (unlocked()){
_extraEasingParams = _arg1;
};
}
public function get reverseOnCycle():Boolean{
return (_reverseOnCycle);
}
public function get direction():int{
if (((_reverseOnCycle) && (((_currentCycle % 2) == 1)))){
return (-1);
};
return (1);
}
public function set reverseOnCycle(_arg1:Boolean):void{
if (unlocked()){
_reverseOnCycle = _arg1;
};
}
public function get currentCycleHasEasing():Boolean{
return (((((_reverseOnCycle) && (((_currentCycle % 2) == 1)))) && (!((_easingOnCycle == null)))));
}
public function get easingOnCycle():Function{
return (_easingOnCycle);
}
public function set easingOnCycle(_arg1:Function):void{
if (unlocked()){
_easingOnCycle = _arg1;
};
}
}
}//package org.goasap.managers
Section 155
//Repeater (org.goasap.managers.Repeater)
package org.goasap.managers {
import org.goasap.*;
public class Repeater {
protected var _cycles:uint;
protected var _item:PlayableBase;
protected var _currentCycle:uint;// = 0
public static const INFINITE:uint = 0;
public function Repeater(_arg1:uint=1){
_cycles = _arg1;
}
public function skipTo(_arg1:Number, _arg2:Number):Number{
if (((isNaN(_arg1)) || (isNaN(_arg2)))){
return (0);
};
_arg2 = Math.max(0, _arg2);
if (cycles != INFINITE){
_arg2 = Math.min(_arg2, (_cycles * _arg1));
};
_currentCycle = Math.floor((_arg2 / _arg1));
return ((_arg2 % _arg1));
}
public function get done():Boolean{
return ((((_currentCycle == _cycles)) && (!((_cycles == INFINITE)))));
}
protected function unlocked():Boolean{
return (((!(_item)) || (((_item) && ((_item.state == PlayableBase.STOPPED))))));
}
public function next():Boolean{
if (_cycles == INFINITE){
_currentCycle++;
return (true);
};
if ((_cycles - _currentCycle) > 0){
_currentCycle++;
};
if (_cycles == _currentCycle){
return (false);
};
return (true);
}
public function get cycles():uint{
return (_cycles);
}
public function setParent(_arg1:PlayableBase):void{
if (!_item){
_item = _arg1;
};
}
public function reset():void{
_currentCycle = 0;
}
public function get currentCycle():uint{
return (_currentCycle);
}
public function set cycles(_arg1:uint):void{
if (unlocked()){
_cycles = _arg1;
};
}
public function hasNext():Boolean{
return ((((_cycles == INFINITE)) || (((_cycles - _currentCycle) > 1))));
}
}
}//package org.goasap.managers
Section 156
//PlayableGroup (org.goasap.utils.PlayableGroup)
package org.goasap.utils {
import flash.utils.*;
import org.goasap.events.*;
import org.goasap.interfaces.*;
import org.goasap.managers.*;
import org.goasap.*;
public class PlayableGroup extends PlayableBase implements IPlayable {
protected var _listeners:uint;// = 0
protected var _children:Dictionary;
protected var _repeater:Repeater;
public function PlayableGroup(... _args){
_children = new Dictionary();
super();
if (_args.length > 0){
this.children = ((_args[0] is Array)) ? _args[0] : _args;
};
_repeater = new Repeater();
_repeater.setParent(this);
}
public function get children():Array{
var _local2:Object;
var _local1:Array = [];
for (_local2 in _children) {
_local1.push(_local2);
};
return (_local1);
}
public function get repeater():Repeater{
return (_repeater);
}
public function stop():Boolean{
var _local2:Object;
if (_state == STOPPED){
return (false);
};
_state = STOPPED;
_repeater.reset();
delete _playRetainer[this];
if (_listeners == 0){
dispatchEvent(new GoEvent(GoEvent.COMPLETE));
return (true);
};
var _local1:Boolean;
for (_local2 in _children) {
unListenTo((_local2 as IPlayable));
_local1 = (((_local2 as IPlayable).stop()) && (_local1));
};
dispatchEvent(new GoEvent(GoEvent.STOP));
return (_local1);
}
public function get listenerCount():uint{
return (_listeners);
}
public function anyChildHasState(_arg1:String):Boolean{
var _local2:Object;
for (_local2 in _children) {
if ((_local2 as IPlayable).state == _arg1){
return (true);
};
};
return (false);
}
public function skipTo(_arg1:Number):Boolean{
var _local4:Object;
var _local2:Boolean;
var _local3:uint;
_arg1 = _repeater.skipTo(_repeater.cycles, _arg1);
for (_local4 in _children) {
_local2 = (((_local4 as IPlayable).skipTo(_arg1)) && (_local2));
listenTo((_local4 as IPlayable));
_local3++;
};
_state = (_local2) ? PLAYING : STOPPED;
return ((((_local3 > 0)) && (_local2)));
}
protected function unListenTo(_arg1:IPlayable):void{
if (_children[_arg1] === true){
_arg1.removeEventListener(GoEvent.STOP, onItemEnd);
_arg1.removeEventListener(GoEvent.COMPLETE, onItemEnd);
_children[_arg1] = false;
_listeners--;
};
}
public function start():Boolean{
var _local2:Object;
var _local3:Boolean;
stop();
var _local1:Boolean;
for (_local2 in _children) {
_local3 = (_local2 as IPlayable).start();
if (_local3){
listenTo((_local2 as IPlayable));
};
_local1 = ((_local3) || (_local1));
};
if (!_local1){
return (false);
};
_state = PLAYING;
dispatchEvent(new GoEvent(GoEvent.START));
_playRetainer[this] = 1;
return (true);
}
public function resume():Boolean{
var _local3:Object;
var _local4:Boolean;
if (_state != PAUSED){
return (false);
};
var _local1:Boolean;
var _local2:uint;
for (_local3 in _children) {
_local4 = (_local3 as IPlayable).resume();
if (_local4){
_local2++;
};
_local1 = ((_local1) && (_local4));
};
if (_local2 > 0){
_state = PLAYING;
dispatchEvent(new GoEvent(GoEvent.RESUME));
};
return ((((_local2 > 0)) && (_local1)));
}
protected function onItemEnd(_arg1:GoEvent):void{
unListenTo((_arg1.target as IPlayable));
if (_listeners == 0){
complete();
};
}
protected function listenTo(_arg1:IPlayable):void{
if (_children[_arg1] === false){
_arg1.addEventListener(GoEvent.STOP, onItemEnd, false, 0, true);
_arg1.addEventListener(GoEvent.COMPLETE, onItemEnd, false, 0, true);
_children[_arg1] = true;
_listeners++;
};
}
public function removeChild(_arg1:IPlayable):Boolean{
var _local2:* = _children[_arg1];
if (_local2 === null){
return (false);
};
if (_local2 === true){
unListenTo(_arg1);
};
delete _children[_arg1];
return (true);
}
protected function complete():void{
var _local1:Object;
var _local2:Boolean;
if (_repeater.next()){
dispatchEvent(new GoEvent(GoEvent.CYCLE));
for (_local1 in _children) {
_local2 = (_local1 as IPlayable).start();
if (_local2){
listenTo((_local1 as IPlayable));
};
};
} else {
stop();
};
}
public function addChild(_arg1:IPlayable, _arg2:Boolean=false):Boolean{
var _local3:IPlayable;
var _local4:Boolean;
var _local5:IPlayable;
var _local6:Boolean;
if (_children[_arg1]){
return (false);
};
if (_arg1.state != _state){
_local3 = (_arg2) ? _arg1 : this;
_local4 = (((_local3.state == PLAYING)) || ((_local3.state == PLAYING_DELAY)));
_local5 = (_arg2) ? this : _arg1;
_local6 = (((_local5.state == PLAYING)) || ((_local5.state == PLAYING_DELAY)));
if (!((_local4) && (_local6))){
switch (_local3.state){
case STOPPED:
_local5.stop();
break;
case PAUSED:
if (_local5.state == STOPPED){
_local5.start();
};
_local5.pause();
break;
case PLAYING:
case PLAYING_DELAY:
if (_local5.state == PAUSED){
_local5.resume();
} else {
if (_local5.state == STOPPED){
if (_arg2){
_state = PLAYING;
dispatchEvent(new GoEvent(GoEvent.START));
} else {
_local5.start();
};
};
};
break;
};
};
};
_children[_arg1] = false;
if (_state != STOPPED){
listenTo(_arg1);
};
return (true);
}
public function pause():Boolean{
var _local3:Object;
var _local4:Boolean;
if (_state != PLAYING){
return (false);
};
var _local1:Boolean;
var _local2:uint;
for (_local3 in _children) {
_local4 = (_local3 as IPlayable).pause();
if (_local4){
_local2++;
};
_local1 = ((_local1) && (_local4));
};
if (_local2 > 0){
_state = PAUSED;
dispatchEvent(new GoEvent(GoEvent.PAUSE));
};
return ((((_local2 > 0)) && (_local1)));
}
public function set children(_arg1:Array):void{
var _local2:Object;
if (_listeners > 0){
stop();
};
for each (_local2 in _arg1) {
if ((_local2 is IPlayable)){
addChild((_local2 as IPlayable));
};
};
}
public function getChildByID(_arg1, _arg2:Boolean=true):IPlayable{
var _local3:Object;
var _local4:IPlayable;
for (_local3 in _children) {
if ((_local3 as IPlayable).playableID === _arg1){
return ((_local3 as IPlayable));
};
};
if (_arg2){
for (_local3 in _children) {
if ((_local3 is PlayableGroup)){
_local4 = (_local3 as PlayableGroup).getChildByID(_arg1, true);
if (_local4){
return ((_local4 as IPlayable));
};
};
};
};
return (null);
}
}
}//package org.goasap.utils
Section 157
//GoEngine (org.goasap.GoEngine)
package org.goasap {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import org.goasap.interfaces.*;
import org.goasap.errors.*;
public class GoEngine {
public static const ENTER_FRAME:int = -1;
public static const INFO:String = "GoASAP 0.4.9 (c) Moses Gunesch, MIT Licensed.";
private static var items:Dictionary = new Dictionary(false);
private static var delayedPulses:Dictionary = new Dictionary(false);
private static var timers:Dictionary = new Dictionary(false);
private static var managerTable:Object = new Object();
private static var managers:Array = new Array();
private static var lockedPulses:Dictionary = new Dictionary(false);
private static var paused:Boolean = false;
private static var addQueue:Dictionary = new Dictionary(false);
private static var liveManagers:uint = 0;
private static var itemCounts:Dictionary = new Dictionary(false);
private static var pulseSprite:Sprite;
private static function removePulse(_arg1:int):Boolean{
if (_arg1 == ENTER_FRAME){
if (pulseSprite){
pulseSprite.removeEventListener(Event.ENTER_FRAME, update);
delete timers[ENTER_FRAME];
pulseSprite = null;
return (true);
};
};
var _local2:Timer = (timers[_arg1] as Timer);
if (_local2){
_local2.stop();
_local2.removeEventListener(TimerEvent.TIMER, update);
delete timers[_arg1];
return (true);
};
return (false);
}
public static function removeManager(_arg1:String):void{
managers.splice(managers.indexOf(managerTable[_arg1]), 1);
if ((managerTable[_arg1] is ILiveManager)){
liveManagers--;
};
delete managerTable[_arg1];
}
public static function hasItem(_arg1:IUpdatable):Boolean{
return (!((items[_arg1] == null)));
}
public static function getManager(_arg1:String):IManager{
return (managerTable[_arg1]);
}
private static function update(_arg1:Event):void{
var _local5:Array;
var _local6:*;
var _local7:Object;
var _local2:Number = getTimer();
var _local3:int = ((_arg1 is TimerEvent)) ? (_arg1.target as Timer).delay : ENTER_FRAME;
lockedPulses[_local3] = true;
var _local4 = (liveManagers > 0);
if (_local4){
_local5 = [];
};
for (_local6 in items) {
if ((((items[_local6] == _local3)) && (!(addQueue[_local6])))){
(_local6 as IUpdatable).update(_local2);
if (_local4){
_local5.push(_local6);
};
};
};
lockedPulses[_local3] = false;
if (delayedPulses[_local3]){
for (_local6 in addQueue) {
delete addQueue[_local6];
};
delete delayedPulses[_local3];
};
if (_local4){
for each (_local7 in managers) {
if ((_local7 is ILiveManager)){
(_local7 as ILiveManager).onUpdate(_local3, _local5, _local2);
};
};
};
}
public static function addItem(_arg1:IUpdatable):Boolean{
var _local3:IManager;
var _local2:int = _arg1.pulseInterval;
if (items[_arg1]){
if (items[_arg1] == _arg1.pulseInterval){
return (false);
};
removeItem(_arg1);
};
if (lockedPulses[_local2] == true){
delayedPulses[_local2] = true;
addQueue[_arg1] = true;
};
items[_arg1] = _local2;
if (!timers[_local2]){
addPulse(_local2);
itemCounts[_local2] = 1;
} else {
var _local4 = itemCounts;
var _local5 = _local2;
var _local6 = (_local4[_local5] + 1);
_local4[_local5] = _local6;
};
if ((_arg1 is IManageable)){
for each (_local3 in managers) {
_local3.reserve((_arg1 as IManageable));
};
};
return (true);
}
public static function removeItem(_arg1:IUpdatable):Boolean{
var _local3:IManager;
if (items[_arg1] == null){
return (false);
};
var _local2:int = items[_arg1];
var _local4 = itemCounts;
var _local5 = _local2;
var _local6 = (_local4[_local5] - 1);
_local4[_local5] = _local6;
if (_local6 == 0){
removePulse(_local2);
delete itemCounts[_local2];
};
delete items[_arg1];
delete addQueue[_arg1];
if ((_arg1 is IManageable)){
for each (_local3 in managers) {
_local3.release((_arg1 as IManageable));
};
};
return (true);
}
private static function addPulse(_arg1:int):Boolean{
if (_arg1 == ENTER_FRAME){
if (!pulseSprite){
timers[ENTER_FRAME] = (pulseSprite = new Sprite());
pulseSprite.addEventListener(Event.ENTER_FRAME, update);
};
return (true);
};
var _local2:Timer = (timers[_arg1] as Timer);
if (!_local2){
_local2 = (timers[_arg1] = new Timer(_arg1));
(timers[_arg1] as Timer).addEventListener(TimerEvent.TIMER, update);
_local2.start();
return (true);
};
return (false);
}
public static function addManager(_arg1:IManager):void{
var _local2:String = getQualifiedClassName(_arg1);
_local2 = _local2.slice((_local2.lastIndexOf("::") + 2));
if (managerTable[_local2]){
throw (new DuplicateManagerError(_local2));
};
managerTable[_local2] = _arg1;
managers.push(_arg1);
if ((_arg1 is ILiveManager)){
liveManagers++;
};
}
public static function clear(_arg1:Number=NaN):uint{
var _local4:Object;
var _local2:Boolean = isNaN(_arg1);
var _local3:Number = 0;
for (_local4 in items) {
if (((_local2) || ((items[_local4] == _arg1)))){
if (removeItem((_local4 as IUpdatable)) == true){
_local3++;
};
};
};
return (_local3);
}
public static function getCount(_arg1:Number=NaN):uint{
var _local3:int;
if (!isNaN(_arg1)){
return (itemCounts[_arg1]);
};
var _local2:Number = 0;
for each (_local3 in itemCounts) {
_local2 = (_local2 + _local3);
};
return (_local2);
}
public static function getPaused():Boolean{
return (paused);
}
public static function setPaused(_arg1:Boolean=true, _arg2:Number=NaN):uint{
var _local7:Object;
var _local8:int;
if (paused == _arg1){
return (0);
};
var _local3:Number = 0;
var _local4:Boolean;
var _local5:Boolean = isNaN(_arg2);
var _local6:String = (_arg1) ? "pause" : "resume";
for (_local7 in items) {
_local8 = (items[_local7] as int);
if (((_local5) || ((_local8 == _arg2)))){
_local4 = ((_local4) || ((_arg1) ? removePulse(_local8) : addPulse(_local8)));
if (_local7.hasOwnProperty(_local6)){
if ((_local7[_local6] is Function)){
_local7[_local6].apply(_local7);
_local3++;
};
};
};
};
if (_local4){
paused = _arg1;
};
return (_local3);
}
}
}//package org.goasap
Section 158
//PlayableBase (org.goasap.PlayableBase)
package org.goasap {
import flash.events.*;
import flash.utils.*;
import org.goasap.interfaces.*;
import org.goasap.errors.*;
public class PlayableBase extends EventDispatcher implements IPlayableBase {
protected var _state:String;// = "STOPPED"
protected var _id;
public static const STOPPED:String = "STOPPED";
public static const PLAYING:String = "PLAYING";
public static const PLAYING_DELAY:String = "PLAYING_DELAY";
public static const PAUSED:String = "PAUSED";
private static var _idCounter:int = -1;
protected static var _playRetainer:Dictionary = new Dictionary(false);
public function PlayableBase():void{
var _local1:String = getQualifiedClassName(this);
if (_local1.slice((_local1.lastIndexOf("::") + 2)) == "PlayableBase"){
throw (new InstanceNotAllowedError("PlayableBase"));
};
playableID = ++_idCounter;
}
public function get playableID(){
return (_id);
}
public function get state():String{
return (_state);
}
public function set playableID(_arg1):void{
_id = _arg1;
}
override public function toString():String{
var _local1:String = super.toString();
var _local2 = (_local1.charAt((_local1.length - 1)) == "]");
if (_local2){
_local1 = _local1.slice(0, -1);
};
if ((playableID is String)){
_local1 = (_local1 + ((" playableID:\"" + playableID) + "\""));
} else {
_local1 = (_local1 + (" playableID:" + playableID));
};
if (_local2){
_local1 = (_local1 + "]");
};
return (_local1);
}
}
}//package org.goasap
Section 159
//Logger (org.osflash.thunderbolt.Logger)
package org.osflash.thunderbolt {
import flash.utils.*;
import flash.system.*;
import flash.external.*;
public class Logger {
public static const WARN:String = "warn";
private static const AUTHOR:String = "Jens Krause [www.websector.de]";
private static const FIELD_SEPERATOR:String = " :: ";
public static const LOG:String = "log";
public static const ERROR:String = "error";
public static const INFO:String = "info";
private static const MAX_DEPTH:int = 0xFF;
private static const VERSION:String = "1.0";
private static var _depth:int;
public static var includeTime:Boolean = true;
private static var _hide:Boolean = false;
private static var _stopLog:Boolean = false;
private static var _logLevel:String;
private static function primitiveType(_arg1:String):Boolean{
var _local2:Boolean;
switch (_arg1){
case "Boolean":
case "void":
case "int":
case "uint":
case "Number":
case "String":
case "undefined":
case "null":
_local2 = true;
break;
default:
_local2 = false;
};
return (_local2);
}
public static function trace(_arg1:String, _arg2:String="", ... _args):void{
var _local4:String;
var _local5:int;
var _local6:int;
if (!_hide){
_depth = 0;
_logLevel = _arg1;
_local4 = (("[" + _logLevel.toUpperCase()) + "] ");
if (includeTime){
_local4 = (_local4 + getCurrentTime());
};
_local4 = (_local4 + _arg2);
ExternalInterface.call(("console." + _logLevel), _local4);
_local6 = _args.length;
_local5 = 0;
while (_local5 < _local6) {
_slot1.logObject(_args[_local5]);
_local5++;
};
};
}
public static function debug(_arg1:String=null, ... _args):void{
_slot1.trace(_slot1.LOG, _arg1, _args);
}
public static function about():void{
var _local1:String;
_local1 = (((("+++ Welcome to ThunderBolt AS3 | VERSION: " + _slot1.VERSION) + " | AUTHOR: ") + _slot1.AUTHOR) + " | Happy logging ;-) +++");
_slot1.trace(_slot1.INFO, _local1);
}
public static function warn(_arg1:String=null, ... _args):void{
_slot1.trace(_slot1.WARN, _arg1, _args);
}
public static function error(_arg1:String=null, ... _args):void{
_slot1.trace(_slot1.ERROR, _arg1, _args);
}
public static function memorySnapshot():String{
var _local1:uint;
var _local2:String;
_local1 = System.totalMemory;
_local2 = (((("Memory Snapshot: " + (Math.round((((_local1 / 0x0400) / 0x0400) * 100)) / 100)) + " MB (") + Math.round((_local1 / 0x0400))) + " kb)");
return (_local2);
}
public static function set hide(_arg1:Boolean):void{
_hide = _arg1;
}
private static function timeToValidString(_arg1:Number):String{
return (((_arg1 > 9)) ? _arg1.toString() : ("0" + _arg1.toString()));
}
private static function logObject(_arg1, _arg2:String=null):void{
var _local3:String;
var _local4:XML;
var _local5:String;
var _local6:String;
var _local7:String;
var _local8:int;
var _local9:int;
var _local10:XMLList;
var _local11:XML;
var _local12:String;
var _local13:String;
var _local14:String;
var _local15:*;
if (_depth < _slot1.MAX_DEPTH){
_depth++;
_local3 = ((_arg2) || (""));
_local4 = describeType(_arg1);
_local5 = _local4.@name;
if (primitiveType(_local5)){
_local6 = (_local3.length) ? ((((("[" + _local5) + "] ") + _local3) + " = ") + _arg1) : ((("[" + _local5) + "] ") + _arg1);
ExternalInterface.call(("console." + _slot1.LOG), _local6);
} else {
if (_local5 == "Object"){
ExternalInterface.call("console.group", ("[Object] " + _local3));
for (_local7 in _arg1) {
logObject(_arg1[_local7], _local7);
};
ExternalInterface.call("console.groupEnd");
} else {
if (_local5 == "Array"){
if (_depth > 1){
ExternalInterface.call("console.group", ("[Array] " + _local3));
};
_local9 = _arg1.length;
_local8 = 0;
while (_local8 < _local9) {
logObject(_arg1[_local8]);
_local8++;
};
ExternalInterface.call("console.groupEnd");
} else {
_local10 = _local4..accessor;
if (_local10.length()){
for each (_local11 in _local10) {
_local12 = _local11.@name;
_local13 = _local11.@type;
_local14 = _local11.@access;
if (((_local14) && (!((_local14 == "writeonly"))))){
_local15 = _arg1[_local12];
logObject(_local15, _local12);
};
};
} else {
logObject(_arg1, _local5);
};
};
};
};
} else {
if (!_stopLog){
ExternalInterface.call(("console." + _slot1.WARN), (("STOP LOGGING: More than " + _depth) + " nested objects or properties."));
_stopLog = true;
};
};
}
public static function info(_arg1:String=null, ... _args):void{
_slot1.trace(_slot1.INFO, _arg1, _args);
}
private static function getCurrentTime():String{
var _local1:Date;
var _local2:String;
_local1 = new Date();
_local2 = (((((((("time " + timeToValidString(_local1.getHours())) + ":") + timeToValidString(_local1.getMinutes())) + ":") + timeToValidString(_local1.getSeconds())) + ".") + timeToValidString(_local1.getMilliseconds())) + FIELD_SEPERATOR);
return (_local2);
}
}
}//package org.osflash.thunderbolt