// send this file the flashvars: "videofile" + optional "barcolor" + optional "autoplay=false" + optional "mute=true"
import fl.video.* // to be able to refer to the properties of the FLVPlayback component
var objFlashVars:Object = getFlashVars();
myVideo.autoPlay = true; // the FLVPlayback component instance on the stage is named myVideo
myVideo.source = "http://www.mediacollege.com/video-gallery/testclips/20051210-w50s_56K.flv"; // a default video. This will be over-ridden by your value from the FlashVars
myVideo.skin = getContextPath() + "SkinOverAllNoFullNoCaption.swf"; // feel free to change the skin. This will need to be placed in the same directory as the genplayer.swf
// Change settings based on FlashVars:
if (objFlashVars.videofile != undefined) { myVideo.source = objFlashVars.videofile; }
if (objFlashVars.barcolor != undefined) { myVideo.skinBackgroundColor = objFlashVars.barcolor; }
if (objFlashVars.autoplay != undefined) { if (objFlashVars.autoplay == "false") { myVideo.autoPlay = false; } }
if (objFlashVars.mute != undefined) { if (objFlashVars.mute == "true") { myVideo.volume = 0; } }
// Get rid of the loader:
myVideo.addEventListener(VideoEvent.READY, myFun);
function myFun(e:VideoEvent):void {
spinner_mc.stop();
spinner_mc.visible = false;
spinner_mc.enabled = false;
}
// That's it. The video should autoPlay unless you've told it not to with FlashVars.
////////////////////////////////////////////////////////////////////////////////////////////////
// Related Functions Below, from http://snipplr.com/view/10204/as3-my-favorite-helper-functions/
////////////////////////////////////////////////////////////////////////////////////////////////
function getFlashVars():Object
{
return Object( LoaderInfo( this.loaderInfo ).parameters );
}
function getContextPath():String
{
var uri:String = getLoaderURL();
return uri.substring(0, uri.lastIndexOf("/")) + "/";
}
function getLoaderURL():String
{
return this.loaderInfo.loaderURL;
}