Load external FLV into Flash via XML

moralec
moralec used Ask the Experts™
on
I have been trying to load an external FLV into my flash movie via XML.  I got one solution from EE but something is still not working correctly.  I am trying to load a single FLV with a small headline. Currently the headline loads correctly, but loading the flv via a variable passed through XML is not working.  I have uploaded an archive of my files at

http://winkmediagroup.com/documents/clienthost/archive.zip

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
well first of all your xml tag is closed wrong.  you had menu when it shouldve been movies.

then in your actionscript you had sVideoPath = this.firstChild.childNodes[0].attributes.path; when you shouldve changed path to url which is the actual attribute name.

on your button code that launches video add this and delete what you have.

on (release) {
  var nc:NetConnection = new NetConnection();
  nc.connect(null);
  var ns:NetStream = new NetStream(nc);
  theVideo.attachVideo(ns);
  ns.play(sVideoPath);
}
I replaced your flv placeholder with an empty video holder. look around and you'll see the changes. nothing major.

http://www.hybridart.com/test/working_MDB_WinnersXML.zip

Author

Commented:
Thank you soooooo much!

Author

Commented:
Ok I'm almost there...

The video is to be loaded and played without user initiation.  Currently it appears to be loading but the FLV is paused.

I've re-uploaded my files to
http://winkmediagroup.com/documents/clienthost/archive.zip

Any help is greatly appreciated
ok, all you do is this.

take this part of the code

      var nc:NetConnection = new NetConnection();
      nc.connect(null);
      var ns:NetStream = new NetStream(nc);

and remove it from where you have in in the xml if statement...and move it above or around the top variables for the headline and url.  below code is how it works.

// These two variables will contain the information from the XML
var sVideoPath :String = "";
var sVideoDesc :String = "";
//Create NetConnection and NetStream for video playback
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
// This is the code to load the XML
var contextXML:XML = new XML();
contextXML.ignoreWhite = true;
contextXML.load('video.xml');
contextXML.onLoad = function(success){
  if (success){
    // This code sets the two variables to the information in the XML
    sVideoPath = this.firstChild.childNodes[0].attributes.url;
    sVideoDesc = this.firstChild.childNodes[0].attributes.headline;
   //Attach the video to the stream and play it
    theVideo.attachVideo(ns);
    ns.play(sVideoPath);
     }      
}

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial