Calling a video from Youtube.com in Flash through an XML -
I am trying to call a video in flash as2 from youtube.com. The video link is stored in the external XML file. Flash works fine when I try to make a video call with an exact FLV location, but whenever I try to call the YouTube URL I am stuck with the code I was wondering if the video is a specific Please start with GMT, which needs to be stored in XML, please help.
Here is the flash code:
security.Laudomain ("www.youtube.com"); Security.allowDomain ("*"); // Start XML Loading Loading XML file xmlData = new XML (); XmlData.ignoreWhite = True; XmlData.onLoad = loadXML; XmlData.load ("videos.xml"); // Paste the nodes of XML into an array function loadXML () {vidArray = new Array (); ANode = this.firstChild.childNodes; Len = aNode.length; For (var n = 0; n! = Len; n ++) {vidArray [n] = A node [n] .attributes.url; }} Output_vid.onEnterFrame = function () {trace (vidArray [0]); Output_vid.contentPath = vidArray [0]; }; And here is the XML code (video.xml)
& Lt; / Video & gt; please help !!
Load in XML Flash. Obtain the URL in your string, for example say "string3"
string3 = "http://www.youtube.com/watch?v=jYa1eI1hpDE"
Now "v /"
Var string array: replace "watch = v =" with "array = string3.split" ("watch? V ="); String3 = stringArray.join ("v /"); Now string3 = "http://www.youtube.com/v/jYa1eI1hpDE"
This is the exact FLV location on all YouTube videos .... Some And do not need to do
Comments
Post a Comment