poindexter
%Europe/Berlin %815 %2006, 19:33
vraagje,
ook ik heb de tutorials op gotoandlearn gemaakt betreft de video player. Nu is het zo dat Lee gebruik maakt van een listbox waarin de lijst met videofilmpjes in getoont wordt.
Ik zou graag willen weten of het mogelijk is om op een andere manier een lijst te maken. Zodat wanneer ik een titel aan klik hij het filmpje afspeelt. zelf dacht ik aan gewoon een button en als je daar op klikt moet ie het filmpje afspelen in de player.
de ascode die ik gebruik is:
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
theVideo.attachVideo(ns);
ns.setBufferTime(10);
ns.onStatus = function(info) {
if(info.code == "NetStream.Buffer.Full") {
bufferClip._visible = false;
}
if(info.code == "NetStream.Buffer.Empty") {
bufferClip._visible = true;
}
if(info.code == "NetStream.Play.Stop") {
ns.seek(0);
}
}
playButton.onRelease = function() {
ns.pause();
}
rewindButton.onRelease = function() {
ns.seek(0);
}
this.createEmptyMovieClip("vFrame",this.getNextHighestDepth());
vFrame.onEnterFrame = videoStatus;
var amountLoaded:Number;
var duration:Number;
ns["onMetaData"] = function(obj) {
duration = obj.duration;
}
function videoStatus() {
amountLoaded = ns.bytesLoaded / ns.bytesTotal;
loader.loadbar._width = amountLoaded * 208.9;
loader.scrub._x = ns.time / duration * 208.9;
}
var scrubInterval;
loader.scrub.onPress = function() {
vFrame.onEnterFrame = scrubit;
this.startDrag(false,0,this._y,208,this._y);
}
loader.scrub.onRelease = loader.scrub.onReleaseOutside = function() {
vFrame.onEnterFrame = videoStatus;
this.stopDrag();
}
function scrubit() {
ns.seek(Math.floor((loader.scrub._x/208)*duration));
}
var theMenu:ContextMenu = new ContextMenu();
theMenu.hideBuiltInItems();
_root.menu = theMenu;
var item1:ContextMenuItem = new ContextMenuItem("::::: Video Controls :::::",trace);
theMenu.customItems[0] = item1;
var item2:ContextMenuItem = new ContextMenuItem("Play / Pause Video",pauseIt,true);
theMenu.customItems[1] = item2;
var item3:ContextMenuItem = new ContextMenuItem("Replay the Video",restartIt);
theMenu.customItems[2] = item3;
var item4:ContextMenuItem = new ContextMenuItem("© 2006 Tiep-iets",trace,true);
theMenu.customItems[3] = item4;
function pauseIt() {
ns.pause();
}
function stopIt() {
ns.seek(0);
ns.pause();
}
function restartIt() {
ns.seek(0);
}
_root.createEmptyMovieClip("vSound",_root.getNextHighestDepth());
vSound.attachAudio(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");
}
}
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.desc,videos[i].attributes.url);
}
ns.play(videoList.getItemAt(0).data);
videoList.selectedIndex = 0;
}
var vidList:Object = new Object();
vidList.change = function() {
ns.play(videoList.getItemAt(videoList.selectedInde x).data);
}
videoList.addEventListener("change",vidList);
vlist.load("videos.xml");
videoList.setStyle("selectionColor",0xFFFFFF);
videoList.setStyle("textSelectedColor",0x000000);
videoList.setStyle("rollOverColor",0xFFFFFF);
en dit de xml code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<videos>
<video url="http://www.ericayong.nl/Skoda.flv" desc="Skoda Reclame" />
<video url="http://www.ericayong.nl/Davitamon.flv" desc="Davitamon" />
<video url="http://www.ericayong.nl/senseo.flv" desc="Senseo" />
<video url="http://www.ericayong.nl/gtst.flv" desc="GTST" />
<video url="http://www.ericayong.nl/Hbs.flv" desc="Hot Black Stuff" />
</videos>
alvast bedankt
ook ik heb de tutorials op gotoandlearn gemaakt betreft de video player. Nu is het zo dat Lee gebruik maakt van een listbox waarin de lijst met videofilmpjes in getoont wordt.
Ik zou graag willen weten of het mogelijk is om op een andere manier een lijst te maken. Zodat wanneer ik een titel aan klik hij het filmpje afspeelt. zelf dacht ik aan gewoon een button en als je daar op klikt moet ie het filmpje afspelen in de player.
de ascode die ik gebruik is:
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
theVideo.attachVideo(ns);
ns.setBufferTime(10);
ns.onStatus = function(info) {
if(info.code == "NetStream.Buffer.Full") {
bufferClip._visible = false;
}
if(info.code == "NetStream.Buffer.Empty") {
bufferClip._visible = true;
}
if(info.code == "NetStream.Play.Stop") {
ns.seek(0);
}
}
playButton.onRelease = function() {
ns.pause();
}
rewindButton.onRelease = function() {
ns.seek(0);
}
this.createEmptyMovieClip("vFrame",this.getNextHighestDepth());
vFrame.onEnterFrame = videoStatus;
var amountLoaded:Number;
var duration:Number;
ns["onMetaData"] = function(obj) {
duration = obj.duration;
}
function videoStatus() {
amountLoaded = ns.bytesLoaded / ns.bytesTotal;
loader.loadbar._width = amountLoaded * 208.9;
loader.scrub._x = ns.time / duration * 208.9;
}
var scrubInterval;
loader.scrub.onPress = function() {
vFrame.onEnterFrame = scrubit;
this.startDrag(false,0,this._y,208,this._y);
}
loader.scrub.onRelease = loader.scrub.onReleaseOutside = function() {
vFrame.onEnterFrame = videoStatus;
this.stopDrag();
}
function scrubit() {
ns.seek(Math.floor((loader.scrub._x/208)*duration));
}
var theMenu:ContextMenu = new ContextMenu();
theMenu.hideBuiltInItems();
_root.menu = theMenu;
var item1:ContextMenuItem = new ContextMenuItem("::::: Video Controls :::::",trace);
theMenu.customItems[0] = item1;
var item2:ContextMenuItem = new ContextMenuItem("Play / Pause Video",pauseIt,true);
theMenu.customItems[1] = item2;
var item3:ContextMenuItem = new ContextMenuItem("Replay the Video",restartIt);
theMenu.customItems[2] = item3;
var item4:ContextMenuItem = new ContextMenuItem("© 2006 Tiep-iets",trace,true);
theMenu.customItems[3] = item4;
function pauseIt() {
ns.pause();
}
function stopIt() {
ns.seek(0);
ns.pause();
}
function restartIt() {
ns.seek(0);
}
_root.createEmptyMovieClip("vSound",_root.getNextHighestDepth());
vSound.attachAudio(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");
}
}
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.desc,videos[i].attributes.url);
}
ns.play(videoList.getItemAt(0).data);
videoList.selectedIndex = 0;
}
var vidList:Object = new Object();
vidList.change = function() {
ns.play(videoList.getItemAt(videoList.selectedInde x).data);
}
videoList.addEventListener("change",vidList);
vlist.load("videos.xml");
videoList.setStyle("selectionColor",0xFFFFFF);
videoList.setStyle("textSelectedColor",0x000000);
videoList.setStyle("rollOverColor",0xFFFFFF);
en dit de xml code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<videos>
<video url="http://www.ericayong.nl/Skoda.flv" desc="Skoda Reclame" />
<video url="http://www.ericayong.nl/Davitamon.flv" desc="Davitamon" />
<video url="http://www.ericayong.nl/senseo.flv" desc="Senseo" />
<video url="http://www.ericayong.nl/gtst.flv" desc="GTST" />
<video url="http://www.ericayong.nl/Hbs.flv" desc="Hot Black Stuff" />
</videos>
alvast bedankt