Skip to content

Instantly share code, notes, and snippets.

@raison00
Created January 8, 2021 01:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raison00/b724f169bc17d0e71cfb091d32549227 to your computer and use it in GitHub Desktop.
Save raison00/b724f169bc17d0e71cfb091d32549227 to your computer and use it in GitHub Desktop.
Believe Campaign with Custom Video Player Code
<?xml version="1.0" encoding="iso-8859-1"?>
<home>
<believemeter>
<title><![CDATA[ ]]></title>
<explanation>
<![CDATA[ ]]>
</explanation>
<believeLevels>
<!-- these dates are inclusive, so specifying 11/07/2008-11/08/2008 will mean that amount will be in effect for both the 7th and 8th of November -->
<level amt="10" dateRange="11/06/2008-11/09/2008" />
<level amt="11" dateRange="11/10/2008-11/10/2008" />
<level amt="14" dateRange="11/11/2008-11/12/2008" />
<level amt="19" dateRange="11/13/2008-11/13/2008" />
<level amt="25" dateRange="11/14/2008-11/16/2008" />
<level amt="26" dateRange="11/17/2008-11/17/2008" />
<level amt="27" dateRange="11/18/2008-11/18/2008" />
<level amt="28" dateRange="11/19/2008-11/19/2008" />
<level amt="31" dateRange="11/20/2008-11/20/2008" />
<level amt="33" dateRange="11/21/2008-11/23/2008" />
<level amt="34" dateRange="11/24/2008-11/24/2008" />
<level amt="35" dateRange="11/25/2008-11/25/2008" />
<level amt="37" dateRange="11/26/2008-11/26/2008" />
<level amt="38" dateRange="11/28/2008-11/30/2008" />
<level amt="40" dateRange="12/01/2008-12/01/2008" />
<level amt="41" dateRange="12/02/2008-12/02/2008" />
<level amt="42" dateRange="12/03/2008-12/03/2008" />
<level amt="45" dateRange="12/04/2008-12/04/2008" />
<level amt="46" dateRange="12/05/2008-12/07/2008" />
<level amt="47" dateRange="12/08/2008-12/08/2008" />
<level amt="49" dateRange="12/09/2008-12/09/2008" />
<level amt="50" dateRange="12/10/2008-12/10/2008" />
<level amt="51" dateRange="12/11/2008-12/11/2008" />
<level amt="52" dateRange="12/12/2008-12/14/2008" />
<level amt="54" dateRange="12/15/2008-12/15/2008" />
<level amt="55" dateRange="12/16/2008-12/16/2008" />
<level amt="56" dateRange="12/17/2008-12/17/2008" />
<level amt="57" dateRange="12/17/2008-12/17/2008" />
<level amt="58" dateRange="12/18/2008-12/18/2008" />
<level amt="59" dateRange="12/19/2008-12/21/2008" />
<level amt="62" dateRange="12/22/2008-12/2/2008" />
<level amt="65" dateRange="12/23/2008-12/23/2008" />
<level amt="72" dateRange="12/24/2008-12/24/2008" />
<level amt="72" dateRange="12/25/2008-12/25/2008" />
<level amt="52" dateRange="12/26/2008-12/26/2008" />
<level amt="42" dateRange="12/28/2008-12/28/2008" />
<level amt="30" dateRange="12/29/2008-12/31/2008" />
<level amt="5" dateRange="1/27/2009-11/07/2009" />
</believeLevels>
</believemeter>
<promos>
<promo src="" />
<promo src="" />
</promos>
<banner>
<bannersrc>imgs/Macy_GiftGuide_1027.jpg</bannersrc>
<disabled>true</disabled>
</banner>
<popups>
<yes><![CDATA[<font size="+2"><b>See where it all began</b></font><br><br>Hear from our Stars and get the true story<br>behind one curious little girl's efforts to find<br>proof that the magic of Santa exists.]]></yes>
<post><![CDATA[<font size="+1"><b>Spread the spirit and help Make-A-Wish®</b></font><font size="-1"><br><br>Download some Santa stationery to write your<br>wishes to Santa. Drop your letter off in Santa's<br>special mailbox and your wishes will help<br>the Make-A-Wish Foundation®</font>]]></post>
<claus><![CDATA[<font size="+2"><b>Prove you believe and Be Claus</b></font><br><br>Turn yourself into Santa, then send to your friends to help spread Christmas cheer<br>across the world.]]></claus>
</popups>
<loading>
<yes>
<title>
<![CDATA[See Where It All Began]]>
</title>
<description>
<![CDATA[Hear from our Stars and get the true story<br>behind one curious little girl's efforts to find<br>proof that the magic of Santa exists.]]>
</description>
</yes>
<post>
<title>
<![CDATA[Spread the spirit and help Make-A-Wish®]]>
</title>
<description>
<![CDATA[Download some Santa stationary to write your<br>wishes to Santa. Drop Your Letter Off In Santa's<br>Special Mailbox And Your Wishes Will Help<br>The Make-A-Wish Foundation®.]]>
</description>
</post>
<claus>
<title>
<![CDATA[Prove You Believe and Be Claus]]>
</title>
<description>
<![CDATA[Transform Yourself Into A Santa Avatar,<br>Then Send To Your Friends To Help<br>Spread Christmas Cheer Across The World.]]>
</description>
</claus>
</loading>
</home>
import ConnectInfo;
import Main;
class CreateConnection {
private var infoObj:ConnectInfo;
private var serverName:String;
private var appName:String;
private var instName:String;
private var streamName:String;
private var theBufferTime:Number;
private var connectTimeout:Number;
private var root_mc:MovieClip;
private var the_mainObj:Main;
private var connListCounter:Number;
private var connString:String;
private var nc:NetConnection;
private var connList:Array = [
{protocol:"rtmp", port:1935},
{protocol:"rtmp", port:443},
{protocol:"rtmpt", port:80},
{protocol:"rtmps", port:80}
];
public function CreateConnection(target:MovieClip, mainObj:Main) {
trace("CreateConnection: CreateConnection() target="+target);
root_mc = target;
the_mainObj = mainObj;
// the url is the xml file link that contains the information of flv file name and the fmss server url in order to get the streaming video from the fmss server.
var url:String = root_mc.flvUrl; // flvUrl is passed into the swf through FlahVar variable
infoObj = new ConnectInfo(this, target.url);
//root_mc.status_txt.text = "Loading URL: " + url;
/*serverName = "cp37423.edgefcs.net";
appName = "ondemand";
instName = "";
streamName = "flash/b8/75/b87591f417294bdc69f51ea5f8e6b702-474e0f47";
theBufferTime = 2;*/
//netConnect();
}
public function finish_proces_xml(thexmlStatus:Boolean) { // call by the ConnectInfo.as
var args:Array = infoObj.get_args();
infoObj = null;
trace("CreateConnection: finish_proces_xml() args[serverName]="+args["serverName"]);
if(args != undefined ) {
serverName = args["serverName"];
appName = args["appName"];
instName = args["instName"];
streamName = args["streamName"];
theBufferTime = args["bufferTime"];
netConnect();
}
else { // default values:
serverName = "cp37423.edgefcs.net";
appName = "ondemand";
instName = "";
streamName = "flash/b8/75/b87591f417294bdc69f51ea5f8e6b702-474e0f47";
theBufferTime = 2;
}
}
public function netConnect() {
trace("CreateConnection: netConnect() this="+this);
//var nc:NetConnection = new NetConnection();
nc = new NetConnection();
var this_mc = this;
nc.onStatus = function(info) {
trace("Level: " + info.level + " Code: " + info.code);
switch(info.code)
{
case "NetConnection.Connect.Success":
trace("Connection " + this_mc.connList[0].protocol + ":" + this_mc.connList[0].port + " succeeded.");
this_mc.onConnect(this, this_mc.streamName, this_mc.theBufferTime);
break;
default:
trace("Connection " + this_mc.connList[0].protocol + ":" + this_mc.connList[0].port + " failed.");
this_mc.onConnectFailed(info);
break;
}
}
var connString:String = connList[0].protocol + "://" + serverName + ":" + connList[0].port + "/" + appName;
if (instName) {
connString += "/" + instName;
}
root_mc.status_txt.text = "Connecting";
nc.connect(connString);
}
public function onConnect(nc:NetConnection, streamName:String, buffer_time:Number) {
trace("CreateConnection: onConnect(): nc="+nc + " streamName="+streamName + " buffer_time="+buffer_time);
root_mc.status_txt.text = "Connected";
the_mainObj.conneted(nc, streamName, buffer_time);
}
public function onDisconnect() {
nc.close();
nc = null;
}
public function onConnectFailed(info) {
trace("CreateConnection: onConnectFailed()");
root_mc.status_txt.text = "Connection Fail!";
for (var p in info){
trace("p)"+p + ": " + info[p]);
if (p == "application"){
var appObj = info.application;
for (var q in appObj){
trace("q) " + q + ": " + appObj[q]);
}
}
}
}
}
.mblborderBgTable{background-image:url('../images/mobileborder.png');width:422px;height:600px;background-repeat:no-repeat;}
.mblbgImage{background-image:url('../images/mobilebg.png'); background-repeat:repeat-x; width:417px; height:594px;border:medium none;}
.emlborderBgTable{background-image:url('../images/emlborder.png');width:422px;height:390px;background-repeat:no-repeat;}
.emlbgImage{background-image:url('../images/mobilebg.png'); background-repeat:repeat-x; width:417px; height:384px;border:medium none;}
.tblhorizontalRule{background-image:url(../images/mobiletitle_underline.png);height:5px;background-repeat:no-repeat;background-position:center top;}
.tblcol{text-align:middle;vertical-align:middle;}
.buttonBG{text-align:center;vertical-align:middle;background-image:url(../images/gold_button.png);background-repeat:no-repeat;background-position:center center;width:116px;height:48px;}
.cancelButton{text-decoration:none;border:none;vertical-align:middle;}
.sendButton{text-decoration:none;border:none;vertical-align:middle;}
.errorText{text-align:center; }
.countryCode{color:#f1bd9b;padding:2px;background-color:transparent;border:1px solid #f1bd9b;width:30px}
.areaCode{color:#f1bd9b;padding:2px;background-color:transparent;border:1px solid #f1bd9b;width:30px}
.phoneNumber{color:#f1bd9b;padding:2px;background-color:transparent;border:1px solid #f1bd9b;width:50px}
.name{color:#f1bd9b;padding:2px;background-color:transparent;border:1px solid #f1bd9b;width:150px}
.captcha{color:#f1bd9b;padding:2px;background-color:transparent;border:1px solid #f1bd9b;width:250px}
.titleTextFont{font-size:18px;font-family: tahoma,arial,helvetica,sans-serif; color:#f1bd9b;}
.labelFont{font-size:11px;vertical-align:bottom;text-align:right;font-family: tahoma,arial,helvetica,sans-serif; color:#f1bd9b;}
.helpFont{font-size:10px;vertical-align:top;font-family: tahoma,arial,helvetica,sans-serif; color:#f1bd9b;}
.errorFont{font: bold 10px tahoma,arial,helvetica,sans-serif; color:#FFFFFF;font-family: tahoma,arial,helvetica,sans-serif; }
.termsFont{font-size:10px;font-family: tahoma,arial,helvetica,sans-serif; color:#f1bd9b;}
.termsFontSmall{font-size:9px;font-family: tahoma,arial,helvetica,sans-serif; color:#f1bd9b;}
.termsTitleFont{font-size:11px;text-decoration:strong;font-family: tahoma,arial,helvetica,sans-serif; color:#f1bd9b;}
a.linkFont{font-size:10px;vertical-align:top;font-family: tahoma,arial,helvetica,sans-serif; color:#ffffff;text-decoration:underline;cursor:pointer;}
a.linkFont:visited{font-size:10px;vertical-align:top;font-family: tahoma,arial,helvetica,sans-serif; color:#ffffff;text-decoration:underline;cursor:pointer;}
a.linkFont:hover{font-size:10px;vertical-align:top;font-family: tahoma,arial,helvetica,sans-serif; color:#ffffff;text-decoration:underline;cursor:pointer;}
span.select{
position:absolute;
width: 176px; /* With the padding included, the width is 190 pixels: the actual width of the image. */
height: 20px;
padding: 0 24px 0 8px;
color: #fff;
font: 12px tahoma,arial,helvetica,sans-serif;
background: url(../images/select.png) no-repeat;
overflow: hidden;
}
span.checkbox {
width: 19px;
height: 25px;
padding: 0 5px 0 0;
background: url(../images/check_box.png) no-repeat;
display:block;
clear: left;
float: left;
}
.seloption{background-color: #B68031;color:#ffffff;font-size:9px;}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Macy's Believe</title>
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript" src="swfaddress.js"></script>
<link rel="stylesheet" type="text/css" href="subModal.css" />
<link rel="stylesheet" href="sIFR-screen.css" type="text/css" media="screen" />
<link rel="stylesheet" href="hsIFR-print.css" type="text/css" media="print" />
<link rel="stylesheet" href="form.css" type="text/css" media="screen" />
<script src="social_actions.js" type="text/javascript"></script>
<script type="text/javascript">
var VERSION_NUM = "randomDirectory";
function getViewportSize() {
var size = [0, 0];
if (typeof window.innerWidth != "undefined") {
size = [window.innerWidth, window.innerHeight];
}
else if (typeof document.documentElement != "undefined" && typeof document.documentElement.clientWidth != "undefined" && document.documentElement.clientWidth != 0) {
size = [document.documentElement.clientWidth, document.documentElement.clientHeight];
}
else {
size = [document.getElementsByTagName("body")[0].clientWidth, document.getElementsByTagName("body")[0].clientHeight];
}
return size;
}
var MIN_HEIGHT = 864;
var MIN_WIDTH = 960;
function createFullBrowserFlash() {
swfobject.createCSS("html", "height:100%;");
swfobject.createCSS("body", "height:100%;");
swfobject.createCSS("#container", "margin:0; width:100%; height:100%; min-width:"+MIN_WIDTH+"px; min-height:"+MIN_HEIGHT+"px;");
var flashvars = {};
if(location.href.indexOf("#")>0){
flashvars.initialPath = location.href.substring(location.href.indexOf("#")+1, location.href.length);;
}else{
flashvars.initialPath = "/";
}
flashvars.dirPath = SWFAddress.getBaseURL();
if(flashvars.dirPath.indexOf("?")>=0 && flashvars.dirPath.indexOf("#")<0){
flashvars.dirPath = flashvars.dirPath.substring(0, flashvars.dirPath.indexOf("?")-1 );
}
flashvars.dirPath = flashvars.dirPath + "/" + VERSION_NUM + "/";
var paramvars = {allowscriptaccess:"always", wmode:"transparent", menu:false}
var attributes = {id:"MacysBelieveFlash"};
swfobject.embedSWF(VERSION_NUM+"/swfs/macys_shell.swf", "content", "100%", "100%", "9.0.28", "js/expressInstall.swf", flashvars, paramvars, attributes);
window.onresize = function() {
var el = document.getElementById("container");
var size = getViewportSize();
el.style.width = size[0] < MIN_WIDTH ? ""+MIN_WIDTH+"px" : "100%";
el.style.height = size[1] < MIN_HEIGHT ? ""+MIN_HEIGHT+"px" : "100%";
};
if(swfobject.getFlashPlayerVersion().major==undefined || swfobject.getFlashPlayerVersion().major<9 || swfobject.getFlashPlayerVersion().major==null){
document.getElementById("noflashholder").style.visibility = "visible";
}
window.onresize();
}
function fillFull()
{
window.moveTo(0,0);
window.resizeTo(screen.availWidth, screen.availHeight);
}
//swfobject.addDomLoadEvent(fillFull);
swfobject.addDomLoadEvent(createFullBrowserFlash);
</script>
<style type="text/css">
body { margin:0; padding:0; text-align:center; }
#container { margin:20px auto; width:1000px; text-align:left; background-color:#E4E7E6 }
#noflashholder{
background-repeat: repeat-x;
padding:86px 0 220px 0;
}
#noflashmessage{
margin:0px auto;
width:374px;
}
</style>
</head>
<body bgcolor="#E4E7E6">
<div id="container">
<div id="content">
<div id="noflashholder" style="visibility:hidden">
<div id="noflashmessage">You are missing the Flash player, <a href="http://get.adobe.com/flashplayer/">click here to install it</a>.<br />
<a href="http://get.adobe.com/flashplayer/"><img src="randomDirectory/imgs/flashIcon.jpg" alt="Flash Icon" style="margin-left:135px; border:none" /></a>
</div>
</div>
</div>
</div>
</body>
<!-- Google Analytics -->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-5477042-2");
pageTracker._trackPageview();
</script>
</html>
class PlayVideo {
private var root_mc:MovieClip;
private var videoDatarate:Number;
private var videoDuration:Number;
private var audio:Sound;
private var lastVideoVol:Number;
private var the_streamName:String;
private var bStart:Number;
private var cInterval:Number;
private var statusID:Number;
private var video_mc:MovieClip;
private var ns:NetStream;
//private var connectionObj:CreateConnection;
// the buffer_time should be calculated depents on the bandwidth rate. ???
public function PlayVideo(target:MovieClip, nc:NetConnection, streamName:String, buffer_time:Number) {
trace("PlayVideo: PlayVideo() target="+target);
root_mc = target;
// there are two type of video display; determine which video display mcs should be used:
if(root_mc.videoType == "wide") {
root_mc.player_mc.video_mc._visible = false;
video_mc = root_mc.player_mc.videoWide_mc;
}
else {
root_mc.player_mc.videoWide_mc._visible = false;
video_mc = root_mc.player_mc.video_mc;
}
root_mc.player_mc.pauseScreen_mc._visible = false;
the_streamName = streamName;
startStream(nc, streamName, buffer_time);
//statusID = setInterval(video_loaded_progress, 200, this);
}
private function startStream(nc:NetConnection, streamName:String, buffer_time:Number) {
trace("Main: startStream()");
ns = new NetStream(nc);
audio = new Sound();
//audio.setVolume(audioLevel_mc.value);
ns.play(streamName);
ns.setBufferTime(2);//buffer_time);
// ns.receiveAudio(10);
video_mc.attachVideo(ns);
video_control();
ns.root_mc = root_mc;
var thisObj = this;
// trace("Main: startStream() ns.bytesTotal="+ns.bytesTotal);
ns.onStatus = function(info) {
trace(info.code + " : " + info.description);
switch(info.code) {
case "NetStream.Play.Reset": //what does Play.Reset mean?????
this.root_mc.status_txt.text = "1) Connecting to media";
break;
case "NetStream.Buffer.Empty":
if (Math.round(this.time) >= thisObj.videoDuration) {
//thisObj.stopStream();
this.seek(0); // streaming finished. play the video again.
} else {
thisObj.bStart = setInterval(thisObj.displayBuffer, 1000, thisObj); //1000
}
this.root_mc.status_txt.text = "2) " + info.code;
break;
case "NetStream.Play.Start":
thisObj.bStart = setInterval(thisObj.displayBuffer, 1000, thisObj);
this.root_mc.status_txt.text = "3) " + info.code;
break;
case "NetStream.Play.Stop":
this.root_mc.status_txt.text = "3) stop" + info.code;
break;
case "NetStream.Pause.Notify":
clearInterval(thisObj.bStart);
this.root_mc.status_txt.text = "4) " + info.code;
break;
case "NetStream.Buffer.Full":
clearInterval(thisObj.bStart);
thisObj.cInterval = setInterval(thisObj.play_progress, 1000, thisObj);
//sInterval = setInterval(updateSeek, 1000);
this.root_mc.status_txt.text = "5) Playing: " + thisObj.videoDatarate + " K bits/second";
break;
case "NetStream.Buffer.Flush":
trace("Buffer.Flush: this.bufferLength="+this.bufferLength);
// can not do seek(0) here, since the pause action will triger the Buffer Flash also.
//this.seek(0); // streaming finished. play the video again.
break;
case "NetStream.Play.StreamNotFound":
this.root_mc.status_txt.text = "6) Stream not found";
break;
default:
this.root_mc.status_txt.text = info.code;
break;
}
}
ns.onMetaData = function(info) {
thisObj.videoDuration = Math.round(info.duration);
thisObj.videoDatarate = info.videodatarate;
trace("Main: thisObj.videoDuration="+thisObj.videoDuration);
}
}
private function stopStream() {
trace("Main: stopStream()");
//root_mc.status_txt.text = "2) stopStream()";
video_mc.clear();
ns.close();
/*nc.close();
nc = null;*/
//connectionObj.onDisconnect(); // distroy the nc instance.
//playPause_btn.setLabel("Restart");
//clearInterval(bStart);
//root_mc.status_txt.text = "Stopped";
}
private function displayBuffer(this_obje) {
var cBuffer:Number = (Math.round((this_obje.ns.bufferLength /this_obje. ns.bufferTime)*100));
trace("Main: displayBuffer() cBuffer="+cBuffer);
if (cBuffer > 0 && cBuffer <= 100) {
this_obje.root_mc.loader_txt.text = "Buffering... " + cBuffer + "%";
} else {
this_obje.root_mc.loader_txt.text = "???cBuffer="+cBuffer + "%";
clearInterval(this_obje.bStart);
}
}
function play_progress(this_obje) {
//trace("play_progress: this_obje="+this_obje);
if (this_obje.videoDuration) {
// calculate and show the play progress bar:
var maxPos:Number = this_obje.root_mc.playProgress_mc.progress_mc.playprog_mc._width;
var percent:Number = this_obje.ns.time/this_obje.videoDuration * 100;
var currentPos:Number = int(percent/100 * maxPos) - maxPos;
this_obje.root_mc.playProgress_mc.progress_mc.playprog_mc._x = currentPos;
this_obje.root_mc.playProgress_mc.progress_mc.pause_oval_mc._x = currentPos + (maxPos-this_obje.root_mc.playProgress_mc.progress_mc.pause_oval_mc._width);
this_obje.root_mc.playProgress_mc.counter_txt.text = this_obje.convertTime(this_obje.ns.time) + " / " +this_obje. convertTime(this_obje.videoDuration);
}
else {
this_obje.root_mc.playProgress_mc.counter_txt.text = this_obje.convertTime(this_obje.ns.time);
}
}
function video_loaded_progress(this_obje) {
//trace("Main: videoStatus() this_ns.bytesLoaded="+ this_obje.ns.bytesLoaded);
//trace("Main: videoStatus() this_ns.bytesTotal="+ this_obje.ns.bytesTotal);
var amountLoaded:Number = this_obje.ns.bytesLoaded / this_obje.ns.bytesTotal;
var maxPos:Number = this_obje.root_mc.playProgress_mc.progress_mc.load_mc._width;
var currentPos:Number = int(amountLoaded * maxPos) - maxPos;
this_obje.root_mc.playProgress_mc.progress_mc.load_mc._x = currentPos;
}
function padNumber(value) {
value = "00" + value;
return(value.substr(value.length - 2));
};
function convertTime(s) {
var m:Number = Math.floor(s/60);
s = Math.floor(s%60);
var h:Number = Math.floor(m/60);
m = Math.floor(m%60);
var fhtime:String = "";
if (h > 0) {
fhtime = padNumber(h) + ":";
}
var ftime = fhtime + padNumber(m) + ":" + padNumber(s);
return(ftime);
}
private function distroy() {
trace("Main: distroy()");
//connectionObj = null;
}
private function video_control() {
trace("Main: video_control()");
var this_obj = this;
var timeInterval:Number = 5;
var btn_state:String = "play";
root_mc.control_mc.play_btn.gotoAndStop("on");
// for the volume bar to move to the left and right boundary:
var offsetLeft:Number = 12;
var offsetRight:Number = 68;
var offsetVolume = 0;
offsetVolume = root_mc.control_mc.volume_mc.volKnob_btn._x - offsetLeft;
/*else if(String(mainStage_mc) == "_level0.video560x272_mc") {
offsetLeft = 23;
offsetRight = 10;
offsetVolume = 32;
}*/
var minVolumeXPosition:Number = root_mc.control_mc.volume_mc.volKnob_btn._x - offsetLeft;
var maxVolumeXPosition:Number = root_mc.control_mc.volume_mc.volKnob_btn._x + offsetRight;
root_mc.control_mc.play_btn.onRelease = function() {
trace("Main: video_control() play_btn.onRelease");
if(btn_state != "play") {
if(btn_state == "pause") {
this_obj.ns.resume();
this_obj.ns.pause(false);
this.gotoAndStop("on");
this._parent.pause_btn.gotoAndStop("off");
}
else if(btn_state == "stop") {
this_obj.ns.play(this_obj.the_streamName);
this_obj.ns.setBufferTime(2);
this_obj.video_mc.attachVideo(this_obj.ns);
}
btn_state = "play";
}
else {
if(this_obj.ns.time == 0) {
}
}
if(btn_state=="play" && this._parent._parent.player_mc.pauseScreen_mc._visible) {
this._parent._parent.player_mc.pauseScreen_mc._visible = false;
trace("Main: video_control() play_btn.onRelease this._parent._parent="+this._parent._parent);
}
};
root_mc.control_mc.play_btn.onRollOver = function() {
trace("Main: video_control() play_btn.onRollOver");
if(btn_state == "pause") {
this.gotoAndStop("on");
}
}
root_mc.control_mc.play_btn.onRollOut = function() {
trace("Main: video_control() play_btn.onRollOut");
if(btn_state == "pause") {
this.gotoAndStop("off");
}
}
root_mc.control_mc.bwd_btn.onRelease = function() {
trace("Main: video_control() bwd_btn.onRelease this_obj.ns.time="+this_obj.ns.time);
if(this_obj.ns.time > timeInterval) {
this_obj.ns.seek(this_obj.ns.time - timeInterval);
}
else {
this_obj.ns.seek(0);
}
};
root_mc.control_mc.bwd_btn.onRollOver = function() {
trace("Main: video_control() bwd_btn.onRollOver");
this.gotoAndStop("on");
}
root_mc.control_mc.bwd_btn.onRollOut = function() {
trace("Main: video_control() bwd_btn.onRollOut");
this.gotoAndStop("off");
}
root_mc.control_mc.fwd_btn.onRelease = function() {
trace("Main: video_control() fwd_btn.onRelease this_obj.ns.time="+this_obj.ns.time);
if(this_obj.ns.time + timeInterval >this_obj.videoDuration) {
this_obj.ns.seek(this_obj.videoDuration);
}
else {
this_obj.ns.seek(this_obj.ns.time + timeInterval);
}
};
root_mc.control_mc.fwd_btn.onRollOver = function() {
trace("Main: video_control() fwd_btn.onRollOver");
this.gotoAndStop("on");
}
root_mc.control_mc.fwd_btn.onRollOut = function() {
trace("Main: video_control() fwd_btn.onRollOut");
this.gotoAndStop("off");
}
root_mc.control_mc.back_btn.onRelease = function() {
trace("Main: video_control() back_btn.onRelease");
this_obj.ns.seek(0);
};
root_mc.control_mc.pause_btn.onRelease = function() {
trace("Main: video_control() pause_btn.onRelease");
if(btn_state != "pause") {
btn_state = "pause";
this_obj.ns.pause(true);
this.gotoAndStop("on");
this._parent.play_btn.gotoAndStop("off");
//this._parent._parent.status_txt.text = "Paused";
//this._parent._parent.video_mc.clear();
}
if(btn_state=="pause" && this._parent._parent.player_mc.pauseScreen_mc._visible==false) {
this._parent._parent.player_mc.pauseScreen_mc._visible = true;
}
};
root_mc.control_mc.pause_btn.onRollOver = function() {
trace("Main: video_control() pause_btn.onRollOver");
if(btn_state == "play") {
this.gotoAndStop("on");
}
}
root_mc.control_mc.pause_btn.onRollOut = function() {
trace("Main: video_control() pause_btn.onRollOut");
if(btn_state == "play") {
this.gotoAndStop("off");
}
}
root_mc.playProgress_mc.progress_mc.pause_oval_mc.onRelease = function() {
trace("Main: video_control() pause_oval_mc.onRelease");
//this_obj.ns.pause();
}
root_mc.control_mc.volume_mc.mute_mc.onRelease = function() {
trace("Main: mute_mc.onRelease.");
if(this_obj.audio.getVolume()>0) {
trace("Main: mute_mc.onRelease. if");
this_obj.lastVideoVol = this_obj.audio.getVolume();
this_obj.audio.setVolume(0);
}
else {
trace("Main: mute_mc.onRelease. else");
this_obj.audio.setVolume(this_obj.lastVideoVol);
}
}
root_mc.control_mc.volume_mc.volKnob_btn.onPress = function() {
trace("Main: volKnob_btn.onPress. this="+this);
var this_MC2:MovieClip = this;
startDrag(this, false, minVolumeXPosition, this._y, maxVolumeXPosition, this._y);
this.onMouseMove = function(){
//thisFlv_mc.volume = (this_MC2._x - offsetVolume)*1.3;
this_obj.audio.setVolume((this_MC2._x - offsetVolume)*1.3);
var num = (this_MC2._x - offsetVolume)*1.3;
trace("Main: onMouseMove volKnob_btn.onPress. num="+num);
};
};
root_mc.control_mc.volume_mc.volKnob_btn.onRelease = root_mc.control_mc.volume_mc.volKnob_btn.onReleaseOutside=function () {
stopDrag();
this.onMouseMove = null;
};
}
/*private function active_button() {
root_mc.control_mc.play_btn.gotoAndStop("off");
root_mc.control_mc.pause_btn.gotoAndStop("off");
root_mc.control_mc.back_btn.gotoAndStop("off");
root_mc.control_mc.fwd_btn.gotoAndStop("off");
switch(btn_state) {
case "play": root_mc.control_mc.play_btn.gotoAndStop("on"); break;
case "pause": root_mc.control_mc.play_btn.gotoAndStop("on"); break;
case "play": root_mc.control_mc.play_btn.gotoAndStop("on"); break;
case "play": root_mc.control_mc.play_btn.gotoAndStop("on"); break;
}
}*/
}
<?xml version="1.0" encoding="iso-8859-1"?>
<postoffice>
<home>
<text1><![CDATA[<font size="+5">W</font>RITE A LETTER TO <font size="+5">S</font>ANTA, DROP IT OFF AT <font size="+5">M</font>ACY'S,<br>AND WE'LL DELIVER IT TO THE <font size="+5">N</font>ORTH <font size="+5">P</font>OLE]]></text1>
<text2><![CDATA[At every Macy's across the country there is a mailbox to collect letters for Santa Claus. Bring your stamped letter to Macy's, addressed to Santa at the North Pole, and drop it into Santa's special letterbox. We will count them up, and for each letter received, we'll donate $1 to the Make-a-Wish Foundation® up to $1,000,000.<br>We'll deliver them to the Post Office, and together, we'll collect a million reasons to believe.]]></text2>
</home>
<letter>
<text1><![CDATA[<font size="+5">D</font>OWNLOAD <font size="+5">A</font> <font size="+5">L</font>ETTER <font size="+5">T</font>EMPLATE]]></text1>
<text2><![CDATA[To download some Christmas-inspired stationery to write a letter to Santa, just click here and print out the PDF. Or, use your own paper.]]></text2>
</letter>
<wish>
<text1><![CDATA[Since 1980, the Make-A-Wish Foundation® has collected money to help make the wishes of children with life-threatening medical conditions come true. Macy's has been among the Foundation's biggest supporters. Last year we donated over $5 million. This year, you can do your part by writing a letter to Santa and dropping it at a mailbox at any Macy's.<br>For each letter, we will donate $1 to the Make-A-Wish Foundation® (up to 1 million dollars).]]></text1>
</wish>
<pdf>
pdfs/Letter_To_Santa_Template.pdf
</pdf>
</postoffice>
/**
* POPUP CONTAINER STYLES
*/
#popupMask {
position: absolute;
z-index: 200;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
opacity: .4;
filter: alpha(opacity=40);
/* this hack is so it works in IE
* I find setting the color in the css gives me more flexibility
* than the PNG solution.
*/
background-color:transparent !important;
background-color: #333333;
/* this hack is for opera support
* you can uncomment the background-image if you don't care about opera.
* this gives you the flexibility to use any bg color that you want, instead of the png
*/
background-image/**/: url("maskBG.png") !important; // For browsers Moz, Opera, etc.
background-image:none;
background-repeat: repeat;
display:none;
}
#popupContainer {
position: absolute;
z-index: 201;
top: 0px;
left: 0px;
display:none;
padding: 0px;
}
#popupInner {
border: none;
background-color: transparent;
}
#popupFrame {
margin: 0px;
width: 100%;
height: 100%;
position: relative;
z-index: 202;
}
#popupTitleBar {
background-color: #999999;
color: #000000;
font-weight: bold;
height: 1px;
padding: 0px;
border-bottom: 1px solid #444444;
border-top: 1px solid #CCCCCC;
border-left: 1px solid #CCCCCC;
border-right: 1px solid #666666;
position: relative;
z-index: 203;
}
#popupTitle {
float:left;
font-size: 1px;
}
#popupControls {
float: right;
cursor: pointer;
cursor: hand;
}
//import flash.geom.ColorTransform; // only work on player version 8, not version 7. Find out how to work on version 7?????????
//import flash.geom.Transform;
class ResizePlayer {
private var root_mc:MovieClip;
public function ResizePlayer(target:MovieClip) {
trace("ResizePlayer: ResizePlayer()");
root_mc = target;
//var infoObj:PlayerInfo = new PlayerInfo(this, "playerInfo.xml"); // get the video player info. from the xml file.
//Stage._xscale = 150;
//Stage._yscale = 150;
//trace("Stage size is now " + Stage.width + " by " + Stage.height);
//resize_bg();
//resize_video();
//resize_control();
//change_bg_color();
}
// call by PlayerInfo.as
public function finish_process_playerInfo(infoObj:Object) {
//resize_video();
//resize_control();
//resize_bg();
//change_bg_color();
}
public function resize_video() {
trace("ResizePlayer: resize_video()");
root_mc.video_mc._xscale = 75;
root_mc.video_mc._yscale = 75;
root_mc.video_mc._x = 30;
root_mc.video_mc._y = 30;
}
public function resize_control() {
trace("ResizePlayer: resize_control()");
// change the size of the control_mc:
root_mc.control_mc._xscale = 150;
root_mc.control_mc._yscale = 150;
root_mc.control_mc._x = 50;
//root_mc.control_mc._y = 50;
//change the text color of the button:
root_mc.control_mc.play_btn.play_txt.html = true;
root_mc.control_mc.play_btn.play_txt.htmlText = "<b>Play</b>"; // <color>????
}
public function resize_bg() {
trace("ResizePlayer: resize_bg() ");
root_mc.bg_mc._x = 20;
root_mc.bg_mc._y = 20;
// change the size of the bg_mc:
root_mc.bg_mc._xscale = 120;
root_mc.bg_mc._yscale = 120;
}
public function change_bg_color(bgColor:Number) { // change bg color:
trace("ResizePlayer: change_bg_color() bgColor="+bgColor);
trace("ResizePlayer: change_bg_color() root_mc.bg_mc="+root_mc.bg_mc);
if(bgColor==undefined || bgColor==null){
bgColor = 0xff0000;
}
/*var colorTrans:ColorTransform = new ColorTransform();
var trans:Transform = new Transform(root_mc.bg_mc);
colorTrans.rgb = bgColor;//0x333399; // blue
trans.colorTransform = colorTrans;*/
var colorTrans:Color = new Color(root_mc.bg_mc);
colorTrans.setRGB(bgColor);
}
}
/* These are standard sIFR styles... do not modify */
.sIFR-flash {
visibility: visible !important;
margin: 0;
}
.sIFR-replaced {
visibility: visible !important;
}
span.sIFR-alternate {
position: absolute;
left: 0;
top: 0;
width: 0;
height: 0;
display: block;
overflow: hidden;
}
/* Hide Adblock Object tab: the text should show up just fine, not poorly with a tab laid over it. */
.sIFR-flash + div[adblocktab=true] {
display: none !important;
}
/* These "decoy" styles are used to hide the browser text before it is replaced... the negative-letter spacing in this case is used to make the browser text metrics match up with the sIFR text metrics since the sIFR text in this example is so much narrower... your own settings may vary... any weird sizing issues you may run into are usually fixed by tweaking these decoy styles */
.sIFR-hasFlash h1 {
visibility: hidden;
}
.sIFR-hasFlash h2 {
visibility: hidden;
letter-spacing: -9px;
font-size: 55px;
}
.sIFR-hasFlash h3 {
visibility: hidden;
letter-spacing: -6px;
font-size: 25px;
}
.sIFR-hasFlash h4 {
visibility: hidden;
letter-spacing: -5px;
font-size: 21px;
}
.sIFR-hasFlash h5#pullquote {
letter-spacing: -4px;
visibility: hidden;
font-size: 24px;
}
/* This is the print stylesheet to hide the Flash headlines from the browser... regular browser text headlines will now print as normal */
.sIFR-flash, .sIFR-flash object, .sIFR-flash embed {
display: none !important;
height: 0;
width: 0;
position: absolute;
overflow: hidden;
}
span.sIFR-alternate {
visibility: visible !important;
display: block !important;
position: static !important;
left: auto !important;
top: auto !important;
}
var campaignidSA = 26;
var maileridSMS = {26: 4, 27: 1};
var maileridEmail = {26: 2, 27: 2};
var templateprefix = '/mc/templates/macys/believe/actions';
var smsw = 421, smsh=600;
var emailw = 421, emailh=300;
var emailpopuperrorcodes = {2014 /*RESPONSE_INVALID_CAPTCHA*/: 1, 2015 /*RESPONSE_INVALID_TERMS*/ : 1};
var jspsessionid;
var isTestMode = false;
var gaJsPageTracker = null;
var gaId = "UA-5477042-2";
var flashTest =
{
onSocialCancelled: function() {document.getElementById(this.swfname).innerHTML = 'onSocialCancelled called';},
onSocialCompleted: function(code, msg) {document.getElementById(this.swfname).innerHTML = 'onSocialCompleted called code=' + code + " msg=" + msg;},
PercentLoaded : function() {return 100;}
};
function showSMS(sessionidunused, swfname, mailerparamsstr)
{
//alert(onModalClosed);
var url = templateprefix + '/mobileform.jsp?swf=' + swfname +
"&op=txt" +
(mailerparamsstr ? "&mailerparams=" + escape(mailerparamsstr) : "");
var cbk = function(result, xmlhttp)
{
showPopWin(result, smsw, smsh, null, false);
onJspLoaded(xmlhttp.getResponseHeader("X-Skava-Jsessionid"));
};
var errcbk = function(msg)
{
onCompleted(1, swfname, null, -1, msg, "sms");
};
jx.load(url, cbk, "text/html", "GET", errcbk);
}
function showEmail(sessionidunused, swfname, mailerparamsstr, toaddress, fromname, fromaddress)
{
//alert(onModalClosed);
var url = templateprefix + '/mobileform.jsp?swf=' + swfname +
"&op=mail" +
"&toaddress=" + escape(toaddress) +
"&fromname=" + escape(fromname) +
"&fromaddress=" + escape(fromaddress) +
(mailerparamsstr ? "&mailerparams=" + escape(mailerparamsstr) : "");
//alert(url);
var cbk = function(result, xmlhttp)
{
showPopWin(result, emailw, emailh, null, false);
onJspLoaded(xmlhttp.getResponseHeader("X-Skava-Jsessionid"));
};
var errcbk = function(msg)
{
onCompleted(1, swfname, emailpopuperrorcodes, -1, msg, "email");
};
jx.load(url, cbk, "text/html", "GET", errcbk);
}
function sendSocial(toaddress, fromname, carriercode, terms, captcha, mailerparams, swfname, mailerid, isSms)
{
clearErrorInPopup();
var afterUpload = function(result)
{
//alert(result);
var response = parseResult(result);
//alert(response["X-Skava-ResponseMessage"] + " " + urldecode(response["X-Skava-ResponseMessage"]));
onCompleted(1, swfname, (isSms ? null : emailpopuperrorcodes), response["X-Skava-ResponseCode"], urldecode(response["X-Skava-ResponseMessage"]), (isSms ? "sms" : "email"));
}
var url = "/mc/social;jsessionid=" + jspsessionid + "?campaign_id=" + campaignidSA +
// "&X-Skava-Authorization=" + auth[campaignidSA] +
"&variableresponse=1" +
"&op=" + (isSms ? "txt" : "mail") +
"&mailer_id=" + mailerid+
"&user_name=" + escape(fromname) +
"&eto=" + escape(toaddress) +
"&erto=" + escape(carriercode) +
"&terms=" + escape(terms) +
"&cv=" + escape(captcha) +
"&mailer_params="+escape(JSON.stringify(mailerparams));
//alert("3: " + mailerparams + " " + url);
jx.load(url, afterUpload, "application/x-www-form-urlencoded", "POST", showErrorInPopup);
}
function showErrorInPopup(message)
{
loadCaptchaImage('idimgcaptcha', jspsessionid);
document.getElementById('idCaptcha').value = '';
document.getElementById('errortext').innerHTML= 'Error: ' + message;
}
function clearErrorInPopup()
{
document.getElementById('errortext').innerHTML= "&nbsp;";
}
function onCompleted(attempt, swfname, popuperrcodes, respcode, respmessage, actionname)
{
//alert("oncompleted: " + respcode + " " + respmessage + " " + popuperrcodes);
if(respcode != 0 && (popuperrcodes == null || popuperrcodes[respcode] == 1))
{
showErrorInPopup(respmessage);
}
else
{
var tracker = getGaJsTracker();
//alert("tracker=" + tracker);
if(tracker)
{
tracker._trackPageview("/socialactions/" + actionname);
//alert("tracked : " +"/socialactions/" + actionname);
}
var flashObj = getFlashMovieObject(swfname, true);
if (flashObj && attempt > 0 && flashObj.PercentLoaded() == 100)
{
try
{
// if it is test, we will show the error right there.
hidePopWin();
flashObj.onSocialCompleted(respcode, respmessage);
}
catch(e)
{
showErrorInPopup("Invalid Flash object. Please contact support. " + e);
}
}
else if(attempt > 20) // dialup and slow connections...
{
showErrorInPopup("Invalid Flash object. Unable to load it.");
}
else
{
setTimeout(createDelegate(onCompleted, this, [attempt + 1, swfname, popuperrcodes, respcode, respmessage, actionname]), 500);
}
}
}
function onCancelled(attempt, swfname)
{
var flashObj = getFlashMovieObject(swfname, true);
if (flashObj && attempt > 0 && flashObj.PercentLoaded() == 100)
{
try
{
// if it is test, we will show the error right there.
hidePopWin();
flashObj.onSocialCancelled();
}
catch(e)
{
showErrorInPopup("Invalid Flash object. Please contact support. " + e);
}
}
else if(attempt > 20) // dialup and slow connections...
{
showErrorInPopup("Invalid Flash object. Unable to load it.");
}
else
{
setTimeout(createDelegate(onCancelled, this, [attempt + 1, swfname]), 500);
}
}
function parseResult(result)
{
var qsParm = new Array();
if(result)
{
var parms = result.split('&');
for (var i=0; i<parms.length; i++)
{
var pos = parms[i].indexOf('=');
if (pos > 0)
{
var key = parms[i].substring(0,pos);
var val = parms[i].substring(pos+1);
qsParm[key] = urldecode(val);
}
}
}
return qsParm;
}
function getFlashMovieObject(movieName)
{
//alert('gfo:' + movieName);
var flashObj = null;
if(isTestMode)
{
flashObj = flashTest;
flashObj.swfname = movieName;
}
else
{
if (window.document[movieName])
{
flashObj = window.document[movieName];
}
else if (navigator.appName.indexOf("Microsoft Internet")==-1)
{
if (document.embeds && document.embeds[movieName])
flashObj = document.embeds[movieName];
}
else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
{
flashObj = document.getElementById(movieName);
}
}
return flashObj;
}
function urldecode(msg)
{
// unescape does not unescape a string this : hello+world
return (msg ? unescape(msg.replace(/\+/g, "%20")) : msg);
}
function doSendActionSMS(swfname, mailerparamsstr, idform)
{
var mailerparams = JSON.parse(mailerparamsstr);
var form = document.getElementById(idform);
if(form['idCarrier'].value == '-1')
{
showErrorInPopup('Please select your carrier.');
}
else
{
var from = form['idFrom'].value;
var to = form['idPhone1'].value + form['idPhone2'].value + form['idPhone3'].value;
mailerparams.FROM = from;
mailerparams.TO = to;
sendSocial(
to,
from,
form['idCarrier'].value,
(form['idTerms'].checked ? form['idTerms'].value : null),
form['idCaptcha'].value,
mailerparams,
swfname,
maileridSMS[campaignidSA],
true);
}
return false;
}
function doSendActionEmail(swfname, mailerparamsstr, idform, toaddress, fromname, fromaddress)
{
var mailerparams = JSON.parse(mailerparamsstr);
var form = document.getElementById(idform);
mailerparams.FROM = fromname;
mailerparams.TO = toaddress;
mailerparams.FROMADDRESS = fromaddress;
//alert(maileridEmail[campaignidSA]);
sendSocial(
toaddress,
fromname,
fromaddress,
(form['idTerms'].checked ? form['idTerms'].value : null),
form['idCaptcha'].value,
mailerparams,
swfname,
maileridEmail[campaignidSA],
false);
return false;
}
function doCancelAction(swfname)
{
onCancelled(1, swfname);
return false;
}
function loadCaptchaImage(elname, sessionid)
{
var el = document.getElementById(elname);
if(el)
{
//<!-- require jsessionid here - otherwise captcha uses wrong session id with IE-->
var url = '/mc/captcha;jsessionid='+sessionid+'?timeforreload="' + (new Date()).getTime() + '"';
//alert(elname + " " + url + " " + document.getElementById(elname));
//alert(document.getElementById(elname).src);
el.src = url;
}
}
function shareFb(sessionidunused, swfname, title, description, fileUrl, iconUrl, webUrl, hostUrl)
{
var shareUrl = hostUrl +
"/mc/templates/common/fbshare.jsp?" +
'entry_label1=' + escape(title) +
'&campaign_id=26' +
'&time=' + (new Date().getTime()) +
'&entry_comment=' + escape(description) +
'&entry_fileurl=' + escape(fileUrl) +
'&entry_itemurl1=' + escape(iconUrl) +
'&entry_mediatype=' + 4/*MEDIATYPE_APP*/ +
'&entry_mediacontenttype=' + escape("application/x-shockwave-flash") +
'&webUrl=' + escape(webUrl);
//alert(shareUrl);
var url = "http://www.facebook.com/share.php?u=" + escape(shareUrl);
//alert(url);
(window.open(url, '_blank')).focus(); // openInNewTab
onCompleted(1, swfname, null, 0, "Success", "facebook");
}
function shareMs(sessionidunused, swfname, title, description, webUrl)
{
var url = "http://www.myspace.com/index.cfm?fuseaction=postto&l=1&u=" + escape(webUrl) + "&t=" + escape(title) +
" &c=" + escape(description);
(window.open(url, '_blank')).focus(); // openInNewTab
onCompleted(1, swfname, null, 0, "Success", "myspace");
}
function includeJavaScript(jsFile)
{
document.write('<script type="text/javascript" src="' + jsFile + '"></scr' + 'ipt>');
}
function includeCss(cssFile)
{
document.write('<link rel="stylesheet" type="text/css" href="'+cssFile+'" />');
}
function initTest(campaignId, auth, cbk)
{
campaignidSA = campaignId;
var afterUpload = function(result)
{
//alert(result);
var response = parseResult(result);
//alert(response["X-Skava-ResponseMessage"] + " " + urldecode(response["X-Skava-ResponseMessage"]));
cbk(response["X-Skava-ResponseCode"], urldecode(response["X-Skava-ResponseMessage"]), urldecode(response["session"]));
};
var errcbk = function(message)
{
alert("protocol error: " + message);
};
var url = "/mc/social?campaign_id=" + campaignidSA +
"&X-Skava-Authorization=" + auth +
"&variableresponse=1&op=sess";
//alert("3: " + mailerparams + " " + url);
jx.load(url, afterUpload, "application/x-www-form-urlencoded", "POST", errcbk);
}
function onJspLoaded(returnedsessionid)
{
//alert("abt to change sifr: " + (typeof sIFR));
if(typeof sIFR == "function")
{
// This is the preferred "named argument" syntax
sIFR.replaceElement(named({sSelector:".sifrtitlebold", sFlashSrc:"images/mproblack.swf", sColor:"#fadbb2", sBgColor:"transparent", sWmode:"transparent", sFlashVars:"textalign=center&offsetTop=2"}));
sIFR.replaceElement(named({sSelector:".sifrrightalignedbold", sFlashSrc:"images/mproblack.swf", sColor:"#f1bd9b", sBgColor:"transparent", sWmode:"transparent", sFlashVars:"textalign=right&offsetTop=0"}));
sIFR.replaceElement(named({sSelector:".sifrleftbold", sFlashSrc:"images/msemiprobold.swf", sColor:"#f1bd9b", sBgColor:"transparent", sWmode:"transparent", sFlashVars:"textalign=left&offsetTop=0"}));
sIFR.replaceElement(named({sSelector:".sifrcenteralignedbold", sFlashSrc:"images/mproblack.swf", sColor:"#f1bd9b", sBgColor:"transparent", sWmode:"transparent", sFlashVars:"textalign=center&offsetTop=0"}));
sIFR.replaceElement(named({sSelector:".sifrleftalignedbold", sFlashSrc:"images/mproblack.swf", sColor:"#f1bd9b", sBgColor:"transparent", sWmode:"transparent", sFlashVars:"textalign=left&offsetTop=0"}));
sIFR.replaceElement(named({sSelector:".sifrcenteralignednormal", sFlashSrc:"images/mpro.swf", sColor:"#f1bd9b", sBgColor:"transparent", sWmode:"transparent", sFlashVars:"textalign=center&offsetTop=0"}));
sIFR.replaceElement(named({sSelector:".sifrleftalignednormal", sFlashSrc:"images/mpro.swf", sColor:"#f1bd9b", sBgColor:"transparent", sWmode:"transparent", sFlashVars:"textalign=left&offsetTop=0"}));
sIFR.replaceElement(named({sSelector:".sifrlinkleftalignednormal", sFlashSrc:"images/mpro.swf", sColor:"#f1bd9b", sBgColor:"transparent", sWmode:"transparent", sFlashVars:"textalign=left&offsetTop=0&underline=true", sLinkColor:"#f1bd9b", sHoverColor: "#f1bd9b"}));
};
jspsessionid = returnedsessionid;
Custom.init(); //to draw the custom styled boxes
}
function includeDependencies()
{
//includeCss("/mc/static/submodal/subModal.css");
//includeCss(templateprefix + "/scripts/sIFR-screen.css");
//includeCss(templateprefix + "/scripts/sIFR-print.css");
//includeCss(templateprefix + "/scripts/form.css");
includeJavaScript(templateprefix + "/scripts/custom-form-elements.js");
includeJavaScript(templateprefix + "/scripts/sifr.js");
includeJavaScript(templateprefix + "/scripts/sifr-addons.js");
includeJavaScript("/mc/json2.js");
includeJavaScript("/mc/http.js");
includeJavaScript("/mc/static/submodal/common.js");
includeJavaScript("/mc/static/submodal/subModal.js");
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
}
function getGaJsTracker()
{
// we init it in a separate function from includeDependencies in order to give it some time to load
if(!gaJsPageTracker)
{
gaJsPageTracker = _gat._getTracker(gaId);
}
return gaJsPageTracker;
}
includeDependencies();
import CreateConnection;
import ResizePlayer;
//import PlayVideo;
import mx.utils.Delegate;
class Main {
private var root_mc:MovieClip;
private var videoDatarate:Number;
private var videoDuration:Number;
private var audio:Sound;
private var lastVideoVol:Number;
private var the_streamName:String;
private var bStart:Number;
private var cInterval:Number;
private var statusID:Number;
private var video_mc:MovieClip;
private var nc:NetConnection;
private var ns:NetStream;
private var connectionObj:CreateConnection;
private var resizePlayerObj:ResizePlayer;
public function Main(target:MovieClip) {
trace("Main: Main() target="+target);
root_mc = target;
// there are two type of video display; determine which video display mcs should be used:
if(root_mc.videoType == "wide") {
root_mc.video_mc._visible = false;
video_mc = root_mc.videoWide_mc;
}
else {
root_mc.videoWide_mc._visible = false;
video_mc = root_mc.video_mc;
}
connectionObj = new CreateConnection(root_mc, this);
// change the player color oor resize it:
resizePlayerObj = new ResizePlayer(root_mc);
resizePlayerObj.change_bg_color(root_mc.bgColor);
}
// called by CreateConnection.as when connection is establish:
public function conneted(nc:NetConnection, streamName:String, buffer_time:Number) {
trace("Main: conneted() nc="+nc);
//new PlayVideo(root_mc, nc, streamName, buffer_time);
startStream(nc, streamName, buffer_time);
}
private function startStream(nc:NetConnection, streamName:String, buffer_time:Number) {
trace("Main: startStream()");
ns = new NetStream(nc);
audio = new Sound();
//audio.setVolume(audioLevel_mc.value);
ns.play(streamName);
ns.setBufferTime(2);//buffer_time);
// ns.receiveAudio(10);
video_mc.attachVideo(ns);
video_control();
ns.root_mc = root_mc;
var thisObj = this;
// trace("Main: startStream() ns.bytesTotal="+ns.bytesTotal);
ns.onStatus = function(info) {
trace(info.code + " : " + info.description);
switch(info.code) {
case "NetStream.Play.Reset": //what does Play.Reset mean?????
this.root_mc.status_txt.text = "1) Connecting to media";
break;
case "NetStream.Buffer.Empty":
if (Math.round(this.time) >= thisObj.videoDuration) {
//thisObj.stopStream();
this.seek(0); // streaming finished. play the video again.
} else {
thisObj.bStart = setInterval(thisObj.displayBuffer, 1000, thisObj); //1000
}
this.root_mc.status_txt.text = "2) " + info.code;
break;
case "NetStream.Play.Start":
thisObj.bStart = setInterval(thisObj.displayBuffer, 1000, thisObj);
this.root_mc.status_txt.text = "3) " + info.code;
break;
case "NetStream.Play.Stop":
this.root_mc.status_txt.text = "3) stop" + info.code;
break;
case "NetStream.Pause.Notify":
clearInterval(thisObj.bStart);
this.root_mc.status_txt.text = "4) " + info.code;
break;
case "NetStream.Buffer.Full":
clearInterval(thisObj.bStart);
thisObj.cInterval = setInterval(thisObj.play_progress, 1000, thisObj);
//sInterval = setInterval(updateSeek, 1000);
this.root_mc.status_txt.text = "5) Playing: " + thisObj.videoDatarate + " K bits/second";
break;
case "NetStream.Buffer.Flush":
trace("Buffer.Flush: this.bufferLength="+this.bufferLength);
//this.seek(0); // streaming finished. play the video again.
this.root_mc.status_txt.text = "5 b) buffer flush: ";
break;
case "NetStream.Play.StreamNotFound":
this.root_mc.status_txt.text = "6) Stream not found";
break;
default:
this.root_mc.status_txt.text = info.code;
break;
}
}
ns.onMetaData = function(info) {
thisObj.videoDuration = Math.round(info.duration);
thisObj.videoDatarate = info.videodatarate;
trace("Main: thisObj.videoDuration="+thisObj.videoDuration);
}
}
private function stopStream() {
trace("Main: stopStream()");
//root_mc.status_txt.text = "2) stopStream()";
video_mc.clear();
ns.close();
/*nc.close();
nc = null;*/
//connectionObj.onDisconnect(); // distroy the nc instance.
//playPause_btn.setLabel("Restart");
//clearInterval(bStart);
//root_mc.status_txt.text = "Stopped";
}
private function displayBuffer(this_obje) {
var cBuffer:Number = (Math.round((this_obje.ns.bufferLength /this_obje. ns.bufferTime)*100));
trace("Main: displayBuffer() cBuffer="+cBuffer);
if (cBuffer > 0 && cBuffer <= 100) {
this_obje.root_mc.loader_txt.text = "Buffering... " + cBuffer + "%";
} else {
this_obje.root_mc.loader_txt.text = "???cBuffer="+cBuffer + "%";
clearInterval(this_obje.bStart);
}
}
function play_progress(this_obje) {
//trace("play_progress: this_obje="+this_obje);
if (this_obje.videoDuration) {
// calculate and show the play progress bar:
var maxPos:Number = this_obje.root_mc.control_mc.progress_mc.playprog_mc._width;
var percent:Number = this_obje.ns.time/this_obje.videoDuration * 100;
var currentPos:Number = int(percent/100 * maxPos) - maxPos;
this_obje.root_mc.control_mc.progress_mc.playprog_mc._x = currentPos;
this_obje.root_mc.counter_txt.text = this_obje.convertTime(this_obje.ns.time) + " / " +this_obje. convertTime(this_obje.videoDuration);
}
else {
this_obje.root_mc.counter_txt.text = this_obje.convertTime(this_obje.ns.time);
}
trace("play_progress: playprog_mc._x="+currentPos);
}
function video_loaded_progress(this_obje) {
//trace("Main: videoStatus() this_ns.bytesLoaded="+ this_obje.ns.bytesLoaded);
//trace("Main: videoStatus() this_ns.bytesTotal="+ this_obje.ns.bytesTotal);
var amountLoaded:Number = this_obje.ns.bytesLoaded / this_obje.ns.bytesTotal;
var maxPos:Number = this_obje.root_mc.control_mc.progress_mc.load_mc._width;
var currentPos:Number = int(amountLoaded * maxPos) - maxPos;
this_obje.root_mc.control_mc.progress_mc.load_mc._x = currentPos;
}
function padNumber(value) {
value = "00" + value;
return(value.substr(value.length - 2));
};
function convertTime(s) {
var m:Number = Math.floor(s/60);
s = Math.floor(s%60);
var h:Number = Math.floor(m/60);
m = Math.floor(m%60);
var fhtime:String = "";
if (h > 0) {
fhtime = padNumber(h) + ":";
}
var ftime = fhtime + padNumber(m) + ":" + padNumber(s);
return(ftime);
}
private function distroy() {
trace("Main: distroy()");
//connectionObj = null;
}
private function video_control() {
trace("Main: video_control()");
var this_obj = this;
var timeInterval:Number = 5;
var btn_state:String = "play";
// for the volume bar to move to the left and right boundary:
var offsetLeft:Number = 23;
var offsetRight:Number = 30;
var offsetVolume = 0;
offsetVolume = root_mc.control_mc.volume_mc.volKnob_btn._x - offsetLeft;
/*else if(String(mainStage_mc) == "_level0.video560x272_mc") {
offsetLeft = 23;
offsetRight = 10;
offsetVolume = 32;
}*/
var minVolumeXPosition:Number = root_mc.control_mc.volume_mc.volKnob_btn._x - offsetLeft;
var maxVolumeXPosition:Number = root_mc.control_mc.volume_mc.volKnob_btn._x + offsetRight;
root_mc.control_mc.play_btn.onRelease = function() {
trace("Main: video_control() play_btn.onRelease");
if(btn_state != "play") {
if(btn_state == "pause") {
this_obj.ns.resume();
this_obj.ns.pause(false);
}
else if(btn_state == "stop") {
this_obj.ns.play(this_obj.the_streamName);
this_obj.ns.setBufferTime(2);
this_obj.video_mc.attachVideo(this_obj.ns);
}
btn_state = "play";
}
/*else if(btn_state == "play" && this_obj.ns.time>=) {
if(this_obj.ns.time == 0) {
}
}*/
}
root_mc.control_mc.bwd_btn.onRelease = function() {
trace("Main: video_control() bwd_btn.onRelease this_obj.ns.time="+this_obj.ns.time);
if(this_obj.ns.time > timeInterval) {
this_obj.ns.seek(this_obj.ns.time - timeInterval);
}
else {
this_obj.ns.seek(0);
}
}
root_mc.control_mc.fwd_btn.onRelease = function() {
trace("Main: video_control() fwd_btn.onRelease this_obj.ns.time="+this_obj.ns.time);
trace("Main: video_control() fwd_btn.onRelease videoDuration="+this_obj.videoDuration);
if(this_obj.ns.time + timeInterval > this_obj.videoDuration) {
this_obj.ns.seek(this_obj.videoDuration);
trace("if");
}
else {
this_obj.ns.seek(this_obj.ns.time + timeInterval);
trace("else");
}
}
root_mc.control_mc.back_btn.onRelease = function() {
trace("Main: video_control() back_btn.onRelease");
this_obj.ns.seek(0);
}
root_mc.control_mc.pause_btn.onRelease = function() {
trace("Main: video_control() pause_btn.onRelease");
if(btn_state != "pause") {
btn_state = "pause";
this_obj.ns.pause(true);
//this._parent._parent.status_txt.text = "Paused";
//this._parent._parent.video_mc.clear();
}
}
root_mc.control_mc.volume_mc.mute_mc.onRelease = function() {
trace("Main: mute_mc.onRelease.");
if(this_obj.audio.getVolume()>0) {
trace("Main: mute_mc.onRelease. if");
this_obj.lastVideoVol = this_obj.audio.getVolume();
this_obj.audio.setVolume(0);
}
else {
trace("Main: mute_mc.onRelease. else");
this_obj.audio.setVolume(this_obj.lastVideoVol);
}
}
root_mc.control_mc.volume_mc.volKnob_btn.onPress = function() {
trace("Main: volKnob_btn.onPress. this="+this);
var this_MC2:MovieClip = this;
startDrag(this, false, minVolumeXPosition, this._y, maxVolumeXPosition, this._y);
this.onMouseMove = function(){
//thisFlv_mc.volume = (this_MC2._x - offsetVolume)*1.3;
this_obj.audio.setVolume((this_MC2._x - offsetVolume)*1.3);
var num = (this_MC2._x - offsetVolume)*1.3;
trace("Main: onMouseMove volKnob_btn.onPress. num="+num);
};
};
root_mc.control_mc.volume_mc.volKnob_btn.onRelease = root_mc.control_mc.volume_mc.volKnob_btn.onReleaseOutside=function () {
stopDrag();
this.onMouseMove = null;
};
}
}
<?xml version="1.0" encoding="iso-8859-1"?>
<yesvirginia>
<landing>
<text1><![CDATA[<b>In 1897, a girl named Virginia wrote a letter to the editor of the New York Sun asking if Santa truly exists.</b>]]></text1>
<text2><![CDATA[<b>The editor, in response, published a letter that assured her that Santa exists as surely as beauty and joy exist. One must simply have the courage to shun cynicism and have faith in things that can't always be seen. And for those spirited ones, <br>Santa will always exist.</b>]]></text2>
</landing>
<letter>
<audio>
audio/testSound.mp3
</audio>
</letter>
<reply>
<text1><![CDATA[<b><font color="#CC0000"><i> Dear Editor—<br> I am 8 years old. Some of my little friends say there is no Santa Claus. Papa says, "If you see it in The Sun, it's so." Please tell me the truth, is there a Santa Claus?<br><br> Virginia O'Hanlon</i></font><br><br>Virginia, your little friends are wrong. They have been affected by the skepticism of a skeptical age. They do not believe except they see. They think that nothing can be which is not comprehensible by their little minds. All minds, Virginia, whether they be men's or children's, are little. In this great universe of ours, man is a mere insect, an ant, in his intellect as compared with the boundless world about him, as measured by the intelligence capable of grasping the whole of truth and knowledge.<br><br>Yes, Virginia, there is a Santa Claus. He exists as certainly as love and generosity and devotion exist, and you know that they abound and give to your life its highest beauty and joy. Alas! how dreary would be the world if there were no Santa Claus! It would be as dreary as if there were no Virginias. There would be no childlike faith then, no poetry, no romance to make tolerable this existence. We should have no enjoyment, except in sense and sight. The eternal light with which childhood fills the world would be extinguished.<br><br>Not believe in Santa Claus! You might as well not believe in fairies. You might get your papa to hire men to watch in all the chimneys on Christmas eve to catch Santa Claus, but even if you did not see Santa Claus coming down, what would that prove? Nobody sees Santa Claus, but that is no sign that there is no Santa Claus. The most real things in the world are those that neither children nor men can see. Did you ever see fairies dancing on the lawn? Of course not, but that's no proof that they are not there. Nobody can conceive or imagine all the wonders there are unseen and unseeable in the world.<br><br>You tear apart the baby's rattle and see what makes the noise inside, but there is a veil covering the unseen world which not the strongest man, nor even the united strength of all the strongest men that ever lived could tear apart. Only faith, poetry, love, romance, can push aside that curtain and view and picture the supernal beauty and glory beyond. Is it all real? Ah, Virginia, in all this world there is nothing else real and abiding.<br><br>No Santa Claus! Thank God! he lives and lives forever. A thousand years from now, Virginia, nay 10 times 10,000 years from now, he will continue to make glad the heart of childhood.<br><br><br></b>]]></text1>
<pdf>
pdfs/YesVirginia_Download.pdf
</pdf>
</reply>
<history>
<text1><![CDATA[<font size="+5">T</font>HE <font size="+5">H</font>ISTORY <font size="+5">O</font>F <font size="+5">T</font>HE <font size="+5">L</font>ETTER]]></text1>
<text2><![CDATA[In 1897, a young girl from New York City named Virginia asked her father if Santa truly exists. She had been told by friends that he did not. Her father suggested she write a letter to <i>the New York Sun</i>, a prominent New York newspaper whose motto was "If you see it in <i>The Sun</i>, it’s so." And so she did. What follows is a letter to Virginia from Francis Pharcellus Church, one of <i>The Sun's</i> editors. Indeed, Mr. Church assured her, Santa does exist as surely as joy and beauty and love exist.]]></text2>
</history>
<stars>
<video>
video/testVideo.flv
</video>
<text1>
<![CDATA[<b><font size="+5">D</font>ROP <font size="+5">O</font>FF <font size="+5">Y</font>OUR <font size="+5">L</font>ETTER <font size="+5">T</font>O <font size="+5">S</font>ANTA <font size="+5">A</font>ND <font size="+5">M</font>AKE <font size="+5">A W</font>ISH <font size="+5">C</font>OME <font size="+5">T</font>RUE.</b>]]>
</text1>
</stars>
</yesvirginia>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment