Skip to content

Instantly share code, notes, and snippets.

@raison00
Created January 8, 2021 01:24
Show Gist options
  • Select an option

  • Save raison00/58be90bc9222cb83520d7f816060324a to your computer and use it in GitHub Desktop.

Select an option

Save raison00/58be90bc9222cb83520d7f816060324a to your computer and use it in GitHub Desktop.
Culinary Council Streaming Video Content
var swfPath:String = insecureHost+"/media/campaign/videoplayer/player_283x213.swf";
//swfPath = "player_283x213.swf";
_global.insecureHost = insecureHost;
var xmlPath:String = _global.insecureHost+"/img/campaign/cc/xml/chefvideo.xml";
//var xmlPath = "chefvideo.xml";
//var url1:String = "http://macys.edgeboss.net/flash/macys/cc/4513_rick768.flv";
//var url0:String = "http://macys.edgeboss.net/flash/macys/cc/4513_tom768.flv";
var v_title:Array = new Array();
var v_description:Array = new Array();
var v_url:Array = new Array();
// the default active link is chef0
var chef0_active:Boolean = true;
var chef1_active:Boolean = false;
name_link_mc0.enabled = false;
//name_link_mc1.title1_red_mc._visible = false; // for some unknown reason that this is needed, otherwise the red text field is shown.
/*name_link_mc0.title0_red_mc.title.embedFonts = true;
name_link_mc0.title0_black_mc.title.embedFonts = true;
name_link_mc1.title1_red_mc.title.embedFonts = true;
name_link_mc1.title1_black_mc.title.embedFonts = true;
*/
loadXML(xmlPath);
name_link_mc0.onRelease = function() {
trace("ming_link_mc.onRelease");
if(chef0_active == false) {
chef0_active = true;
chef1_active = false;
this._parent.name_link_mc1.gotoAndStop("inactive");
this.gotoAndStop("active");
this.enabled = false;
this._parent.name_link_mc1.enabled = true;
//this.title0_red_mc.title.embedFonts = true;
//this._parent.name_link_mc1.title1_black_mc.title.embedFonts = true;
this.title0_red_mc.title.text = v_title[0]; // for some unknown reason that this is needed, otherwise the red text field is empty.
this._parent.name_link_mc1.title1_black_mc.title.text = v_title[1]; // for some unknown reason that this is needed, otherwise the black text field is empty.
//this._parent.name_link_mc1.title1_red_mc._visible = false; // for some unknown reason that this is needed, otherwise the red text field is shown.
load_player(swfPath, v_url[0]);
}
};
name_link_mc1.onRelease = function() {
trace("andrea_link_mc.onRelease");
if(chef1_active == false) {
chef1_active = true;
chef0_active = false;
this._parent.name_link_mc0.gotoAndStop("inactive");
this.gotoAndStop("active");
this.enabled = false;
//this.title1_red_mc._visible = true; // for some unknown reason that this is needed, otherwise the red text field is shown.
this._parent.name_link_mc0.enabled = true;
load_player(swfPath, v_url[1]);
}
};
function load_player(thePath:String, theUrl:String) {
trace("load_player() theUrl="+theUrl);
// stop the video steamming here
player_mc.the_loaded_swf("stopStream"); // the_loaded_swf is the function in the loaded swf. the_loaded_swf calls the stopStream() in the PlayVideo.as to stop the video playing.
player_mc.unloadMovie();
_global.videoUrl = theUrl;
player_mc.loadMovie(swfPath);
};
function loadXML(myXml:String):Void{
trace("LoadXML() myXml="+myXml);
var this_mc:MovieClip =this;
var numOfItems:Number
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function()
{
var nodes = this.firstChild.childNodes;
numOfItems = nodes.length;
for(var i=0;i<numOfItems;i++)
{
v_url[i]= nodes[i].attributes.video;
v_title[i] = nodes[i].attributes.title;
v_description[i] = nodes[i].attributes.description;
}
// default video:
/*this_mc.name_link_mc0.title0_red_mc.title.embedFonts = true;
this_mc.name_link_mc0.title0_black_mc.title.embedFonts = true;
this_mc.name_link_mc1.title1_red_mc.title.embedFonts = true;
this_mc.name_link_mc1.title1_black_mc.title.embedFonts = true;
*/
this_mc.name_link_mc0.title0_red_mc.title.text = v_title[0];
this_mc.name_link_mc0.title0_black_mc.title.text = v_title[0];
this_mc.name_link_mc1.title1_red_mc.title.text = v_title[1];
this_mc.name_link_mc1.title1_black_mc.title.text = v_title[1];
/*desc0.embedFonts = true;
desc1.embedFonts = true;
*/desc0.text = v_description[0];
desc1.text = v_description[1];
test_tx.text = v_description[1];
_global.videoUrl = v_url[0];
load_player(swfPath, v_url[0]);
}
xml.load(myXml);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment