| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Registered User
Join Date: Jul 2006
Posts: 7
|
I'm trying to get Lee's code to work to no avail, does anyone see where I'm making a mistake? I belive is the XML part because the player works with
ns.play("http://mysite.com/sample.flv");(gets deleted by Lee to get items XML loaded) This is the code: ***************** var nc:NetConnection = new NetConnection(); nc.connect(null); var ns:NetStream = new NetStream(nc); theVideo.attachVideo(ns); ns.setBufferTime(10); ns.onStatus = function(info) { trace(info.code); 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); } var videoInterval = setInterval(videoStatus,100); 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() { clearInterval(videoInterval); scrubInterval = setInterval(scrubit,10); this.startDrag(false,0,this._y,208,this._y); } loader.scrub.onRelease = loader.scrub.onReleaseOutside = function() { clearInterval(scrubInterval); videoInterval = setInterval(videoStatus,100); 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("© 2005 Lee Brimelow",trace,true); theMenu.customItems[3] = item4; function pauseIt() { ns.pause(); } function stopIt() { ns.seek(0); ns.pause(); } function restartIt() { ns.seek(0); } var vlist:XML = new XML(); vlist.ignoreWhite=true; vlist.onLoad = function() { var videos:Array = this.firstChild.childNodes; for(i=0;i<videos.lenght;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.adddEventListener("change",vidList); vlist.load("videos.xml"); ************ XML is as per Lee, List has Instance -videoList_and all are in the same directory.Thanks |
|
|
|
|
|
#2 |
|
Banned by AS.org Staff
Join Date: Jan 2007
Location: Montréal, Québec
Posts: 14,074
|
Attach your .fla & .xml file.
|
|
|
|
|
|
|
|
|
#3 |
|
Registered User
Join Date: Jul 2006
Posts: 7
|
These are the changes:
// xml playlist // create an XMl object var vidList:XML = new XML(); // ignore white spaces vidList.ignoreWhite = true; vidList.onLoad = function() { // put the nodes of xml into array var videoArray:Array = this.firstChild.childNodes; // iterate through video array // and add videos to the listbox for (var i = 0; i<videoArray.length; i++) { videoList.addItem(videoArray[i].attributes.desc, videoArray[i].attributes.url); } // when xml is loaded play first item ns.play(videoList.getItemAt(0).data); // highlight first video in listbox videoList.selectedIndex = 0; }; // create a listener that responds // to changes in the listbox var vidListener:Object = new Object(); vidListener.change = function() { // play the item selected in listbox ns.play(videoList.getItemAt(videoList.selectedInde x).data); }; // register the event listener to listbox videoList.addEventListener("change", vidListener); // load xml file vidList.load("videos.xml"); |
|
|
|
|
|
#4 |
|
Banned by AS.org Staff
Join Date: Jan 2007
Location: Montréal, Québec
Posts: 14,074
|
One's never better served than by one's self!
![]() |
|
|
|
|
|
#5 |
|
Registered User
Join Date: May 2008
Posts: 10
|
i don't see any mistake.... this error is serious one...
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Square box (not rounded) for video chat application | artane | Flash Media Server | 5 | 11-29-2008 03:02 AM |
| Dynamic Playlist Help... | Gaffer | ActionScript 2.0 | 0 | 09-27-2007 03:00 AM |
| Interested in a free Flash video tutorial??? | Filipinho | Other Flash General Questions | 4 | 07-01-2002 02:41 AM |
| Free Flash video tutorial??? | Filipinho | Simple Stuff (Newbies) | 3 | 06-30-2002 08:58 AM |