kayus
09-27-2007, 11:50 PM
I would be gratefull if anyone out there might be able to help me.
I want to display jpegs alongside the text when selecting which videos to play,
the problem is I am not sure how to change the xml file and the actionscript.
Can you please help.
Here is the code
var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
stream_ns.setBufferTime (30);
stream_ns.onStatus = function (info) {
if(info.code == "NetStream.Buffer.Full") {
bufferClip._visible = false;
}
if(info.code == "NetStream.Buffer.Empty") {
bufferClip._visible = true;
}
}
video.attachVideo(stream_ns);
rewindButton.onRelease = function() {
stream_ns.seek(0);
}
playButton.onRelease = function() {
stream_ns.pause();
}
var vlist:XML = new XML ();
vlist.ignoreWhite = true;
vlist.onLoad = function (){
var videos:Array = this.firstChild.childNodes;
for (i=0;i<videos.length;i++) {
videoList.addItem(videos[i].attributes.thumb,videos[i].attributes.url);
}
stream_ns.play(videoList.getItemAt (0) .data) ;
videoList.selectedIndex = 0;
}
var vidList:Object = new Object();
vidList.change = function() {
stream_ns.play (videoList.getItemAt(videoList.selectedIndex).data );
}
videoList.addEventListener("change",vidList);
vlist.load("video.xml");
var videoInterval = setInterval(videoStatus,100);
var amountLoaded:Number;
var duration:Number;
stream_ns["onMetaData"] = function(obj) {
duration = obj.duration;
}
function videoStatus() {
amountLoaded = stream_ns.bytesLoaded / stream_ns.bytesTotal;
loader.loadbar._width = amountLoaded * 297.9;
loader.scrub._x = stream_ns.time / duration * 297.9;
}
var scrubInterval;
loader.scrub.onPress = function() {
clearInterval(videoInterval);
scrubInterval = setInterval(scrubit,10);
this.startDrag(false,0,this._y,289,this._y);
}
loader.scrub.onRelease = loader.scrub.onReleaseOutside = function() {
clearInterval(scrubInterval);
videoInterval = setInterval(videoStatus,100);
this.stopDrag();
}
function scrubit() {
stream_ns.seek(Math.floor((loader.scrub._x/289) * duration));
}
_root.createEmptyMovieClip("vSound",_root.getNextHighestDepth());
vSound.attachAudio(stream_ns);
var so:Sound = new Sound(vSound);
so.setVolume(100);
mute.onRollOver = function() {
if (so.getVolume() == 100) {
this.gotoAndStop("onOver");
}
else {
this.gotoAndStop("muteOver");
}
}
mute.onRollOut = function() {
if (so.getVolume() == 100) {
this.gotoAndStop("on");
}
else {
this.gotoAndStop("mute");
}
}
mute.onRelease = function() {
if (so.getVolume() == 100) {
so.setVolume(0);
this.gotoAndStop("muteOver");
}
else {
so.setVolume(100);
this.gotoAndStop("onOver");
}
}
Here is the XML
<?xml version="1.0" encoding="ISO-8859-1"?>
<videos>
<video url="http://fimm.tv/09072007.flv" desc="Come & Drink - Linda Faith" thumb="test.jpg" />
</videos>
</xml>
I want to display jpegs alongside the text when selecting which videos to play,
the problem is I am not sure how to change the xml file and the actionscript.
Can you please help.
Here is the code
var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
stream_ns.setBufferTime (30);
stream_ns.onStatus = function (info) {
if(info.code == "NetStream.Buffer.Full") {
bufferClip._visible = false;
}
if(info.code == "NetStream.Buffer.Empty") {
bufferClip._visible = true;
}
}
video.attachVideo(stream_ns);
rewindButton.onRelease = function() {
stream_ns.seek(0);
}
playButton.onRelease = function() {
stream_ns.pause();
}
var vlist:XML = new XML ();
vlist.ignoreWhite = true;
vlist.onLoad = function (){
var videos:Array = this.firstChild.childNodes;
for (i=0;i<videos.length;i++) {
videoList.addItem(videos[i].attributes.thumb,videos[i].attributes.url);
}
stream_ns.play(videoList.getItemAt (0) .data) ;
videoList.selectedIndex = 0;
}
var vidList:Object = new Object();
vidList.change = function() {
stream_ns.play (videoList.getItemAt(videoList.selectedIndex).data );
}
videoList.addEventListener("change",vidList);
vlist.load("video.xml");
var videoInterval = setInterval(videoStatus,100);
var amountLoaded:Number;
var duration:Number;
stream_ns["onMetaData"] = function(obj) {
duration = obj.duration;
}
function videoStatus() {
amountLoaded = stream_ns.bytesLoaded / stream_ns.bytesTotal;
loader.loadbar._width = amountLoaded * 297.9;
loader.scrub._x = stream_ns.time / duration * 297.9;
}
var scrubInterval;
loader.scrub.onPress = function() {
clearInterval(videoInterval);
scrubInterval = setInterval(scrubit,10);
this.startDrag(false,0,this._y,289,this._y);
}
loader.scrub.onRelease = loader.scrub.onReleaseOutside = function() {
clearInterval(scrubInterval);
videoInterval = setInterval(videoStatus,100);
this.stopDrag();
}
function scrubit() {
stream_ns.seek(Math.floor((loader.scrub._x/289) * duration));
}
_root.createEmptyMovieClip("vSound",_root.getNextHighestDepth());
vSound.attachAudio(stream_ns);
var so:Sound = new Sound(vSound);
so.setVolume(100);
mute.onRollOver = function() {
if (so.getVolume() == 100) {
this.gotoAndStop("onOver");
}
else {
this.gotoAndStop("muteOver");
}
}
mute.onRollOut = function() {
if (so.getVolume() == 100) {
this.gotoAndStop("on");
}
else {
this.gotoAndStop("mute");
}
}
mute.onRelease = function() {
if (so.getVolume() == 100) {
so.setVolume(0);
this.gotoAndStop("muteOver");
}
else {
so.setVolume(100);
this.gotoAndStop("onOver");
}
}
Here is the XML
<?xml version="1.0" encoding="ISO-8859-1"?>
<videos>
<video url="http://fimm.tv/09072007.flv" desc="Come & Drink - Linda Faith" thumb="test.jpg" />
</videos>
</xml>