Frame 1
movie = player.movie;
movie.base_url = "/";
movie.tracker_cls = logic.PlayerTracker;
movie.setMovie(video_id, iurl, undefined, l, t);
if (_root.infringe) {
movie.setInfringeMute();
movie.Mute();
}
if (!iurl) {
movie.playMovie();
}
Stage.scaleMode = "noScale";
Stage.addListener(this);
onResize = function () {
trace(((((((" sw:" + Stage.width) + " sh:") + Stage.height) + " rw:") + _root._width) + " rh:") + _root._height);
player.resize(Stage.width, Stage.height);
trace((("px:" + player._x) + " py:") + player._y);
};
movie.onEndMovie = function () {
if (_root.playnext) {
getURL ("javascript:gotoNext()");
delete _root.playnext;
return(true);
}
};
var show_fs = _root.fs;
player.controller.showFSButtons(show_fs);
max = player.controller.max;
min = player.controller.min;
if (show_fs || (_root.rs)) {
onEnterFrame = function () {
onResize();
delete this.onEnterFrame;
};
}
min.onRelease = function () {
if (Stage.displayState != undefined) {
if (Stage.displayState == "fullScreen") {
Stage.displayState = "normal";
} else {
Stage.displayState = "fullScreen";
}
} else {
getURL ("javascript:closeFull()");
}
};
max.onRelease = function () {
if (Stage.displayState != undefined) {
if (Stage.displayState == "fullScreen") {
Stage.displayState = "normal";
} else {
Stage.displayState = "fullScreen";
}
} else {
getURL ("javascript:openFull()");
movie.stopAll();
}
};
if (_root.sn) {
movie.supress_next = true;
}
Symbol 4 MovieClip [spinner] Frame 22
stop();
Symbol 16 MovieClip [SoundController] Frame 1
#initclip 27
Object.registerClass("SoundController", logic.SoundController);
#endinitclip
Symbol 66 MovieClip Frame 1
stop();
normal = function () {
gotoAndStop (1);
};
highLight = function () {
gotoAndStop (2);
};
Symbol 83 MovieClip [ControlBlock] Frame 1
#initclip 20
Object.registerClass("ControlBlock", logic.MovieController);
#endinitclip
sound_control.movie = movie;
fullBar = full_progress_bar.fullBar;
seekBar = full_progress_bar.seekBar;
progressBar = full_progress_bar.progressBar;
seek_time = timer.seek_time;
seek_total_time = timer.seek_total_time;
trace("controller movie is:" + movie);
Symbol 92 MovieClip Frame 1
setStars = function (v) {
this.value = v;
bg._xscale = (v * 100) / 5;
};
Symbol 94 MovieClip [overlay_screen] Frame 1
#initclip 21
Object.registerClass("overlay_screen", logic.Overlay);
#endinitclip
Symbol 102 MovieClip [NextVideoPanel] Frame 1
#initclip 22
Object.registerClass("NextVideoPanel", logic.NextVideoPanel);
#endinitclip
Symbol 106 MovieClip [progressCircle] Frame 1
#initclip 23
Object.registerClass("progressCircle", logic.progressCircle);
#endinitclip
Symbol 130 MovieClip [endScreen] Frame 1
#initclip 24
Object.registerClass("endScreen", logic.EndScreen);
#endinitclip
Symbol 138 MovieClip [OverLay] Frame 1
#initclip 25
Object.registerClass("OverLay", logic.Overlay);
#endinitclip
Symbol 140 MovieClip [fullDisplay] Frame 1
#initclip 26
Object.registerClass("fullDisplay", logic.Movie);
#endinitclip
Symbol 141 MovieClip Frame 1
controller.registerMovie(movie);
movie.useHandCursor = false;
resize = function (w, h) {
controller._y = (h / 2) - controller._height;
trace("height of the controller is:" + controller._y);
controller.resize_width(w);
movie.resize(w, h - controller._height);
trace(((((" moive_width:" + movie._width) + " w:") + w) + " mx:") + movie._x);
};
Symbol 142 MovieClip [__Packages.logic.PlayerTracker] Frame 0
class logic.PlayerTracker
{
var movie, track_point, track_tk, google_tracker;
function PlayerTracker (_m) {
movie = _m;
track_point = 0;
track_tk = _root.tk;
google_tracker = new logic.VideoStats("http://video.google.com/s", "yt", _root.sourceid, _root.sdetail, _root.q, _root.sk);
var o = _m;
google_tracker.getMediaTime = function () {
return(o.getTime());
};
google_tracker.getMediaDuration = function () {
return(o.getTotalTime());
};
google_tracker.getBytesDownloaded = function () {
var _local1 = o.ns.bytesLoaded;
if (isNaN(_local1)) {
return(0);
}
return(_local1);
};
}
function doSetTrack(time, percentage) {
}
function doTrack(time, percentage) {
if (movie.getTotalTime() && (!google_tracker.__get__playbackStarted())) {
trace("STARTING PLAYBACK TRACKER");
google_tracker.startPlayback(movie.video_id, _root.sw);
}
if ((isNaN(percentage) || (!track_tk)) || (!movie.isPlaying())) {
return(undefined);
}
if ((track_point < 1) && (time >= 0)) {
trace((((((("point1:" + track_point) + " time:") + time) + " percentage:") + percentage) + "type(p):") + typeof(percentage));
sendTrack(time, percentage);
track_point = 1;
} else if ((track_point < 2) && (time >= 20)) {
trace((("point2:" + track_point) + " time:") + time);
sendTrack(time, percentage);
track_point = 2;
} else if ((track_point < 3) && (time >= 30)) {
trace((("point2:" + track_point) + " time:") + time);
sendTrack(time, percentage);
track_point = 3;
} else if ((track_point < 4) && (percentage >= 0.9)) {
trace((("point3:" + track_point) + " percentage:") + percentage);
sendTrack(time, percentage);
track_point = 4;
}
}
function doEndMovieTrack() {
trace("end the fucking movie tracking");
google_tracker.sendReport();
}
function endTrack() {
google_tracker.endPlayback();
}
function sendTrack(time, percentage) {
var _local2 = new logic.urlRestXML(movie.base_url);
_local2.dispatch(this, undefined, undefined, "tracker", {w:1, tp:Math.floor(time), p:Math.floor(percentage), i:track_tk});
}
}
Symbol 143 MovieClip [__Packages.logic.VideoStats] Frame 0
class logic.VideoStats
{
var urlBase_, namespace_, visitorId_, sourceId_, sourceDetail_, query_, playbackStarted_, startTimes_, endTimes_, sendSegments_, eventReporter_, startDownloadTime_, startBytes_, getBytesDownloaded, endDownloadTime_, lastBytes_, numSegments_, numSegmentsSent_, startTime_, lastMediaTime_, getMediaTime, lastRealTime_, segmentStart_, sendInterval_, sentInitialPing_, sentFullPlayPing_, mediaInterval_, count_, nextCount_, getMediaDuration;
function VideoStats (urlBase, namespace, sourceId, sourceDetail, query, visitorId) {
urlBase_ = urlBase;
namespace_ = namespace;
visitorId_ = visitorId;
sourceId_ = sourceId;
sourceDetail_ = sourceDetail;
query_ = query;
playbackStarted_ = false;
startTimes_ = new Array();
endTimes_ = new Array();
sendSegments_ = false;
}
function startPlayback(docid, sw) {
if (playbackStarted_) {
endPlayback();
}
playbackStarted_ = true;
eventReporter_ = new logic.EventReporter(urlBase_);
if ((namespace_ != undefined) && (namespace_ != "")) {
eventReporter_.addGlobalParameters({ns:namespace_});
}
if ((sourceId_ != undefined) && (sourceId_ != "")) {
eventReporter_.addGlobalParameters({sourceid:escape(sourceId_)});
}
if ((sourceDetail_ != undefined) && (sourceDetail_ != "")) {
eventReporter_.addGlobalParameters({sdetail:escape(sourceDetail_)});
}
if ((query_ != undefined) && (query_ != "")) {
eventReporter_.addGlobalParameters({q:escape(query_)});
}
if ((visitorId_ != undefined) && (visitorId_ != "")) {
eventReporter_.addGlobalParameters({vid:visitorId_});
}
eventReporter_.addGlobalParameters({docid:docid});
if (sw != undefined) {
eventReporter_.addGlobalParameters({sw:sw});
sendSegments_ = true;
}
startDownloadTime_ = getTimer();
startBytes_ = getBytesDownloaded();
endDownloadTime_ = startDownloadTime_;
lastBytes_ = startBytes_;
numSegments_ = 0;
numSegmentsSent_ = 0;
startTime_ = startDownloadTime_;
lastMediaTime_ = getMediaTime();
lastRealTime_ = startTime_;
segmentStart_ = lastMediaTime_;
sendInterval_ = null;
sentInitialPing_ = false;
sentFullPlayPing_ = false;
mediaInterval_ = setInterval(this, "mediaUpdate", 100);
}
function endPlayback() {
if (playbackStarted_) {
playbackStarted_ = false;
if (mediaInterval_ != null) {
clearInterval(mediaInterval_);
}
if (sendInterval_ != null) {
clearInterval(sendInterval_);
}
sendSegments();
delete eventReporter_;
}
}
function get playbackStarted() {
return(playbackStarted_);
}
function sendReport(forced) {
addSegment();
sendSegments(forced);
}
function onInterval() {
count_--;
if (count_ == 0) {
count_ = nextCount_;
if (nextCount_ < 4) {
nextCount_ = nextCount_ * 2;
}
sendReport();
}
}
function mediaUpdate() {
var _local4 = getBytesDownloaded();
var _local2 = getMediaTime();
var _local3 = getTimer();
var _local7 = getMediaDuration();
if ((!sentInitialPing_) && (_local2 > 0)) {
sentInitialPing_ = true;
eventReporter_.send({st:_local2, et:_local2, len:_local7, rt:(_local3 - startTime_) / 1000, fv:escape(System.capabilities.version)});
count_ = 1;
nextCount_ = 2;
sendInterval_ = setInterval(this, "onInterval", 10000);
}
if ((startBytes_ == 0) || (_local4 < lastBytes_)) {
startDownloadTime_ = _local3;
endDownloadTime_ = _local3;
startBytes_ = _local4;
} else {
var _local8 = _local4 - lastBytes_;
if (_local8 > 0) {
endDownloadTime_ = _local3;
}
}
lastBytes_ = _local4;
var _local5 = _local2 - lastMediaTime_;
if (_local5 != 0) {
var _local6 = _local3 - lastRealTime_;
if ((_local5 < 0) || (_local5 > (_local6 + 200))) {
addSegment();
segmentStart_ = _local2;
}
lastRealTime_ = _local3;
}
lastMediaTime_ = _local2;
}
function addSegment() {
if (numSegmentsSent_ > MAX_REQ) {
return(undefined);
}
if ((lastMediaTime_ - segmentStart_) > 3) {
startTimes_[numSegments_] = segmentStart_;
endTimes_[numSegments_] = lastMediaTime_;
numSegments_++;
segmentStart_ = lastMediaTime_;
}
}
function sendSegments(forced) {
var _local5 = getTimer() - startTime_;
if ((numSegments_ > 0) || (forced)) {
var _local4 = String(startTimes_[0]);
var _local3 = String(endTimes_[0]);
var _local2 = 1;
while (_local2 < numSegments_) {
_local4 = _local4 + ("," + String(startTimes_[_local2]));
_local3 = _local3 + ("," + String(endTimes_[_local2]));
_local2++;
}
if (sendSegments_ || (forced)) {
eventReporter_.send({st:_local4, et:_local3, len:getMediaDuration(), rt:_local5 / 1000, bc:lastBytes_, bd:lastBytes_ - startBytes_, bt:(endDownloadTime_ - startDownloadTime_) / 1000});
}
startBytes_ = getBytesDownloaded();
startDownloadTime_ = getTimer();
endDownloadTime_ = startDownloadTime_;
numSegmentsSent_++;
numSegments_ = 0;
}
}
var MAX_REQ = 400;
}
Symbol 144 MovieClip [__Packages.logic.UrlConstructor] Frame 0
class logic.UrlConstructor
{
var baseUrl_, hasParameter_;
function UrlConstructor (baseUrl) {
baseUrl_ = baseUrl;
hasParameter_ = true;
if (baseUrl_.indexOf("?") < 0) {
hasParameter_ = false;
baseUrl_ = baseUrl_ + "?";
}
}
function addGlobalParameters(args) {
baseUrl_ = makeUrl(args);
hasParameter_ = true;
}
function get url() {
return(baseUrl_);
}
function makeUrl(args) {
var _local2 = baseUrl_;
var _local3 = hasParameter_;
for (var _local5 in args) {
if (_local3) {
_local2 = _local2 + "&";
}
_local2 = _local2 + ((_local5 + "=") + args[_local5]);
_local3 = true;
}
return(_local2);
}
}
Symbol 145 MovieClip [__Packages.logic.EventReporter] Frame 0
class logic.EventReporter extends logic.UrlConstructor
{
var makeUrl;
function EventReporter (baseUrl) {
super(baseUrl);
}
function send(args) {
var _local2 = makeUrl(args);
sendUrl(_local2);
}
function sendUrl(url) {
trace("reporting event to this " + url);
var _local2 = new MovieClipLoader();
var _local3 = _root.createEmptyMovieClip("junkClip", 999999);
_local2.loadClip(url, _local3);
}
}
Symbol 146 MovieClip [__Packages.logic.restXML] Frame 0
class logic.restXML
{
var request_url;
function restXML (_req_url) {
request_url = _req_url;
trace("initializing:" + _req_url);
}
function get_call_string(method) {
return(call_location + escape(method));
}
function dispatch(o, cb, cb_error, method, params) {
var _local7 = new XML();
var _local8 = new XML();
_local8.ignoreWhite = false;
_local7.ignoreWhite = true;
if (_root.auth_code != undefined) {
trace("auth code:" + _root.auth_code);
_local8.addRequestHeader("Authorization", _root.auth_code);
}
var _local3 = get_call_string(method);
for (var _local5 in params) {
if (_local3.indexOf("?") == -1) {
_local3 = _local3 + "?";
} else {
_local3 = _local3 + "&";
}
_local3 = _local3 + (_local5 + "=");
_local3 = _local3 + escape(params[_local5]);
}
var _local9 = request_url + _local3;
trace("request_url" + request_url);
var pr = this;
_local7.onLoad = function (success) {
if (success) {
var _local2 = pr.process(this);
if (_local2.error) {
cb_error.call(o, _local2.data);
} else {
cb.call(o, _local2.data);
}
} else {
cb_error.call(o);
}
};
trace("sending request to:" + _local9);
_local8.sendAndLoad(_local9, _local7);
}
function process(xml_rsp) {
var _local1 = {};
var _local2 = get_sub_node("ut_response", xml_rsp);
if (_local2.attributes.status == "ok") {
_local1.data = get_dict(_local2);
} else if (_local2.attributes.status == "fail") {
var _local3 = get_dict(_local2);
_local1.data = get_dict(_local3.error);
_local1.error = true;
} else {
_local1.error = true;
}
return(_local1);
}
static function get_dict(node) {
if (!node) {
return(undefined);
}
var _local4 = new Object();
var _local2 = 0;
while (_local2 < node.childNodes.length) {
var _local1 = node.childNodes[_local2];
if (_local1.nodeType == 1) {
var _local3 = _local1.childNodes[0];
if (_local3.nodeType == 3) {
_local4[_local1.nodeName] = strip_white_space(_local3.nodeValue);
} else {
_local4[_local1.nodeName] = _local1;
}
}
_local2++;
}
return(_local4);
}
static function get_sub_array(name, node) {
if (!node) {
return(undefined);
}
var _local4 = [];
var _local1 = 0;
while (_local1 < node.childNodes.length) {
var _local2 = node.childNodes[_local1];
if (_local2.nodeName == name) {
_local4.push(_local2);
}
_local1++;
}
return(_local4);
}
static function get_sub_node(name, node) {
var _local2 = node.childNodes;
for (var _local4 in _local2) {
var _local1 = _local2[_local4];
if ((_local1.nodeType == 1) and (_local1.nodeName == name)) {
return(_local1);
}
}
}
static function get_sub_text(name, node) {
var _local1 = get_sub_node(name, node);
var _local2 = _local1.childNodes;
for (var _local3 in _local2) {
_local1 = _local2[_local3];
if (_local1.nodeType == 3) {
return(strip_white_space(_local1.nodeValue));
}
}
}
static function add_text_node(name, value, node) {
var _local2 = new XML();
var _local1 = _local2.createElement(name);
_local1.appendChild(_local2.createTextNode(value));
node.appendChild(_local1);
}
static function is_whitespace(c) {
return(((c == " ") || (c == newline)) || (c == "\t"));
}
static function strip_white_space(buffer) {
var _local4 = 0;
var _local3 = buffer.length - 1;
var _local1 = 0;
while (_local1 < buffer.length) {
if ((_local4 == _local1) && (is_whitespace(buffer.charAt(_local4)))) {
_local4++;
}
if ((_local3 == (buffer.length - (_local1 + 1))) && (is_whitespace(buffer.charAt(_local3)))) {
_local3--;
}
if ((_local4 == (_local1 + 1)) || (_local3 == (buffer.length - (_local1 + 2)))) {
} else {
break;
}
_local1++;
}
return(buffer.slice(_local4, _local3 + 1));
}
var call_location = "api2_rest?method=";
}
Symbol 147 MovieClip [__Packages.logic.urlRestXML] Frame 0
class logic.urlRestXML extends logic.restXML
{
function urlRestXML (r) {
super(r);
}
function get_call_string(method) {
return(method);
}
}
Symbol 148 MovieClip [__Packages.logic.MovieController] Frame 0
class logic.MovieController extends MovieClip
{
var pause_button, play_button, stop_button, slider, full_progress_bar, getBounds, left_justified_elements, ldiv, right_justified_elements, timer, mrdiv, sound_control, rdiv, regular, small, min, max, movie, right_bg, left_bg, main_bg, seek_time, seek_total_time, fullBar, seekBar, progressBar;
function MovieController () {
super();
pause_button._visible = false;
var o = this;
play_button.onRelease = function () {
o.movie.playMovie();
};
pause_button.onRelease = function () {
o.movie.pauseMovie();
};
stop_button.onRelease = function () {
o.movie.stopMovie();
};
var _local6 = function () {
o.slider_down = true;
o.slider.highLight();
this.onEnterFrame = function () {
var _local1 = o._xmouse;
if (_local1 < o.full_progress_bar._x) {
_local1 = o.full_progress_bar._x;
} else if (_local1 > (o.full_progress_bar._x + o.full_progress_bar._width)) {
_local1 = o.full_progress_bar._x + o.full_progress_bar._width;
}
o.slider._x = _local1;
o.movie.peekSeekRatio(o.getScale());
};
};
var _local7 = function () {
o.slider.normal();
o.movie.setSeekRatio(o.getScale());
o.slider_down = false;
delete this.onEnterFrame;
};
full_progress_bar.onPress = (slider.onPress = _local6);
full_progress_bar.onRelease = (full_progress_bar.onReleaseOutside = (slider.onRelease = (slider.onReleaseOutside = _local7)));
var _local3 = getBounds(this);
left_justified_elements = [play_button, pause_button, stop_button, ldiv, full_progress_bar];
for (var _local5 in left_justified_elements) {
left_justified_elements[_local5]._xstart = _local3.xMin - left_justified_elements[_local5]._x;
}
right_justified_elements = [timer, mrdiv, sound_control, rdiv, regular, small, min, max];
for (var _local5 in right_justified_elements) {
right_justified_elements[_local5]._xstart = _local3.xMax - right_justified_elements[_local5]._x;
}
trace((("regular:" + regular) + " smal._xstart:") + regular._xstart);
full_progress_bar._xend = _local3.xMax - (full_progress_bar._width + full_progress_bar._x);
}
function registerMovie(m) {
trace("registering controller to:" + m);
movie = m;
sound_control.registerMovie(m);
var o = this;
m.onPauseMovie = function () {
trace("showing the goddamn play button");
o.showPlay();
};
var old_play_handler = m.onPlayMovie;
m.onPlayMovie = function () {
o.showPause();
old_play_handler.call(this);
};
m.onSeek = function (ir, r) {
o.showSeek(ir, r);
};
m.onProgress = function (ir, r) {
o.showProgress(ir, r);
};
}
function getScale() {
var _local2 = (slider._x - full_progress_bar._x) / full_progress_bar._width;
if (_local2 < 0) {
return(0);
}
return(_local2);
}
function resize_width(w) {
var _local6 = Stage.displayState;
if (_local6 == "fullScreen") {
showFSButtons(true);
} else if (_local6 == "normal") {
showFSButtons(false);
}
main_bg._width = w - (left_bg._width + right_bg._width);
left_bg._x = -1 * (w / 2);
right_bg._x = w / 2;
for (var _local2 in left_justified_elements) {
left_justified_elements[_local2]._x = (-1 * (w / 2)) - left_justified_elements[_local2]._xstart;
}
var _local5 = full_progress_bar._x + MIN_PROGRESS_BAR_SIZE;
var _local3;
var _local2 = 0;
while (_local2 < right_justified_elements.length) {
right_justified_elements[_local2]._x = (w / 2) - right_justified_elements[_local2]._xstart;
if (right_justified_elements[_local2]._x < rdiv._x) {
if ((right_justified_elements[_local2]._x - 10) < _local5) {
right_justified_elements[_local2]._visible = false;
} else {
makeVisible(right_justified_elements[_local2]);
if (isNaN(_local3)) {
_local3 = right_justified_elements[_local2]._x;
}
}
} else {
makeVisible(right_justified_elements[_local2]);
if (isNaN(_local3)) {
_local3 = right_justified_elements[_local2]._x;
}
}
_local2++;
}
full_progress_bar._width = (_local3 - full_progress_bar._x) - 10;
}
function showPlay() {
play_button._visible = true;
pause_button._visible = false;
}
function showPause() {
play_button._visible = false;
pause_button._visible = true;
}
function format_minute_time(t) {
if (t == undefined) {
return("0:00");
}
var _local1 = String(Math.floor(t % 60));
if (_local1.length == 1) {
_local1 = "0" + _local1;
}
var _local2 = String(Math.floor(t / 60));
if (_local2.length == 1) {
_local2 = "0" + _local2;
}
return((_local2 + ":") + _local1);
}
function showSeek(ir, r) {
if (isNaN(r)) {
r = 0;
}
seek_time.text = format_minute_time(movie.getCurrentTime());
seek_total_time.text = format_minute_time(movie.getTotalTime());
seekBar._x = ir * fullBar._width;
seekBar._width = (r - ir) * fullBar._width;
if (!slider_down) {
slider._x = (r * full_progress_bar._width) + full_progress_bar._x;
}
}
function showProgress(ir, r) {
progressBar._x = ir * fullBar._width;
if (r) {
progressBar._width = (r - ir) * fullBar._width;
} else {
progressBar._width = 0;
}
}
function showFSButtons(_show) {
var o = this;
if (_show) {
permShow(min);
permHide(max);
permHide(regular);
permHide(small);
} else {
permHide(min);
permShow(max);
permHide(regular);
permShow(small);
regular.onPress = function () {
trace("to: regular");
o.movie.resizeNormal();
o.permHide(o.regular);
o.permShow(o.small);
};
small.onRelease = function () {
trace("to: original");
o.movie.resizeOriginal();
o.permShow(o.regular);
o.permHide(o.small);
};
}
}
function permShow(clip) {
clip._visible = true;
clip._perm_visible = true;
}
function permHide(clip) {
clip._visible = false;
clip._perm_visible = false;
}
function makeVisible(clip) {
if (clip._perm_visible != undefined) {
clip._visible = clip._perm_visible;
} else {
clip._visible = true;
}
}
var slider_down = false;
static var MIN_PROGRESS_BAR_SIZE = 100;
}
Symbol 149 MovieClip [__Packages.logic.Overlay] Frame 0
class logic.Overlay extends MovieClip
{
var loading, _width, play_button, loading_mc, attachMovie, getNextHighestDepth, _alpha, bg, img, getURL, _parent, onRelease, createEmptyMovieClip;
function Overlay () {
super();
loading._visible = false;
loading._woffset = _width - loading._width;
play_button._visible = false;
}
function show_message(msg) {
loading.text = msg;
loading_mc.removeMovieClip();
}
function show_loading() {
loading_mc = attachMovie("spinner", "loading_mc", getNextHighestDepth());
loading_mc._xscale = 150;
loading_mc._yscale = 150;
loading._visible = true;
play_button._visible = false;
}
function hide() {
loading_mc.removeMovieClip();
loading._visible = false;
_alpha = 0;
}
function show() {
loading._visible = false;
_alpha = 100;
}
function resize(w, h) {
bg._width = w;
bg._height = h;
loading._width = w - loading._woffset;
if (loading._xscale > 100) {
loading._xscale = 100;
}
loading._yscale = loading._xscale;
loading._x = (-1 * loading._width) / 2;
fit_img();
}
function fit_img() {
if (img._loaded) {
img._width = bg._width;
img._height = bg._height;
img._x = (-1 * bg._width) / 2;
img._y = (-1 * bg._height) / 2;
trace((((((("fiting image to:" + bg._width) + ":") + bg._height) + " actual:") + img._width) + ":") + img._height);
}
}
function gotoURL() {
(getURL(_parent.movie_url, "_blank"));// not popped
}
function makePressable() {
onRelease = gotoURL;
}
function makePlayPressable() {
onRelease = function () {
(this.getURL(this._parent.movie_url, "_self"));// not popped
};
}
function makePlayMoviePressable() {
play_button._visible = true;
onRelease = function () {
this.play_button._visible = false;
this._parent.playMovie();
delete this.onRelease;
};
}
function loadClip(still_url) {
var _local2 = new Object();
var o = this;
if ((!still_url) || (!logic.Util.inYTDomain(still_url))) {
return(undefined);
}
_local2.onLoadInit = function (target_mc) {
target_mc._loaded = true;
o.fit_img();
trace("we loaded the image");
};
var _local3 = new MovieClipLoader();
_local3.addListener(_local2);
createEmptyMovieClip("img", loading.getDepth() - 1);
_local3.loadClip(still_url, img);
}
}
Symbol 150 MovieClip [__Packages.logic.Util] Frame 0
class logic.Util
{
function Util () {
}
static function alert(msg) {
getURL (("javascript:alert('" + escape(msg)) + "');");
}
static function createOverlay(clip, suffix) {
var _local2 = clip._parent[(clip._name + "_") + suffix];
if (!_local2) {
_local2 = clip._parent.createEmptyMovieClip((clip._name + "_") + suffix, clip._parent.getNextHighestDepth());
}
return(_local2);
}
static function calc_accl(x1, x2, t, v0) {
return(((x2 - x1) - (v0 * t)) / (t * t));
}
static function calc_dist(x1, t, a, v0) {
return((((a * t) * t) + (v0 * t)) + x1);
}
static function tween_to(clip, x, y, w, h, frames, notifier) {
var _local2 = createOverlay(clip, "tweener");
_local2.ax = calc_accl(clip._x, x, frames, 0);
_local2.ay = calc_accl(clip._y, y, frames, 0);
_local2.aw = calc_accl(clip._width, w, frames, 0);
_local2.ah = calc_accl(clip._height, h, frames, 0);
_local2.ox = clip._x;
_local2.oy = clip._y;
_local2.dx = x;
_local2.dy = y;
_local2.ow = clip._width;
_local2.oh = clip._height;
_local2.dw = w;
_local2.dh = h;
_local2.clip = clip;
_local2.frame_count = 0;
_local2.max_frames = frames;
_local2.notifier = notifier;
_local2.onEnterFrame = function () {
this.frame_count++;
if (this.frame_count < this.max_frames) {
clip._x = logic.Util.calc_dist(this.ox, this.frame_count, this.ax, 0);
clip._y = logic.Util.calc_dist(this.oy, this.frame_count, this.ay, 0);
var _local3 = logic.Util.calc_dist(this.ow, this.frame_count, this.aw, 0);
var _local2 = logic.Util.calc_dist(this.oh, this.frame_count, this.ah, 0);
if (clip.resize) {
clip.resize(_local3, _local2);
} else {
clip._width = _local3;
clip._height = _local2;
}
} else {
clip._x = this.dx;
clip._y = this.dy;
if (clip.resize) {
clip.resize(this.dw, this.dh);
} else {
clip._width = this.dw;
clip._height = this.dh;
}
delete this.onEnterFrame;
if (this.notifier) {
this.notifier.onTweenComplete();
}
}
};
}
static function fade_in(_c, frames) {
var clip = _c;
var _local2 = createOverlay(clip, "fader");
clip._visible = true;
var increment = ((100 - clip._alpha) / frames);
_local2.onEnterFrame = function () {
clip._alpha = clip._alpha + increment;
if (clip._alpha >= 100) {
clip._alpha = 100;
delete this.onEnterFrame;
}
};
}
static function fade_out(_c, frames) {
var clip = _c;
var _local2 = createOverlay(clip, "fader");
var decrement = (clip._alpha / frames);
_local2.onEnterFrame = function () {
clip._alpha = clip._alpha - decrement;
if (clip._alpha <= 0) {
clip._alpha = 0;
clip._visible = false;
delete this.onEnterFrame;
}
};
}
static function createClickableOverlay(field) {
var _local1 = createOverlay(field, "overlay");
_local1._x = field._x;
_local1._y = field._y;
var _local3 = field._width;
var _local4 = field._height;
if (field.textWidth && (field.textWidth < field._width)) {
_local3 = field.textWidth;
}
_local1.clear();
_local1.beginFill(0, 0);
_local1.moveTo(0, 0);
_local1.lineTo(_local3, 0);
_local1.lineTo(_local3, _local4);
_local1.lineTo(0, _local4);
_local1.lineTo(0, 0);
_local1.endFill();
return(_local1);
}
static function getDist(x1, y1, x2, y2) {
return(Math.sqrt(((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1))));
}
static function call_js(func) {
var _local4 = "";
var _local2 = 1;
while (_local2 < arguments.length) {
var _local3 = ("'" + escape(arguments[_local2])) + "'";
if (_local4.length) {
_local4 = _local4 + ("," + _local3);
} else {
_local4 = _local4 + _local3;
}
_local2++;
}
getURL (((("javascript:" + func) + "(") + _local4) + ");");
}
static function popUpWin(url, winName, w, h, toolbar, location, directories, status, menubar, scrollbars, resizable) {
getURL ((((((((((((((((((((((((((((((((("javascript:var " + winName) + ";if (!") + winName) + "||") + winName) + ".closed){") + winName) + "=window.open('") + url) + "', '") + winName) + "', '") + "width=") + w) + ", height=") + h) + ", toolbar=") + toolbar) + ", location=") + location) + ", directories=") + directories) + ", status=") + status) + ", menubar=") + menubar) + ", scrollbars=") + scrollbars) + ", resizable=") + resizable) + "')}else{") + winName) + ".focus();};void(0);");
}
static function format_minute_time(t) {
if (t == undefined) {
return("0:00");
}
var _local1 = String(Math.floor(t % 60));
if (_local1.length == 1) {
_local1 = "0" + _local1;
}
var _local2 = String(Math.floor(t / 60));
if (_local2.length == 1) {
_local2 = "0" + _local2;
}
return((_local2 + ":") + _local1);
}
static function popUpShare(base_url, video_id) {
getURL (((base_url + "share?v=") + video_id) + "&embed=1", "_blank");
}
static function popUpSharePlayList(base_url, pl_id) {
getURL (((base_url + "share?p=") + pl_id) + "&embed=1", "_blank");
}
static function inYTDomain(url) {
if (url.indexOf("http://") == 0) {
var _local1 = url.split("/", 3)[2];
if ((_local1.indexOf("%") > -1) || (_local1.indexOf("#") > -1)) {
return(false);
}
if (_local1.substring(_local1.length - 12, _local1.length).toLowerCase() == ".youtube.com") {
return(true);
}
if (_local1.substring(_local1.length - 17, _local1.length).toLowerCase() == ".youtube.com:8000") {
return(true);
}
if (_local1.substring(_local1.length - 22, _local1.length).toLowerCase() == ".googlesyndication.com") {
return(true);
}
}
return(false);
}
static function loadImgClip(clip, img_url, notifier, _b) {
var _local1 = new Object();
var b = _b;
if (!b) {
b = clip.getBounds(clip._parent);
}
var n = notifier;
var _local3 = function (target_mc, error) {
target_mc._x = b.xMin;
target_mc._y = b.yMin;
target_mc._width = b.xMax - b.xMin;
target_mc._height = b.yMax - b.yMin;
if (n) {
n.onClipLoaded(target_mc, error);
}
};
_local1.onLoadInit = _local3;
_local1.onLoadError = _local3;
var _local2 = new MovieClipLoader();
_local2.addListener(_local1);
_local2.loadClip(img_url, clip);
}
static function loadSafeImgClipAndFade(clip, img_url, notifier, _b) {
var _local3 = new Object();
var b = _b;
if (!b) {
b = clip.getBounds(clip._parent);
}
var n = notifier;
var _local5 = function (target_mc, error) {
target_mc._x = b.xMin;
target_mc._y = b.yMin;
target_mc._width = b.xMax - b.xMin;
target_mc._height = b.yMax - b.yMin;
target_mc._iurl = this.img_url;
if (n) {
n.onClipLoaded(target_mc, error);
}
target_mc._visible = true;
target_mc._alpha = 0;
target_mc.onEnterFrame = function () {
target_mc._alpha = target_mc._alpha + 20;
if (target_mc._alpha >= 100) {
delete this.onEnterFrame;
target_mc._alpha = 100;
}
};
trace((((((((((("clip:" + target_mc) + " x:") + target_mc._x) + " y:") + target_mc._y) + " width:") + target_mc._width) + " height:") + target_mc._height) + " target height:") + (b.yMax - b.yMin));
};
_local3.onLoadInit = _local5;
_local3.onLoadError = _local5;
_local3.img_url = img_url;
trace((((("clip :" + clip) + " _url:") + clip._iurl) + " img_url:") + img_url);
if (clip._iurl) {
if (clip._iurl == img_url) {
clip._visible = true;
return(undefined);
}
clip = clip._parent.createEmptyMovieClip(clip._name, clip.getDepth());
}
clip._iurl = img_url;
var _local4 = new MovieClipLoader();
_local4.addListener(_local3);
_local4.loadClip(img_url, clip);
}
}
Symbol 151 MovieClip [__Packages.logic.NextVideoPanel] Frame 0
class logic.NextVideoPanel extends MovieClip
{
var _visible, clip1, clip2, load_next, active_clip, bg, clip_bounds, server, _parent, data, clip_index, swap_clip, clip3, animate_interval_id, title_field, run_time, view_count, author, stars, loaded, paused, _alpha, getURL, clip_interval_id;
function NextVideoPanel () {
super();
_visible = false;
clip1._visible = false;
clip2._visible = false;
load_next = undefined;
active_clip = clip1;
bg._alpha = 30;
clip_bounds = clip1.getBounds(clip1._parent);
server = _parent;
}
function load(next_data) {
load_next = next_data;
}
function load_data(d) {
data = d;
if (data == undefined) {
_visible = false;
return(undefined);
}
clip_index = 1;
active_clip = (swap_clip = clip2);
logic.Util.loadImgClip(clip2, data.thumbnail_url2, this, clip_bounds);
clip1._visible = false;
clip2._visible = false;
clip3._visible = false;
clip1.loaded = false;
clip2.loaded = false;
clip3.loaded = false;
clearInterval(animate_interval_id);
animate_interval_id = undefined;
title_field.text = "";
run_time.text = "";
view_count.text = "";
author.text = "";
stars.setStars(0);
bg._alpha = 30;
loaded = false;
}
function makeActiveClip(c) {
swap_clip = c;
swap_clip._visible = true;
if (active_clip != swap_clip) {
swap_clip._alpha = 0;
} else {
swap_clip._alpha = 100;
}
}
function onClipLoaded(clip, error) {
_visible = true;
trace("clip loaded, error:" + error);
if (!error) {
trace("set clip as loaded");
makeActiveClip(clip);
clip.loaded = true;
}
if (!loaded) {
loaded = true;
animate_interval_id = setInterval(this, "animate", 25);
server.clip_loaded();
}
}
function loadNextClip() {
clip_index = (clip_index + 1) % 3;
var _local2 = this["clip" + (clip_index + 1)];
if (_local2.loaded) {
makeActiveClip(_local2);
} else {
trace("loading image for index:" + clip_index);
logic.Util.loadImgClip(_local2, data["thumbnail_url" + (clip_index + 1)], this, clip_bounds);
}
}
function onEnterFrame() {
if (load_next && (!paused)) {
if ((_alpha > 0) && (data)) {
_alpha = _alpha - 10;
} else {
_alpha = 100;
_visible = false;
load_data(load_next);
load_next = undefined;
}
}
if (active_clip != swap_clip) {
if (active_clip._alpha > 0) {
active_clip._alpha = active_clip._alpha - 3;
swap_clip._alpha = 100 - active_clip._alpha;
} else {
active_clip._visible = false;
active_clip = swap_clip;
active_clip._alpha = 100;
}
}
}
function animate() {
if (title_field.text.length < data.title.length) {
title_field.text = title_field.text + data.title.charAt(title_field.text.length);
}
if (run_time.text.length < data.run_time.length) {
run_time.text = run_time.text + data.run_time.charAt(run_time.text.length);
}
if (view_count.text.length < data.view_count.length) {
view_count.text = view_count.text + data.view_count.charAt(view_count.text.length);
}
if (author.text.length < data.author.length) {
author.text = author.text + data.author.charAt(author.text.length);
}
if (stars.value < Number(data.rating)) {
stars.setStars(stars.value + 0.1);
}
}
function onRelease() {
(getURL(data.url + "&NR=1", "_self"));// not popped
}
function setTextNormal(c) {
title_field.textColor = 6724044 /* 0x6699CC */;
run_time.textColor = 10066329 /* 0x999999 */;
view_count.textColor = 6724044 /* 0x6699CC */;
author.textColor = 6724044 /* 0x6699CC */;
author.textColor = 6724044 /* 0x6699CC */;
}
function setTextHighlight() {
title_field.textColor = 10079487 /* 0x99CCFF */;
run_time.textColor = 13421772 /* 0xCCCCCC */;
view_count.textColor = 10079487 /* 0x99CCFF */;
author.textColor = 10079487 /* 0x99CCFF */;
author.textColor = 10079487 /* 0x99CCFF */;
}
function onRollOver() {
_alpha = 100;
bg._alpha = 50;
paused = true;
server.pause();
setTextHighlight();
if (swap_clip == active_clip) {
loadNextClip();
}
clip_interval_id = setInterval(this, "loadNextClip", 3000);
}
function onRollOut() {
bg._alpha = 30;
paused = false;
server.unpause();
setTextNormal();
clearInterval(clip_interval_id);
}
var MAX_LIFE = 200;
}
Symbol 152 MovieClip [__Packages.logic.progressCircle] Frame 0
class logic.progressCircle extends MovieClip
{
var radius, paused, clear, bg, beginFill, lineStyle, moveTo, lineTo, curveTo, endFill, value, notifier, onEnterFrame;
function progressCircle () {
super();
radius = 11;
paused = false;
trace("the radius is:" + radius);
}
function genCurvePoints(r, d, delta) {
var _local6 = Math.sin(d) * r;
var _local5 = (-1 * Math.cos(d)) * r;
var _local2 = Math.tan(d);
var _local12 = Math.sin(d - delta) * r;
var _local11 = (-1 * Math.cos(d - delta)) * r;
var _local3 = Math.tan(d - delta);
var _local4;
var _local10;
var _local9 = _local11 - (_local3 * _local12);
var _local8 = _local5 - (_local2 * _local6);
_local4 = (_local8 - _local9) / (_local3 - _local2);
if (Math.abs(_local3) < Math.abs(_local2)) {
_local10 = _local9 + (_local3 * _local4);
} else {
_local10 = _local8 + (_local2 * _local4);
}
return([_local4, _local10, _local6, _local5]);
}
function drawCircle(r, v) {
var _local4 = 1 - v;
clear();
if (bg) {
beginFill(16777215, 40);
}
lineStyle(0, 0, 0);
moveTo(0, 0);
lineTo(r * Math.sin((_local4 * Math.PI) * 2), (-r) * Math.cos((_local4 * Math.PI) * 2));
lineStyle(2, 13421772, 100);
var _local2 = 0;
while (_local2 < 8) {
if (((_local2 + 1) * 0.125) > _local4) {
var _local3;
if ((_local2 * 0.125) > _local4) {
_local3 = genCurvePoints(r, (Math.PI * (_local2 + 1)) / 4, (Math.PI/4));
} else {
_local3 = genCurvePoints(r, (Math.PI * (_local2 + 1)) / 4, Math.PI * (((_local2 + 1) / 4) - (2 * _local4)));
}
curveTo(_local3[0], _local3[1], _local3[2], _local3[3]);
}
_local2++;
}
lineStyle(0, 0, 0);
lineTo(0, 0);
if (bg) {
endFill();
}
}
function display_value(v) {
value = v;
drawCircle(radius, v);
}
function start_count_down(v, count_down_notifier) {
notifier = count_down_notifier;
display_value(v);
onEnterFrame = count_down;
}
function is_counting() {
return(onEnterFrame != undefined);
}
function end_count() {
display_value(0);
}
function count_down() {
if (paused) {
return(undefined);
}
if (value != undefined) {
if (value <= 0) {
notifier.count_down_end();
delete value;
delete onEnterFrame;
} else {
display_value(value - 0.005);
}
}
}
function reset() {
display_value(0);
delete onEnterFrame;
}
function pause() {
paused = true;
}
function unpause() {
paused = false;
}
function onRollOver() {
bg = true;
}
function onRollOut() {
bg = false;
}
function onRelease() {
end_count();
}
}
Symbol 153 MovieClip [__Packages.logic.EndScreen] Frame 0
class logic.EndScreen extends MovieClip
{
var movie, _parent, share, end_buttons, replay, prev_button, next_panel, count_down, next_visible, _visible, bg, awsome_data, awsome_videos, attachMovie, next_index;
function EndScreen () {
super();
movie = _parent;
share = end_buttons.shareButton;
replay = end_buttons.replayButton;
trace("Ending the movie is :" + movie);
var o = this;
replay.onRelease = function () {
trace("replay me please:" + o.movie);
this.gotoAndStop(2);
if (o.movie.rePlay) {
o.movie.rePlay();
} else {
o.movie.playMovie();
}
};
share.onRelease = function () {
o.movie.share();
this.gotoAndStop(2);
};
prev_button.onRelease = function () {
o.load_previous_panels();
};
share.stop();
replay.stop();
share.onRollOver = (replay.onRollOver = function () {
this.gotoAndStop(2);
});
share.onRollOut = (share.onReleaseOutside = (replay.onRollOut = (replay.onReleaseOutside = function () {
this.gotoAndStop(1);
})));
init();
}
function resetText(strings) {
if (strings) {
replay.replayText.watchagain_txt.text = strings.WatchAgain;
share.shareText.share_txt.text = strings.Share;
next_panel.views_txt.text = strings.Views;
next_panel.from_txt.text = strings.From;
}
}
function init() {
end_buttons._visible = true;
next_panel._visible = false;
count_down._visible = false;
prev_button._visible = false;
next_visible = false;
}
function show() {
if (!_visible) {
_visible = true;
init();
display_next();
resetText(_root.strings);
}
}
function hide() {
_visible = false;
count_down.reset();
}
function resize(w, h) {
bg._width = w;
bg._height = h;
end_buttons._width = w - 20;
if (end_buttons._xscale > 100) {
end_buttons._xscale = 100;
}
end_buttons._yscale = end_buttons._xscale;
layout_next();
}
function load_for_awsome() {
var _local2 = new logic.urlRestXML(movie.base_url);
next_visible = false;
_local2.dispatch(this, parse_next, undefined, "set_awesome", {video_id:movie.video_id, w:movie.getSeekRatio(), l:movie.getTotalTime(), m:""});
}
function show_next() {
next_visible = true;
_visible = true;
end_buttons._visible = false;
var _local3 = new logic.urlRestXML(movie.base_url);
_local3.dispatch(this, parse_next, undefined, "next_awesome", {video_id:movie.video_id, w:movie.getSeekRatio(), l:movie.getTotalTime(), nc:_root.nc});
}
function parse_next(data) {
awsome_data = data;
if (_visible) {
display_next();
}
}
function parse_data() {
if (awsome_data) {
var _local4 = logic.restXML.get_sub_array("video", awsome_data.video_list);
awsome_videos = [];
var _local3 = 0;
while (_local3 < _local4.length) {
awsome_videos.push(logic.restXML.get_dict(_local4[_local3]));
_local3++;
}
awsome_data = undefined;
_root.status.text = "Data parsed :" + awsome_videos.length;
}
}
function display_next() {
if (!movie.supress_next) {
if (next_visible) {
end_buttons._visible = false;
}
if (awsome_data) {
parse_data();
}
layout_next();
}
}
function layout_next() {
if (!next_panel) {
return(undefined);
}
var _local7 = bg.getBounds(this);
var _local10 = _local7.yMin;
var _local9 = _local7.yMax - _local7.yMin;
var _local8 = 0;
if (end_buttons._visible == true) {
_local8 = end_buttons._height + (2 * margin);
}
var _local5 = Math.max(0, Math.min(int((_local9 - _local8) / (next_panel._height + margin)), 4));
trace("panels:" + _local5);
var _local6 = _local7.yMin + ((_local9 - ((_local8 + (next_panel._height * _local5)) + (margin * Math.max(_local5 - 1, 0)))) / 2);
if (end_buttons._visible == true) {
end_buttons._y = _local6 + (end_buttons._height / 2);
_local6 = _local6 + (end_buttons._height + (2 * margin));
}
trace((((((("top_margin:" + _local6) + " height:") + _local9) + " panel:") + next_panel._height) + "margin:") + margin);
panels = [];
var _local3 = 0;
while (_local3 < _local5) {
var _local2;
if (_local3 == 0) {
_local2 = next_panel;
} else {
trace("creating next clip");
_local2 = attachMovie("NextVideoPanel", "next_panel" + _local3, _local3);
}
_local2._x = next_panel._x;
_local2._y = _local6 + (_local2._height / 2);
_local6 = _local6 + (_local2._height + margin);
_local2.load(get_next());
panels.push(_local2);
_local3++;
}
var _local4 = _local5;
while (_local4 < last_panels) {
if (_local4 != 0) {
this["next_panel" + _local4].removeMovieClip();
trace("removing panels");
}
_local4++;
}
last_panels = _local5;
resize_next_prev_buttons(_local7);
count_down.reset();
count_down._visible = false;
prev_button._visible = false;
}
function resize_next_prev_buttons(bounds) {
count_down._x = bounds.xMax - ((margin / 2) + (count_down._width / 2));
count_down._y = bounds.yMax - ((margin / 2) + (count_down._height / 2));
prev_button._x = (bounds.xMin + (margin / 2)) + (prev_button._width / 2);
prev_button._y = bounds.yMax - ((margin / 2) + (prev_button._height / 2));
}
function get_next() {
if (isNaN(next_index)) {
next_index = 0;
} else {
next_index = (next_index + 1) % awsome_videos.length;
}
return(awsome_videos[next_index]);
}
function clip_loaded() {
var _local2 = 0;
while (_local2 < panels.length) {
if (!panels[_local2].loaded) {
trace(panels[_local2] + "not loaded");
return(undefined);
}
_local2++;
}
count_down._visible = true;
prev_button._visible = true;
trace("STARTING COUNT DOWN!");
count_down.start_count_down(1, this);
}
function count_down_end() {
trace("STARTING COUNT END!");
var _local2 = 0;
while (_local2 < panels.length) {
panels[_local2].load(get_next());
_local2++;
}
count_down._visible = false;
prev_button._visible = false;
}
function load_previous_panels() {
if (count_down.is_counting()) {
next_index = next_index - (2 * panels.length);
if (next_index < 0) {
next_index = next_index + awsome_videos.length;
}
}
count_down.end_count();
}
function pause() {
count_down.pause();
}
function unpause() {
count_down.unpause();
}
var panels = [];
var last_panels = 0;
var margin = 11;
}
Symbol 154 MovieClip [__Packages.logic.Movie] Frame 0
class logic.Movie extends MovieClip
{
var videoDisplay, snd, createEmptyMovieClip, sound_data_so, sound_data, audio, base_url, display_ratio, end_screen, onShowMute, onShowVolume, is_playing, onPlayMovie, onPauseMovie, video_id, track_id, movie_url, movieTime, load_awsome, tracker, tracker_cls, started, restart, stall_count, api_loaded, max_seek_ratio, overlay, loader, ns, _parent, static_share_clip, static_share, attachMovie, getNextHighestDepth, onEndMovie, onStartMovie, onSeek, is_peeking, onProgress, lastTime, stallCount, _height, _width, clear, beginFill, moveTo, lineTo, endFill, bg;
function Movie () {
super();
trace("Constructing movie");
com.youtube.debug.Debug.getInstance().init(null, false);
com.youtube.debug.Debug.info("init()", "Movie");
videoDisplay.smoothing = true;
snd = createEmptyMovieClip("snd", 0);
sound_data_so = SharedObject.getLocal("soundData", "/");
sound_data = sound_data_so.data;
audio = new Sound(snd);
if (sound_data.volume == undefined) {
sound_data.volume = 100;
}
if (sound_data.mute == undefined) {
sound_data.mute = false;
}
if (_root.BASE_YT_URL == undefined) {
base_url = "http://www.youtube.com/";
} else {
base_url = _root.BASE_YT_URL;
}
display_ratio = videoDisplay._width / videoDisplay._height;
registerLoader(new logic.MovieLoader());
end_screen._visible = false;
_root.strings = {Share:"share", WatchAgain:"watch again", From:"From:", Views:"Views:", VideoNoLongerAvailable:"This video is no longer available.", EmbeddingNotAllowed:"The owner of this video does not allow video embedding please watch this video on YouTube.com", VideoUnavailable:"This video is unavailable."};
com.youtube.debug.Debug.info("hl = " + _root.hl);
if (((_root.hl != "en") && (_root.hl != "")) && (_root.hl != undefined)) {
com.youtube.debug.Debug.info("loading different language dict", "Movie");
var _local7 = new XML();
_local7.ignoreWhite = true;
_local7.onLoad = function (s) {
if (s) {
com.youtube.debug.Debug.info(this);
var _local3 = this.firstChild.firstChild.childNodes;
for (var _local4 in _local3) {
if (_local3[_local4].nodeName == "msg") {
_root.strings[_local3[_local4].attributes.name] = _local3[_local4].firstChild.nodeValue;
}
}
com.youtube.debug.Debug.info("parsed language: " + _root.hl);
for (var _local5 in _root.strings) {
com.youtube.debug.Debug.info((_local5 + " = ") + _root.strings[_local5]);
}
com.youtube.debug.Debug.info("-----");
} else {
com.youtube.debug.Debug.warning("Failed to load xlb file");
}
};
com.youtube.debug.Debug.info(((("loading XML: " + base_url) + "xlb/") + _root.hl) + ".xlb");
_local7.load(((base_url + "xlb/") + _root.hl) + ".xlb");
}
}
function initController() {
if (sound_data.mute) {
audio.setVolume(0);
onShowMute();
} else {
onShowVolume(sound_data.volume);
audio.setVolume(sound_data.volume);
}
if (is_playing) {
onPlayMovie();
} else {
onPauseMovie();
}
}
function setMovie(_video_id, image_url, movie_url, l, _track_id, eurl, append_vars) {
trace((("setting the movie video_id:" + _video_id) + " base_url:") + base_url);
video_id = _video_id;
track_id = _track_id;
var _local2 = image_url;
if ((_local2 == undefined) && (is_embed)) {
_local2 = ("http://img.youtube.com/vi/" + video_id) + "/2.jpg";
}
if (eurl == undefined) {
eurl = "";
}
if (append_vars == undefined) {
append_vars = "";
}
if (movie_url == undefined) {
movie_url = (((base_url + "watch?v=") + video_id) + "&eurl=") + escape(eurl);
}
this.movie_url = movie_url;
movieTime = l;
if (is_embed) {
append_vars = append_vars + ("&eurl=" + escape(eurl));
if (is_ad) {
append_vars = append_vars + "&adp=1";
}
load_awsome = false;
} else {
load_awsome = true;
}
if (tracker) {
tracker.endTrack();
delete tracker;
}
if (tracker_cls) {
tracker = new this.tracker_cls(this);
}
setSeek(0);
pauseMovie();
hideEnded();
is_playing = false;
started = false;
restart = true;
stall_count = 0;
api_loaded = false;
max_seek_ratio = 0;
if (_local2) {
if (is_ad) {
overlay.makePlayPressable();
} else if (is_embed) {
overlay.makePressable();
} else {
overlay.makePlayMoviePressable();
}
overlay.loadClip(_local2);
}
loader.load(base_url, video_id, track_id, append_vars);
_attachLoader(loader);
if (!loader.started) {
overlay.show();
} else {
overlay.hide();
}
}
function registerLoader(_loader, leave_old) {
if (loader) {
if (!leave_old) {
loader.die();
}
delete ns;
delete loader;
}
_attachLoader(_loader);
}
function _attachLoader(_loader) {
loader = _loader;
loader.setMovie(this);
ns = loader.ns;
videoDisplay.attachVideo(ns);
snd.attachAudio(ns);
}
function popLoader() {
var _local2 = loader;
delete ns;
delete loader;
registerLoader(new logic.MovieLoader());
return(_local2);
}
function share() {
var _local2 = _parent;
if (static_share_clip) {
static_share_clip.removeMovieClip();
delete static_share_clip;
} else if (static_share) {
_local2.play_button._visible = false;
attachMovie("StaticShare", "static_share_clip", getNextHighestDepth(), {share_url:movie_url});
} else {
logic.Util.popUpShare(base_url, video_id);
}
_local2.logShareEvent();
pauseMovie();
}
function endMovie() {
if (tracker) {
tracker.doTrack(getTime(), getSeekRatio());
trace("MOVIE ENDING RATIO IS:" + getSeekRatio());
tracker.doEndMovieTrack();
}
restart = true;
loader.clearOffset();
pauseMovie();
if (load_awsome) {
end_screen.load_for_awsome();
load_awsome = false;
}
if (!onEndMovie()) {
showEnded();
}
}
function showEnded() {
end_screen.show();
}
function hideEnded() {
end_screen.hide();
}
function pauseMovie() {
ns.pause(true);
is_playing = false;
onPauseMovie();
}
function stopMovie() {
restart = true;
loader.clearOffset();
pauseMovie();
}
function stopAll() {
is_playing = false;
loader.die();
pauseMovie();
}
function playMovie() {
if (static_share_clip) {
static_share_clip.removeMovieClip();
delete static_share_clip;
}
if (loader.started == false) {
trace((("ns:" + ns) + ", ns.stats:") + ns.onStatus);
loader.start();
overlay.show_loading();
onStartMovie();
} else {
if (restart == true) {
setSeek(0);
}
ns.pause(false);
}
hideEnded();
onPlayMovie();
is_playing = true;
restart = false;
}
function isPlaying() {
return(is_playing);
}
function getMovieInfo() {
trace("getting movie");
var _local2 = new logic.restXML(base_url);
trace(_local2);
_local2.dispatch(this, parseMovieInfo, undefined, "youtube.videos.get_video_info", {video_id:video_id});
}
function parseMovieInfo(data) {
trace("the set movie is :" + data);
if (data.video) {
var _local3 = logic.restXML.get_dict(data.video);
var _local4 = Number(_local3.length_seconds);
if (_local4) {
movieTime = _local4;
}
if ((_local3.embed_status == "rejected") || (_local3.embed_status == "unavail")) {
overlay.show_message(_root.strings.VideoNoLongerAvailable);
stopAll();
} else if (_local3.embed_status == "not_allowed") {
overlay.show_message(_root.strings.EmbeddingNotAllowed);
stopAll();
} else if (_local3.embed_status == "restricted") {
overlay.show_message(_root.strings.VideoUnavailable);
stopAll();
}
api_loaded = true;
}
}
function Mute() {
sound_data.mute = true;
audio.setVolume(0);
onShowMute();
sound_data_so.flush();
}
function setInfringeMute() {
is_infringe_mute = true;
}
function unMute() {
if (!is_infringe_mute) {
sound_data.mute = false;
audio.setVolume(sound_data.volume);
onShowVolume(sound_data.volume);
sound_data_so.flush();
}
}
function use_master_sound(master_movie) {
sound_data = new Object();
sound_data_so = undefined;
var _local2 = master_movie.sound_data;
sound_data = {mute:_local2.mute, volume:_local2.volume};
if (sound_data.mute) {
Mute();
} else {
unMute();
}
}
function toggleMute() {
if (sound_data.mute) {
unMute();
} else {
Mute();
}
}
function setVolume(v) {
if (!is_infringe_mute) {
sound_data.volume = v;
sound_data.mute = false;
trace((("setting volumne to:" + v) + ":") + sound_data.volume);
audio.setVolume(sound_data.volume);
onShowVolume(sound_data.volume);
sound_data_so.flush();
}
}
function setSeekRatio(ratio) {
setSeek(ratio * movieTime);
}
function getTotalTime() {
return(movieTime);
}
function getCurrentTime() {
return(ns.time);
}
function findCue(t) {
trace("There is no que?");
if (loader.cues) {
var _local3 = loader.cues;
var _local2 = 0;
while (_local2 < _local3.times.length) {
var _local4 = _local2 + 1;
if ((_local3.times[_local2] <= t) && ((_local3.times[_local4] >= t) || (_local4 == _local3.times.length))) {
trace("found que as index:" + _local2);
return({time:_local3.times[_local2], position:_local3.positions[_local2]});
}
_local2++;
}
}
}
function setSeek(s) {
if (s != undefined) {
var _local2 = findCue(s);
if (_local2) {
trace((("cue at:" + _local2.position) + " loaded:") + ns.bytesLoaded);
var _local4 = 100;
if ((_local2.position > ((loader.start_pos + ns.bytesLoaded) + _local4)) || (_local2.position < (loader.start_pos - _local4))) {
if (!loader.loadOffset(_local2.time, _local2.position)) {
ns.seek(s);
}
} else {
ns.seek(s);
}
} else {
ns.seek(s);
}
onSeek(getStartRatio(), getSeekRatio());
if (tracker) {
tracker.doSetTrack(getTime(), getSeekRatio());
}
is_peeking = false;
ns.pause(!is_playing);
}
}
function peekSeekRatio(r) {
trace("seeking:" + r);
restart = false;
is_peeking = true;
hideEnded();
ns.seek(r * movieTime);
onSeek(getStartRatio(), getSeekRatio());
trace((("start:" + getStartRatio()) + " seeked:") + getSeekRatio());
}
function getLoadRatio() {
if (!loader.started) {
return(0);
}
var _local3 = ns.bytesLoaded + loader.start_pos;
var _local2 = ns.bytesTotal + loader.start_pos;
if (_local2 == 0) {
return(0);
}
if ((_local3 == _local2) && (_local3 > 1000)) {
return(1);
}
return(_local3 / _local2);
}
function getSeekRatio() {
if (restart == true) {
return(0);
}
if (loader.delay_progress || (!loader.started)) {
return(loader.start_time / movieTime);
}
if (ns.time > movieTime) {
return(1);
}
return(ns.time / movieTime);
}
function getStartRatio() {
if (loader.start_time == undefined) {
return(0);
}
if (loader.start_time > movieTime) {
return(1);
}
return(loader.start_time / movieTime);
}
function getTime() {
return(ns.time);
}
function onEnterFrame() {
var _local4 = getStartRatio();
var _local3 = getSeekRatio();
var _local2 = getTime();
onSeek(_local4, _local3);
onProgress(_local4, getLoadRatio());
max_seek_ratio = Math.max(max_seek_ratio, _local3);
if ((_local3 > 0.8) && (load_awsome)) {
trace("loading for awsome.");
end_screen.load_for_awsome();
load_awsome = false;
}
if (tracker) {
tracker.doTrack(_local2, _local3);
}
if (init_run) {
initController();
init_run = false;
} else if ((((ns.bytesLoaded == ns.bytesTotal) && (_local2 >= (movieTime - 1))) && (is_playing)) && (!is_peeking)) {
if (lastTime != _local2) {
lastTime = _local2;
stallCount = 0;
} else if (stallCount < 30) {
stallCount++;
} else {
endMovie();
stallCount = 0;
}
}
}
function resizeNormal() {
videoDisplay._height = overlay._height;
videoDisplay._width = overlay._width;
videoDisplay._x = videoDisplay._width / -2;
videoDisplay._y = videoDisplay._height / -2;
}
function resizeOriginal() {
trace((("VIDEO SIZE IS: " + videoDisplay.height) + ",") + videoDisplay.width);
videoDisplay._height = videoDisplay.height;
videoDisplay._width = videoDisplay.width;
videoDisplay._x = videoDisplay._width / -2;
videoDisplay._y = videoDisplay._height / -2;
}
function resize(w, h) {
trace((((((("** Movie: resize w: " + _width) + "->") + w) + " h: ") + _height) + "->") + h);
if (!is_embed) {
clear();
beginFill(0);
var _local5 = (-1 * w) / 2;
var _local4 = (-1 * h) / 2;
moveTo(_local5, _local4);
lineTo(_local5 + w, _local4);
lineTo(_local5 + w, _local4 + h);
lineTo(_local5, _local4 + h);
lineTo(_local5, _local4);
endFill();
}
var _local6 = w / h;
if (_local6 > display_ratio) {
w = h * display_ratio;
} else {
h = w / display_ratio;
}
trace((((("resizing to:" + w) + ":") + h) + " ratio:") + display_ratio);
videoDisplay._width = w;
videoDisplay._height = h;
videoDisplay._x = (-1 * w) / 2;
videoDisplay._y = (-1 * h) / 2;
bg._width = w;
bg._height = h;
overlay.resize(w, h);
end_screen.resize(w, h);
trace((("overlay: " + overlay._width) + ",") + overlay._height);
trace((("end_screen: " + end_screen._width) + ",") + end_screen._height);
}
var init_run = true;
var is_embed = false;
var is_ad = false;
var is_infringe_mute = false;
}
Symbol 155 MovieClip [__Packages.logic.MovieLoader] Frame 0
class logic.MovieLoader
{
var delay_progress, started, nc, ns, interval_id, movie, wait_time, file, append_vars, movieTime, start_pos, start_time, _load_start_time, can_srub_to_offset;
function MovieLoader () {
delay_progress = false;
started = false;
}
function initNetStream() {
delete nc;
delete ns;
nc = new NetConnection();
nc.connect(null);
ns = new NetStream(nc);
enableScrubToOffset();
ns.setBufferTime(2);
var o = this;
ns.onMetaData = function (obj) {
trace("we got meta fuck yeah!");
if (obj.duration != undefined) {
o.movieTime = obj.duration;
trace("time is:" + o.movieTime);
if (obj.keyframes) {
o.cues = {times:obj.keyframes.times, positions:obj.keyframes.filepositions};
trace("cues times are:" + o.cues.times);
o.resetScrubToOffset();
trace("total bytes is:" + o.total_bytes);
}
} else {
o.movieTime == undefined;
o.cues = undefined;
}
};
ns.onStatus = function (object) {
trace((("status code of " + o.file) + " is:") + object.code);
if (object.code == "NetStream.Play.Stop") {
trace("movie stoping..");
if (o.movie.is_playing) {
o.movie.endMovie();
}
} else if (object.code == "NetStream.Play.Start") {
o.started = true;
if (o.movie.loader == o) {
o.movie.overlay.hide();
o.movie.onDisplayMovie();
}
} else if (object.code == "NetStream.Buffer.Full") {
o.delay_progress = false;
if (o.movie.loader == o) {
o.movie.onDisplayMovie();
trace("movie starting to play..");
if (o.movieTime && (o.movie.movieTime == undefined)) {
o.movie.movieTime = o.movieTime;
} else if ((o.movie.movieTime == undefined) && (!o.api_loaded)) {
trace("loading for time.");
o.movie.getMovieInfo();
}
}
} else if (object.code == "NetStream.Play.StreamNotFound") {
trace("movie Error..");
if ((!o.timeout) || (o.timeout < (getTimer() - o._start_load_time))) {
trace("reloading from embed");
if (o.movie.is_embed && (!o.movie.api_loaded)) {
o.movie.getMovieInfo();
}
o.loadLater();
} else {
trace("failed");
o.movie.onLoadError();
}
}
};
}
function loadLater(waited) {
if (interval_id) {
clearInterval(interval_id);
interval_id = undefined;
}
if (waited) {
trace("playing for error!!");
_loadMovie();
ns.pause(!((movie.loader == this) && (movie.is_playing)));
} else {
interval_id = setInterval(this, "loadLater", wait_time * 1000, true);
wait_time = wait_time * 5;
}
}
function load(base_url, video_id, track_id, _append_vars) {
var _local2 = (((base_url + "get_video?video_id=") + video_id) + "&t=") + track_id;
if (interval_id) {
clearInterval(interval_id);
interval_id = undefined;
}
if (_local2 != file) {
append_vars = _append_vars;
trace((("DIFFERENT loading :" + file) + " vs ") + _local2);
file = _local2;
movieTime = undefined;
wait_time = 5;
started = false;
start_pos = 0;
start_time = 0;
initNetStream();
}
}
function setMovie(m) {
movie = m;
}
function die() {
started = false;
ns.close();
if (interval_id) {
clearInterval(interval_id);
}
}
function preLoad() {
if (!started) {
start_pos = 0;
start_time = 0;
trace("PRELOAD :" + file);
ns.play(file + append_vars);
ns.pause(true);
_load_start_time = getTimer();
}
}
function start() {
if (!started) {
trace("START PLAYING :" + file);
clearOffset();
ns.play(file + append_vars);
_load_start_time = getTimer();
}
}
function clearOffset() {
if (start_pos) {
start_pos = 0;
start_time = 0;
started = false;
delay_progress = true;
}
}
function loadOffset(_start_time, _pos) {
if ((start_pos != _pos) && (can_srub_to_offset)) {
start_pos = _pos;
start_time = _start_time;
trace((("loading offset time:" + start_time) + ":") + start_pos);
started = false;
delay_progress = true;
_loadMovie();
return(true);
}
return(false);
}
function _loadMovie() {
ns.play((file + append_vars) + (start_pos ? ("&start=" + start_pos) : ""));
}
function isBuffered() {
return(ns.bufferLength > ns.bufferTime);
}
function enableScrubToOffset() {
if (!_root.soff) {
can_srub_to_offset = true;
}
}
function resetScrubToOffset() {
if (can_srub_to_offset && (start_pos)) {
can_srub_to_offset = false;
start_pos = 0;
start_time = 0;
}
}
}
Symbol 156 MovieClip [__Packages.com.youtube.debug.Debug] Frame 0
class com.youtube.debug.Debug
{
static var _log, _url, window, instance, debugMenu;
var isLocal, mc, _useLocalConnection, outgoingLocalConnection;
function Debug () {
_log = new Array();
isLocal = (_url.indexOf("http://") == -1) || (_url == undefined);
}
function build(mc) {
this.mc = mc;
window = com.youtube.debug.LogWindow(mc.attachMovie("LogWindow", "LogWindow_mc", mc.getNextHighestDepth()));
window._visible = false;
window.mc = mc;
}
static function getInstance() {
if (instance == undefined) {
instance = new com.youtube.debug.Debug();
}
return(instance);
}
function init(mc, useLocalConnection) {
_useLocalConnection = useLocalConnection;
if (_useLocalConnection) {
outgoingLocalConnection = new LocalConnection();
} else {
Key.addListener(this);
build(mc);
}
}
static function info(msg, callee) {
if (LOG_LEVEL > 2) {
getInstance().log(msg.toString(), "info", callee);
}
}
static function warning(msg, callee) {
if (LOG_LEVEL > 1) {
getInstance().log(msg.toString(), "warn", callee);
}
}
static function severe(msg, callee) {
if (LOG_LEVEL > 0) {
getInstance().log(msg.toString(), "severe", callee);
}
}
function onKeyDown() {
if ((Key.isDown(17) && (Key.isDown(68))) && (Key.isDown(16))) {
window.toggleWindow();
}
}
function enableMenuItems() {
debugMenu = new ContextMenu();
debugMenu.customItems.push(new ContextMenuItem("Log Level: Off", setLevelOff));
debugMenu.customItems.push(new ContextMenuItem("Log Level: Info", setLevelInfo));
debugMenu.customItems.push(new ContextMenuItem("Log Level: Warning", setLevelWarning));
debugMenu.customItems.push(new ContextMenuItem("Log Level: Severe", setLevelSevere));
debugMenu.customItems.push(new ContextMenuItem("Clear Log", clearLog));
_root.menu = debugMenu;
}
function disableMenuItems() {
debugMenu.customItems[0].visible = false;
debugMenu.customItems[1].visible = false;
debugMenu.customItems[2].visible = false;
debugMenu.customItems[3].visible = false;
debugMenu.customItems[4].visible = false;
_root.menu = debugMenu;
}
function clearLog() {
_log = [];
updateOutput();
}
function setLevelOff() {
LOG_LEVEL = 0;
}
function setLevelInfo() {
LOG_LEVEL = 3;
}
function setLevelWarning() {
LOG_LEVEL = 2;
}
function setLevelSevere() {
LOG_LEVEL = 1;
}
function log(msg, level, fromClass) {
var _local7 = "";
var _local9 = "";
if (fromClass != null) {
var _local5 = fromClass.split(".");
_local9 = ("[ " + _local5[_local5.length - 1]) + " ]";
_local7 = ("[ <font color='#FFFFCC'>" + _local5[_local5.length - 1]) + "</font> ]";
} else {
_local7 = "";
}
var _local6;
var _local15;
switch (level) {
case "info" :
_local6 = INFO_COLOR;
break;
case "warn" :
_local6 = WARN_COLOR;
break;
case "severe" :
_local6 = SEVERE_COLOR;
break;
default :
_local6 = DEFAULT_COLOR;
}
var _local11 = ((((("[<font color='" + _local6) + "'>") + level) + "</font>]") + _local7) + " ";
var _local12 = ((("[" + level) + "]") + _local9) + " ";
_log.push(_local11 + msg);
if (isLocal || (_root.enabletrace)) {
trace(_local12 + msg);
}
if (_useLocalConnection) {
outgoingLocalConnection.send("_superSecretYouTubeDebugConnection", level, msg, fromClass);
}
var _local14 = _log.length;
var _local4 = _log.length - LOG_BUFFER;
if ((_local4 > LOG_BUFFER) && (window.scrollbar.__get__isScrolledDown())) {
var _local3 = 0;
while (_local3 < _local4) {
_log.shift();
_local3++;
}
}
if (window._visible && (window.scrollbar.__get__isScrolledDown())) {
updateOutput();
}
}
static function updateOutput() {
window.setOutput(_log.join("<br>"));
}
static function toggleWindow() {
window.toggleWindow();
}
static var className = "com.youtube.debug.Debug";
static var LOG_LEVEL = 3;
static var LOG_BUFFER = 175;
var INFO_COLOR = "#00aa00";
var WARN_COLOR = "#cc6600";
var SEVERE_COLOR = "#ff0000";
var DEFAULT_COLOR = "#000000";
}
Symbol 157 MovieClip [__Packages.com.youtube.debug.LogWindow] Frame 0
class com.youtube.debug.LogWindow extends MovieClip
{
var hit, closebutton, _visible, swapDepths, mc, output_txt, scrollbar;
function LogWindow () {
super();
}
function onLoad() {
build();
}
function build() {
var _self = this;
hit.onPress = function () {
_self.startDrag();
};
var _local2 = function () {
_self.stopDrag();
};
hit.onRelease = (hit.onReleaseOutside = _local2);
closebutton.onRelease = function () {
_self.toggleWindow();
};
com.youtube.debug.Debug.info("Log Window Initalized!", LINK_NAME);
}
function toggleWindow() {
if (_visible) {
_visible = false;
com.youtube.debug.Debug.getInstance().disableMenuItems();
} else {
swapDepths(mc.getNextHighestDepth());
_visible = true;
com.youtube.debug.Debug.getInstance().enableMenuItems();
com.youtube.debug.Debug.updateOutput();
}
}
function setOutput(msg) {
output_txt.htmlText = msg;
if (scrollbar.__get__isScrolledDown()) {
output_txt.scroll = output_txt.maxscroll;
}
}
static var LINK_NAME = "LogWindow";
static var FORCE_LINK = Object.registerClass(LINK_NAME, com.youtube.debug.LogWindow);
}
Symbol 158 MovieClip [__Packages.com.youtube.debug.LogWindowScrollbar] Frame 0
class com.youtube.debug.LogWindowScrollbar extends MovieClip
{
var tf, _parent, scrollTop, track, scrollBottom, handle, scrollTravel, trackhit, mscroll;
function LogWindowScrollbar () {
super();
tf = _parent.output_txt;
}
function onLoad() {
build();
}
function build() {
scrollTop = track._y;
scrollBottom = (track._y + track._height) - handle._height;
scrollTravel = scrollBottom - scrollTop;
var _self = this;
handle.onPress = function () {
this.startDrag(false, this._x, _self.scrollTop, this._x, _self.scrollBottom);
_self.mscroll = _self.tf.maxscroll;
this.onEnterFrame = com.google.chianti.event.EventDelegate.create(_self, _self.onScroll);
};
var _local2 = function () {
this.stopDrag();
this.onEnterFrame = null;
com.youtube.debug.Debug.updateOutput();
};
handle.onRelease = (handle.onReleaseOutside = _local2);
trackhit.onRelease = com.google.chianti.event.EventDelegate.create(this, onTrackClick);
trackhit.useHandCursor = false;
tf.scroll = tf.maxscroll;
}
function onTrackClick() {
var _local2 = track._y + track._height;
handle._y = track._ymouse - (handle._height / 2);
if (handle._y > (_local2 - handle._height)) {
handle._y = _local2 - handle._height;
}
mscroll = tf.maxscroll;
onScroll();
}
function onScroll() {
var _local2 = Math.ceil(((handle._y - scrollTop) / scrollTravel) * 100);
tf.scroll = Math.ceil(((mscroll - 1) / 100) * _local2) + 1;
}
function get isScrolledDown() {
if (handle._y == ((track._y + track._height) - handle._height)) {
return(true);
}
return(false);
}
static var LINK_NAME = "LogWindowScrollbar";
static var FORCE_LINK = Object.registerClass(LINK_NAME, com.youtube.debug.LogWindowScrollbar);
}
Symbol 159 MovieClip [__Packages.com.google.chianti.event.EventDelegate] Frame 0
class com.google.chianti.event.EventDelegate extends Object
{
function EventDelegate () {
super();
}
static function create(scope, handler, data) {
var _local2 = function () {
arguments.push(data);
return(handler.apply(scope, arguments));
};
_local2.scope = scope;
return(_local2);
}
}
Symbol 160 MovieClip [__Packages.logic.SoundController] Frame 0
class logic.SoundController extends MovieClip
{
var _parent, knob, sound_bar, sound_button, movie;
function SoundController () {
super();
trace("constructing SoundController:" + _parent.movie);
trace("knob is:" + knob);
var o = this;
var _local4 = function () {
o.knob.highLight();
o.onEnterFrame = function () {
var _local2 = this._xmouse - o.sound_bar._x;
if (_local2 < 0) {
_local2 = 0;
} else if (_local2 > o.sound_bar._width) {
_local2 = o.sound_bar._width;
}
o.hideMute();
o.knob._x = _local2 + o.sound_bar._x;
o.movie.setVolume(o.getSoundPos(o.knob._x));
};
};
sound_bar.onPress = _local4;
knob.onPress = _local4;
var _local6 = function () {
o.knob.normal();
trace("released x:" + o.getSoundPos(this._x));
var _local2 = o.getSoundPos(o.knob._x);
o.movie.setVolume(_local2);
delete o.onEnterFrame;
};
sound_bar.onRelease = (sound_bar.onReleaseOutside = (knob.onRelease = (knob.onReleaseOutside = _local6)));
sound_button.onRelease = function () {
o.movie.toggleMute();
};
}
function registerMovie(m) {
movie = m;
trace("registering sound to:" + movie);
var o = this;
m.onShowMute = function () {
o.showMute();
};
m.onShowVolume = function (v) {
o.hideMute();
o.showVolume(v);
};
}
function getSoundPos(pos) {
var _local2 = Math.round(((pos - sound_bar._x) * 100) / sound_bar._width);
_local2 = Math.min(_local2, 100);
return(Math.max(_local2, 0));
}
function showMute() {
showVolume(0);
}
function hideMute() {
}
function showVolume(v) {
trace("show v:" + v);
var _local3 = ((v * sound_bar._width) / 100) + sound_bar._x;
knob._x = _local3;
showBars(v);
}
function showBars(v) {
var _local3 = Math.round((v * num_bars) / 100);
var _local2 = 1;
while (_local2 <= num_bars) {
if (_local2 <= _local3) {
this["v" + _local2]._visible = true;
} else {
this["v" + _local2]._visible = false;
}
_local2++;
}
if (_local3 == 0) {
sound_button._alpha = 50;
} else {
sound_button._alpha = 100;
}
}
var num_bars = 4;
var volume_spacer = 5;
var vs_space = 5;
var muted = false;
}