Frame 1
tube.init(this);
Symbol 13 MovieClip [StaticShare] Frame 1
share_url_field.text = share_url;
if (_parent.videoDisplay._width > this._width) {
this._width = _parent.videoDisplay._widt;
this._yscale = this._xscale;
}
Symbol 46 MovieClip [SoundControl] Frame 1
#initclip 33
Object.registerClass("SoundControl", logic.EmbedSoundController);
#endinitclip
Symbol 80 MovieClip Frame 1
stop();
normal = function () {
gotoAndStop (1);
};
highLight = function () {
gotoAndStop (2);
};
Symbol 86 MovieClip [ControlBlock] Frame 1
#initclip 22
Object.registerClass("ControlBlock", logic.EmbedMovieController);
#endinitclip
sound_control.movie = movie;
trace("controller movie is:" + movie);
Symbol 94 MovieClip [thumb] Frame 1
#initclip 23
Object.registerClass("thumb", logic.Thumbnail);
#endinitclip
border_mc._visible = false;
stop();
Symbol 94 MovieClip [thumb] Frame 2
play();
Symbol 94 MovieClip [thumb] Frame 13
stop();
Symbol 94 MovieClip [thumb] Frame 19
stop();
Symbol 97 MovieClip Frame 1
stop();
Symbol 97 MovieClip Frame 7
stop();
Symbol 97 MovieClip Frame 20
stop();
Symbol 98 MovieClip [thumbnails] Frame 1
#initclip 24
Object.registerClass("thumbnails", logic.ThumbnailSlider);
#endinitclip
Symbol 110 MovieClip [Stars] Frame 1
#initclip 25
Object.registerClass("Stars", logic.Stars);
#endinitclip
Symbol 111 MovieClip [genieEffect] Frame 1
#initclip 26
Object.registerClass("genieEffect", logic.ThumbnailSliderContainer);
#endinitclip
Instance of Symbol 110 MovieClip [Stars] "stars" in Symbol 111 MovieClip [genieEffect] Frame 1
//component parameters
onClipEvent (construct) {
can_vote = true;
}
Symbol 112 MovieClip [overlay_screen] Frame 1
#initclip 27
Object.registerClass("overlay_screen", logic.Overlay);
#endinitclip
Symbol 119 MovieClip [EndScreen] Frame 1
#initclip 28
Object.registerClass("EndScreen", logic.EndScreen);
#endinitclip
Symbol 121 MovieClip [OverLay] Frame 1
#initclip 29
Object.registerClass("OverLay", logic.Overlay);
#endinitclip
Symbol 123 MovieClip [fullDisplay] Frame 1
#initclip 30
Object.registerClass("fullDisplay", logic.Movie);
#endinitclip
Symbol 153 MovieClip [EmbedMenu] Frame 1
#initclip 31
Object.registerClass("EmbedMenu", logic.EmbedMenu);
#endinitclip
Symbol 185 MovieClip [tube] Frame 1
#initclip 32
Object.registerClass("tube", logic.EmbedRecommendedController);
#endinitclip
Instance of Symbol 110 MovieClip [Stars] "stars" in Symbol 185 MovieClip [tube] Frame 1
//component parameters
onClipEvent (construct) {
can_vote = false;
}
Symbol 186 MovieClip [__Packages.logic.EmbedMovieController] Frame 0
class logic.EmbedMovieController extends MovieClip
{
var movie, timer, pause_button, fullBar, full_progress_bar, seekBar, progressBar, seek_time, play_button, stop_button, slider, getBounds, left_justified_elements, ldiv, bg, _width, right_justified_elements, sound_control, mrdiv, rdiv, share, regular, seek_total_time, min, max, small;
function EmbedMovieController () {
super();
trace("constructing MovieController:" + movie);
trace("timer.seek_total_time" + timer.seek_total_time);
pause_button._visible = false;
fullBar = full_progress_bar.fullBar;
seekBar = full_progress_bar.seekBar;
progressBar = full_progress_bar.progressBar;
seek_time = timer.seek_time;
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, ldiv, full_progress_bar, bg];
for (var _local5 in left_justified_elements) {
left_justified_elements[_local5]._xstart = _local3.xMin - left_justified_elements[_local5]._x;
}
bg._width_offset = _width - bg._width;
right_justified_elements = [timer, sound_control, mrdiv, rdiv, share];
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);
showSeek(0, 0);
showProgress(0, 0);
var o = this;
m.onPauseMovie = function () {
trace("showing the goddamn play button");
o.showPlay();
};
var old_handler = m.onPlayMovie;
m.onPlayMovie = function () {
o.showPause();
old_handler();
};
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) {
trace((("resize width:" + w) + " bg offset") + bg._width_offset);
bg._width = w - bg._width_offset;
for (var _local2 in left_justified_elements) {
left_justified_elements[_local2]._x = (-1 * (w / 2)) - left_justified_elements[_local2]._xstart;
}
sound_control.enablePopUp();
slider._x = full_progress_bar._x;
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 {
right_justified_elements[_local2]._visible = true;
if (isNaN(_local3)) {
_local3 = right_justified_elements[_local2]._x;
}
}
} else if (isNaN(_local3)) {
_local3 = right_justified_elements[_local2]._x;
}
_local2++;
}
full_progress_bar._width = (_local3 - full_progress_bar._x) - 12;
}
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 (isNaN(t) || (t < 0)) {
return("--:--");
}
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) {
var _local2 = movie.getCurrentTime();
if (isNaN(_local2)) {
_local2 = 0;
}
seek_time.text = format_minute_time(movie.getTotalTime() - _local2);
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;
progressBar._width = (r - ir) * fullBar._width;
}
function showFSButtons(_show) {
var o = this;
if (_show) {
min._visible = true;
max._visible = false;
regular._visible = false;
small._visible = false;
} else {
min._visible = false;
max._visible = true;
regular._visible = false;
small._visible = true;
regular.onPress = function () {
trace("to: regular");
o.movie.resizeNormal();
o.regular._visible = false;
o.small._visible = true;
};
small.onRelease = function () {
trace("to: original");
o.movie.resizeOriginal();
o.regular._visible = true;
o.small._visible = false;
};
}
}
var slider_down = false;
static var MIN_PROGRESS_BAR_SIZE = 50;
}
Symbol 187 MovieClip [__Packages.logic.Thumbnail] Frame 0
class logic.Thumbnail extends MovieClip
{
var border_mc, img_bounds, main_mc, data, reflection_mc, _parent;
function Thumbnail () {
super();
border_mc._visible = false;
img_bounds = main_mc.getBounds(main_mc);
if (data) {
render();
}
}
function update(d) {
data = d;
render();
}
function render() {
var _local2 = main_mc.createEmptyMovieClip("imgHolder", 1);
var _local3 = reflection_mc.createEmptyMovieClip("imgHolder", 1);
trace((("rendering :" + data.img_url) + " for ") + _local2);
logic.Util.loadImgClip(_local2, data.thumbnail_url, this, img_bounds);
logic.Util.loadImgClip(_local3, data.thumbnail_url, this, img_bounds);
}
function onRollOver() {
border_mc._visible = true;
_parent.updateDisplay(data);
}
function onRollOut() {
border_mc._visible = false;
}
function onRelease() {
data.caller.onSelect(data);
}
}
Symbol 188 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);
}
static function loadFlash(clip, img_url, notifier) {
var _local1 = new Object();
var n = notifier;
var _local3 = function (target_mc, error) {
if (n) {
n.onClipLoaded(target_mc, error);
}
trace((((((((("clip" + target_mc) + "x:") + target_mc._x) + " y:") + target_mc._y) + " width:") + target_mc._width) + " height:") + target_mc._height);
};
_local1.onLoadInit = _local3;
_local1.onLoadError = _local3;
var _local2 = new MovieClipLoader();
_local2.addListener(_local1);
_local2.loadClip(img_url, clip);
}
}
Symbol 189 MovieClip [__Packages.logic.ThumbnailSlider] Frame 0
class logic.ThumbnailSlider extends MovieClip
{
var zoom_max, zoom_min, zoom_range, zoom_r_min, zoom_r_max, zoom_r_range, thumbs_padding, arena_w, _parent, first_thumb, thumb0, last_thumb, thumbs_w_max, thumbs_w_min, last_mouse_x, _xmouse, last_mouse_y, _ymouse, thumbnails, thumbs_showing, gradient_animation, num_thumbs, getNextHighestDepth, mouse_tracker, createEmptyMovieClip, onEnterFrame, _name;
function ThumbnailSlider () {
super();
zoom_max = 100;
zoom_min = 50;
zoom_range = zoom_max - zoom_min;
zoom_r_min = 40;
zoom_r_max = 160;
zoom_r_range = zoom_r_max - zoom_r_min;
thumbs_padding = 8;
arena_w = _parent.mask_mc._width - 15;
first_thumb = thumb0;
last_thumb = thumb0;
thumbs_w_max = (first_thumb._width * zoom_max) / 100;
thumbs_w_min = (first_thumb._width * zoom_min) / 100;
last_mouse_x = _xmouse;
last_mouse_y = _ymouse;
thumbnails = [];
thumbs_showing = false;
gradient_animation.onRelease = function () {
};
}
function init(input_array) {
num_thumbs = input_array.length;
if (num_thumbs) {
first_thumb.update(input_array[0]);
}
var _local2 = 1;
while (_local2 < num_thumbs) {
var _local4 = input_array[_local2];
var _local3 = first_thumb.duplicateMovieClip("thumb" + _local2, getNextHighestDepth(), {id:_local2, _xscale:zoom_min, _yscale:zoom_min, data:_local4});
_local3._x = (_local3._width / 2) + ((_local3._width + thumbs_padding) * _local2);
last_thumb = _local3;
_local2++;
}
startMouseTracking();
updateThumbs();
}
function getThumbnail(index) {
return(this["thumb" + index]);
}
function startMouseTracking() {
if (!mouse_tracker) {
mouse_tracker = createEmptyMovieClip("mouse_tracker", getNextHighestDepth());
}
mouse_tracker.onEnterFrame = function () {
var _local2 = logic.Util.getDist(this._xmouse, this._ymouse, this._parent.mouse_last_x, this._parent.mouse_last_y);
if (_local2 > 1) {
this._parent.updateThumbs();
}
this._parent.mouse_last_x = this._parent._xmouse;
this._parent.mouse_last_y = this._parent._ymouse;
};
}
function stopMouseTracking() {
delete mouse_tracker.onEnterFrame;
}
function updateThumbs() {
var _local3 = 0;
while (_local3 < num_thumbs) {
var _local5 = getThumbnail(_local3);
var _local6 = logic.Util.getDist(_local5._x, _local5._y, _xmouse, _ymouse);
var _local2 = 1 - ((_local6 - zoom_r_min) / zoom_r_range);
if (_local2 < 0) {
_local2 = 0;
}
if (_local2 > 1) {
_local2 = 1;
}
_local5._xscale = (_local5._yscale = Math.round(zoom_min + (zoom_range * _local2)));
_local3++;
}
var _local7 = thumbs_padding * (num_thumbs - 1);
_local3 = 0;
while (_local3 < num_thumbs) {
_local7 = _local7 + getThumbnail(_local3)._width;
_local3++;
}
var _local9 = _local7 - arena_w;
var _local10 = first_thumb._width / 2;
if (_local9 > 0) {
var _local8 = _xmouse;
if (_local8 > arena_w) {
_local8 = arena_w;
}
if (_local8 < 0) {
_local8 = 0;
}
first_thumb._x = _local10 - (_local9 * (_local8 / arena_w));
} else {
first_thumb._x = _local10 - (_local9 * 0.5);
}
_local3 = 1;
while (_local3 < num_thumbs) {
var _local5 = getThumbnail(_local3);
var _local4 = getThumbnail(_local3 - 1);
_local5._x = ((_local4._x + (_local4._width / 2)) + thumbs_padding) + (_local5._width / 2);
_local3++;
}
}
function showThumbs() {
if (!getThumbsShowing()) {
displayThumbs("show");
}
}
function hideThumbs() {
if (getThumbsShowing()) {
displayThumbs("hide");
updateDisplay();
}
}
function displayThumbs(state) {
var display_count = 0;
onEnterFrame = function () {
var _local2 = display_count;
if (_local2 >= this.num_thumbs) {
delete this.onEnterFrame;
return(undefined);
}
this.getThumbnail(_local2).gotoAndPlay(state);
this.getThumbnail(_local2).border_mc._visible = false;
display_count++;
};
trace((("playing gradient:" + gradient_animation) + " @ ") + state);
gradient_animation.gotoAndPlay(state);
thumbs_showing = ((state == "show") ? true : false);
}
function getThumbsShowing() {
return(thumbs_showing);
}
function updateDisplay(d) {
_parent.updateDisplay(d);
}
function thumbHide() {
trace("\nReleased: " + _name);
stopMouseTracking();
hideThumbs();
}
function thumbShow() {
startMouseTracking();
}
function getNumItems() {
return(num_thumbs);
}
}
Symbol 190 MovieClip [__Packages.logic.Stars] Frame 0
class logic.Stars extends MovieClip
{
var value, _parent, can_vote, bg, ratings_url_prefix;
function Stars () {
super();
value = undefined;
_parent.stars_desc.text = default_star_desc;
if (can_vote) {
var star_id = 0;
while (star_id < num_stars) {
this["star" + star_id]._alpha = 0;
this["star" + star_id].star_id = star_id;
this["star" + star_id].onRollOut = function () {
this._parent._parent.stars_desc.text = this._parent.default_star_desc;
this._parent.setStars();
};
this["star" + star_id].onRollOver = function () {
this._parent.setStars(this.star_id + 1);
this._parent._parent.stars_desc.text = this._parent.star_descs[this.star_id];
};
this["star" + star_id].onRelease = function () {
this._parent.logRating(this.star_id + 1);
};
star_id++;
}
} else {
var star_id = 0;
while (star_id < num_stars) {
this["star" + star_id]._visible = false;
star_id++;
}
}
}
function setStars(v) {
if (v == undefined) {
if (value == undefined) {
v = num_stars;
} else {
v = value;
}
} else if (_parent.stars_desc) {
_parent._parent.stars_desc.text = default_star_desc;
}
bg._xscale = (v * 100) / num_stars;
}
function logRating(rating_value) {
var _local4 = (ratings_url_prefix + "&rating=") + rating_value;
var _local5 = _root.createEmptyMovieClip("junkClip", -999999);
trace((("logging rating '" + rating_value) + "' to ") + _local4);
_local5.loadMovie(_local4);
setStars(rating_value);
var _local3 = 0;
while (_local3 < num_stars) {
this["star" + _local3].onRollOut = undefined;
this["star" + _local3].onRollOver = undefined;
this["star" + _local3].onRelease = undefined;
_local3++;
}
_parent.stars_desc.text = completed_star_desc;
trace("Stars: logRating: calling parent");
_parent._parent.logRatings();
}
var num_stars = 5;
var default_star_desc = "Rate this video";
var completed_star_desc = "Thanks for rating!";
var star_descs = ["Poor", "Nothing Special", "Worth Watching", "Pretty Cool", "Awesome!"];
}
Symbol 191 MovieClip [__Packages.logic.ThumbnailSliderContainer] Frame 0
class logic.ThumbnailSliderContainer extends MovieClip
{
var stars, title_field;
function ThumbnailSliderContainer () {
super();
stars._visible = false;
}
function updateDisplay(data) {
if (data.title) {
title_field.autoSize = true;
title_field.htmlText = "<b>Related:</b> " + data.title;
} else {
title_field.text = "";
}
if (data.rating_avg != undefined) {
stars._visible = true;
stars.setStars(Number(data.rating_avg));
} else {
stars._visible = false;
}
}
}
Symbol 192 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 () {
var _local2 = this._parent;
(this.getURL(_local2.movie_url, "_self"));// not popped
_local2._parent.logWatchEvent();
};
}
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 193 MovieClip [__Packages.logic.EndScreen] Frame 0
class logic.EndScreen extends MovieClip
{
var movie, _parent, end_buttons, share, replay, prev_button, next_panel, count_down, next_visible, _visible, bg, awsome_data, awsome_videos, attachMovie, next_index;
function EndScreen () {
super();
movie = _parent;
if (end_buttons.shareButton) {
share = end_buttons.shareButton;
} else {
share = end_buttons.share;
}
if (end_buttons.replayButton) {
replay = end_buttons.replayButton;
} else {
replay = end_buttons.replay;
}
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 194 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 195 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 196 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 197 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) {
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) + append_vars);
ns.play(file + append_vars);
ns.pause(true);
_load_start_time = getTimer();
}
}
function start() {
if (!started) {
trace(("START PLAYING :" + file) + append_vars);
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 198 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 199 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 200 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 201 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 202 MovieClip [__Packages.logic.EmbedMenu] Frame 0
class logic.EmbedMenu extends MovieClip
{
var embed_button, url_button, pop_up_window, embed_grab, current_button, current_text, video_id;
function EmbedMenu () {
super();
embed_button._oy = embed_button._y;
url_button._oy = url_button._y;
var o = this;
embed_button.onRelease = function () {
this._parent.setEmbed();
};
url_button.onRelease = function () {
this._parent.setUrl();
};
pop_up_window._visible = false;
pop_up_window.close_button.onRelease = function () {
o.closePopUp();
};
embed_grab.cancel_button.onRelease = function () {
o.closePopUp();
};
embed_grab.copy_button.onRelease = function () {
o.copyCurrent();
};
embed_grab.text_field.onSetFocus = function (old) {
var c = 2;
this._parent.onEnterFrame = function () {
Selection.setSelection(0, this.text_field.text.length);
c--;
if (c < 0) {
delete this.onEnterFrame;
}
};
};
closePopUp();
}
function closePopUp() {
hideAll();
embed_button._visible = true;
url_button._visible = true;
embed_button._y = embed_button._oy;
url_button._y = url_button._oy;
}
function hideAll() {
embed_button._visible = false;
url_button._visible = false;
pop_up_window._visible = false;
embed_grab._visible = false;
}
function popUp() {
hideAll();
current_button._visible = true;
current_button._y = pop_up_window._y;
pop_up_window._visible = true;
}
function popGrab() {
hideAll();
current_button._visible = true;
current_button._y = pop_up_window._y;
embed_grab._visible = true;
embed_grab.text_field.text = current_text;
}
function copyCurrent() {
System.setClipboard(current_text);
popUp();
}
function setUrl() {
current_text = "http://www.youtube.com/watch?v=" + video_id;
current_button = url_button;
popGrab();
}
function setEmbed() {
current_text = (((EMBED_URL + video_id) + EMBED2_URL) + video_id) + EMBED3_URL;
current_button = embed_button;
popGrab();
}
static var EMBED_URL = "<object width=\"425\" height=\"350\"><param name=\"movie\" value=\"http://www.youtube.com/v/";
static var EMBED2_URL = "\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"http://www.youtube.com/v/";
static var EMBED3_URL = "\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"425\" height=\"350\"></embed></object>";
}
Symbol 203 MovieClip [__Packages.logic.EmbedRecommendedController] Frame 0
class logic.EmbedRecommendedController extends MovieClip
{
var show_menu, manual_show_menu, movie, recs_loaded, watermark, embed_menu, menu_bg, play_button, mini_screen, mini_layout_manager, title_field, title_shadow_field, stars, menu_off_button, controller, thumbnails, thumbnail_container, current_video_index, left_paddle, right_paddle, eurl, append, enable_recs, min_resize, _xscale, _yscale;
function EmbedRecommendedController () {
super();
var o = this;
show_menu = false;
manual_show_menu = false;
movie._ox = movie._x;
movie._oy = movie._y;
recs_loaded = false;
watermark._xoffset = (movie._x + (movie._width / 2)) - watermark._x;
watermark._yoffset = (movie._y + (movie._height / 2)) - watermark._y;
embed_menu._xoffset = (menu_bg._x + (menu_bg._width / 2)) - (embed_menu._x + embed_menu._width);
embed_menu._yoffset = menu_bg._y - embed_menu._y;
play_button._xoffset = movie._x - play_button._x;
play_button._yoffset = movie._y - play_button._y;
mini_screen._xoffset = (menu_bg._x - (menu_bg._width / 2)) - mini_screen._x;
mini_screen._yoffset = (menu_bg._y - (menu_bg._height / 2)) - mini_screen._y;
mini_layout_manager = new logic.LayoutManager(mini_screen.mini_movie, this);
mini_layout_manager.registerObject(title_field, logic.LayoutManager.TOP | logic.LayoutManager.LEFT);
mini_layout_manager.registerObject(title_shadow_field, logic.LayoutManager.TOP | logic.LayoutManager.LEFT);
mini_layout_manager.registerObject(stars, logic.LayoutManager.BOTTOM | logic.LayoutManager.LEFT);
mini_layout_manager.registerObject(menu_off_button, logic.LayoutManager.BOTTOM | logic.LayoutManager.RIGHT, true);
mini_layout_manager.permHide(stars);
mini_layout_manager.hideObjects();
movie.is_embed = true;
movie.tracker_cls = logic.EmbedTracker;
movie.onPlayMovie = function () {
trace("playing.. the movie");
o.play_button._visible = false;
if (!o.recs_loaded) {
o.loadRecs();
}
o.manual_show_menu = false;
o.onPlayMovie();
};
movie.onEndMovie = function () {
o.drawMenuMovie();
};
play_button.onRelease = function () {
trace("Playing the movie!");
o.playMovie();
};
controller.share.onRelease = function () {
o.toggleMenu();
};
menu_off_button.onRelease = function () {
o.toggleMenu();
};
thumbnails = thumbnail_container.thumbnails;
current_video_index = 0;
left_paddle.onRelease = function () {
o.setPlayPrev();
};
right_paddle.onRelease = function () {
o.setPlayNext();
};
embed_menu._visible = false;
mini_screen._visible = false;
left_paddle._visible = false;
right_paddle._visible = false;
}
function hidePaddles() {
left_paddle._visible = false;
right_paddle._visible = false;
}
function fitPaddles() {
var _local2 = movie.overlay.getBounds(this);
left_paddle._y = movie._y;
left_paddle._x = _local2.xMin;
right_paddle._y = movie._y;
right_paddle._x = _local2.xMax;
}
function showPaddles() {
logic.Util.fade_in(left_paddle, 5);
logic.Util.fade_in(right_paddle, 5);
fitPaddles();
}
function drawMenuMovie(fixed) {
show_menu = true;
embed_menu._visible = true;
mini_screen._visible = true;
mini_screen._x = (menu_bg._x - (menu_bg._width / 2)) - mini_screen._xoffset;
mini_screen._y = (menu_bg._y - (menu_bg._height / 2)) - mini_screen._yoffset;
mini_screen._xscale = menu_bg._xscale;
mini_screen._yscale = mini_screen._xscale;
if (mini_screen._xscale > 100) {
embed_menu._xscale = mini_screen._xscale;
embed_menu._yscale = mini_screen._xscale;
}
embed_menu._x = (menu_bg._x + (menu_bg._width / 2)) - (embed_menu._xoffset + embed_menu._width);
if (mini_screen.hitTest(embed_menu)) {
mini_screen._x = (menu_bg._x - (menu_bg._width / 2)) + 2;
embed_menu._x = (menu_bg._x + (menu_bg._width / 2)) - (embed_menu._width + 2);
}
var _local2 = mini_screen.mini_movie.getBounds(this);
var _local3 = _local2.xMax - _local2.xMin;
var _local4 = _local2.yMax - _local2.yMin;
var _local6 = _local2.xMin + (_local3 / 2);
var _local5 = _local2.yMin + (_local4 / 2);
if (fixed) {
movie.resize(_local3, _local4);
movie._x = _local6;
movie._y = _local5;
} else {
logic.Util.tween_to(movie, _local2.xMin + (_local3 / 2), _local2.yMin + (_local4 / 2), _local3, _local4, 10, this);
}
watermark._x = (menu_bg._x + (menu_bg._width / 2)) - watermark._xoffset;
watermark._y = ((menu_bg._y - (menu_bg._height / 2)) + watermark._yoffset) - watermark._height;
embed_menu._y = Math.max(_local5 - embed_menu._yoffset, (watermark._y + watermark._height) + 15);
fitPaddles();
renderThumbnails();
mini_layout_manager.layoutObjects();
}
function onTweenComplete() {
mini_layout_manager.showObjects();
}
function drawRegularMovie(fixed) {
show_menu = false;
if (fixed) {
movie.resize(menu_bg._width, menu_bg._height);
movie._x = movie._ox;
movie._y = movie._oy;
} else {
logic.Util.tween_to(movie, movie._ox, movie._oy, menu_bg._width, menu_bg._height, 10);
}
embed_menu._visible = false;
mini_screen._visible = false;
watermark._x = (movie._x + (movie._width / 2)) - watermark._xoffset;
watermark._y = (movie._y + (movie._height / 2)) - watermark._yoffset;
fitPaddles();
renderThumbnails();
mini_layout_manager.hideObjects();
}
function toggleMenu() {
if (show_menu) {
manual_show_menu = true;
drawRegularMovie();
} else {
manual_show_menu = false;
drawMenuMovie();
}
}
function playMovie() {
movie.playMovie();
}
function setMovie(video_id, image_url, movie_url, length, track_id, _eurl, _append) {
eurl = _eurl;
append = _append;
trace("setting movie");
play_button._visible = true;
movie.setMovie(video_id, image_url, movie_url, length, track_id, eurl, append);
embed_menu.video_id = video_id;
}
function onEnterFrame() {
if ((Math.abs(_root._xmouse - mouse_last_x) + Math.abs(_root._ymouse - mouse_last_y)) < 4) {
if (idle_count < IDLE_HIDE_MENU_MAX) {
idle_count++;
}
} else {
idle_count = 0;
}
if (((idle_count < IDLE_MAX) && (enable_recs)) || (show_menu)) {
if (thumbnail_container._visible) {
trace("SHOWING #:" + thumbnails.getNumItems());
thumbnails.showThumbs();
showPaddles();
}
if ((((!manual_show_menu) && (idle_count >= IDLE_HIDE_MENU_MAX)) && (show_menu)) && (movie.isPlaying())) {
drawRegularMovie();
}
} else if (thumbnail_container._visible) {
trace((("HIDING x:" + _root._xmouse) + ":") + _root._ymouse);
thumbnails.hideThumbs();
hidePaddles();
}
if (!show_menu) {
watermark._x = (movie._x + (movie._width / 2)) - watermark._xoffset;
watermark._y = (movie._y + (movie._height / 2)) - watermark._yoffset;
}
if (play_button._visible) {
play_button._x = movie._x - play_button._xoffset;
play_button._y = movie._y - play_button._yoffset;
}
mouse_last_x = _root._xmouse;
mouse_last_y = _root._ymouse;
}
function hideThumbsTillNextMove() {
idle_count = IDLE_MAX + 3;
}
function setPlayNext() {
setPlayMovieFromData(thumbnails.getThumbnail((current_video_index + 1) % thumbnails.getNumItems()).data);
}
function setPlayPrev() {
setPlayMovieFromData(thumbnails.getThumbnail(((thumbnails.getNumItems() + current_video_index) - 1) % thumbnails.getNumItems()).data);
}
function setPlayMovieFromData(data) {
movie.setMovie(data.id, data.thumbnail_url, data.url, data.length_seconds, data.t, eurl, append);
current_video_index = data.index;
embed_menu.video_id = data.id;
title_field.text = data.title;
title_shadow_field.text = data.title;
stars.setStars(Number(data.rating_avg));
mini_layout_manager.permShow(stars);
movie.playMovie();
}
function renderThumbnails() {
if (!thumbnails.getNumItems()) {
thumbnail_container._visible = false;
hidePaddles();
} else {
thumbnail_container._visible = true;
var _local2 = menu_bg.getBounds(this);
thumbnail_container._xscale = menu_bg._xscale;
thumbnail_container._yscale = thumbnail_container._xscale;
thumbnail_container._x = _local2.xMin;
thumbnail_container._y = _local2.yMax;
}
}
function fixed_resize(w, h) {
trace((("resizing to:" + w) + ":") + h);
menu_bg._x = movie._ox;
menu_bg._y = movie._oy;
movie.resize(w, h - 18);
menu_bg._width = movie._width;
menu_bg._height = movie._height;
if (show_menu) {
drawMenuMovie(true);
} else {
fitPaddles();
renderThumbnails();
}
trace((("actual size of movie is:" + movie._width) + ":") + movie._height);
controller.resize_width(menu_bg._width);
controller._y = menu_bg._y + (menu_bg._height / 2);
trace(((((" moive_width:" + movie._width) + " w:") + w) + " mx:") + movie._x);
}
function resize(w, h) {
if ((w < FIX_WIDTH) || (h < FIX_HEIGHT)) {
fixed_resize(FIX_WIDTH, FIX_HEIGHT);
var _local3 = (w / FIX_WIDTH) * 100;
var _local2 = (h / FIX_HEIGHT) * 100;
if (show_menu) {
drawRegularMovie(true);
}
thumbnail_container._visible = false;
left_paddle._visible = false;
right_paddle._visible = false;
min_resize = true;
if (_local3 > _local2) {
_local3 = _local2;
} else {
_local2 = _local3;
}
_xscale = _local3;
_yscale = _local2;
} else {
min_resize = false;
_xscale = 100;
_yscale = 100;
fixed_resize(w, h);
}
}
function onResize(w, h) {
resize(Stage.width, Stage.height);
}
function init(root) {
movie.static_share = root.sshare;
if (root.loop) {
movie.onEndMovie = function () {
this.playMovie();
return(true);
};
}
Stage.scaleMode = "noScale";
Stage.addListener(this);
setMovie(root.video_id, root.iurl, root.movie_url, root.l, root.t, root.eurl, root.ap);
if (root.autoplay) {
playMovie();
}
enable_recs = root.rel == "2";
controller.registerMovie(movie);
onResize();
}
function loadRecs() {
if (!min_resize) {
recs_loaded = true;
var _local2 = new logic.restXML(movie.base_url);
_local2.call_location = "embed_api_rest?method=";
_local2.dispatch(this, parseRecs, undefined, "list_recs", {v:movie.video_id, t:movie.track_id});
}
}
function onSelect(data) {
setPlayMovieFromData(data);
}
function parseRecs(data) {
var _local4 = logic.restXML.get_sub_array("video", data.video_list);
var _local5 = [];
var _local2 = 0;
while (_local2 < _local4.length) {
var _local3 = logic.restXML.get_dict(_local4[_local2]);
_local3.caller = this;
_local3.index = _local2;
_local5.push(_local3);
_local2++;
}
idle_count = IDLE_MAX;
thumbnails.init(_local5);
renderThumbnails();
}
var mouse_last_x = 0;
var mouse_last_y = 0;
var idle_count = 0;
var IDLE_MAX = 50;
var IDLE_HIDE_MENU_MAX = 125;
var FIX_WIDTH = 300;
var FIX_HEIGHT = 237;
}
Symbol 204 MovieClip [__Packages.logic.LayoutManager] Frame 0
class logic.LayoutManager
{
var bounds_clip, rel_clip, layout_objects, _show, current_bounds;
function LayoutManager (_bounds_clip, _rel_clip) {
bounds_clip = _bounds_clip;
rel_clip = _rel_clip;
layout_objects = [];
_show = true;
setBounds();
}
function setBounds(bounds) {
if (bounds) {
current_bounds = bounds;
} else {
current_bounds = bounds_clip.getBounds(rel_clip);
}
}
function isRel(point, dir) {
return(point.indexOf(dir) > -1);
}
static function getBounds(object) {
var _local1 = object.getBounds(object);
if (!_local1) {
_local1 = {xMin:0, yMin:0, xMax:object._width, yMax:object._height};
}
return(_local1);
}
static function getRelY(object) {
if (object._fixed) {
return(0);
}
var _local1 = getBounds(object);
if (object._rel & TOP) {
return(-_local1.yMin);
}
if (object._rel & BOTTOM) {
return(-_local1.yMax);
}
if (object._rel & V_CENTER) {
return((-(_local1.yMin + _local1.yMax)) / 2);
}
}
static function getRelX(object) {
if (object._fixed) {
return(0);
}
var _local1 = getBounds(object);
if (object._rel & LEFT) {
return(-_local1.xMin);
}
if (object._rel & RIGHT) {
return(-_local1.xMax);
}
if (object._rel & H_CENTER) {
return((-(_local1.xMin + _local1.xMax)) / 2);
}
}
function registerObject(object, rel_layout, fixed) {
object._rel = rel_layout;
object._fixed = fixed;
switch (rel_layout & V_MASK) {
case TOP :
object._yoffset = current_bounds.yMin - (object._y + getRelY(object));
break;
case BOTTOM :
object._yoffset = current_bounds.yMax - (object._y + getRelY(object));
break;
case V_CENTER :
object._yoffset = ((current_bounds.yMax + current_bounds.yMin) / 2) - (object._y + getRelY(object));
}
switch (rel_layout & H_MASK) {
case LEFT :
object._xoffset = current_bounds.xMin - (object._x + getRelX(object));
break;
case RIGHT :
object._xoffset = current_bounds.xMax - (object._x + getRelX(object));
break;
case H_CENTER :
object._xoffset = ((current_bounds.xMax + current_bounds.xMin) / 2) - (object._x + getRelX(object));
}
trace((((((("Registering: " + (rel_layout & V_MASK)) + " @ ") + object._yoffset) + " , ") + (rel_layout & H_MASK)) + " @ ") + object._xoffset);
layout_objects.push(object);
}
function layoutObject(object) {
var _local3 = object._rel;
switch (_local3 & V_MASK) {
case TOP :
object._y = current_bounds.yMin - (object._yoffset + getRelY(object));
break;
case BOTTOM :
object._y = current_bounds.yMax - (object._yoffset + getRelY(object));
break;
case V_CENTER :
object._y = ((current_bounds.yMax + current_bounds.yMin) / 2) - (object._yoffset + getRelY(object));
}
switch (_local3 & H_MASK) {
case LEFT :
object._x = current_bounds.xMin - (object._xoffset + getRelX(object));
break;
case RIGHT :
object._x = current_bounds.xMax - (object._xoffset + getRelX(object));
break;
case H_CENTER :
object._x = ((current_bounds.xMax + current_bounds.xMin) / 2) - (object._xoffset + getRelX(object));
}
}
function layoutObjects(new_bounds) {
setBounds(new_bounds);
var _local2 = 0;
while (_local2 < layout_objects.length) {
layoutObject(layout_objects[_local2]);
_local2++;
}
}
function hideObjects() {
var _local2 = 0;
while (_local2 < layout_objects.length) {
layout_objects[_local2]._visible = false;
_local2++;
}
_show = false;
}
function showObjects() {
var _local2 = 0;
while (_local2 < layout_objects.length) {
if (!layout_objects[_local2]._hide) {
layout_objects[_local2]._visible = true;
}
_local2++;
}
_show = true;
}
function permHide(object) {
object._visible = false;
object._hide = true;
}
function permShow(object) {
object._visible = _show;
delete object._hide;
}
static var TOP = 2;
static var BOTTOM = 4;
static var V_CENTER = 0;
static var H_CENTER = 0;
static var RIGHT = 32;
static var LEFT = 64;
static var H_MASK = 240;
static var V_MASK = 15;
}
Symbol 205 MovieClip [__Packages.logic.EmbedTracker] Frame 0
class logic.EmbedTracker
{
var movie, track_point, do_track;
function EmbedTracker (_m) {
movie = _m;
track_point = 0;
do_track = false;
}
function doTrack(time, percentage) {
if (isNaN(percentage) || (!movie.isPlaying())) {
return(undefined);
}
if (((track_point < 1) && (time >= 0)) && (do_track)) {
trace("getting movie");
var _local4 = new logic.restXML(movie.base_url);
_local4.dispatch(this, parseTrack, undefined, "youtube.videos.track_embed_video", {video_id:movie.video_id});
track_point = 1;
} else if (((track_point < 2) && (time >= 20)) && (do_track)) {
trace((("point2:" + track_point) + " time:") + time);
sendTrack(time, percentage);
track_point = 2;
} else if (((track_point < 3) && (time >= 30)) && (do_track)) {
trace((("point2:" + track_point) + " time:") + time);
sendTrack(time, percentage);
track_point = 3;
} else if (((track_point < 4) && (percentage >= 0.9)) && (do_track)) {
trace((("point3:" + track_point) + " percentage:") + percentage);
sendTrack(time, percentage);
track_point = 4;
}
}
function parseTrack(data) {
if (data.track_embed == 1) {
do_track = true;
sendTrack(movie.getTime(), movie.getSeekRatio());
}
}
function sendTrack(time, percentage) {
var _local2 = new logic.urlRestXML(movie.base_url);
_local2.dispatch(this, undefined, undefined, "tracker", {w:4, i:movie.video_id, tp:Math.floor(time), p:Math.floor(percentage), t:movie.track_id, itype:4});
}
}
Symbol 206 MovieClip [__Packages.logic.EmbedSoundController] Frame 0
class logic.EmbedSoundController extends MovieClip
{
var sound_button, sound_bar, knob, movie, bg;
function EmbedSoundController () {
super();
trace("constructing EmbedSoundController." + this);
var o = this;
sound_button.onRelease = function () {
o.movie.toggleMute();
};
var _local4 = function () {
o.knob.highLight();
o.onEnterFrame = function () {
var _local2 = this._ymouse - o.sound_bar._y;
if (_local2 < 0) {
_local2 = 0;
} else if (_local2 > o.sound_bar._height) {
_local2 = o.sound_bar._height;
}
o.hideMute();
o.knob._y = _local2 + o.sound_bar._y;
o.movie.setVolume(o.getSoundPos(o.knob._y));
};
};
sound_bar.onPress = _local4;
knob.onPress = _local4;
var _local6 = function () {
o.knob.normal();
trace("released x:" + o.getSoundPos(this._y));
var _local2 = o.getSoundPos(o.knob._y);
o.movie.setVolume(_local2);
delete o.onEnterFrame;
};
sound_bar.onRelease = (sound_bar.onReleaseOutside = (knob.onRelease = (knob.onReleaseOutside = _local6)));
hideBar();
}
function registerMovie(m) {
movie = m;
trace("registering embed 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(((sound_bar._height - (pos - sound_bar._y)) * 100) / sound_bar._height);
_local2 = Math.min(_local2, 100);
return(Math.max(_local2, 0));
}
function enablePopUp() {
var o = this;
var delayed_hide_id;
var _local3 = function () {
o.showBar();
clearInterval(delayed_hide_id);
};
var execute_hide = function () {
o.hideBar();
clearInterval(delayed_hide_id);
};
var _local2 = function () {
delayed_hide_id = setInterval(execute_hide, 100);
};
sound_button.onRollOver = (bg.onRollOver = (knob.onRollOver = (sound_bar.onRollOver = _local3)));
sound_button.onRollOut = (bg.onRollOut = _local2);
}
function disablePopUp() {
sound_button.onRollOver = undefined;
sound_button.onRollOut = undefined;
}
function hideBar() {
sound_bar._visible = false;
knob._visible = false;
bg._visible = false;
}
function showBar() {
sound_bar._visible = true;
knob._visible = true;
bg._visible = true;
}
function showMute() {
showVolume(0);
trace("showing mute");
}
function hideMute() {
}
function showVolume(v) {
trace("show v:" + v);
var _local3 = (sound_bar._height - ((v * sound_bar._height) / 100)) + sound_bar._y;
knob._y = _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 muted = false;
var num_bars = 2;
}