Section 1
//AbstractView (com.jeroenwijering.events.AbstractView)
package com.jeroenwijering.events {
import flash.display.*;
import flash.events.*;
public class AbstractView extends EventDispatcher {
public function get config():Object{
return (new Object());
}
public function addModelListener(_arg1:String, _arg2:Function):void{
}
public function get playlist():Array{
return (new Array());
}
public function addControllerListener(_arg1:String, _arg2:Function):void{
}
public function sendEvent(_arg1:String, _arg2:Object=undefined):void{
}
public function addViewListener(_arg1:String, _arg2:Function):void{
}
public function get skin():MovieClip{
return (new MovieClip());
}
}
}//package com.jeroenwijering.events
Section 2
//ControllerEvent (com.jeroenwijering.events.ControllerEvent)
package com.jeroenwijering.events {
import flash.events.*;
public class ControllerEvent extends Event {
private var _data:Object;
public static var PLAYLIST:String = "PLAYLIST";
public static var ERROR:String = "ERROR";
public static var STOP:String = "STOP";
public static var ITEM:String = "ITEM";
public static var PLAY:String = "PLAY";
public static var SEEK:String = "SEEK";
public static var MUTE:String = "MUTE";
public static var VOLUME:String = "VOLUME";
public static var RESIZE:String = "RESIZE";
public static var QUALITY:String = "QUALITY";
public function ControllerEvent(_arg1:String, _arg2:Object=undefined, _arg3:Boolean=false, _arg4:Boolean=false):void{
super(_arg1, _arg3, _arg4);
_data = _arg2;
}
public function get data():Object{
return (_data);
}
}
}//package com.jeroenwijering.events
Section 3
//ModelEvent (com.jeroenwijering.events.ModelEvent)
package com.jeroenwijering.events {
import flash.events.*;
public class ModelEvent extends Event {
private var _data:Object;
public static var BUFFER:String = "BUFFER";
public static var LOADED:String = "LOADED";
public static var ERROR:String = "ERROR";
public static var META:String = "META";
public static var TIME:String = "TIME";
public static var STATE:String = "STATE";
public function ModelEvent(_arg1:String, _arg2:Object=undefined, _arg3:Boolean=false, _arg4:Boolean=false):void{
super(_arg1, _arg3, _arg4);
_data = _arg2;
}
public function get data():Object{
return (_data);
}
}
}//package com.jeroenwijering.events
Section 4
//ModelStates (com.jeroenwijering.events.ModelStates)
package com.jeroenwijering.events {
public class ModelStates {
public static var BUFFERING:String = "BUFFERING";
public static var PAUSED:String = "PAUSED";
public static var COMPLETED:String = "COMPLETED";
public static var IDLE:String = "IDLE";
public static var PLAYING:String = "PLAYING";
}
}//package com.jeroenwijering.events
Section 5
//PluginInterface (com.jeroenwijering.events.PluginInterface)
package com.jeroenwijering.events {
public interface PluginInterface {
function initializePlugin(_arg1:AbstractView):void;
}
}//package com.jeroenwijering.events
Section 6
//ViewEvent (com.jeroenwijering.events.ViewEvent)
package com.jeroenwijering.events {
import flash.events.*;
public class ViewEvent extends Event {
private var _data:Object;
public static var STOP:String = "STOP";
public static var RESIZE:String = "RESIZE";
public static var FULLSCREEN:String = "FULLSCREEN";
public static var NEXT:String = "NEXT";
public static var ITEM:String = "ITEM";
public static var MUTE:String = "MUTE";
public static var VOLUME:String = "VOLUME";
public static var QUALITY:String = "QUALITY";
public static var TRACE:String = "TRACE";
public static var LOAD:String = "LOAD";
public static var PREV:String = "PREV";
public static var PLAY:String = "PLAY";
public static var SEEK:String = "SEEK";
public static var LINK:String = "LINK";
public function ViewEvent(_arg1:String, _arg2:Object=undefined, _arg3:Boolean=false, _arg4:Boolean=false):void{
super(_arg1, _arg3, _arg4);
_data = _arg2;
}
public function get data():Object{
return (_data);
}
}
}//package com.jeroenwijering.events
Section 7
//CameraModel (com.jeroenwijering.models.CameraModel)
package com.jeroenwijering.models {
import com.jeroenwijering.events.*;
import flash.events.*;
import com.jeroenwijering.player.*;
import flash.net.*;
import flash.media.*;
import flash.utils.*;
public class CameraModel implements ModelInterface {
private var stream:NetStream;
private var interval:Number;
private var connection:NetConnection;
private var camera:Camera;
private var model:Model;
private var microphone:Microphone;
private var position:Number;
private var video:Video;
public function CameraModel(_arg1:Model):void{
var mod = _arg1;
super();
model = mod;
try {
camera = Camera.getCamera();
microphone = Microphone.getMicrophone();
video = new Video(320, 240);
} catch(err:Error) {
model.sendEvent(ModelEvent.ERROR, {message:"No webcam found on this computer."});
};
connection = new NetConnection();
connection.objectEncoding = ObjectEncoding.AMF0;
connection.addEventListener(NetStatusEvent.NET_STATUS, statusHandler);
connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, errorHandler);
quality(model.config["quality"]);
}
public function stop():void{
position = 0;
video.attachCamera(null);
clearInterval(interval);
if (stream){
stream.publish(null);
};
}
public function pause():void{
video.attachCamera(null);
if (stream){
stream.publish(null);
stream.attachAudio(null);
stream.attachCamera(null);
};
clearInterval(interval);
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.PAUSED});
}
private function statusHandler(_arg1:NetStatusEvent):void{
if (_arg1.info.code == "NetConnection.Connect.Success"){
stream = new NetStream(connection);
stream.addEventListener(NetStatusEvent.NET_STATUS, statusHandler);
play();
};
model.sendEvent(ModelEvent.META, {info:_arg1.info.code});
}
public function volume(_arg1:Number):void{
}
private function errorHandler(_arg1:ErrorEvent):void{
model.sendEvent(ModelEvent.ERROR, {message:_arg1.text});
}
public function load():void{
position = model.playlist[model.config["item"]]["start"];
model.mediaHandler(video);
if (model.config["streamer"]){
connection.connect(model.config["streamer"]);
} else {
play();
};
}
private function timeInterval():void{
var _local1:*;
position = (Math.round(((position * 10) + 1)) / 10);
_local1 = model.playlist[model.config["item"]]["duration"];
if (_local1 > 0){
if (position >= _local1){
clearInterval(interval);
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.COMPLETED});
} else {
model.sendEvent(ModelEvent.TIME, {position:position, duration:_local1});
};
};
}
public function play():void{
video.attachCamera(camera);
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.PLAYING});
interval = setInterval(timeInterval, 100);
if (stream){
stream.publish(model.playlist[model.config["item"]]["file"]);
stream.attachAudio(microphone);
stream.attachCamera(camera);
};
}
public function seek(_arg1:Number):void{
position = _arg1;
clearInterval(interval);
play();
}
public function quality(_arg1:Boolean):void{
if (_arg1 == true){
camera.setMode(480, 360, 25);
video.smoothing = true;
video.deblocking = 4;
model.sendEvent(ModelEvent.META, {framerate:25, height:360, width:480});
} else {
camera.setMode(240, 180, 12);
video.smoothing = false;
video.deblocking = 1;
model.sendEvent(ModelEvent.META, {framerate:12, height:180, width:240});
};
}
}
}//package com.jeroenwijering.models
Section 8
//HTTPModel (com.jeroenwijering.models.HTTPModel)
package com.jeroenwijering.models {
import com.jeroenwijering.events.*;
import flash.events.*;
import com.jeroenwijering.player.*;
import com.jeroenwijering.utils.*;
import flash.net.*;
import flash.media.*;
import flash.utils.*;
public class HTTPModel implements ModelInterface {
private var stream:NetStream;
private var loaded:Number;
private var h264:Boolean;
private var timeinterval:Number;
private var offset:Number;
private var timeoffset:Number;
private var model:Model;
private var loadinterval:Number;
private var keyframes:Object;
private var timer:Timer;
private var connection:NetConnection;
private var transform:SoundTransform;
private var video:Video;
public function HTTPModel(_arg1:Model):void{
model = _arg1;
connection = new NetConnection();
connection.addEventListener(NetStatusEvent.NET_STATUS, statusHandler);
connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, errorHandler);
connection.addEventListener(AsyncErrorEvent.ASYNC_ERROR, errorHandler);
connection.connect(null);
stream = new NetStream(connection);
stream.addEventListener(NetStatusEvent.NET_STATUS, statusHandler);
stream.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, metaHandler);
stream.bufferTime = model.config["bufferlength"];
stream.client = new NetClient(this);
video = new Video(320, 240);
video.attachNetStream(stream);
transform = new SoundTransform();
stream.soundTransform = transform;
if ((model.config["mute"] == true)){
volume(0);
} else {
volume(model.config["volume"]);
};
quality(model.config["quality"]);
offset = (timeoffset = 0);
}
public function stop():void{
clearInterval(loadinterval);
clearInterval(timeinterval);
offset = (timeoffset = 0);
h264 = false;
keyframes = undefined;
if (stream.bytesLoaded != stream.bytesTotal){
stream.close();
};
stream.pause();
}
private function loadHandler():void{
var _local1:*;
if (!timer){
timer = new Timer(2000, 1);
timer.addEventListener("timer", timerHandler);
timer.start();
};
loaded = stream.bytesLoaded;
_local1 = stream.bytesTotal;
if ((((loaded >= _local1)) && ((loaded > 0)))){
clearInterval(loadinterval);
};
model.sendEvent(ModelEvent.LOADED, {loaded:loaded, total:(_local1 + offset), offset:offset});
}
private function getOffset(_arg1:Number, _arg2:Boolean=false):Number{
var _local3:*;
_local3 = 0;
while (_local3 < keyframes.times.length) {
if ((((keyframes.times[_local3] <= _arg1)) && ((((keyframes.times[(_local3 + 1)] >= _arg1)) || (!(keyframes.times[(_local3 + 1)])))))){
if (_arg2 == true){
return (keyframes.times[_local3]);
};
return (keyframes.filepositions[_local3]);
};
_local3++;
};
return (0);
}
private function metaHandler(_arg1:ErrorEvent):void{
model.sendEvent(ModelEvent.META, {error:_arg1.text});
}
public function pause():void{
clearInterval(timeinterval);
stream.pause();
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.PAUSED});
}
public function volume(_arg1:Number):void{
transform.volume = (_arg1 / 100);
stream.soundTransform = transform;
}
private function errorHandler(_arg1:ErrorEvent):void{
model.sendEvent(ModelEvent.ERROR, {message:_arg1.text});
}
public function seek(_arg1:Number):void{
var _local2:*;
clearInterval(timeinterval);
_local2 = getOffset(_arg1);
if ((((_local2 < offset)) || ((_local2 > (offset + loaded))))){
offset = _local2;
timeoffset = getOffset(_arg1, true);
load();
} else {
if (h264){
stream.seek((_arg1 - timeoffset));
} else {
stream.seek(_arg1);
};
play();
};
}
public function onData(_arg1:Object):void{
var _local2:*;
if ((((_arg1.type == "metadata")) && (!(h264)))){
if (_arg1.width){
video.width = _arg1.width;
video.height = _arg1.height;
model.mediaHandler(video);
} else {
model.mediaHandler();
};
if (_arg1.seekpoints){
h264 = true;
keyframes = new Object();
keyframes.times = new Array();
keyframes.filepositions = new Array();
for (_local2 in _arg1.seekpoints) {
keyframes.times[_local2] = Number(_arg1.seekpoints[_local2]["time"]);
keyframes.filepositions[_local2] = Number(_arg1.seekpoints[_local2]["offset"]);
};
} else {
if (_arg1.keyframes){
keyframes = _arg1.keyframes;
};
};
if (model.playlist[model.config["item"]]["start"] > 0){
seek(model.playlist[model.config["item"]]["start"]);
};
model.sendEvent(ModelEvent.META, _arg1);
} else {
if (_arg1.type != "metadata"){
model.sendEvent(ModelEvent.META, _arg1);
};
};
}
public function play():void{
stream.resume();
timeinterval = setInterval(timeHandler, 100);
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.PLAYING});
}
private function timeHandler():void{
var _local1:*;
var _local2:*;
var _local3:*;
_local1 = Math.round(((stream.bufferLength / stream.bufferTime) * 100));
_local2 = (Math.round((stream.time * 10)) / 10);
if (h264){
_local2 = (_local2 + timeoffset);
};
_local3 = model.playlist[model.config["item"]]["duration"];
if ((((_local1 < 100)) && ((_local2 < Math.abs((_local3 - (stream.bufferTime * 2))))))){
model.sendEvent(ModelEvent.BUFFER, {percentage:_local1});
if (((!((model.config["state"] == ModelStates.BUFFERING))) && ((_local1 < 50)))){
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.BUFFERING});
};
} else {
if (model.config["state"] == ModelStates.BUFFERING){
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.PLAYING});
if (!keyframes){
video.width = 320;
video.height = 240;
model.mediaHandler(video);
};
};
};
if (_local3 > 0){
model.sendEvent(ModelEvent.TIME, {position:_local2, duration:_local3});
};
}
private function getToken():String{
return (model.config["token"]);
}
public function timerHandler(_arg1:TimerEvent):void{
var _local2:*;
_local2 = Math.round(((stream.bytesLoaded * 4) / 0x0400));
model.sendEvent(ModelEvent.META, {bandwidth:_local2});
}
public function load():void{
var _local1:*;
if (stream.bytesLoaded != stream.bytesTotal){
stream.close();
};
_local1 = model.playlist[model.config["item"]]["file"];
if (model.config["streamer"] == "lighttpd"){
if (h264){
_local1 = (_local1 + ("?start=" + timeoffset));
} else {
_local1 = (_local1 + ("?start=" + offset));
};
} else {
if (model.config["streamer"].indexOf("?") > -1){
_local1 = ((((model.config["streamer"] + "&file=") + _local1) + "&start=") + offset);
} else {
_local1 = ((((model.config["streamer"] + "?file=") + _local1) + "&start=") + offset);
};
};
_local1 = (_local1 + ("&id=" + model.config["id"]));
_local1 = (_local1 + ("&client=" + encodeURI(model.config["client"])));
_local1 = (_local1 + ("&version=" + encodeURI(model.config["version"])));
if (getToken()){
_local1 = (_local1 + ("&token=" + getToken()));
};
trace(_local1);
stream.play(_local1);
clearInterval(loadinterval);
clearInterval(timeinterval);
loadinterval = setInterval(loadHandler, 100);
timeinterval = setInterval(timeHandler, 100);
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.BUFFERING});
}
private function statusHandler(_arg1:NetStatusEvent):void{
if (_arg1.info.code == "NetStream.Play.Stop"){
if (model.config["state"] != ModelStates.COMPLETED){
clearInterval(timeinterval);
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.COMPLETED});
};
} else {
if (_arg1.info.code == "NetStream.Play.StreamNotFound"){
stop();
model.sendEvent(ModelEvent.ERROR, {message:("Video stream not found: " + model.playlist[model.config["item"]]["file"])});
} else {
model.sendEvent(ModelEvent.META, {info:_arg1.info.code});
};
};
}
public function quality(_arg1:Boolean):void{
if (_arg1 == true){
video.smoothing = true;
video.deblocking = 3;
} else {
video.smoothing = false;
video.deblocking = 1;
};
}
}
}//package com.jeroenwijering.models
Section 9
//ImageModel (com.jeroenwijering.models.ImageModel)
package com.jeroenwijering.models {
import com.jeroenwijering.events.*;
import flash.display.*;
import flash.events.*;
import com.jeroenwijering.player.*;
import flash.net.*;
import flash.media.*;
import flash.utils.*;
public class ImageModel implements ModelInterface {
private var interval:Number;
private var loader:Loader;
private var position:Number;
private var model:Model;
public function ImageModel(_arg1:Model):void{
model = _arg1;
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderHandler);
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
}
public function stop():void{
SoundMixer.stopAll();
clearInterval(interval);
if (loader.contentLoaderInfo.bytesLoaded != loader.contentLoaderInfo.bytesTotal){
loader.close();
} else {
loader.unload();
};
}
public function quality(_arg1:Boolean):void{
var stt = _arg1;
try {
Bitmap(loader.content).smoothing = stt;
} catch(err:Error) {
};
}
public function seek(_arg1:Number):void{
clearInterval(interval);
position = _arg1;
play();
}
public function volume(_arg1:Number):void{
}
private function progressHandler(_arg1:ProgressEvent):void{
var _local2:*;
_local2 = Math.round(((_arg1.bytesLoaded / _arg1.bytesTotal) * 100));
model.sendEvent(ModelEvent.BUFFER, {percentage:_local2});
}
private function errorHandler(_arg1:ErrorEvent):void{
model.sendEvent(ModelEvent.ERROR, {message:_arg1.text});
}
public function load():void{
clearInterval(interval);
position = model.playlist[model.config["item"]]["start"];
loader.load(new URLRequest(model.playlist[model.config["item"]]["file"]));
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.BUFFERING});
model.sendEvent(ModelEvent.BUFFER, {percentage:0});
}
private function timeInterval():void{
var _local1:*;
position = (Math.round(((position * 10) + 1)) / 10);
_local1 = model.playlist[model.config["item"]]["duration"];
if ((((position >= _local1)) && ((_local1 > 0)))){
clearInterval(interval);
SoundMixer.stopAll();
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.COMPLETED});
} else {
if (_local1 > 0){
model.sendEvent(ModelEvent.TIME, {position:position, duration:_local1});
};
};
}
public function play():void{
interval = setInterval(timeInterval, 100);
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.PLAYING});
}
public function pause():void{
clearInterval(interval);
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.PAUSED});
}
private function loaderHandler(_arg1:Event):void{
model.mediaHandler(loader);
quality(model.config["quality"]);
play();
model.sendEvent(ModelEvent.META, {height:_arg1.target.height, width:_arg1.target.width});
model.sendEvent(ModelEvent.LOADED, {loaded:_arg1.target.bytesLoaded, total:_arg1.target.bytesTotal});
}
}
}//package com.jeroenwijering.models
Section 10
//ModelInterface (com.jeroenwijering.models.ModelInterface)
package com.jeroenwijering.models {
public interface ModelInterface {
function stop():void;
function play():void;
function pause():void;
function seek(_arg1:Number):void;
function volume(_arg1:Number):void;
function load():void;
function quality(_arg1:Boolean):void;
}
}//package com.jeroenwijering.models
Section 11
//RTMPModel (com.jeroenwijering.models.RTMPModel)
package com.jeroenwijering.models {
import com.jeroenwijering.events.*;
import flash.events.*;
import com.jeroenwijering.player.*;
import com.jeroenwijering.utils.*;
import flash.net.*;
import flash.media.*;
import flash.utils.*;
public class RTMPModel implements ModelInterface {
private var stream:NetStream;
private var timeinterval:Number;
private var timeout:Number;
private var connection:NetConnection;
private var model:Model;
private var transform:SoundTransform;
private var metadata:Boolean;
private var video:Video;
public function RTMPModel(_arg1:Model):void{
model = _arg1;
connection = new NetConnection();
connection.addEventListener(NetStatusEvent.NET_STATUS, statusHandler);
connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, errorHandler);
connection.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
connection.addEventListener(AsyncErrorEvent.ASYNC_ERROR, metaHandler);
connection.objectEncoding = ObjectEncoding.AMF0;
connection.client = new NetClient(this);
video = new Video(320, 240);
quality(model.config["quality"]);
transform = new SoundTransform();
if ((model.config["mute"] == true)){
volume(0);
} else {
volume(model.config["volume"]);
};
}
private function timeHandler():void{
var _local1:*;
var _local2:*;
var _local3:*;
_local1 = Math.round(((stream.bufferLength / stream.bufferTime) * 100));
_local2 = (Math.round((stream.time * 10)) / 10);
_local3 = model.playlist[model.config["item"]]["duration"];
if ((((_local1 < 100)) && ((_local2 < Math.abs(((_local3 - stream.bufferTime) - 1)))))){
model.sendEvent(ModelEvent.BUFFER, {percentage:_local1});
if (model.config["state"] != ModelStates.BUFFERING){
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.BUFFERING});
};
} else {
if (model.config["state"] == ModelStates.BUFFERING){
if (!metadata){
video.width = 320;
video.height = 240;
model.mediaHandler(video);
};
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.PLAYING});
};
};
if (_local3 > 0){
model.sendEvent(ModelEvent.TIME, {position:_local2, duration:_local3});
};
}
private function metaHandler(_arg1:ErrorEvent):void{
model.sendEvent(ModelEvent.META, {error:_arg1.text});
}
public function setStream(_arg1:String=""):void{
var _local2:*;
_local2 = getID(model.playlist[model.config["item"]]["file"]);
stream = new NetStream(connection);
stream.addEventListener(NetStatusEvent.NET_STATUS, statusHandler);
stream.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, metaHandler);
stream.bufferTime = model.config["bufferlength"];
stream.client = new NetClient(this);
video.attachNetStream(stream);
stream.soundTransform = transform;
stream.play((_local2 + _arg1));
clearInterval(timeinterval);
timeinterval = setInterval(timeHandler, 100);
}
private function subscribe(_arg1:String):void{
connection.call("FCSubscribe", null, _arg1);
}
public function stop():void{
metadata = false;
clearInterval(timeinterval);
connection.close();
if (stream){
stream.close();
};
video.attachNetStream(null);
}
private function statusHandler(_arg1:NetStatusEvent):void{
if (_arg1.info.code == "NetConnection.Connect.Success"){
if (_arg1.info.secureToken != undefined){
connection.call("secureTokenResponse", null, TEA.decrypt(_arg1.info.secureToken, model.config["token"]));
};
setStream();
} else {
if (_arg1.info.code == "NetStream.Seek.Notify"){
clearInterval(timeinterval);
timeinterval = setInterval(timeHandler, 100);
} else {
if ((((((_arg1.info.code == "NetStream.Play.StreamNotFound")) || ((_arg1.info.code == "NetConnection.Connect.Rejected")))) || ((_arg1.info.code == "NetConnection.Connect.Failed")))){
stop();
model.sendEvent(ModelEvent.ERROR, {message:("Stream not found: " + model.playlist[model.config["item"]]["file"])});
} else {
model.sendEvent(ModelEvent.META, {info:_arg1.info.code});
};
};
};
}
private function errorHandler(_arg1:ErrorEvent):void{
model.sendEvent(ModelEvent.ERROR, {message:_arg1.text});
}
public function load():void{
connection.connect(model.config["streamer"]);
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.BUFFERING});
}
public function onData(_arg1:Object):void{
if ((((_arg1.type == "metadata")) && (!(metadata)))){
metadata = true;
if (_arg1.width){
video.width = _arg1.width;
video.height = _arg1.height;
model.mediaHandler(video);
} else {
model.mediaHandler();
};
if (model.playlist[model.config["item"]]["start"] > 0){
seek(model.playlist[model.config["item"]]["start"]);
};
} else {
if (_arg1.type == "complete"){
clearInterval(timeinterval);
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.COMPLETED});
} else {
if ((((_arg1.type == "fcsubscribe")) && ((_arg1.code == "NetStream.Play.Start")))){
setStream();
clearInterval(timeout);
} else {
if (_arg1.type == "bandwidth"){
setStream(("?bw=" + _arg1.bandwidth));
};
};
};
};
model.sendEvent(ModelEvent.META, _arg1);
}
private function getID(_arg1:String):String{
if (_arg1.substr(-4) == ".mp3"){
_arg1 = ("mp3:" + _arg1.substr(0, (_arg1.length - 4)));
} else {
if ((((((((_arg1.substr(-4) == ".mp4")) || ((_arg1.substr(-4) == ".mov")))) || ((_arg1.substr(-4) == ".aac")))) || ((_arg1.substr(-4) == ".m4a")))){
_arg1 = ("mp4:" + _arg1.substr(0, (_arg1.length - 4)));
} else {
if (_arg1.substr(-4) == ".flv"){
_arg1 = _arg1.substr(0, (_arg1.length - 4));
};
};
};
return (_arg1);
}
public function volume(_arg1:Number):void{
transform.volume = (_arg1 / 100);
if (stream){
stream.soundTransform = transform;
};
}
public function play():void{
clearTimeout(timeout);
clearInterval(timeinterval);
stream.resume();
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.PLAYING});
timeinterval = setInterval(timeHandler, 100);
}
public function seek(_arg1:Number):void{
clearTimeout(timeout);
clearInterval(timeinterval);
if (model.config["state"] == ModelStates.PAUSED){
stream.resume();
} else {
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.PLAYING});
};
stream.seek(_arg1);
}
public function pause():void{
clearInterval(timeinterval);
stream.pause();
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.PAUSED});
}
public function quality(_arg1:Boolean):void{
if (_arg1 == true){
video.smoothing = true;
video.deblocking = 3;
} else {
video.smoothing = false;
video.deblocking = 1;
};
}
}
}//package com.jeroenwijering.models
Section 12
//SoundModel (com.jeroenwijering.models.SoundModel)
package com.jeroenwijering.models {
import com.jeroenwijering.events.*;
import flash.events.*;
import com.jeroenwijering.player.*;
import flash.net.*;
import flash.media.*;
import flash.utils.*;
public class SoundModel implements ModelInterface {
private var channel:SoundChannel;
private var interval:Number;
private var sound:Sound;
private var duration:Number;
private var model:Model;
private var transform:SoundTransform;
private var context:SoundLoaderContext;
private var position:Number;
public function SoundModel(_arg1:Model):void{
model = _arg1;
transform = new SoundTransform();
if ((model.config["mute"] == true)){
volume(0);
} else {
volume(model.config["volume"]);
};
context = new SoundLoaderContext((model.config["bufferlength"] * 1000));
}
public function stop():void{
clearInterval(interval);
if (channel){
channel.stop();
};
try {
sound.close();
} catch(err:Error) {
};
}
private function timeHandler():void{
var _local1:*;
var _local2:*;
position = (Math.round((channel.position / 100)) / 10);
_local1 = (Math.round((((sound.length * sound.bytesTotal) / sound.bytesLoaded) / 100)) / 10);
if ((((sound.isBuffering == true)) && ((sound.bytesTotal > sound.bytesLoaded)))){
if (model.config["state"] != ModelStates.BUFFERING){
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.BUFFERING});
} else {
_local2 = Math.floor(((sound.length / (channel.position + (model.config["bufferlength"] * 1000))) * 100));
model.sendEvent(ModelEvent.BUFFER, {percentage:_local2});
};
} else {
if ((((model.config["state"] == ModelStates.BUFFERING)) && ((sound.isBuffering == false)))){
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.PLAYING});
};
};
if (_local1 > position){
model.sendEvent(ModelEvent.TIME, {position:position, duration:_local1});
};
if (((!((_local1 == duration))) && (!(isNaN(_local1))))){
duration = _local1;
model.sendEvent(ModelEvent.META, {duration:duration});
};
}
private function completeHandler(_arg1:Event):void{
clearInterval(interval);
position = model.playlist[model.config["item"]]["start"];
model.sendEvent(ModelEvent.TIME, {position:position, duration:duration});
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.COMPLETED});
}
public function volume(_arg1:Number):void{
transform.volume = (_arg1 / 100);
if (channel){
channel.soundTransform = transform;
};
}
private function progressHandler(_arg1:ProgressEvent):void{
var _local2:*;
var _local3:*;
_local2 = _arg1.bytesLoaded;
_local3 = _arg1.bytesTotal;
model.sendEvent(ModelEvent.LOADED, {loaded:_local2, total:_local3});
}
private function errorHandler(_arg1:ErrorEvent):void{
model.sendEvent(ModelEvent.ERROR, {message:_arg1.text});
stop();
}
public function load():void{
position = model.playlist[model.config["item"]]["start"];
duration = model.playlist[model.config["item"]]["duration"];
sound = new Sound();
sound.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
sound.addEventListener(ProgressEvent.PROGRESS, progressHandler);
sound.load(new URLRequest(model.playlist[model.config["item"]]["file"]), context);
model.mediaHandler();
play();
}
public function play():void{
channel = sound.play((position * 1000), 0, transform);
channel.removeEventListener(Event.SOUND_COMPLETE, completeHandler);
channel.addEventListener(Event.SOUND_COMPLETE, completeHandler);
interval = setInterval(timeHandler, 100);
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.PLAYING});
}
public function pause():void{
clearInterval(interval);
channel.stop();
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.PAUSED});
}
public function seek(_arg1:Number):void{
clearInterval(interval);
position = _arg1;
channel.stop();
play();
}
public function quality(_arg1:Boolean):void{
}
}
}//package com.jeroenwijering.models
Section 13
//VideoModel (com.jeroenwijering.models.VideoModel)
package com.jeroenwijering.models {
import com.jeroenwijering.events.*;
import flash.events.*;
import com.jeroenwijering.player.*;
import com.jeroenwijering.utils.*;
import flash.net.*;
import flash.media.*;
import flash.utils.*;
public class VideoModel implements ModelInterface {
private var stream:NetStream;
private var timeinterval:Number;
private var connection:NetConnection;
private var model:Model;
private var loadinterval:Number;
private var transform:SoundTransform;
private var metadata:Boolean;
private var video:Video;
public function VideoModel(_arg1:Model):void{
model = _arg1;
connection = new NetConnection();
connection.addEventListener(NetStatusEvent.NET_STATUS, statusHandler);
connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, errorHandler);
connection.objectEncoding = ObjectEncoding.AMF0;
connection.connect(null);
stream = new NetStream(connection);
stream.addEventListener(NetStatusEvent.NET_STATUS, statusHandler);
stream.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, metaHandler);
stream.bufferTime = model.config["bufferlength"];
stream.client = new NetClient(this);
video = new Video(320, 240);
video.attachNetStream(stream);
transform = new SoundTransform();
stream.soundTransform = transform;
quality(model.config["quality"]);
if ((model.config["mute"] == true)){
volume(0);
} else {
volume(model.config["volume"]);
};
}
public function stop():void{
if (stream.bytesLoaded != stream.bytesTotal){
stream.close();
};
stream.pause();
metadata = false;
clearInterval(loadinterval);
clearInterval(timeinterval);
}
private function loadHandler():void{
var _local1:*;
var _local2:*;
_local1 = stream.bytesLoaded;
_local2 = stream.bytesTotal;
model.sendEvent(ModelEvent.LOADED, {loaded:_local1, total:_local2});
if ((((_local1 == _local2)) && ((_local1 > 0)))){
clearInterval(loadinterval);
};
}
private function metaHandler(_arg1:ErrorEvent):void{
model.sendEvent(ModelEvent.META, {error:_arg1.text});
}
private function timeHandler():void{
var _local1:*;
var _local2:*;
var _local3:*;
_local1 = Math.round(((stream.bufferLength / stream.bufferTime) * 100));
_local2 = (Math.round((stream.time * 10)) / 10);
_local3 = model.playlist[model.config["item"]]["duration"];
if ((((_local1 < 100)) && ((_local2 < Math.abs((_local3 - (stream.bufferTime * 2))))))){
model.sendEvent(ModelEvent.BUFFER, {percentage:_local1});
if (((!((model.config["state"] == ModelStates.BUFFERING))) && ((_local1 < 50)))){
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.BUFFERING});
};
} else {
if (model.config["state"] == ModelStates.BUFFERING){
if (!metadata){
video.width = 320;
video.height = 240;
model.mediaHandler(video);
};
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.PLAYING});
};
};
if (_local3 > 0){
model.sendEvent(ModelEvent.TIME, {position:_local2, duration:_local3});
};
}
private function statusHandler(_arg1:NetStatusEvent):void{
if ((((_arg1.info.code == "NetStream.Play.Stop")) && ((stream.bytesLoaded == stream.bytesTotal)))){
clearInterval(timeinterval);
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.COMPLETED});
} else {
if (_arg1.info.code == "NetStream.Play.StreamNotFound"){
stop();
model.sendEvent(ModelEvent.ERROR, {message:("Video not found: " + model.playlist[model.config["item"]]["file"])});
};
};
model.sendEvent(ModelEvent.META, {info:_arg1.info.code});
}
public function volume(_arg1:Number):void{
transform.volume = (_arg1 / 100);
stream.soundTransform = transform;
}
private function errorHandler(_arg1:ErrorEvent):void{
model.sendEvent(ModelEvent.ERROR, {message:_arg1.text});
}
public function load():void{
stream.play(model.playlist[model.config["item"]]["file"]);
loadinterval = setInterval(loadHandler, 100);
timeinterval = setInterval(timeHandler, 100);
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.BUFFERING});
}
public function onData(_arg1:Object):void{
if ((((_arg1.type == "metadata")) && (!(metadata)))){
metadata = true;
if (_arg1.width){
video.width = _arg1.width;
video.height = _arg1.height;
model.mediaHandler(video);
} else {
model.mediaHandler();
};
if (model.playlist[model.config["item"]]["start"] > 0){
seek(model.playlist[model.config["item"]]["start"]);
};
};
model.sendEvent(ModelEvent.META, _arg1);
}
public function play():void{
stream.resume();
timeinterval = setInterval(timeHandler, 100);
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.PLAYING});
}
public function seek(_arg1:Number):void{
clearInterval(timeinterval);
stream.seek(_arg1);
play();
}
public function pause():void{
clearInterval(timeinterval);
stream.pause();
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.PAUSED});
}
public function quality(_arg1:Boolean):void{
if (_arg1 == true){
video.smoothing = true;
video.deblocking = 3;
} else {
video.smoothing = false;
video.deblocking = 1;
};
}
}
}//package com.jeroenwijering.models
Section 14
//YoutubeModel (com.jeroenwijering.models.YoutubeModel)
package com.jeroenwijering.models {
import com.jeroenwijering.events.*;
import flash.display.*;
import flash.events.*;
import com.jeroenwijering.player.*;
import flash.net.*;
public class YoutubeModel implements ModelInterface {
private var connected:Boolean;
private var loader:Loader;
private var metasent:Boolean;
private var model:Model;
private var outgoing:LocalConnection;
private var inbound:LocalConnection;
private var loading:Boolean;
public function YoutubeModel(_arg1:Model):void{
var url:*;
var ytb:*;
var mod = _arg1;
super();
model = mod;
outgoing = new LocalConnection();
outgoing.allowDomain("*");
outgoing.allowInsecureDomain("*");
outgoing.addEventListener(StatusEvent.STATUS, onLocalConnectionStatusChange);
inbound = new LocalConnection();
inbound.allowDomain("*");
inbound.allowInsecureDomain("*");
inbound.addEventListener(StatusEvent.STATUS, onLocalConnectionStatusChange);
inbound.client = this;
try {
inbound.connect("_AS2_to_AS3");
connected = true;
} catch(err:Error) {
stop();
model.sendEvent(ModelEvent.ERROR, {message:"Cannot connect to Youtube. Only one YouTube connection per computer can be made!"});
};
loader = new Loader();
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
url = model.skin.loaderInfo.url;
ytb = (url.substr(0, (url.lastIndexOf("/") + 1)) + "yt.swf");
loader.load(new URLRequest(ytb));
}
public function onSwfLoadComplete():void{
outgoing.send("_AS3_to_AS2", "setSize", 320, 240);
if ((model.config["mute"] == true)){
volume(0);
} else {
volume(model.config["volume"]);
};
if (loading){
load();
};
}
public function onLocalConnectionStatusChange(_arg1:StatusEvent):void{
}
public function onLoadChange(_arg1:Number, _arg2:Number, _arg3:Number):void{
model.sendEvent(ModelEvent.LOADED, {loaded:_arg1, total:_arg2, offset:_arg3});
}
public function seek(_arg1:Number):void{
outgoing.send("_AS3_to_AS2", "seekTo", _arg1);
play();
}
public function onStateChange(_arg1:Number):void{
switch (Number(_arg1)){
case -1:
break;
case 0:
if (((!((model.config["state"] == ModelStates.BUFFERING))) && (!((model.config["state"] == ModelStates.IDLE))))){
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.COMPLETED});
};
break;
case 1:
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.PLAYING});
break;
case 2:
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.PAUSED});
break;
case 3:
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.BUFFERING});
model.sendEvent(ModelEvent.BUFFER, {percentage:0});
break;
};
}
public function onTimeChange(_arg1:Number, _arg2:Number):void{
model.sendEvent(ModelEvent.TIME, {position:_arg1, duration:_arg2});
if (!metasent){
model.sendEvent(ModelEvent.META, {width:320, height:240, duration:_arg2});
metasent = true;
};
}
public function volume(_arg1:Number):void{
outgoing.send("_AS3_to_AS2", "setVolume", _arg1);
}
private function errorHandler(_arg1:ErrorEvent):void{
model.sendEvent(ModelEvent.ERROR, {message:_arg1.text});
}
public function stop():void{
outgoing.send("_AS3_to_AS2", "stopVideo");
}
public function load():void{
var _local1:*;
var _local2:*;
if (connected){
model.sendEvent(ModelEvent.STATE, {newstate:ModelStates.BUFFERING});
loading = true;
if (outgoing){
_local1 = getID(model.playlist[model.config["item"]]["file"]);
_local2 = model.playlist[model.config["item"]]["start"];
outgoing.send("_AS3_to_AS2", "loadVideoById", _local1, _local2);
model.mediaHandler(loader);
};
};
}
public function onError(_arg1:String):void{
var _local2:*;
_local2 = model.playlist[model.config["item"]]["file"];
model.sendEvent(ModelEvent.ERROR, {message:("YouTube error (video not found?):\n" + _local2)});
stop();
}
private function getID(_arg1:String):String{
var _local2:*;
var _local3:*;
var _local4:*;
_local2 = _arg1.split("?");
_local3 = "";
for (_local4 in _local2) {
if (_local2[_local4].substr(0, 2) == "v="){
_local3 = _local2[_local4].substr(2);
};
};
if (_local3 == ""){
_local3 = _arg1.substr((_arg1.indexOf("/v/") + 3));
};
if (_local3.indexOf("&") > -1){
_local3 = _local3.substr(0, _local3.indexOf("&"));
};
return (_local3);
}
public function play():void{
outgoing.send("_AS3_to_AS2", "playVideo");
}
public function pause():void{
outgoing.send("_AS3_to_AS2", "pauseVideo");
}
public function quality(_arg1:Boolean):void{
}
}
}//package com.jeroenwijering.models
Section 15
//ASXParser (com.jeroenwijering.parsers.ASXParser)
package com.jeroenwijering.parsers {
import com.jeroenwijering.utils.*;
public class ASXParser extends ObjectParser {
public static function parse(_arg1:XML):Array{
var _local2:*;
var _local3:*;
var _local4:*;
_local2 = new Array();
_local3 = new Object();
for each (_local4 in _arg1.children()) {
_local3 = ASXParser.parseItem(_local4);
if (_local3["type"] != undefined){
_local2.push(_local3);
};
};
return (_local2);
}
public static function parseItem(_arg1:XML):Object{
var _local2:*;
var _local3:*;
_local2 = new Object();
for each (_local3 in _arg1.children()) {
if (!_local3.localName()){
break;
};
switch (_local3.localName().toLowerCase()){
case "ref":
_local2["file"] = _local3.@href.toString();
break;
case "title":
_local2["title"] = _local3.text().toString();
break;
case "moreinfo":
_local2["link"] = _local3.@href.toString();
break;
case "abstract":
_local2["description"] = _local3.text().toString();
break;
case "author":
_local2["author"] = _local3.text().toString();
break;
case "duration":
_local2["duration"] = Strings.seconds(_local3.@value);
break;
case "starttime":
_local2["start"] = Strings.seconds(_local3.@value);
break;
case "param":
_local2[_local3.@name] = _local3.@value.toString();
break;
};
};
return (ObjectParser.detect(_local2));
}
}
}//package com.jeroenwijering.parsers
Section 16
//ATOMParser (com.jeroenwijering.parsers.ATOMParser)
package com.jeroenwijering.parsers {
public class ATOMParser extends ObjectParser {
public static function parse(_arg1:XML):Array{
var _local2:*;
var _local3:*;
var _local4:*;
_local2 = new Array();
_local3 = new Object();
for each (_local4 in _arg1.children()) {
if (_local4.localName() == "entry"){
_local3 = ATOMParser.parseItem(_local4);
};
if (_local3["type"] != undefined){
_local2.push(_local3);
};
};
return (_local2);
}
public static function parseItem(_arg1:XML):Object{
var _local2:*;
var _local3:*;
_local2 = new Object();
for each (_local3 in _arg1.children()) {
switch (_local3.localName()){
case "author":
_local2["author"] = _local3.children()[0].text().toString();
break;
case "title":
_local2["title"] = _local3.text().toString();
break;
case "summary":
_local2["description"] = _local3.text().toString();
break;
case "link":
if (_local3.@rel == "alternate"){
_local2["link"] = _local3.@href.toString();
};
break;
case "group":
_local2 = MediaParser.parseGroup(_local3, _local2);
break;
};
};
_local2 = MediaParser.parseGroup(_arg1, _local2);
return (ObjectParser.detect(_local2));
}
}
}//package com.jeroenwijering.parsers
Section 17
//MediaParser (com.jeroenwijering.parsers.MediaParser)
package com.jeroenwijering.parsers {
import com.jeroenwijering.utils.*;
public class MediaParser extends ObjectParser {
public static function parseGroup(_arg1:XML, _arg2:Object):Object{
var _local3:*;
for each (_local3 in _arg1.children()) {
switch (_local3.localName()){
case "content":
if (((!(_arg2["file"])) && (ObjectParser.MIMETYPES[_local3.@type.toString()]))){
_arg2["file"] = _local3.@url.toString();
_arg2["type"] = _local3.@type.toString();
if (_local3.@duration){
_arg2["duration"] = Strings.seconds(_local3.@duration);
};
if (_local3.@start){
_arg2["start"] = Strings.seconds(_local3.@start);
};
};
break;
case "description":
_arg2["description"] = _local3.text().toString();
break;
case "thumbnail":
if (!_arg2["image"]){
_arg2["image"] = _local3.@url.toString();
};
break;
case "credit":
_arg2["author"] = _local3.text().toString();
break;
case "text":
if (_local3.@url){
_arg2["captions"] = _local3.@url.toString();
};
break;
};
};
return (_arg2);
}
}
}//package com.jeroenwijering.parsers
Section 18
//ObjectParser (com.jeroenwijering.parsers.ObjectParser)
package com.jeroenwijering.parsers {
import com.jeroenwijering.utils.*;
public class ObjectParser {
protected static var EXTENSIONS:Object = {3g2:"video", 3gp:"video", aac:"video", f4b:"video", f4p:"video", f4v:"video", flv:"video", gif:"image", jpg:"image", m4a:"video", m4v:"video", mov:"video", mp3:"sound", mp4:"video", png:"image", rbs:"sound", swf:"image", vp6:"video"};
protected static var MIMETYPES:Object = {application/x-fcs:"rtmp", application/x-shockwave-flash:"image", audio/aac:"video", audio/m4a:"video", audio/mp4:"video", audio/mp3:"sound", audio/mpeg:"sound", audio/x-3gpp:"video", audio/x-m4a:"video", image/gif:"image", image/jpeg:"image", image/png:"image", video/flv:"video", video/3gpp:"video", video/h264:"video", video/mp4:"video", video/x-3gpp:"video", video/x-flv:"video", video/x-m4v:"video", video/x-mp4:"video"};
protected static var ELEMENTS:Object = {audio:undefined, author:undefined, captions:undefined, description:undefined, duration:0, file:undefined, image:undefined, link:undefined, title:undefined, start:0, type:undefined};
protected static var TYPES:Object = {camera:"", image:"", rtmp:"", sound:"", video:"", youtube:""};
public static function parse(_arg1:Object):Object{
var _local2:*;
var _local3:*;
_local2 = new Object();
for (_local3 in ObjectParser.ELEMENTS) {
if (_arg1[_local3] != undefined){
_local2[_local3] = Strings.serialize(_arg1[_local3], ObjectParser.ELEMENTS[_local3]);
};
};
return (ObjectParser.detect(_local2));
}
public static function detect(_arg1:Object, _arg2:Boolean=false):Object{
var _local3:*;
if (_arg1["type"]){
_arg1["type"] = _arg1["type"].toLowerCase();
};
if (_arg1["file"] == undefined){
delete _arg1["type"];
return (_arg1);
};
if (ObjectParser.TYPES[_arg1["type"]] != undefined){
} else {
if (ObjectParser.EXTENSIONS[_arg1["type"]] != undefined){
_arg1["type"] = ObjectParser.EXTENSIONS[_arg1["type"]];
} else {
if ((((_arg1["file"].indexOf("youtube.com/watch") > -1)) || ((_arg1["file"].indexOf("youtube.com/v/") > -1)))){
_arg1["type"] = "youtube";
} else {
if (ObjectParser.MIMETYPES[_arg1["type"]] != undefined){
_arg1["type"] = ObjectParser.MIMETYPES[_arg1["type"]];
} else {
_arg1["type"] = undefined;
for (_local3 in ObjectParser.EXTENSIONS) {
if (((_arg1["file"]) && ((_arg1["file"].substr(-3).toLowerCase() == _local3)))){
_arg1["type"] = ObjectParser.EXTENSIONS[_local3];
break;
};
};
};
};
};
};
if (!_arg1["duration"]){
_arg1["duration"] = 0;
};
if (!_arg1["start"]){
_arg1["start"] = 0;
};
return (_arg1);
}
}
}//package com.jeroenwijering.parsers
Section 19
//RSSParser (com.jeroenwijering.parsers.RSSParser)
package com.jeroenwijering.parsers {
import com.jeroenwijering.utils.*;
public class RSSParser extends ObjectParser {
public static function parse(_arg1:XML):Array{
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
_local2 = new Array();
_local3 = new Object();
for each (_local4 in _arg1.children()) {
if (_local4.localName() == "channel"){
for each (_local5 in _local4.children()) {
if (_local5.name() == "item"){
_local3 = RSSParser.parseItem(_local5);
};
if (_local3["type"] != undefined){
_local2.push(_local3);
};
};
};
};
return (_local2);
}
public static function parseItem(_arg1:XML):Object{
var _local2:*;
var _local3:*;
_local2 = new Object();
for each (_local3 in _arg1.children()) {
switch (_local3.localName()){
case "duration":
_local2["duration"] = Strings.seconds(_local3.text());
break;
case "enclosure":
_local2["file"] = _local3.@url.toString();
_local2["type"] = _local3.@type.toString();
break;
case "title":
_local2["title"] = _local3.text().toString();
break;
case "description":
_local2["description"] = _local3.text().toString();
break;
case "summary":
_local2["description"] = _local3.text().toString();
break;
case "link":
_local2["link"] = _local3.text().toString();
break;
case "author":
_local2["author"] = _local3.text().toString();
break;
case "group":
_local2 = MediaParser.parseGroup(_local3, _local2);
break;
};
};
_local2 = MediaParser.parseGroup(_arg1, _local2);
return (ObjectParser.detect(_local2));
}
}
}//package com.jeroenwijering.parsers
Section 20
//SMILParser (com.jeroenwijering.parsers.SMILParser)
package com.jeroenwijering.parsers {
import com.jeroenwijering.utils.*;
public class SMILParser extends ObjectParser {
public static function parseAttributes(_arg1:Object, _arg2:Object):Object{
var _local3:*;
var _local4:*;
_local3 = 0;
while (_local3 < _arg1.attributes().length()) {
_local4 = String(_arg1.attributes()[_local3].name());
switch (_local4){
case "begin":
_arg2["start"] = Strings.seconds(_arg1.@begin);
break;
case "src":
_arg2["file"] = _arg1.@src.toString();
break;
case "title":
_arg2["title"] = _arg1.@title.toString();
break;
case "dur":
_arg2["duration"] = Strings.seconds(_arg1.@dur);
break;
case "author":
_arg2["author"] = _arg1.@author.toString();
break;
case "type":
_arg2["type"] = _arg1.@type.toString();
break;
case "alt":
_arg2["description"] = _arg1.@alt.toString();
break;
};
_local3++;
};
return (_arg2);
}
public static function parse(_arg1:XML):Array{
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
_local2 = new Array();
_local3 = new Object();
_local4 = _arg1.children()[1].children()[0];
if (_local4.localName().toLowerCase() == "seq"){
for each (_local5 in _local4.children()) {
_local3 = SMILParser.parseSeq(_local5);
if (_local3["type"] != undefined){
_local2.push(_local3);
};
};
} else {
_local2.push(SMILParser.parsePar(_local4));
};
return (_local2);
}
public static function parseSeq(_arg1:Object):Object{
var _local2:*;
_local2 = new Object();
switch (_arg1.localName().toLowerCase()){
case "par":
_local2 = SMILParser.parsePar(_arg1);
break;
case "img":
case "video":
case "audio":
_local2 = SMILParser.parseAttributes(_arg1, _local2);
break;
default:
break;
};
return (ObjectParser.detect(_local2));
}
public static function parsePar(_arg1:Object):Object{
var _local2:*;
var _local3:*;
_local2 = new Object();
for each (_local3 in _arg1.children()) {
switch (_local3.localName()){
case "anchor":
_local2["link"] = _local3.@href.toString();
break;
case "textstream":
_local2["captions"] = _local3.@src.toString();
break;
case "img":
case "video":
case "audio":
_local2[_local3.localName()] = _local3.@src.toString();
_local2 = SMILParser.parseAttributes(_local3, _local2);
break;
default:
break;
};
};
if (_local2["video"]){
_local2["file"] = _local2["video"];
delete _local2["video"];
} else {
if (_local2["audio"]){
_local2["file"] = _local2["audio"];
delete _local2["audio"];
} else {
if (_local2["img"]){
_local2["file"] = _local2["img"];
delete _local2["audio"];
};
};
};
if (_local2["img"]){
_local2["image"] = _local2["img"];
delete _local2["img"];
};
return (_local2);
}
}
}//package com.jeroenwijering.parsers
Section 21
//TTParser (com.jeroenwijering.parsers.TTParser)
package com.jeroenwijering.parsers {
import com.jeroenwijering.utils.*;
public class TTParser {
private static var style:Number;
public static var STYLING:Object = {id:0, backgroundColor:"000000", color:"FFFFFF", displayAlign:"after", fontFamily:"Arial", fontSize:12, fontStyle:false, fontWeight:false, opacity:0, padding:20, textAlign::"center"};
private static var ELEMENTS:Object = {begin:undefined, dur:undefined, end:undefined, style:undefined, text:undefined};
public static function parseCaptions(_arg1:XML):Array{
var _local2:*;
var _local3:*;
var _local4:*;
_local2 = new Array();
_local3 = _arg1.children()[1].children()[0];
if (_arg1.children()[1].@style > 0){
TTParser.style = _arg1.children()[1].@style;
} else {
if (_local3.@style > 0){
TTParser.style = _local3.@style;
};
};
for each (_local4 in _local3.children()) {
if (_local4.localName() == "p"){
_local2.push(TTParser.parseCaption(_local4));
};
};
return (_local2);
}
private static function parseCaption(_arg1:XML):Object{
var _local2:*;
_local2 = {begin:Strings.seconds(_arg1.@begin), dur:Strings.seconds(_arg1.@dur), end:Strings.seconds(_arg1.@end), text:Strings.strip(_arg1.children()), style:_arg1.@style.toString()};
if (_local2["dur"]){
_local2["end"] = (_local2["begin"] + _local2["dur"]);
delete _local2["dur"];
};
if (_local2["style"] == ""){
_local2["style"] = TTParser.style;
};
return (_local2);
}
public static function parseStyles(_arg1:XML):Array{
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
_local2 = new Array(TTParser.STYLING);
for each (_local3 in _arg1.children()[0].children()) {
if (_local3.localName() == "styling"){
for each (_local4 in _local3.children()) {
_local5 = TTParser.parseStyle(_local4);
_local2[_local5.id] = _local5;
};
};
};
return (_local2);
}
private static function parseStyle(_arg1:XML):Object{
var _local2:*;
var _local3:*;
var _local4:*;
_local2 = new Object();
for (_local3 in TTParser.STYLING) {
_local2[_local3] = TTParser.STYLING[_local3];
};
_local4 = 0;
while (_local4 < _arg1.attributes().length()) {
_local2[_arg1.attributes()[_local4].localName()] = _arg1.attributes()[_local4];
_local4++;
};
return (_local2);
}
}
}//package com.jeroenwijering.parsers
Section 22
//XSPFParser (com.jeroenwijering.parsers.XSPFParser)
package com.jeroenwijering.parsers {
import com.jeroenwijering.utils.*;
public class XSPFParser extends ObjectParser {
public static function parse(_arg1:XML):Array{
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
_local2 = new Array();
_local3 = new Object();
for each (_local4 in _arg1.children()) {
if (_local4.localName().toLowerCase() == "tracklist"){
for each (_local5 in _local4.children()) {
_local3 = XSPFParser.parseItem(_local5);
if (_local3["type"] != undefined){
_local2.push(_local3);
};
};
};
};
return (_local2);
}
public static function parseItem(_arg1:XML):Object{
var _local2:*;
var _local3:*;
_local2 = new Object();
for each (_local3 in _arg1.children()) {
if (!_local3.localName()){
break;
};
switch (_local3.localName().toLowerCase()){
case "location":
_local2["file"] = _local3.text().toString();
break;
case "title":
_local2["title"] = _local3.text().toString();
break;
case "annotation":
_local2["description"] = _local3.text().toString();
break;
case "info":
_local2["link"] = _local3.text().toString();
break;
case "image":
_local2["image"] = _local3.text().toString();
break;
case "creator":
_local2["author"] = _local3.text().toString();
break;
case "duration":
_local2["duration"] = Strings.seconds(_local3.text());
break;
case "meta":
_local2[_local3.@rel] = _local3.text().toString();
break;
};
};
return (ObjectParser.detect(_local2));
}
}
}//package com.jeroenwijering.parsers
Section 23
//Controller (com.jeroenwijering.player.Controller)
package com.jeroenwijering.player {
import com.jeroenwijering.events.*;
import flash.display.*;
import flash.events.*;
import com.jeroenwijering.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.system.*;
public class Controller extends EventDispatcher {
private var config:Object;
private var randomizer:Randomizer;
private var view:View;
private var model:Model;
private var skin:MovieClip;
private var playlister:Playlister;
public function Controller(_arg1:Object, _arg2:MovieClip):void{
config = _arg1;
skin = _arg2;
playlister = new Playlister();
playlister.addEventListener(Event.COMPLETE, playlistHandler);
playlister.addEventListener(ErrorEvent.ERROR, errorHandler);
resizeHandler(new ViewEvent(ViewEvent.RESIZE, {width:skin.stage.stageWidth, height:skin.stage.stageHeight}));
}
private function metaHandler(_arg1:ModelEvent):void{
var _local2:*;
if (_arg1.data.duration){
_local2 = (Math.round((_arg1.data.duration * 10)) / 10);
playlister.update(config["item"], "duration", _local2);
};
}
private function loadHandler(_arg1:ViewEvent):void{
var evt = _arg1;
stopHandler();
try {
playlister.load(evt.data.object);
} catch(err:Error) {
dispatchEvent(new ControllerEvent(ControllerEvent.ERROR, {message:err.message}));
};
}
private function volumeHandler(_arg1:ViewEvent):void{
var _local2:*;
_local2 = _arg1.data.percentage;
if (_local2 < 1){
muteHandler(new ViewEvent(ViewEvent.MUTE, {state:true}));
} else {
if (((!(isNaN(_local2))) && ((_local2 < 101)))){
if (config["mute"] == true){
muteHandler(new ViewEvent(ViewEvent.MUTE, {state:false}));
};
config["volume"] = _local2;
dispatchEvent(new ControllerEvent(ControllerEvent.VOLUME, {percentage:_local2}));
};
};
}
private function fullscreenHandler(_arg1:ViewEvent):void{
if (skin.stage["displayState"] == "fullScreen"){
skin.stage["displayState"] = "normal";
} else {
fullscreenrect();
skin.stage["displayState"] = "fullScreen";
};
}
private function nextHandler(_arg1:ViewEvent):void{
if (((playlist) && ((config["shuffle"] == true)))){
playItem(randomizer.pick());
} else {
if (((playlist) && ((config["item"] == (playlist.length - 1))))){
playItem(0);
} else {
if (playlist){
playItem((config["item"] + 1));
};
};
};
}
private function playlistHandler(_arg1:Event):void{
if (config["shuffle"] == true){
randomizer = new Randomizer(playlist.length);
config["item"] = randomizer.pick();
} else {
if (config["item"] > playlist.length){
config["item"] = (playlist.length - 1);
};
};
dispatchEvent(new ControllerEvent(ControllerEvent.PLAYLIST, {playlist:playlist}));
if (config["autostart"] == true){
playItem();
};
}
private function qualityHandler(_arg1:ViewEvent=null):void{
if (_arg1.data.state != undefined){
if (_arg1.data.state == config["quality"]){
return;
};
config["quality"] = _arg1.data.state;
} else {
config["quality"] = !(config["quality"]);
};
fullscreenrect();
dispatchEvent(new ControllerEvent(ControllerEvent.QUALITY, {state:config["quality"]}));
}
private function prevHandler(_arg1:ViewEvent):void{
if (config["item"] == 0){
playItem((playlist.length - 1));
} else {
playItem((config["item"] - 1));
};
}
private function fullscreenrect():void{
try {
skin.stage["fullScreenSourceRect"] = new Rectangle(skin.x, skin.y, (Capabilities.screenResolutionX / 2), (Capabilities.screenResolutionY / 2));
} catch(err:Error) {
};
}
public function start(_arg1:Model, _arg2:View):void{
model = _arg1;
model.addEventListener(ModelEvent.META, metaHandler);
model.addEventListener(ModelEvent.TIME, metaHandler);
model.addEventListener(ModelEvent.STATE, stateHandler);
view = _arg2;
view.addEventListener(ViewEvent.FULLSCREEN, fullscreenHandler);
view.addEventListener(ViewEvent.ITEM, itemHandler);
view.addEventListener(ViewEvent.LINK, linkHandler);
view.addEventListener(ViewEvent.LOAD, loadHandler);
view.addEventListener(ViewEvent.MUTE, muteHandler);
view.addEventListener(ViewEvent.NEXT, nextHandler);
view.addEventListener(ViewEvent.PLAY, playHandler);
view.addEventListener(ViewEvent.PREV, prevHandler);
view.addEventListener(ViewEvent.QUALITY, qualityHandler);
view.addEventListener(ViewEvent.RESIZE, resizeHandler);
view.addEventListener(ViewEvent.SEEK, seekHandler);
view.addEventListener(ViewEvent.STOP, stopHandler);
view.addEventListener(ViewEvent.VOLUME, volumeHandler);
resizeHandler(new ViewEvent(ViewEvent.RESIZE, {width:skin.stage.stageWidth, height:skin.stage.stageHeight}));
if (config["file"]){
playlister.load(config);
};
}
private function resizeHandler(_arg1:ViewEvent):void{
var mgn:*;
var dat:*;
var dps:*;
var evt = _arg1;
mgn = config["margins"].split(",");
dat = {height:(evt.data.height - mgn[0]), width:(evt.data.width - mgn[1]), fullscreen:false};
try {
dps = skin.stage["displayState"];
} catch(err:Error) {
};
if (dps == "fullScreen"){
dat.fullscreen = true;
} else {
if (config["controlbar"] == "bottom"){
dat.height = (dat.height - config["controlbarsize"]);
};
if (config["playlist"] == "right"){
dat.width = (dat.width - config["playlistsize"]);
} else {
if (config["playlist"] == "bottom"){
dat.height = (dat.height - config["playlistsize"]);
};
};
};
config["height"] = dat.height;
config["width"] = dat.width;
dispatchEvent(new ControllerEvent(ControllerEvent.RESIZE, dat));
}
private function playItem(_arg1:Number=undefined):void{
if (_arg1 > -1){
if (playlist[_arg1]["file"] == playlist[config["item"]]["file"]){
playlist[_arg1]["duration"] = playlist[config["item"]]["duration"];
};
config["item"] = _arg1;
};
dispatchEvent(new ControllerEvent(ControllerEvent.ITEM, {index:config["item"]}));
}
private function stopHandler(_arg1:ViewEvent=undefined):void{
dispatchEvent(new ControllerEvent(ControllerEvent.STOP));
}
public function get playlist():Array{
return (playlister.playlist);
}
private function linkHandler(_arg1:ViewEvent):void{
var _local2:*;
var _local3:*;
_local2 = _arg1.data.index;
if (_local2 == undefined){
_local2 = config["item"];
};
_local3 = playlist[_local2]["link"];
if (_local3 != undefined){
navigateToURL(new URLRequest(_local3), config["linktarget"]);
};
}
private function errorHandler(_arg1:ErrorEvent):void{
dispatchEvent(new ControllerEvent(ControllerEvent.ERROR, {message:_arg1.text}));
}
private function seekHandler(_arg1:ViewEvent):void{
var _local2:*;
if (((!((config["state"] == ModelStates.IDLE))) && ((playlist[config["item"]]["duration"] > 0)))){
_local2 = _arg1.data.position;
if (_local2 < 2){
_local2 = 0;
} else {
if (_local2 > (playlist[config["item"]]["duration"] - 2)){
_local2 = (playlist[config["item"]]["duration"] - 2);
};
};
dispatchEvent(new ControllerEvent(ControllerEvent.SEEK, {position:_local2}));
};
}
private function playHandler(_arg1:ViewEvent):void{
if (playlist){
if (((!((_arg1.data.state == false))) && ((config["state"] == ModelStates.PAUSED)))){
dispatchEvent(new ControllerEvent(ControllerEvent.PLAY, {state:true}));
} else {
if (((!((_arg1.data.state == false))) && ((config["state"] == ModelStates.COMPLETED)))){
dispatchEvent(new ControllerEvent(ControllerEvent.SEEK, {position:playlist[config["item"]]["start"]}));
} else {
if (((!((_arg1.data.state == false))) && ((config["state"] == ModelStates.IDLE)))){
playItem();
} else {
if (((!((_arg1.data.state == true))) && ((((config["state"] == ModelStates.PLAYING)) || ((config["state"] == ModelStates.BUFFERING)))))){
dispatchEvent(new ControllerEvent(ControllerEvent.PLAY, {state:false}));
};
};
};
};
};
}
private function itemHandler(_arg1:ViewEvent):void{
var _local2:*;
_local2 = _arg1.data.index;
if (_local2 < 0){
playItem(0);
} else {
if (_local2 > (playlist.length - 1)){
playItem((playlist.length - 1));
} else {
if (!isNaN(_local2)){
playItem(_local2);
};
};
};
}
private function muteHandler(_arg1:ViewEvent):void{
if (_arg1.data.state){
if (_arg1.data.state == config["mute"]){
return;
};
config["mute"] = _arg1.data.state;
} else {
config["mute"] = !(config["mute"]);
};
dispatchEvent(new ControllerEvent(ControllerEvent.MUTE, {state:config["mute"]}));
}
private function stateHandler(_arg1:ModelEvent):void{
if ((((_arg1.data.newstate == ModelStates.COMPLETED)) && ((((((config["repeat"] == "always")) || ((((((config["repeat"] == "list")) && ((config["shuffle"] == true)))) && ((randomizer.length > 0)))))) || ((((((config["repeat"] == "list")) && ((config["shuffle"] == false)))) && ((config["item"] < (playlist.length - 1))))))))){
if (config["shuffle"] == true){
playItem(randomizer.pick());
} else {
if (config["item"] == (playlist.length - 1)){
playItem(0);
} else {
playItem((config["item"] + 1));
};
};
};
}
}
}//package com.jeroenwijering.player
Section 24
//Model (com.jeroenwijering.player.Model)
package com.jeroenwijering.player {
import com.jeroenwijering.events.*;
import flash.display.*;
import flash.events.*;
import com.jeroenwijering.utils.*;
import com.jeroenwijering.models.*;
import flash.net.*;
public class Model extends EventDispatcher {
public var config:Object;
private var loader:Loader;
private var controller:Controller;
private var models:Object;
private var currentModel:String;
private var currentURL:String;
public var skin:MovieClip;
public function Model(_arg1:Object, _arg2:MovieClip, _arg3:Controller):void{
config = _arg1;
skin = _arg2;
Draw.clear(skin.display.media);
controller = _arg3;
controller.addEventListener(ControllerEvent.ITEM, itemHandler);
controller.addEventListener(ControllerEvent.MUTE, muteHandler);
controller.addEventListener(ControllerEvent.PLAY, playHandler);
controller.addEventListener(ControllerEvent.PLAYLIST, playlistHandler);
controller.addEventListener(ControllerEvent.QUALITY, qualityHandler);
controller.addEventListener(ControllerEvent.RESIZE, resizeHandler);
controller.addEventListener(ControllerEvent.SEEK, seekHandler);
controller.addEventListener(ControllerEvent.STOP, stopHandler);
controller.addEventListener(ControllerEvent.VOLUME, volumeHandler);
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.INIT, thumbHandler);
models = new Object();
}
private function playHandler(_arg1:ControllerEvent):void{
if (currentModel){
if (_arg1.data.state == true){
models[currentModel].play();
} else {
models[currentModel].pause();
};
};
}
private function thumbLoader():void{
var _local1:*;
_local1 = playlist[config["item"]]["image"];
if (_local1){
loader.load(new URLRequest(_local1));
};
}
private function volumeHandler(_arg1:ControllerEvent):void{
if (currentModel){
models[currentModel].volume(_arg1.data.percentage);
};
}
private function qualityHandler(_arg1:ControllerEvent):void{
if (currentModel){
models[currentModel].quality(_arg1.data.state);
};
}
private function playlistHandler(_arg1:ControllerEvent):void{
if (currentModel){
stopHandler();
} else {
sendEvent(ModelEvent.STATE, {newstate:ModelStates.IDLE});
};
thumbLoader();
}
public function get playlist():Array{
return (controller.playlist);
}
private function thumbHandler(_arg1:Event=null):void{
mediaHandler(loader);
}
public function mediaHandler(_arg1:DisplayObject=undefined):void{
var _local2:*;
_local2 = skin.display.media;
Draw.clear(_local2);
if (_arg1){
_local2.addChild(_arg1);
Stretcher.stretch(_local2, config["width"], config["height"], config["stretching"]);
} else {
if (playlist[config["item"]]["image"]){
thumbLoader();
};
};
}
private function loadModel(_arg1:String):void{
switch (_arg1){
case "camera":
models[_arg1] = new CameraModel(this);
break;
case "image":
models[_arg1] = new ImageModel(this);
break;
case "sound":
if (((config["streamer"]) && ((config["streamer"].substr(0, 4) == "rtmp")))){
models[_arg1] = new RTMPModel(this);
} else {
models[_arg1] = new SoundModel(this);
};
break;
case "video":
if (config["streamer"]){
if (config["streamer"].substr(0, 4) == "rtmp"){
models[_arg1] = new RTMPModel(this);
} else {
models[_arg1] = new HTTPModel(this);
};
} else {
models[_arg1] = new VideoModel(this);
};
break;
case "youtube":
models[_arg1] = new YoutubeModel(this);
break;
};
}
private function stopHandler(_arg1:ControllerEvent=undefined):void{
currentURL = undefined;
if (currentModel){
models[currentModel].stop();
};
thumbHandler();
sendEvent(ModelEvent.LOADED, {loaded:0, total:0});
sendEvent(ModelEvent.STATE, {newstate:ModelStates.IDLE});
}
private function resizeHandler(_arg1:ControllerEvent):void{
Stretcher.stretch(skin.display.media, _arg1.data.width, _arg1.data.height, config["stretching"]);
}
private function muteHandler(_arg1:ControllerEvent):void{
if (((currentModel) && ((_arg1.data.state == true)))){
models[currentModel].volume(0);
} else {
if (((currentModel) && ((_arg1.data.state == false)))){
models[currentModel].volume(config["volume"]);
};
};
}
private function seekHandler(_arg1:ControllerEvent):void{
if (currentModel){
models[currentModel].seek(_arg1.data.position);
};
}
private function itemHandler(_arg1:ControllerEvent):void{
var _local2:*;
var _local3:*;
_local2 = playlist[_arg1.data.index]["type"];
_local3 = playlist[_arg1.data.index]["file"];
if (((models[_local2]) && ((_local2 == currentModel)))){
if ((((_local3 == currentURL)) && (!((_local2 == "rtmp"))))){
models[_local2].seek(playlist[_arg1.data.index]["start"]);
} else {
models[_local2].stop();
currentURL = _local3;
models[_local2].load();
};
} else {
if (currentModel){
models[currentModel].stop();
};
if (!models[_local2]){
loadModel(_local2);
};
currentModel = _local2;
currentURL = _local3;
models[_local2].load();
};
}
public function sendEvent(_arg1:String, _arg2:Object):void{
if ((((_arg1 == ModelEvent.STATE)) && (!((_arg2.newstate == config["state"]))))){
_arg2.oldstate = config["state"];
config["state"] = _arg2.newstate;
dispatchEvent(new ModelEvent(_arg1, _arg2));
if ((((_arg2.newstate == ModelStates.IDLE)) || ((_arg2.newstate == ModelStates.COMPLETED)))){
sendEvent(ModelEvent.TIME, {position:playlist[config["item"]]["start"], duration:playlist[config["item"]]["duration"]});
};
} else {
if (_arg1 != ModelEvent.STATE){
dispatchEvent(new ModelEvent(_arg1, _arg2));
};
};
}
}
}//package com.jeroenwijering.player
Section 25
//Player (com.jeroenwijering.player.Player)
package com.jeroenwijering.player {
import flash.display.*;
import flash.events.*;
import com.jeroenwijering.utils.*;
import com.jeroenwijering.plugins.*;
public class Player extends MovieClip {
private var loader:SWFLoader;
private var model:Model;
private var defaults:Object;
private var _view:View;
private var controller:Controller;
private var configger:Configger;
public var player:MovieClip;
public function Player():void{
defaults = {author:undefined, description:undefined, duration:0, file:undefined, image:undefined, link:undefined, start:0, title:undefined, type:undefined, backcolor:undefined, frontcolor:undefined, lightcolor:undefined, screencolor:undefined, controlbar:"bottom", controlbarsize:20, height:300, logo:undefined, playlist:"none", playlistsize:180, skin:undefined, width:400, autostart:false, bufferlength:0.1, displayclick:"play", item:0, mute:false, quality:true, repeat:"none", shuffle:false, state:"IDLE", stretching:"uniform", volume:80, abouttext:undefined, aboutlink:"http://www.jeroenwijering.com/?item=JW_FLV_Player", client:undefined, id:undefined, linktarget:"_blank", margins:"0,0,0,0", plugins:undefined, streamer:undefined, token:undefined, tracecall:undefined, version:"4.1.60"};
super();
visible = false;
configger = new Configger(this);
configger.addEventListener(Event.COMPLETE, configHandler);
configger.load(defaults);
}
private function skinHandler(_arg1:Event):void{
controller = new Controller(configger.config, loader.skin);
model = new Model(configger.config, loader.skin, controller);
_view = new View(configger.config, loader, controller, model);
controller.start(model, _view);
visible = true;
addPlugins();
}
private function configHandler(_arg1:Event):void{
loader = new SWFLoader(this);
loader.addEventListener(Event.COMPLETE, skinHandler);
loader.loadSkin(configger.config["skin"]);
}
public function get view():View{
return (_view);
}
private function addPlugins(){
if (loader.skin["captions"]){
new Captions().initializePlugin(view);
};
if (loader.skin["controlbar"]){
new Controlbar().initializePlugin(view);
};
if (loader.skin["display"]){
new Display().initializePlugin(view);
};
if (loader.skin["playlist"]){
new Playlist().initializePlugin(view);
};
loader.loadPlugins(configger.config["plugins"]);
}
}
}//package com.jeroenwijering.player
Section 26
//SWFLoader (com.jeroenwijering.player.SWFLoader)
package com.jeroenwijering.player {
import flash.display.*;
import flash.events.*;
import com.jeroenwijering.utils.*;
import flash.net.*;
import flash.system.*;
public class SWFLoader extends EventDispatcher {
private var loader:Loader;
private var basedir:String;// = "http://plugins.longtailvideo.com/"
private var player:MovieClip;
public var skin:MovieClip;
public function SWFLoader(_arg1:MovieClip):void{
basedir = "http://plugins.longtailvideo.com/";
super();
player = _arg1;
}
public function loadSkin(_arg1:String=null):void{
if (_arg1){
loadSWF(_arg1, true);
} else {
skin = player["player"];
dispatchEvent(new Event(Event.COMPLETE));
};
}
private function skinError(_arg1:IOErrorEvent=null):void{
skin = player["player"];
dispatchEvent(new Event(Event.COMPLETE));
}
private function pluginHandler(_arg1:Event):void{
var plg:*;
var evt = _arg1;
plg = evt.target.content;
try {
plg.initializePlugin(player.view);
} catch(err:Error) {
player.view.sendEvent("trace", (" plugin: " + err.message));
};
}
public function loadPlugins(_arg1:String=null):void{
var _local2:*;
var _local3:*;
if (_arg1){
_local2 = _arg1.split(",");
for (_local3 in _local2) {
loadSWF(_local2[_local3], false);
};
};
}
private function pluginError(_arg1:IOErrorEvent):void{
player.view.sendEvent("trace", (" plugin: " + _arg1.toString()));
}
private function skinHandler(_arg1:Event):void{
var _local2:*;
_local2 = _arg1.target.content;
if (_local2["player"]){
skin = MovieClip(_local2["player"]);
Draw.clear(player);
player.addChild(skin);
dispatchEvent(new Event(Event.COMPLETE));
} else {
skinError();
};
}
public function loadSWF(_arg1:String, _arg2:Boolean):void{
var _local3:*;
var _local4:*;
if (_arg1.substr(-4) != ".swf"){
_arg1 = (_arg1 + ".swf");
};
_local3 = new Loader();
if (_arg2){
_local3.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, skinError);
_local3.contentLoaderInfo.addEventListener(Event.INIT, skinHandler);
} else {
skin.addChild(_local3);
_local3.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, pluginError);
_local3.contentLoaderInfo.addEventListener(Event.INIT, pluginHandler);
};
if (player.loaderInfo.url.indexOf("http") == 0){
_local4 = new LoaderContext(true, ApplicationDomain.currentDomain, SecurityDomain.currentDomain);
if (_arg2){
_local3.load(new URLRequest(_arg1), _local4);
} else {
_local3.load(new URLRequest((basedir + _arg1)), _local4);
};
} else {
_local3.load(new URLRequest(_arg1));
};
}
}
}//package com.jeroenwijering.player
Section 27
//View (com.jeroenwijering.player.View)
package com.jeroenwijering.player {
import com.jeroenwijering.events.*;
import flash.display.*;
import flash.events.*;
import flash.ui.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
import flash.external.*;
public class View extends AbstractView {
private var loader:SWFLoader;
private var controller:Controller;
private var model:Model;
private var context:ContextMenu;
private var listeners:Array;
private var _config:Object;
public function View(_arg1:Object, _arg2:SWFLoader, _arg3:Controller, _arg4:Model):void{
var cfg = _arg1;
var ldr = _arg2;
var ctr = _arg3;
var mdl = _arg4;
super();
_config = cfg;
_config["client"] = ("FLASH " + Capabilities.version);
loader = ldr;
skin.stage.scaleMode = "noScale";
skin.stage.align = "TL";
skin.stage.addEventListener(Event.RESIZE, resizeSetter);
_config["controlbarsize"] = skin["controlbar"].height;
controller = ctr;
model = mdl;
menuSet();
if (((ExternalInterface.available) && ((loader.skin.loaderInfo.url.indexOf("http") == 0)))){
listeners = new Array();
setListening();
setTimeout(playerReady, 50);
try {
if (ExternalInterface.objectID){
_config["id"] = ExternalInterface.objectID;
};
ExternalInterface.addCallback("getConfig", getConfig);
ExternalInterface.addCallback("getPlaylist", getPlaylist);
ExternalInterface.addCallback("addControllerListener", addJSControllerListener);
ExternalInterface.addCallback("addModelListener", addJSModelListener);
ExternalInterface.addCallback("addViewListener", addJSViewListener);
ExternalInterface.addCallback("sendEvent", sendEvent);
ExternalInterface.addCallback("loadPlugin", loadPlugin);
} catch(err:Error) {
};
} else {
if (Capabilities.playerType == "External"){
setListening();
};
};
}
private function menuSet():void{
var qua:*;
var abt:*;
var fsm:*;
context = new ContextMenu();
context.hideBuiltInItems();
skin.contextMenu = context;
addControllerListener(ControllerEvent.QUALITY, qualityHandler);
qua = new ContextMenuItem("Switch to low quality");
if (config["quality"] == false){
qua = new ContextMenuItem("Switch to high quality");
};
menuAdd(qua, qualitySetter);
try {
if (skin.stage["displayState"]){
addControllerListener(ControllerEvent.RESIZE, resizeHandler);
fsm = new ContextMenuItem("Switch to fullscreen");
menuAdd(fsm, fullscreenSetter);
};
} catch(err:Error) {
};
abt = new ContextMenuItem((("About JW Player " + config["version"]) + "..."));
if (config["abouttext"]){
abt = new ContextMenuItem((config["abouttext"] + "..."));
};
menuAdd(abt, aboutSetter);
}
private function fullscreenSetter(_arg1:ContextMenuEvent):void{
sendEvent("fullscreen");
}
private function setController(_arg1:ControllerEvent):void{
forward("CONTROLLER", _arg1.type, _arg1.data);
}
private function setView(_arg1:ViewEvent):void{
forward("VIEW", _arg1.type, _arg1.data);
}
private function getConfig():Object{
return (_config);
}
private function loadPlugin(_arg1:String, _arg2:Object=null):void{
var _local3:*;
loader.loadPlugins(_arg1);
if (_arg2){
for (_local3 in _arg2) {
_config[_local3] = _arg2[_local3];
};
};
}
private function addJSControllerListener(_arg1:String, _arg2:String):Boolean{
listeners.push({target:"CONTROLLER", type:_arg1.toUpperCase(), callee:_arg2});
return (true);
}
override public function addViewListener(_arg1:String, _arg2:Function):void{
this.addEventListener(_arg1.toUpperCase(), _arg2);
}
override public function get config():Object{
return (_config);
}
private function addJSViewListener(_arg1:String, _arg2:String):Boolean{
listeners.push({target:"VIEW", type:_arg1.toUpperCase(), callee:_arg2});
return (true);
}
private function forward(_arg1:String, _arg2:String, _arg3:Object):void{
var _local4:*;
var _local5:*;
var _local6:*;
_local4 = "";
for (_local5 in _arg3) {
_local4 = (_local4 + (((_local5 + ":") + _arg3[_local5]) + ","));
};
if (_local4.length > 0){
_local4 = (("(" + _local4.substr(0, (_local4.length - 1))) + ")");
};
if (Capabilities.playerType == "External"){
trace(((((_arg1 + ": ") + _arg2) + " ") + _local4));
} else {
if (config["tracecall"]){
ExternalInterface.call(config["tracecall"], ((((_arg1 + ": ") + _arg2) + " ") + _local4));
};
};
if (!_arg3){
_arg3 = new Object();
};
_arg3.id = ExternalInterface.objectID;
_arg3.client = config["client"];
_arg3.version = config["version"];
for each (_local6 in listeners) {
if ((((_local6["target"] == _arg1)) && ((_local6["type"] == _arg2)))){
ExternalInterface.call(_local6["callee"], _arg3);
};
};
}
private function getPlaylist():Array{
return (controller.playlist);
}
private function qualityHandler(_arg1:ControllerEvent):void{
if (_arg1.data.state == true){
context.customItems[0].caption = "Switch to low quality";
} else {
context.customItems[0].caption = "Switch to high quality";
};
}
override public function get playlist():Array{
return (controller.playlist);
}
private function resizeSetter(_arg1:Event=undefined):void{
var _local2:*;
_local2 = {height:skin.stage.stageHeight, width:skin.stage.stageWidth};
dispatchEvent(new ViewEvent(ViewEvent.RESIZE, _local2));
}
private function playerReady():void{
var dat:*;
dat = {id:config["id"], client:config["client"], version:config["version"]};
try {
ExternalInterface.call("playerReady", dat);
} catch(err:Error) {
};
}
override public function addModelListener(_arg1:String, _arg2:Function):void{
model.addEventListener(_arg1.toUpperCase(), _arg2);
}
private function menuAdd(_arg1:ContextMenuItem, _arg2:Function):void{
_arg1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, _arg2);
_arg1.separatorBefore = true;
context.customItems.push(_arg1);
}
private function qualitySetter(_arg1:ContextMenuEvent):void{
sendEvent("quality");
}
private function setModel(_arg1:ModelEvent):void{
forward("MODEL", _arg1.type, _arg1.data);
}
private function aboutSetter(_arg1:ContextMenuEvent):void{
navigateToURL(new URLRequest(config["aboutlink"]), "_blank");
}
override public function addControllerListener(_arg1:String, _arg2:Function):void{
controller.addEventListener(_arg1.toUpperCase(), _arg2);
}
override public function sendEvent(_arg1:String, _arg2:Object=undefined):void{
var _local3:*;
_arg1 = _arg1.toUpperCase();
_local3 = new Object();
switch (_arg1){
case "TRACE":
_local3["message"] = _arg2;
break;
case "LINK":
if (_arg2 != null){
_local3["index"] = _arg2;
};
break;
case "LOAD":
_local3["object"] = _arg2;
break;
case "ITEM":
if (_arg2 > -1){
_local3["index"] = _arg2;
};
break;
case "SEEK":
_local3["position"] = _arg2;
break;
case "VOLUME":
_local3["percentage"] = _arg2;
break;
default:
if (((!((_arg2 == null))) && (!((_arg2 == ""))))){
if ((((_arg2 == true)) || ((_arg2 == "true")))){
_local3["state"] = true;
} else {
if ((((_arg2 == false)) || ((_arg2 == "false")))){
_local3["state"] = false;
};
};
};
break;
};
dispatchEvent(new ViewEvent(_arg1, _local3));
}
private function addJSModelListener(_arg1:String, _arg2:String):Boolean{
listeners.push({target:"MODEL", type:_arg1.toUpperCase(), callee:_arg2});
return (true);
}
private function resizeHandler(_arg1:ControllerEvent):void{
if (_arg1.data.fullscreen == false){
context.customItems[1].caption = "Switch to fullscreen";
} else {
context.customItems[1].caption = "Return to normal screen";
};
}
private function setListening():void{
addControllerListener(ControllerEvent.ERROR, setController);
addControllerListener(ControllerEvent.ITEM, setController);
addControllerListener(ControllerEvent.MUTE, setController);
addControllerListener(ControllerEvent.PLAY, setController);
addControllerListener(ControllerEvent.PLAYLIST, setController);
addControllerListener(ControllerEvent.QUALITY, setController);
addControllerListener(ControllerEvent.RESIZE, setController);
addControllerListener(ControllerEvent.SEEK, setController);
addControllerListener(ControllerEvent.STOP, setController);
addControllerListener(ControllerEvent.VOLUME, setController);
addModelListener(ModelEvent.BUFFER, setModel);
addModelListener(ModelEvent.ERROR, setModel);
addModelListener(ModelEvent.LOADED, setModel);
addModelListener(ModelEvent.META, setModel);
addModelListener(ModelEvent.STATE, setModel);
addModelListener(ModelEvent.TIME, setModel);
addViewListener(ViewEvent.FULLSCREEN, setView);
addViewListener(ViewEvent.ITEM, setView);
addViewListener(ViewEvent.LINK, setView);
addViewListener(ViewEvent.LOAD, setView);
addViewListener(ViewEvent.MUTE, setView);
addViewListener(ViewEvent.NEXT, setView);
addViewListener(ViewEvent.PLAY, setView);
addViewListener(ViewEvent.PREV, setView);
addViewListener(ViewEvent.QUALITY, setView);
addViewListener(ViewEvent.RESIZE, setView);
addViewListener(ViewEvent.SEEK, setView);
addViewListener(ViewEvent.STOP, setView);
addViewListener(ViewEvent.TRACE, setView);
addViewListener(ViewEvent.VOLUME, setView);
}
override public function get skin():MovieClip{
return (loader.skin);
}
}
}//package com.jeroenwijering.player
Section 28
//Captions (com.jeroenwijering.plugins.Captions)
package com.jeroenwijering.plugins {
import com.jeroenwijering.events.*;
import flash.display.*;
import flash.events.*;
import com.jeroenwijering.parsers.*;
import flash.net.*;
public class Captions implements PluginInterface {
private var captions:Array;
private var clip:MovieClip;
private var loader:URLLoader;
private var styles:Array;
private var view:AbstractView;
private var location:String;
private var current:Number;
public function Captions():void{
}
private function stateHandler(_arg1:ModelEvent):void{
if (view.config["caption"] == true){
clip.visible = true;
} else {
clip.visible = false;
};
}
private function metaHandler(_arg1:ModelEvent):void{
if (((!((_arg1.data.text == undefined))) && (!((_arg1.data.trackid == undefined))))){
setCaption(_arg1.data.text);
} else {
if (_arg1.data.captions != undefined){
setCaption(_arg1.data.captions);
};
};
}
public function initializePlugin(_arg1:AbstractView):void{
view = _arg1;
if (!view.skin["captions"]){
return;
};
view.addControllerListener(ControllerEvent.ITEM, itemHandler);
view.addControllerListener(ControllerEvent.RESIZE, resizeHandler);
view.addModelListener(ModelEvent.META, metaHandler);
view.addModelListener(ModelEvent.STATE, stateHandler);
loader = new URLLoader();
loader.addEventListener(Event.COMPLETE, loaderHandler);
clip = view.skin.captions;
clip.field.autoSize = "center";
clip.visible = false;
}
private function setCaption(_arg1:String):void{
clip.visible = true;
clip.field.htmlText = _arg1;
resizeHandler();
if (_arg1 != ""){
view.sendEvent("TRACE", ("caption: " + _arg1));
};
}
private function resizeHandler(_arg1:ControllerEvent=undefined):void{
clip.back.height = (clip.field.height + 15);
clip.width = view.config["width"];
clip.scaleY = clip.scaleX;
clip.y = Math.round((view.config["height"] - clip.height));
}
private function itemHandler(_arg1:ControllerEvent):void{
var cap:*;
var evt = _arg1;
current = -1;
setCaption("");
captions = new Array();
cap = view.playlist[view.config["item"]]["captions"];
if (((cap) && (!((cap == location))))){
view.addModelListener(ModelEvent.TIME, timeHandler);
try {
location = cap;
loader.load(new URLRequest(cap));
} catch(err:Error) {
view.sendEvent("ERROR", ("Captions: " + err.message));
};
};
}
private function timeHandler(_arg1:ModelEvent):void{
var _local2:*;
var _local3:*;
var _local4:*;
_local2 = -1;
_local3 = _arg1.data.position;
_local4 = 0;
while (_local4 < captions.length) {
if ((((captions[_local4]["begin"] < _local3)) && ((captions[_local4]["end"] > _local3)))){
_local2 = _local4;
break;
};
_local4++;
};
if (_local2 == -1){
setCaption("");
} else {
if (_local2 != current){
current = _local2;
setCaption(captions[_local2]["text"]);
};
};
}
private function loaderHandler(_arg1:Event):void{
var dat:*;
var evt = _arg1;
try {
dat = XML(evt.target.data);
} catch(err:Error) {
view.sendEvent("ERROR", "These captions are not a valid XML file.");
return;
};
if (dat.localName().toLowerCase() == "tt"){
styles = TTParser.parseStyles(dat);
captions = TTParser.parseCaptions(dat);
} else {
view.sendEvent("ERROR", "Captions are not a valid TimedText file.");
};
}
}
}//package com.jeroenwijering.plugins
Section 29
//Controlbar (com.jeroenwijering.plugins.Controlbar)
package com.jeroenwijering.plugins {
import com.jeroenwijering.events.*;
import flash.display.*;
import flash.events.*;
import flash.ui.*;
import com.jeroenwijering.utils.*;
import flash.geom.*;
import flash.utils.*;
public class Controlbar implements PluginInterface {
private var bar:MovieClip;
private var light:ColorTransform;
private var SLIDERS;
private var BUTTONS;
private var view:AbstractView;
private var front:ColorTransform;
private var margin:Number;
private var scrubbing:Boolean;
private var stacker:Stacker;
private var hiding:Number;
public function Controlbar():void{
BUTTONS = {playButton:"PLAY", pauseButton:"PLAY", stopButton:"STOP", prevButton:"PREV", nextButton:"NEXT", linkButton:"LINK", fullscreenButton:"FULLSCREEN", normalscreenButton:"FULLSCREEN", muteButton:"MUTE", unmuteButton:"MUTE"};
SLIDERS = {timeSlider:"SEEK", volumeSlider:"VOLUME"};
super();
}
private function stateHandler(_arg1:ModelEvent=undefined):void{
var dps:*;
var evt = _arg1;
clearTimeout(hiding);
view.skin.removeEventListener(MouseEvent.MOUSE_MOVE, moveHandler);
Mouse.show();
try {
dps = bar.stage["displayState"];
} catch(err:Error) {
};
switch (view.config["state"]){
case ModelStates.PLAYING:
case ModelStates.BUFFERING:
try {
bar.playButton.visible = false;
bar.pauseButton.visible = true;
} catch(err:Error) {
};
if ((((view.config["controlbar"] == "over")) || ((dps == "fullScreen")))){
hiding = setTimeout(moveTimeout, 1000);
view.skin.addEventListener(MouseEvent.MOUSE_MOVE, moveHandler);
} else {
Animations.fade(bar, 1);
};
break;
default:
try {
bar.playButton.visible = true;
bar.pauseButton.visible = false;
} catch(err:Error) {
};
if ((((view.config["controlbar"] == "over")) || ((dps == "fullScreen")))){
Animations.fade(bar, 1);
};
};
}
private function loadedHandler(_arg1:ModelEvent=null):void{
var pc1:*;
var pc2:*;
var wid:*;
var evt = _arg1;
pc1 = 0;
if (((evt) && ((evt.data.total > 0)))){
pc1 = (evt.data.loaded / evt.data.total);
};
pc2 = 0;
if (((evt) && (evt.data.offset))){
pc2 = (evt.data.offset / evt.data.total);
};
try {
wid = bar.timeSlider.rail.width;
bar.timeSlider.mark.x = (pc2 * wid);
bar.timeSlider.mark.width = (pc1 * wid);
} catch(err:Error) {
};
}
private function setButtons():void{
var _local1:*;
var _local2:*;
for (_local1 in BUTTONS) {
if (bar[_local1]){
bar[_local1].mouseChildren = false;
bar[_local1].buttonMode = true;
bar[_local1].addEventListener(MouseEvent.CLICK, clickHandler);
bar[_local1].addEventListener(MouseEvent.MOUSE_OVER, overHandler);
bar[_local1].addEventListener(MouseEvent.MOUSE_OUT, outHandler);
};
};
for (_local2 in SLIDERS) {
if (bar[_local2]){
bar[_local2].mouseChildren = false;
bar[_local2].buttonMode = true;
bar[_local2].addEventListener(MouseEvent.MOUSE_DOWN, downHandler);
bar[_local2].addEventListener(MouseEvent.MOUSE_OVER, overHandler);
bar[_local2].addEventListener(MouseEvent.MOUSE_OUT, outHandler);
};
};
}
private function downHandler(_arg1:MouseEvent):void{
var _local2:*;
var _local3:*;
_local2 = _arg1.target;
_local3 = new Rectangle(_local2.rail.x, _local2.icon.y, (_local2.rail.width - _local2.icon.width), 0);
_local2.icon.startDrag(true, _local3);
scrubbing = true;
bar.stage.addEventListener(MouseEvent.MOUSE_UP, upHandler);
}
private function fixTime():void{
var scp:*;
try {
scp = bar.timeSlider.scaleX;
bar.timeSlider.scaleX = 1;
bar.timeSlider.icon.x = (scp * bar.timeSlider.icon.x);
bar.timeSlider.mark.x = (scp * bar.timeSlider.mark.x);
bar.timeSlider.mark.width = (scp * bar.timeSlider.mark.width);
bar.timeSlider.rail.width = (scp * bar.timeSlider.rail.width);
} catch(err:Error) {
};
}
private function moveTimeout():void{
if ((((((bar.mouseY < 0)) || ((bar.mouseY > bar.height)))) && ((bar.alpha == 1)))){
Animations.fade(bar, 0);
Mouse.hide();
};
}
private function upHandler(_arg1:MouseEvent):void{
var _local2:*;
var _local3:*;
var _local4:*;
_local2 = _arg1.target;
_local3 = 0;
_local2.icon.stopDrag();
scrubbing = false;
bar.stage.removeEventListener(MouseEvent.MOUSE_UP, upHandler);
if ((((_local2.name == "timeSlider")) && (view.playlist.length))){
_local3 = view.playlist[view.config["item"]]["duration"];
} else {
if (_local2.name == "volumeSlider"){
_local3 = 100;
};
};
_local4 = (((_local2.icon.x - _local2.rail.x) / (_local2.rail.width - _local2.icon.width)) * _local3);
view.sendEvent(SLIDERS[_local2.name], Math.round(_local4));
}
private function setColors():void{
var clr:*;
var btn:*;
var sld:*;
if (view.config["backcolor"]){
clr = new ColorTransform();
clr.color = ("0x" + view.config["backcolor"].substr(-6));
bar.back.transform.colorTransform = clr;
};
if (view.config["frontcolor"]){
try {
front = new ColorTransform();
front.color = uint(("0x" + view.config["frontcolor"].substr(-6)));
for (btn in BUTTONS) {
if (bar[btn]){
bar[btn]["icon"].transform.colorTransform = front;
};
};
for (sld in SLIDERS) {
if (bar[sld]){
bar[sld]["icon"].transform.colorTransform = front;
bar[sld]["mark"].transform.colorTransform = front;
bar[sld]["rail"].transform.colorTransform = front;
};
};
bar.elapsedText.textColor = front.color;
bar.totalText.textColor = front.color;
} catch(err:Error) {
};
};
if (view.config["lightcolor"]){
light = new ColorTransform();
light.color = uint(("0x" + view.config["lightcolor"].substr(-6)));
};
}
private function volumeHandler(_arg1:ControllerEvent=null):void{
var vsl:*;
var evt = _arg1;
try {
vsl = bar.volumeSlider;
vsl.mark.width = ((view.config["volume"] * (vsl.rail.width - (vsl.icon.width / 2))) / 100);
vsl.icon.x = (vsl.mark.x + ((view.config["volume"] * (vsl.rail.width - vsl.icon.width)) / 100));
} catch(err:Error) {
};
}
private function overHandler(_arg1:MouseEvent):void{
if (light){
bar[_arg1.target.name]["icon"].transform.colorTransform = light;
} else {
bar[_arg1.target.name].gotoAndPlay("over");
};
}
private function clickHandler(_arg1:MouseEvent):void{
view.sendEvent(BUTTONS[_arg1.target.name]);
}
public function initializePlugin(_arg1:AbstractView):void{
view = _arg1;
view.addControllerListener(ControllerEvent.RESIZE, resizeHandler);
view.addModelListener(ModelEvent.LOADED, loadedHandler);
view.addModelListener(ModelEvent.STATE, stateHandler);
view.addModelListener(ModelEvent.TIME, timeHandler);
view.addControllerListener(ControllerEvent.PLAYLIST, itemHandler);
view.addControllerListener(ControllerEvent.ITEM, itemHandler);
view.addControllerListener(ControllerEvent.MUTE, muteHandler);
view.addControllerListener(ControllerEvent.VOLUME, volumeHandler);
bar = view.skin["controlbar"];
margin = bar.x;
stacker = new Stacker(bar);
setButtons();
setColors();
itemHandler();
muteHandler();
volumeHandler();
loadedHandler();
timeHandler();
stateHandler();
resizeHandler();
}
private function outHandler(_arg1:MouseEvent):void{
if (front){
bar[_arg1.target.name]["icon"].transform.colorTransform = front;
} else {
bar[_arg1.target.name].gotoAndPlay("out");
};
}
private function muteHandler(_arg1:ControllerEvent=null):void{
var evt = _arg1;
try {
if (view.config["mute"] == true){
bar.muteButton.visible = false;
bar.unmuteButton.visible = true;
bar.volumeSlider.mark.visible = false;
bar.volumeSlider.icon.x = bar.volumeSlider.rail.x;
} else {
bar.muteButton.visible = true;
bar.unmuteButton.visible = false;
bar.volumeSlider.mark.visible = true;
volumeHandler();
};
} catch(err:Error) {
};
}
private function resizeHandler(_arg1:ControllerEvent=null):void{
var wid:*;
var evt = _arg1;
wid = stacker.width;
if ((((view.config["controlbar"] == "over")) || (((evt) && ((evt.data.fullscreen == true)))))){
bar.y = ((view.config["height"] - view.config["controlbarsize"]) - margin);
bar.x = margin;
wid = (view.config["width"] - (2 * margin));
bar.back.alpha = 0.75;
} else {
if (view.config["controlbar"] == "bottom"){
bar.x = 0;
bar.back.alpha = 1;
wid = view.config["width"];
bar.y = view.config["height"];
if (view.config["playlist"] == "right"){
wid = (wid + view.config["playlistsize"]);
};
} else {
bar.visible = false;
};
};
try {
bar.fullscreenButton.visible = false;
bar.normalscreenButton.visible = false;
if (bar.stage["displayState"]){
if (((evt) && ((evt.data.fullscreen == true)))){
bar.fullscreenButton.visible = false;
bar.normalscreenButton.visible = true;
} else {
bar.fullscreenButton.visible = true;
bar.normalscreenButton.visible = false;
};
};
} catch(err:Error) {
};
try {
if (wid < 250){
bar.elapsedText.visible = (bar.totalText.visible = false);
} else {
bar.elapsedText.visible = (bar.totalText.visible = true);
};
} catch(err:Error) {
};
stacker.rearrange(wid);
stateHandler();
fixTime();
}
private function itemHandler(_arg1:ControllerEvent=null):void{
var evt = _arg1;
try {
if (((view.playlist) && ((view.playlist.length > 1)))){
bar.prevButton.visible = (bar.nextButton.visible = true);
} else {
bar.prevButton.visible = (bar.nextButton.visible = false);
};
} catch(err:Error) {
};
try {
if (((view.playlist) && (view.playlist[view.config["item"]]["link"]))){
bar.linkButton.visible = true;
} else {
bar.linkButton.visible = false;
};
} catch(err:Error) {
};
timeHandler();
stacker.rearrange();
fixTime();
}
private function moveHandler(_arg1:MouseEvent=null):void{
if (bar.alpha == 0){
Animations.fade(bar, 1);
};
clearTimeout(hiding);
hiding = setTimeout(moveTimeout, 1000);
Mouse.show();
}
private function timeHandler(_arg1:ModelEvent=null):void{
var dur:*;
var pos:*;
var pct:*;
var tsl:*;
var xps:*;
var evt = _arg1;
dur = 0;
pos = 0;
if (evt){
dur = evt.data.duration;
pos = evt.data.position;
} else {
if (view.playlist){
dur = view.playlist[view.config["item"]]["duration"];
pos = view.playlist[view.config["item"]]["start"];
};
};
pct = (pos / dur);
try {
bar.elapsedText.text = Strings.digits(pos);
bar.totalText.text = Strings.digits(dur);
} catch(err:Error) {
};
try {
tsl = bar.timeSlider;
xps = Math.round((pct * (tsl.rail.width - tsl.icon.width)));
if (dur > 0){
bar.timeSlider.icon.visible = true;
bar.timeSlider.mark.visible = true;
if (scrubbing != true){
bar.timeSlider.icon.x = xps;
};
} else {
bar.timeSlider.icon.visible = false;
bar.timeSlider.mark.visible = false;
};
} catch(err:Error) {
};
}
}
}//package com.jeroenwijering.plugins
Section 30
//Display (com.jeroenwijering.plugins.Display)
package com.jeroenwijering.plugins {
import com.jeroenwijering.events.*;
import flash.display.*;
import flash.events.*;
import com.jeroenwijering.utils.*;
import flash.geom.*;
import flash.net.*;
public class Display implements PluginInterface {
private var display:MovieClip;
private var margins:Array;
private var state:String;
private var loader:Loader;
private var view:AbstractView;
private var ICONS:Array;
public function Display():void{
ICONS = new Array("playIcon", "errorIcon", "bufferIcon", "linkIcon", "muteIcon", "fullscreenIcon", "nextIcon");
super();
}
private function clickHandler(_arg1:MouseEvent):void{
view.sendEvent(view.config["displayclick"]);
}
private function logoHandler(_arg1:Event):void{
if (margins[0] > margins[2]){
display.logo.x = ((display.back.width - margins[2]) - display.logo.width);
} else {
display.logo.x = margins[0];
};
if (margins[1] > margins[3]){
display.logo.y = ((display.back.height - margins[3]) - display.logo.height);
} else {
display.logo.y = margins[1];
};
}
private function errorHandler(_arg1:Object):void{
var evt = _arg1;
setIcon("errorIcon");
try {
display.errorIcon.txt.text = evt.data.message;
} catch(err:Error) {
};
}
public function initializePlugin(_arg1:AbstractView):void{
var clr:*;
var vie = _arg1;
view = vie;
view.addControllerListener(ControllerEvent.ERROR, errorHandler);
view.addControllerListener(ControllerEvent.RESIZE, resizeHandler);
view.addModelListener(ModelEvent.BUFFER, bufferHandler);
view.addModelListener(ModelEvent.ERROR, errorHandler);
view.addModelListener(ModelEvent.STATE, stateHandler);
view.addViewListener(ModelEvent.ERROR, errorHandler);
display = view.skin["display"];
display.media.mask = display.masker;
display.mouseChildren = false;
if (view.config["screencolor"]){
clr = new ColorTransform();
clr.color = ("0x" + view.config["screencolor"].substr(-6));
display.back.transform.colorTransform = clr;
};
if (view.config["displayclick"] != "none"){
display.addEventListener(MouseEvent.CLICK, clickHandler);
display.buttonMode = true;
};
try {
Draw.clear(display.logo);
if (view.config["logo"]){
setLogo();
};
} catch(err:Error) {
};
stateHandler();
resizeHandler();
}
private function setLogo():void{
margins = new Array(display.logo.x, display.logo.y, ((display.back.width - display.logo.x) - display.logo.width), ((display.back.height - display.logo.y) - display.logo.height));
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, logoHandler);
display.logo.addChild(loader);
loader.load(new URLRequest(view.config["logo"]));
}
private function bufferHandler(_arg1:ModelEvent):void{
var pct:*;
var evt = _arg1;
pct = "";
if (evt.data.percentage > 0){
pct = Strings.zero(evt.data.percentage);
};
try {
display.bufferIcon.txt.text = pct;
} catch(err:Error) {
};
}
private function resizeHandler(_arg1:ControllerEvent=null):void{
var wid:*;
var hei:*;
var i:*;
var evt = _arg1;
wid = view.config["width"];
hei = view.config["height"];
if (hei > 0){
display.visible = true;
} else {
display.visible = false;
};
display.back.width = wid;
display.back.height = hei;
try {
display.masker.width = wid;
display.masker.height = hei;
} catch(err:Error) {
};
for (i in ICONS) {
try {
display[ICONS[i]].x = Math.round((wid / 2));
display[ICONS[i]].y = Math.round((hei / 2));
} catch(err:Error) {
};
};
if (view.config["logo"]){
logoHandler(new Event(Event.COMPLETE));
};
}
private function stateHandler(_arg1:ModelEvent=null):void{
state = view.config["state"];
if (state == ModelStates.PLAYING){
setIcon();
} else {
if (state == ModelStates.BUFFERING){
setIcon("bufferIcon");
} else {
switch (view.config.displayclick){
case "none":
setIcon();
break;
default:
setIcon((view.config.displayclick + "Icon"));
break;
};
};
};
}
private function setIcon(_arg1:String=undefined):void{
var _local2:*;
for (_local2 in ICONS) {
if (display[ICONS[_local2]]){
if (_arg1 == ICONS[_local2]){
display[ICONS[_local2]].visible = true;
} else {
display[ICONS[_local2]].visible = false;
};
};
};
}
}
}//package com.jeroenwijering.plugins
Section 31
//Playlist (com.jeroenwijering.plugins.Playlist)
package com.jeroenwijering.plugins {
import com.jeroenwijering.events.*;
import flash.display.*;
import flash.events.*;
import com.jeroenwijering.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.utils.*;
public class Playlist implements PluginInterface {
private var active:Number;
private var buttons:Array;
private var clip:MovieClip;
private var light:ColorTransform;
private var buttonheight:Number;
private var proportion:Number;
private var image:Array;
private var view:AbstractView;
private var back:ColorTransform;
private var front:ColorTransform;
private var scrollInterval:Number;
public function Playlist():void{
}
private function stateHandler(_arg1:ModelEvent):void{
if (view.config["playlist"] == "over"){
if ((((_arg1.data.newstate == ModelStates.PLAYING)) || ((_arg1.data.newstate == ModelStates.BUFFERING)))){
Animations.fade(clip, 0);
} else {
Animations.fade(clip, 1);
};
};
}
private function soverHandler(_arg1:MouseEvent):void{
if (light){
clip.slider.icon.transform.colorTransform = light;
} else {
clip.slider.icon.gotoAndPlay("over");
};
}
private function scrollHandler():void{
var _local1:*;
var _local2:*;
var _local3:*;
var _local4:*;
_local1 = clip.slider;
_local2 = _local1.mouseY;
_local3 = (_local2 - (_local1.icon.height / 2));
_local4 = ((clip.masker.y + (clip.masker.height / 2)) - (proportion * _local2));
_local1.icon.y = Math.round((_local3 - ((_local3 - _local1.icon.y) / 1.5)));
clip.list.y = Math.round((_local4 - ((_local4 - clip.list.y) / 1.5)));
scrollCheck();
}
private function supHandler(_arg1:MouseEvent):void{
clearInterval(scrollInterval);
clip.stage.removeEventListener(MouseEvent.MOUSE_UP, supHandler);
}
private function wheelHandler(_arg1:MouseEvent):void{
}
private function scrollCheck():void{
var _local1:*;
_local1 = clip.slider;
if ((((clip.list.y > 0)) || ((_local1.icon.y < _local1.rail.y)))){
clip.list.y = 0;
_local1.icon.y = _local1.rail.y;
} else {
if ((((clip.list.y < (clip.masker.height - clip.list.height))) || ((_local1.icon.y > ((_local1.rail.y + _local1.rail.height) - _local1.icon.height))))){
_local1.icon.y = ((_local1.rail.y + _local1.rail.height) - _local1.icon.height);
clip.list.y = (clip.masker.height - clip.list.height);
};
};
}
private function setColors():void{
if (view.config["backcolor"]){
back = new ColorTransform();
back.color = uint(("0x" + view.config["backcolor"].substr(-6)));
clip.back.transform.colorTransform = back;
};
if (view.config["frontcolor"]){
front = new ColorTransform();
front.color = uint(("0x" + view.config["frontcolor"].substr(-6)));
try {
clip.slider.icon.transform.colorTransform = front;
clip.slider.rail.transform.colorTransform = front;
} catch(err:Error) {
};
};
if (view.config["lightcolor"]){
light = new ColorTransform();
light.color = uint(("0x" + view.config["lightcolor"].substr(-6)));
};
}
private function playlistHandler(_arg1:ControllerEvent=null):void{
active = undefined;
if (view.config["playlist"] != "none"){
buildList(true);
};
}
private function outHandler(_arg1:MouseEvent):void{
var _local2:*;
var _local3:*;
_local2 = Number(_arg1.target.name);
if (light){
for (_local3 in view.playlist[_local2]) {
if (buttons[_local2].c[_local3]){
buttons[_local2].c[_local3].textColor = front.color;
};
};
} else {
if (_local2 == active){
buttons[_local2].c.gotoAndPlay("active");
} else {
buttons[_local2].c.gotoAndPlay("out");
};
};
}
private function overHandler(_arg1:MouseEvent):void{
var _local2:*;
var _local3:*;
_local2 = Number(_arg1.target.name);
if (light){
for (_local3 in view.playlist[_local2]) {
if (buttons[_local2].c[_local3]){
buttons[_local2].c[_local3].textColor = light.color;
};
};
} else {
buttons[_local2].c.gotoAndPlay("over");
};
}
private function soutHandler(_arg1:MouseEvent):void{
if (front){
clip.slider.icon.transform.colorTransform = front;
} else {
clip.slider.icon.gotoAndPlay("out");
};
}
private function clickHandler(_arg1:MouseEvent):void{
view.sendEvent("item", Number(_arg1.target.name));
}
public function initializePlugin(_arg1:AbstractView):void{
var vie = _arg1;
view = vie;
view.addControllerListener(ControllerEvent.ITEM, itemHandler);
view.addControllerListener(ControllerEvent.PLAYLIST, playlistHandler);
view.addControllerListener(ControllerEvent.RESIZE, resizeHandler);
view.addModelListener(ModelEvent.STATE, stateHandler);
clip = view.skin["playlist"];
buttonheight = clip.list.button.height;
clip.list.button.visible = false;
clip.list.mask = clip.masker;
clip.list.addEventListener(MouseEvent.CLICK, clickHandler);
clip.list.addEventListener(MouseEvent.MOUSE_OVER, overHandler);
clip.list.addEventListener(MouseEvent.MOUSE_OUT, outHandler);
clip.slider.buttonMode = true;
clip.slider.mouseChildren = false;
clip.slider.addEventListener(MouseEvent.MOUSE_DOWN, sdownHandler);
clip.slider.addEventListener(MouseEvent.MOUSE_OVER, soverHandler);
clip.slider.addEventListener(MouseEvent.MOUSE_OUT, soutHandler);
clip.slider.addEventListener(MouseEvent.MOUSE_WHEEL, wheelHandler);
clip.visible = false;
buttons = new Array();
try {
image = new Array(clip.list.button.image.width, clip.list.button.image.height);
} catch(err:Error) {
};
setColors();
playlistHandler();
resizeHandler();
}
private function setContents(_arg1:Number):void{
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
for (_local2 in view.playlist[_arg1]) {
if (!buttons[_arg1].c[_local2]){
continue;
} else {
if (_local2 == "image"){
_local3 = buttons[_arg1].c.image;
_local4 = Draw.rect(buttons[_arg1].c, "0xFF0000", _local3.width, _local3.height, _local3.x, _local3.y);
_local5 = new Loader();
_local3.mask = _local4;
_local3.addChild(_local5);
_local5.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderHandler);
_local5.load(new URLRequest(view.playlist[_arg1]["image"]));
} else {
if (_local2 == "duration"){
if (view.playlist[_arg1][_local2] > 0){
buttons[_arg1].c[_local2].text = Strings.digits(view.playlist[_arg1][_local2]);
if (front){
buttons[_arg1].c[_local2].textColor = front.color;
};
};
} else {
if (_local2 == "description"){
buttons[_arg1].c[_local2].htmlText = view.playlist[_arg1][_local2];
} else {
buttons[_arg1].c[_local2].text = view.playlist[_arg1][_local2];
};
if (front){
buttons[_arg1].c[_local2].textColor = front.color;
};
};
};
};
};
if (buttons[_arg1].c["back"]){
if (light){
buttons[_arg1].c["back"].transform.colorTransform = light;
};
buttons[_arg1].c["back"].visible = false;
};
if (((!(view.playlist[_arg1]["image"])) && (buttons[_arg1].c["image"]))){
buttons[_arg1].c["image"].visible = false;
};
}
private function buildSlider():void{
var _local1:*;
var _local2:*;
_local1 = clip.slider;
_local1.visible = true;
_local1.x = (clip.back.width - _local1.width);
_local2 = (clip.back.height - _local1.height);
_local1.back.height = (_local1.back.height + _local2);
_local1.rail.height = (_local1.rail.height + _local2);
_local1.icon.height = Math.round((_local1.rail.height / proportion));
}
private function sdownHandler(_arg1:MouseEvent):void{
clearInterval(scrollInterval);
clip.stage.addEventListener(MouseEvent.MOUSE_UP, supHandler);
scrollHandler();
scrollInterval = setInterval(scrollHandler, 50);
}
private function itemHandler(_arg1:ControllerEvent):void{
var _local2:*;
_local2 = view.config["item"];
if (buttons[_local2]){
if (buttons[_local2].c["back"]){
buttons[_local2].c["back"].visible = true;
if (!isNaN(active)){
buttons[active].c["back"].visible = false;
};
} else {
buttons[_local2].c.gotoAndPlay("active");
if (!isNaN(active)){
buttons[active].c.gotoAndPlay("out");
};
};
};
active = _local2;
}
private function buildList(_arg1:Boolean):void{
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
if (!view.playlist){
return;
};
_local2 = clip.back.width;
_local3 = clip.back.height;
proportion = ((view.playlist.length * buttonheight) / _local3);
if (proportion > 1.01){
_local2 = (_local2 - clip.slider.width);
buildSlider();
} else {
clip.slider.visible = false;
};
clip.masker.height = _local3;
clip.masker.width = _local2;
if (_arg1){
clip.list.y = 0;
_local5 = 0;
while (_local5 < buttons.length) {
clip.list.removeChild(buttons[_local5].c);
_local5++;
};
buttons = new Array();
clip.visible = true;
} else {
if (proportion > 1){
scrollCheck();
};
};
_local4 = 0;
while (_local4 < view.playlist.length) {
if (_arg1){
_local6 = Draw.clone(clip.list.button, true);
_local7 = new Stacker(_local6);
_local6.y = (_local4 * buttonheight);
_local6.buttonMode = true;
_local6.mouseChildren = false;
_local6.name = _local4;
buttons.push({c:_local6, s:_local7});
setContents(_local4);
};
buttons[_local4].s.rearrange(_local2);
_local4++;
};
}
private function resizeHandler(_arg1:ControllerEvent=null):void{
if (view.config["playlist"] == "right"){
clip.x = view.config["width"];
clip.y = 0;
clip.back.width = view.config["playlistsize"];
clip.back.height = view.config["height"];
buildList(false);
} else {
if (view.config["playlist"] == "bottom"){
clip.x = 0;
clip.y = view.config["height"];
if (view.config["controlbar"] == "bottom"){
clip.y = (clip.y + view.config["controlbarsize"]);
};
clip.back.height = view.config["playlistsize"];
clip.back.width = view.config["width"];
buildList(false);
} else {
if (view.config["playlist"] == "over"){
clip.x = (clip.y = 0);
clip.back.width = view.config["width"];
clip.back.height = view.config["height"];
buildList(false);
} else {
clip.visible = false;
};
};
};
}
private function loaderHandler(_arg1:Event):void{
var _local2:*;
_local2 = Loader(_arg1.target.loader);
Stretcher.stretch(_local2, image[0], image[1], Stretcher.EXACTFIT);
}
}
}//package com.jeroenwijering.plugins
Section 32
//Animations (com.jeroenwijering.utils.Animations)
package com.jeroenwijering.utils {
import flash.display.*;
import flash.events.*;
public class Animations {
public static function fade(_arg1:MovieClip, _arg2:Number=1, _arg3:Number=0.2):void{
if (_arg1.alpha > _arg2){
_arg1.spd = -(Math.abs(_arg3));
} else {
_arg1.spd = Math.abs(_arg3);
};
_arg1.end = _arg2;
_arg1.addEventListener(Event.ENTER_FRAME, fadeHandler);
}
private static function fadeHandler(_arg1:Event):void{
var _local2:*;
_local2 = MovieClip(_arg1.target);
if ((((((_local2.alpha >= (_local2.end - _local2.spd))) && ((_local2.spd > 0)))) || ((((_local2.alpha <= (_local2.end + _local2.spd))) && ((_local2.spd < 0)))))){
_local2.removeEventListener(Event.ENTER_FRAME, fadeHandler);
_local2.alpha = _local2.end;
if (_local2.end == 0){
_local2.visible = false;
};
} else {
_local2.visible = true;
_local2.alpha = (_local2.alpha + _local2.spd);
};
}
private static function writeHandler(_arg1:Event):void{
var _local2:*;
var _local3:*;
_local2 = MovieClip(_arg1.target);
_local3 = Math.floor(((_local2.str.length - _local2.tf.text.length) / _local2.spd));
_local2.tf.text = _local2.str.substr(0, (_local2.str.length - _local3));
if (_local2.tf.text == _local2.str){
_local2.tf.htmlText = _local2.str;
_local2.removeEventListener(Event.ENTER_FRAME, easeHandler);
};
}
private static function easeHandler(_arg1:Event):void{
var _local2:*;
_local2 = MovieClip(_arg1.target);
if ((((Math.abs((_local2.x - _local2.xps)) < 1)) && ((Math.abs((_local2.y - _local2.yps)) < 1)))){
_local2.removeEventListener(Event.ENTER_FRAME, easeHandler);
_local2.x = _local2.xps;
_local2.y = _local2.yps;
} else {
_local2.x = (_local2.xps - ((_local2.xps - _local2.x) / _local2.spd));
_local2.y = (_local2.yps - ((_local2.yps - _local2.y) / _local2.spd));
};
}
public static function ease(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number=2):void{
if (!_arg2){
_arg1.xps = _arg1.x;
} else {
_arg1.xps = _arg2;
};
if (!_arg3){
_arg1.yps = _arg1.y;
} else {
_arg1.yps = _arg3;
};
_arg1.spd = _arg4;
_arg1.addEventListener(Event.ENTER_FRAME, easeHandler);
}
public static function write(_arg1:MovieClip, _arg2:String, _arg3:Number=1.5):void{
_arg1.str = _arg2;
_arg1.spd = _arg3;
_arg1.tf.text = "";
_arg1.addEventListener(Event.ENTER_FRAME, writeHandler);
}
}
}//package com.jeroenwijering.utils
Section 33
//Configger (com.jeroenwijering.utils.Configger)
package com.jeroenwijering.utils {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public class Configger extends EventDispatcher {
public var config:Object;
private var reference:Sprite;
private var loader:URLLoader;
public function Configger(_arg1:Sprite):void{
reference = _arg1;
}
private function compareWrite(_arg1:Object):void{
var _local2:*;
var _local3:*;
for (_local2 in _arg1) {
_local3 = _local2.toLowerCase();
if (config[_local3] != undefined){
config[_local3] = Strings.serialize(_arg1[_local3], config[_local2]);
} else {
config[_local3] = _arg1[_local3];
};
};
}
private function loadXML(_arg1:String):void{
var url = _arg1;
loader = new URLLoader();
loader.addEventListener(Event.COMPLETE, xmlHandler);
try {
loader.load(new URLRequest(url));
} catch(err:Error) {
throw (err);
};
}
private function loadFlashvars():void{
compareWrite(reference.root.loaderInfo.parameters);
dispatchEvent(new Event(Event.COMPLETE));
}
public function load(_arg1:Object):void{
var _local2:*;
config = _arg1;
_local2 = reference.root.loaderInfo.parameters["config"];
if (_local2){
loadXML(Strings.decode(_local2));
} else {
loadFlashvars();
};
}
private function xmlHandler(_arg1:Event):void{
var _local2:*;
var _local3:*;
var _local4:*;
_local2 = XML(_arg1.currentTarget.data);
_local3 = new Object();
for each (_local4 in _local2.children()) {
_local3[_local4.name()] = _local4.text();
};
compareWrite(_local3);
loadFlashvars();
}
}
}//package com.jeroenwijering.utils
Section 34
//Draw (com.jeroenwijering.utils.Draw)
package com.jeroenwijering.utils {
import flash.display.*;
import flash.text.*;
public class Draw {
public static function rect(_arg1:Sprite, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0, _arg7:Number=1):Sprite{
var _local8:*;
_local8 = new Sprite();
_local8.x = _arg5;
_local8.y = _arg6;
_local8.graphics.beginFill(_arg2, _arg7);
_local8.graphics.drawRect(0, 0, _arg3, _arg4);
_arg1.addChild(_local8);
return (_local8);
}
public static function clone(_arg1:MovieClip, _arg2:Boolean=false):MovieClip{
var _local3:Class;
var _local4:*;
_local3 = Object(_arg1).constructor;
_local4 = new (_local3);
_local4.transform = _arg1.transform;
_local4.filters = _arg1.filters;
_local4.cacheAsBitmap = _arg1.cacheAsBitmap;
_local4.opaqueBackground = _arg1.opaqueBackground;
if (_arg2 == true){
_arg1.parent.addChild(_local4);
};
return (_local4);
}
public static function clear(_arg1:Sprite):void{
var _local2:*;
var _local3:*;
_local2 = _arg1.numChildren;
_local3 = 0;
while (_local3 < _local2) {
_arg1.removeChildAt(0);
_local3++;
};
_arg1.scaleX = (_arg1.scaleY = 1);
}
public static function text(_arg1:Sprite, _arg2:String, _arg3:Number, _arg4:Number, _arg5:String, _arg6:String="left", _arg7:Number=12, _arg8:String="Arial"):TextField{
var _local9:*;
var _local10:*;
_local9 = new TextField();
_local10 = new TextFormat();
_local9.autoSize = _arg6;
_local9.selectable = false;
_local10.font = _arg8;
_local10.color = _arg2;
_local10.size = _arg7;
_local10.underline = false;
_local9.defaultTextFormat = _local10;
_local9.x = _arg3;
_local9.y = _arg4;
_local9.text = _arg5;
_arg1.addChild(_local9);
return (_local9);
}
}
}//package com.jeroenwijering.utils
Section 35
//NetClient (com.jeroenwijering.utils.NetClient)
package com.jeroenwijering.utils {
public class NetClient {
private var callback:Object;
public function NetClient(_arg1:Object):void{
callback = _arg1;
}
public function onImageData(_arg1:Object):void{
var _local2:*;
_local2 = {type:"imagedata"};
forward(_arg1);
}
public function onLastSecond(_arg1:Object):void{
var _local2:*;
_local2 = {type:"lastsecond"};
forward(_local2);
}
private function forward(_arg1:Object):void{
callback.onData(_arg1);
}
public function onCaption(_arg1:String, _arg2:Number):void{
var _local3:*;
_local3 = {type:"caption", captions:_arg1, speaker:_arg2};
forward(_local3);
}
public function onMetaData(_arg1:Object):void{
var _local2:*;
var _local3:*;
_local2 = {type:"metadata"};
for (_local3 in _arg1) {
_local2[_local3] = _arg1[_local3];
};
if (((((_local2.videocodecid) || (_local2.videodatarate))) && (!(_local2.width)))){
_local2.width = 320;
_local2.height = 240;
};
forward(_local2);
}
public function onPlayStatus(_arg1:Object):void{
if (_arg1.code == "NetStream.Play.Complete"){
_arg1 = {type:"complete"};
forward(_arg1);
};
}
public function onBWCheck(... _args):Number{
return (0);
}
public function onCaptionInfo(_arg1:Object):void{
var _local2:*;
var _local3:*;
_local2 = {type:"captioninfo"};
for (_local3 in _arg1) {
_local2[_local3] = _arg1[_local3];
};
forward(_local2);
}
public function onBWDone(... _args):void{
var _local2:*;
if (_args.length > 0){
_local2 = {type:"bandwidth", bandwidth:_args[0]};
forward(_local2);
};
}
public function onTextData(_arg1:Object):void{
var _local2:*;
var _local3:*;
_local2 = {type:"textdata"};
for (_local3 in _arg1) {
_local2[_local3] = _arg1[_local3];
};
forward(_local2);
}
public function RtmpSampleAccess(_arg1:Object):void{
var _local2:*;
_local2 = {type:"rtmpsampleaccess"};
forward(_local2);
}
public function onCuePoint(_arg1:Object):void{
var _local2:*;
var _local3:*;
_local2 = {type:"cuepoint"};
for (_local3 in _arg1) {
_local2[_local3] = _arg1[_local3];
};
forward(_local2);
}
public function onFCSubscribe(_arg1:Object):void{
var _local2:*;
var _local3:*;
_local2 = {type:"fcsubscribe"};
for (_local3 in _arg1) {
_local2[_local3] = _arg1[_local3];
};
forward(_local2);
}
}
}//package com.jeroenwijering.utils
Section 36
//Playlister (com.jeroenwijering.utils.Playlister)
package com.jeroenwijering.utils {
import flash.events.*;
import com.jeroenwijering.parsers.*;
import flash.net.*;
public class Playlister extends EventDispatcher {
private var loader:URLLoader;
private var _playlist:Array;
private var status:Number;
public function Playlister():void{
loader = new URLLoader();
loader.addEventListener(Event.COMPLETE, loaderHandler);
loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, errorHandler);
loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, statusHandler);
}
public function update(_arg1:Number, _arg2:String, _arg3:Object):void{
if (_playlist[_arg1]){
_playlist[_arg1][_arg2] = _arg3;
};
}
public function get playlist():Array{
return (_playlist);
}
private function errorHandler(_arg1:ErrorEvent):void{
dispatchEvent(new ErrorEvent(ErrorEvent.ERROR, false, false, ((status + ": ") + _arg1.text)));
}
public function load(_arg1:Object):void{
var itm:*;
var ent:*;
var str:*;
var obj = _arg1;
if (typeof(obj) == "string"){
obj = {file:obj};
};
if (obj["file"]){
itm = ObjectParser.parse(obj);
if (itm["type"] == undefined){
try {
loader.load(new URLRequest(obj["file"]));
} catch(err:Error) {
dispatchEvent(new ErrorEvent(ErrorEvent.ERROR, false, false, err.message));
};
} else {
_playlist = new Array(itm);
dispatchEvent(new Event(Event.COMPLETE));
};
} else {
_playlist = new Array();
for each (ent in obj) {
if ((((typeof(ent) == "object")) && (ent["file"]))){
_playlist.push(ent);
};
};
if (_playlist.length == 0){
str = "No file found. Did you set the \"file\" flashvar?";
dispatchEvent(new ErrorEvent(ErrorEvent.ERROR, false, false, str));
} else {
dispatchEvent(new Event(Event.COMPLETE));
};
};
}
private function loaderHandler(_arg1:Event):void{
var fmt:*;
var dat:*;
var str:*;
var evt = _arg1;
try {
dat = XML(evt.target.data);
} catch(err:Error) {
str = (status + ": This playlist is not a valid XML file.");
dispatchEvent(new ErrorEvent(ErrorEvent.ERROR, false, false, str));
return;
};
fmt = dat.localName().toLowerCase();
if (fmt == "rss"){
_playlist = RSSParser.parse(dat);
} else {
if (fmt == "playlist"){
_playlist = XSPFParser.parse(dat);
} else {
if (fmt == "asx"){
_playlist = ASXParser.parse(dat);
} else {
if (fmt == "smil"){
_playlist = SMILParser.parse(dat);
} else {
if (fmt == "feed"){
_playlist = ATOMParser.parse(dat);
} else {
fmt = ("Unknown playlist format: " + fmt);
dispatchEvent(new ErrorEvent(ErrorEvent.ERROR, false, false, fmt));
return;
};
};
};
};
};
if (_playlist.length == 0){
fmt = "No suitable mediafiles found in this feed.";
dispatchEvent(new ErrorEvent(ErrorEvent.ERROR, false, false, fmt));
} else {
dispatchEvent(new Event(Event.COMPLETE));
};
}
private function statusHandler(_arg1:HTTPStatusEvent):void{
status = _arg1.status;
}
}
}//package com.jeroenwijering.utils
Section 37
//Randomizer (com.jeroenwijering.utils.Randomizer)
package com.jeroenwijering.utils {
public class Randomizer {
private var todo:Array;
private var done:Array;
private var original:Array;
public function Randomizer(_arg1:Number):void{
var _local2:*;
super();
original = new Array();
todo = new Array();
done = new Array();
_local2 = 0;
while (_local2 < _arg1) {
original.push(_local2);
_local2++;
};
}
public function pick():Number{
var _local1:*;
var _local2:*;
var _local3:*;
if (todo.length == 0){
_local3 = 0;
while (_local3 < original.length) {
todo.push(_local3);
_local3++;
};
};
_local1 = Math.floor((Math.random() * todo.length));
_local2 = todo[_local1];
done.push(todo.splice(_local1, 1)[0]);
return (_local2);
}
public function get length():Number{
return (todo.length);
}
public function back():Number{
if (done.length < 2){
return (pick());
};
todo.push(done.pop());
return (done[(done.length - 1)]);
}
}
}//package com.jeroenwijering.utils
Section 38
//Stacker (com.jeroenwijering.utils.Stacker)
package com.jeroenwijering.utils {
import flash.display.*;
public class Stacker {
private var _width:Number;
private var stack:Array;
public var clip:MovieClip;
private var latest:Number;
public function Stacker(_arg1:MovieClip):void{
clip = _arg1;
analyze();
}
public function get width():Number{
return (_width);
}
private function analyze():void{
var _local1:*;
var _local2:*;
_width = clip.width;
stack = new Array();
_local1 = 0;
while (_local1 < clip.numChildren) {
_local2 = clip.getChildAt(_local1);
stack.push({c:_local2, x:_local2.x, n:_local2.name, w:_local2.width});
_local1++;
};
stack.sortOn(["x", "n"], [Array.NUMERIC, Array.CASEINSENSITIVE]);
}
public function rearrange(_arg1:Number=undefined):void{
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
if (_arg1){
latest = _arg1;
};
_local2 = (latest - width);
_local3 = 0;
_local4 = 0;
while (_local4 < stack.length) {
if (stack[_local4].x > (width / 2)){
stack[_local4].c.x = (stack[_local4].x + _local2);
if ((((stack[_local4].c.visible == false)) && ((overlaps(_local4) == false)))){
_local2 = (_local2 - (stack[(_local4 + 1)].x - stack[_local4].x));
};
} else {
stack[_local4].c.x = (stack[_local4].x - _local3);
if ((((stack[_local4].c.visible == false)) && ((overlaps(_local4) == false)))){
if (stack[(_local4 - 1)].w > (width / 3)){
_local3 = (_local3 + (stack[_local4].w + stack[_local4].x));
} else {
_local3 = (_local3 + (((stack[_local4].w + stack[_local4].x) - stack[(_local4 - 1)].x) - stack[(_local4 - 1)].w));
};
};
};
if (stack[_local4].w > (width / 3)){
stack[_local4].c.width = ((stack[_local4].w + _local2) + _local3);
};
_local4++;
};
_local5 = ((latest - width) - _local2);
if (_local5 > 0){
_local6 = 0;
while (_local6 < stack.length) {
if (stack[_local6].x > (width / 2)){
stack[_local6].c.x = (stack[_local6].c.x + _local5);
};
if ((((stack[_local6].w > (width / 3))) && ((stack[_local6].w < width)))){
stack[_local6].c.width = (stack[_local6].c.width + _local5);
};
_local6++;
};
};
}
private function overlaps(_arg1:Number):Boolean{
var _local2:*;
var _local3:*;
var _local4:*;
_local2 = stack[_arg1].x;
_local3 = (stack[_arg1].x + stack[_arg1].w);
for (_local4 in stack) {
if (((((((((!((_local4 == _arg1))) && ((stack[_local4].c.visible == true)))) && ((stack[_local4].w < _width)))) && ((stack[_local4].x < _local3)))) && (((stack[_local4].x + stack[_local4].w) > _local2)))){
return (true);
};
};
return (false);
}
}
}//package com.jeroenwijering.utils
Section 39
//Stretcher (com.jeroenwijering.utils.Stretcher)
package com.jeroenwijering.utils {
import flash.display.*;
public class Stretcher {
public static var EXACTFIT:String = "exactfit";
public static var FILL:String = "fill";
public static var NONE:String = "none";
public static var UNIFORM:String = "uniform";
public static function stretch(_arg1:DisplayObject, _arg2:Number, _arg3:Number, _arg4:String="uniform"):void{
var _local5:*;
var _local6:*;
_local5 = (_arg2 / _arg1.width);
_local6 = (_arg3 / _arg1.height);
switch (_arg4.toLowerCase()){
case "exactfit":
_arg1.width = _arg2;
_arg1.height = _arg3;
break;
case "fill":
if (_local5 > _local6){
_arg1.width = (_arg1.width * _local5);
_arg1.height = (_arg1.height * _local5);
} else {
_arg1.width = (_arg1.width * _local6);
_arg1.height = (_arg1.height * _local6);
};
break;
case "none":
break;
case "uniform":
if (_local5 > _local6){
_arg1.width = (_arg1.width * _local6);
_arg1.height = (_arg1.height * _local6);
} else {
_arg1.width = (_arg1.width * _local5);
_arg1.height = (_arg1.height * _local5);
};
break;
};
_arg1.x = Math.round(((_arg2 / 2) - (_arg1.width / 2)));
_arg1.y = Math.round(((_arg3 / 2) - (_arg1.height / 2)));
_arg1.width = Math.ceil(_arg1.width);
_arg1.height = Math.ceil(_arg1.height);
}
}
}//package com.jeroenwijering.utils
Section 40
//Strings (com.jeroenwijering.utils.Strings)
package com.jeroenwijering.utils {
public class Strings {
public static function serialize(_arg1:String, _arg2:Object):Object{
switch (typeof(_arg2)){
case "boolean":
if (_arg1 == "true"){
return (true);
};
return (false);
case "number":
return (Number(_arg1));
default:
return (Strings.decode(_arg1));
};
}
public static function digits(_arg1:Number):String{
var _local2:*;
var _local3:*;
var _local4:*;
_local2 = Math.floor((_arg1 / 60));
_local3 = Math.floor((_arg1 % 60));
_local4 = ((Strings.zero(_local2) + ":") + Strings.zero(_local3));
return (_local4);
}
public static function zero(_arg1:Number):String{
if (_arg1 < 10){
return (("0" + _arg1));
};
return (("" + _arg1));
}
public static function strip(_arg1:String):String{
var _local2:*;
var _local3:*;
var _local4:*;
_local2 = _arg1.split("\n");
_arg1 = _local2.join("");
_local2 = _arg1.split("\r");
_arg1 = _local2.join("");
_local3 = _arg1.indexOf("<");
for (;_local3 != -1;if (_arg1.substr(_local3, 3) == "<br"){
_arg1 = ((_arg1.substr(0, _local3) + "\n") + _arg1.substr((_local4 + 1), _arg1.length));
} else {
_arg1 = ((_arg1.substr(0, _local3) + " ") + _arg1.substr((_local4 + 1), _arg1.length));
}, (_local3 = _arg1.indexOf("<", _local3))) {
_local4 = _arg1.indexOf(">", (_local3 + 1));
if ((_local4 == -1)){
_local4 = (_arg1.length - 1);
continue;
};
};
return (_arg1);
}
public static function decode(_arg1:String):String{
var _local2:*;
_local2 = _arg1.indexOf("asfunction");
if (_local2 == -1){
return (decodeURI(_arg1));
};
return (decodeURI((_arg1.substr(0, _local2) + _arg1.substr((_local2 + 10)))));
}
public static function seconds(_arg1:String):Number{
var _local2:*;
var _local3:*;
_local2 = _arg1.split(":");
_local3 = 0;
if (_arg1.substr(-1) == "s"){
_local3 = Number(_arg1.substr(0, (_arg1.length - 1)));
} else {
if (_arg1.substr(-1) == "m"){
_local3 = (Number(_arg1.substr(0, (_arg1.length - 1))) * 60);
} else {
if (_arg1.substr(-1) == "h"){
_local3 = (Number(_arg1.substr(0, (_arg1.length - 1))) * 3600);
} else {
if (_local2.length > 1){
_local3 = Number(_local2[(_local2.length - 1)]);
_local3 = (_local3 + (Number(_local2[(_local2.length - 2)]) * 60));
if (_local2.length == 3){
_local3 = (_local3 + (Number(_local2[(_local2.length - 3)]) * 3600));
};
} else {
_local3 = Number(_arg1);
};
};
};
};
return (_local3);
}
}
}//package com.jeroenwijering.utils
Section 41
//TEA (com.jeroenwijering.utils.TEA)
package com.jeroenwijering.utils {
public class TEA {
private static function strToChars(_arg1:String):Array{
var _local2:Array;
var _local3:Number;
_local2 = new Array();
_local3 = 0;
while (_local3 < _arg1.length) {
_local2.push(_arg1.charCodeAt(_local3));
_local3++;
};
return (_local2);
}
private static function charsToHex(_arg1:Array):String{
var _local2:String;
var _local3:Array;
var _local4:Number;
_local2 = new String("");
_local3 = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f");
_local4 = 0;
while (_local4 < _arg1.length) {
_local2 = (_local2 + (_local3[(_arg1[_local4] >> 4)] + _local3[(_arg1[_local4] & 15)]));
_local4++;
};
return (_local2);
}
public static function encrypt(_arg1:String, _arg2:String):String{
var _local3:Array;
var _local4:Array;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
_local3 = charsToLongs(strToChars(_arg1));
_local4 = charsToLongs(strToChars(_arg2));
_local5 = _local3.length;
if (_local5 == 0){
return ("");
};
if (_local5 == 1){
var _temp1 = _local5;
_local5 = (_local5 + 1);
var _local14 = _temp1;
_local3[_local14] = 0;
};
_local7 = _local3[(_local5 - 1)];
_local8 = _local3[0];
_local9 = 2654435769;
_local12 = Math.floor((6 + (52 / _local5)));
_local13 = 0;
while (_local12-- > 0) {
_local13 = (_local13 + _local9);
_local11 = ((_local13 >>> 2) & 3);
_local6 = 0;
while (_local6 < (_local5 - 1)) {
_local8 = _local3[(_local6 + 1)];
_local10 = ((((_local7 >>> 5) ^ (_local8 << 2)) + ((_local8 >>> 3) ^ (_local7 << 4))) ^ ((_local13 ^ _local8) + (_local4[((_local6 & 3) ^ _local11)] ^ _local7)));
_local7 = (_local3[_local6] = (_local3[_local6] + _local10));
_local6++;
};
_local8 = _local3[0];
_local10 = ((((_local7 >>> 5) ^ (_local8 << 2)) + ((_local8 >>> 3) ^ (_local7 << 4))) ^ ((_local13 ^ _local8) + (_local4[((_local6 & 3) ^ _local11)] ^ _local7)));
_local7 = (_local3[(_local5 - 1)] = (_local3[(_local5 - 1)] + _local10));
};
return (charsToHex(longsToChars(_local3)));
}
private static function longToChars(_arg1:Number):Array{
var _local2:Array;
_local2 = new Array();
_local2.push((_arg1 & 0xFF), ((_arg1 >>> 8) & 0xFF), ((_arg1 >>> 16) & 0xFF), ((_arg1 >>> 24) & 0xFF));
return (_local2);
}
private static function hexToChars(_arg1:String):Array{
var _local2:Array;
var _local3:Number;
_local2 = new Array();
_local3 = ((_arg1.substr(0, 2))=="0x") ? 2 : 0;
while (_local3 < _arg1.length) {
_local2.push(parseInt(_arg1.substr(_local3, 2), 16));
_local3 = (_local3 + 2);
};
return (_local2);
}
private static function charsToStr(_arg1:Array):String{
var _local2:String;
var _local3:Number;
_local2 = new String("");
_local3 = 0;
while (_local3 < _arg1.length) {
_local2 = (_local2 + String.fromCharCode(_arg1[_local3]));
_local3++;
};
return (_local2);
}
private static function longsToChars(_arg1:Array):Array{
var _local2:Array;
var _local3:Number;
_local2 = new Array();
_local3 = 0;
while (_local3 < _arg1.length) {
_local2.push((_arg1[_local3] & 0xFF), ((_arg1[_local3] >>> 8) & 0xFF), ((_arg1[_local3] >>> 16) & 0xFF), ((_arg1[_local3] >>> 24) & 0xFF));
_local3++;
};
return (_local2);
}
public static function decrypt(_arg1:String, _arg2:String):String{
var _local3:Array;
var _local4:Array;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
_local3 = charsToLongs(hexToChars(_arg1));
_local4 = charsToLongs(strToChars(_arg2));
_local5 = _local3.length;
if (_local5 == 0){
return ("");
};
_local7 = _local3[(_local5 - 1)];
_local8 = _local3[0];
_local9 = 2654435769;
_local12 = Math.floor((6 + (52 / _local5)));
_local13 = (_local12 * _local9);
while (_local13 != 0) {
_local11 = ((_local13 >>> 2) & 3);
_local6 = (_local5 - 1);
while (_local6 > 0) {
_local7 = _local3[(_local6 - 1)];
_local10 = ((((_local7 >>> 5) ^ (_local8 << 2)) + ((_local8 >>> 3) ^ (_local7 << 4))) ^ ((_local13 ^ _local8) + (_local4[((_local6 & 3) ^ _local11)] ^ _local7)));
_local8 = (_local3[_local6] = (_local3[_local6] - _local10));
_local6--;
};
_local7 = _local3[(_local5 - 1)];
_local10 = ((((_local7 >>> 5) ^ (_local8 << 2)) + ((_local8 >>> 3) ^ (_local7 << 4))) ^ ((_local13 ^ _local8) + (_local4[((_local6 & 3) ^ _local11)] ^ _local7)));
_local8 = (_local3[0] = (_local3[0] - _local10));
_local13 = (_local13 - _local9);
};
return (charsToStr(longsToChars(_local3)));
}
private static function charsToLongs(_arg1:Array):Array{
var _local2:Array;
var _local3:Number;
_local2 = new Array(Math.ceil((_arg1.length / 4)));
_local3 = 0;
while (_local3 < _local2.length) {
_local2[_local3] = (((_arg1[(_local3 * 4)] + (_arg1[((_local3 * 4) + 1)] << 8)) + (_arg1[((_local3 * 4) + 2)] << 16)) + (_arg1[((_local3 * 4) + 3)] << 24));
_local3++;
};
return (_local2);
}
}
}//package com.jeroenwijering.utils
Section 42
//bufferIcon_10 (player_fla.bufferIcon_10)
package player_fla {
import flash.display.*;
import flash.text.*;
public dynamic class bufferIcon_10 extends MovieClip {
public var txt:TextField;
}
}//package player_fla
Section 43
//button_16 (player_fla.button_16)
package player_fla {
import flash.display.*;
import flash.text.*;
public dynamic class button_16 extends MovieClip {
public var description:TextField;
public var shade:MovieClip;
public var image:MovieClip;
public var title:TextField;
public var duration:TextField;
public var back:MovieClip;
}
}//package player_fla
Section 44
//captions_24 (player_fla.captions_24)
package player_fla {
import flash.display.*;
import flash.text.*;
public dynamic class captions_24 extends MovieClip {
public var field:TextField;
public var back:MovieClip;
}
}//package player_fla
Section 45
//controlbar_26 (player_fla.controlbar_26)
package player_fla {
import flash.display.*;
import flash.text.*;
import flash.accessibility.*;
public dynamic class controlbar_26 extends MovieClip {
public var unmuteButton:MovieClip;
public var nextButton:MovieClip;
public var timeSlider:MovieClip;
public var normalscreenButton:MovieClip;
public var shade:MovieClip;
public var prevButton:MovieClip;
public var totalText:TextField;
public var playButton:MovieClip;
public var volumeSlider:MovieClip;
public var muteButton:MovieClip;
public var elapsedText:TextField;
public var linkButton:MovieClip;
public var fullscreenButton:MovieClip;
public var pauseButton:MovieClip;
public var stopButton:MovieClip;
public var back:MovieClip;
public function controlbar_26(){
addFrameScript(0, frame1);
}
function frame1(){
unmuteButton.tabIndex = 9;
muteButton.tabIndex = 8;
linkButton.tabIndex = 5;
fullscreenButton.tabIndex = 7;
nextButton.tabIndex = 4;
pauseButton.tabIndex = 2;
playButton.tabIndex = 1;
normalscreenButton.tabIndex = 6;
prevButton.tabIndex = 3;
prevButton.accessibilityProperties = new AccessibilityProperties();
prevButton.accessibilityProperties.name = "prevButton";
prevButton.accessibilityProperties.shortcut = "left-arrow";
prevButton.accessibilityProperties.forceSimple = true;
normalscreenButton.accessibilityProperties = new AccessibilityProperties();
normalscreenButton.accessibilityProperties.name = "normalscreenButton";
normalscreenButton.accessibilityProperties.shortcut = "f";
playButton.accessibilityProperties = new AccessibilityProperties();
playButton.accessibilityProperties.name = "playButton";
playButton.accessibilityProperties.shortcut = "p";
playButton.accessibilityProperties.forceSimple = true;
pauseButton.accessibilityProperties = new AccessibilityProperties();
pauseButton.accessibilityProperties.name = "pauseButton";
pauseButton.accessibilityProperties.shortcut = "p";
pauseButton.accessibilityProperties.forceSimple = true;
nextButton.accessibilityProperties = new AccessibilityProperties();
nextButton.accessibilityProperties.name = "nextButton";
nextButton.accessibilityProperties.shortcut = "right-arrow";
nextButton.accessibilityProperties.forceSimple = true;
timeSlider.accessibilityProperties = new AccessibilityProperties();
timeSlider.accessibilityProperties.silent = true;
fullscreenButton.accessibilityProperties = new AccessibilityProperties();
fullscreenButton.accessibilityProperties.name = "FullscreenButton";
fullscreenButton.accessibilityProperties.shortcut = "f";
fullscreenButton.accessibilityProperties.forceSimple = true;
linkButton.accessibilityProperties = new AccessibilityProperties();
linkButton.accessibilityProperties.name = "linkButton";
linkButton.accessibilityProperties.shortcut = "l";
linkButton.accessibilityProperties.forceSimple = true;
muteButton.accessibilityProperties = new AccessibilityProperties();
muteButton.accessibilityProperties.name = "muteButton";
muteButton.accessibilityProperties.shortcut = "m";
muteButton.accessibilityProperties.forceSimple = true;
unmuteButton.accessibilityProperties = new AccessibilityProperties();
unmuteButton.accessibilityProperties.name = "unmuteButton";
unmuteButton.accessibilityProperties.shortcut = "m";
unmuteButton.accessibilityProperties.forceSimple = true;
volumeSlider.accessibilityProperties = new AccessibilityProperties();
volumeSlider.accessibilityProperties.silent = true;
}
}
}//package player_fla
Section 46
//display_2 (player_fla.display_2)
package player_fla {
import flash.display.*;
import flash.accessibility.*;
public dynamic class display_2 extends MovieClip {
public var media:MovieClip;
public var nextIcon:MovieClip;
public var muteIcon:MovieClip;
public var masker:MovieClip;
public var linkIcon:MovieClip;
public var errorIcon:MovieClip;
public var logo:MovieClip;
public var playIcon:MovieClip;
public var fullscreenIcon:MovieClip;
public var bufferIcon:MovieClip;
public var back:MovieClip;
public function display_2(){
addFrameScript(0, frame1);
}
function frame1(){
back.accessibilityProperties = new AccessibilityProperties();
back.accessibilityProperties.silent = true;
masker.accessibilityProperties = new AccessibilityProperties();
masker.accessibilityProperties.silent = true;
back.accessibilityProperties = new AccessibilityProperties();
back.accessibilityProperties.silent = true;
}
}
}//package player_fla
Section 47
//errorIcon_6 (player_fla.errorIcon_6)
package player_fla {
import flash.display.*;
import flash.text.*;
public dynamic class errorIcon_6 extends MovieClip {
public var txt:TextField;
}
}//package player_fla
Section 48
//fullscreenButton_39 (player_fla.fullscreenButton_39)
package player_fla {
import flash.display.*;
public dynamic class fullscreenButton_39 extends MovieClip {
public var icon:MovieClip;
}
}//package player_fla
Section 49
//linkButton_37 (player_fla.linkButton_37)
package player_fla {
import flash.display.*;
public dynamic class linkButton_37 extends MovieClip {
public var icon:MovieClip;
public function linkButton_37(){
addFrameScript(1, frame2, 3, frame4);
}
function frame4(){
stop();
}
function frame2(){
stop();
}
}
}//package player_fla
Section 50
//list_15 (player_fla.list_15)
package player_fla {
import flash.display.*;
public dynamic class list_15 extends MovieClip {
public var button:MovieClip;
}
}//package player_fla
Section 51
//muteButton_35 (player_fla.muteButton_35)
package player_fla {
import flash.display.*;
public dynamic class muteButton_35 extends MovieClip {
public var icon:MovieClip;
}
}//package player_fla
Section 52
//nextButton_45 (player_fla.nextButton_45)
package player_fla {
import flash.display.*;
public dynamic class nextButton_45 extends MovieClip {
public var icon:MovieClip;
}
}//package player_fla
Section 53
//normalscreenButton_51 (player_fla.normalscreenButton_51)
package player_fla {
import flash.display.*;
public dynamic class normalscreenButton_51 extends MovieClip {
public var icon:MovieClip;
}
}//package player_fla
Section 54
//pauseButton_47 (player_fla.pauseButton_47)
package player_fla {
import flash.display.*;
public dynamic class pauseButton_47 extends MovieClip {
public var icon:MovieClip;
}
}//package player_fla
Section 55
//playButton_49 (player_fla.playButton_49)
package player_fla {
import flash.display.*;
public dynamic class playButton_49 extends MovieClip {
public var icon:MovieClip;
}
}//package player_fla
Section 56
//player_1 (player_fla.player_1)
package player_fla {
import flash.display.*;
import flash.accessibility.*;
public dynamic class player_1 extends MovieClip {
public var controlbar:MovieClip;
public var captions:MovieClip;
public var display:MovieClip;
public var playlist:MovieClip;
public function player_1(){
addFrameScript(0, frame1);
}
function frame1(){
playlist.accessibilityProperties = new AccessibilityProperties();
playlist.accessibilityProperties.silent = true;
display.accessibilityProperties = new AccessibilityProperties();
display.accessibilityProperties.silent = true;
}
}
}//package player_fla
Section 57
//playlist_13 (player_fla.playlist_13)
package player_fla {
import flash.display.*;
public dynamic class playlist_13 extends MovieClip {
public var masker:MovieClip;
public var list:MovieClip;
public var slider:MovieClip;
public var back:MovieClip;
}
}//package player_fla
Section 58
//prevButton_55 (player_fla.prevButton_55)
package player_fla {
import flash.display.*;
public dynamic class prevButton_55 extends MovieClip {
public var icon:MovieClip;
}
}//package player_fla
Section 59
//slider_20 (player_fla.slider_20)
package player_fla {
import flash.display.*;
public dynamic class slider_20 extends MovieClip {
public var icon:MovieClip;
public var rail:MovieClip;
public var back:MovieClip;
}
}//package player_fla
Section 60
//stopButton_53 (player_fla.stopButton_53)
package player_fla {
import flash.display.*;
public dynamic class stopButton_53 extends MovieClip {
public var icon:MovieClip;
}
}//package player_fla
Section 61
//timeSlider_41 (player_fla.timeSlider_41)
package player_fla {
import flash.display.*;
import flash.accessibility.*;
public dynamic class timeSlider_41 extends MovieClip {
public var icon:MovieClip;
public var rail:MovieClip;
public var mark:MovieClip;
public function timeSlider_41(){
addFrameScript(0, frame1);
}
function frame1(){
icon.accessibilityProperties = new AccessibilityProperties();
icon.accessibilityProperties.silent = true;
mark.accessibilityProperties = new AccessibilityProperties();
mark.accessibilityProperties.silent = true;
}
}
}//package player_fla
Section 62
//unmuteButton_33 (player_fla.unmuteButton_33)
package player_fla {
import flash.display.*;
public dynamic class unmuteButton_33 extends MovieClip {
public var icon:MovieClip;
}
}//package player_fla
Section 63
//volumeIcon_32 (player_fla.volumeIcon_32)
package player_fla {
import flash.display.*;
public dynamic class volumeIcon_32 extends MovieClip {
public function volumeIcon_32(){
addFrameScript(1, frame2, 3, frame4);
}
function frame4(){
stop();
}
function frame2(){
stop();
}
}
}//package player_fla
Section 64
//volumeSlider_29 (player_fla.volumeSlider_29)
package player_fla {
import flash.display.*;
public dynamic class volumeSlider_29 extends MovieClip {
public var icon:MovieClip;
public var rail:MovieClip;
public var mark:MovieClip;
}
}//package player_fla