I’m trying to use XML to make my video player easy to update 'cept it’s not really working. Can anyone here see the issue at hand? My eyes are too worn right now (been looking at it forever).:sen::crazy:
ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#808080]*/////////XML/////////////*[/COLOR]
[COLOR=#000000]function[/COLOR] loadXMLCOLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000ff]if[/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000ff]xmlNode[/COLOR] = [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]firstChild[/COLOR];
[COLOR=#0000ff]video[/COLOR] = [COLOR=#000000][[/COLOR][COLOR=#000000]][/COLOR];
tag = [COLOR=#000000][[/COLOR][COLOR=#000000]][/COLOR];
total = [COLOR=#0000ff]xmlNode[/COLOR].[COLOR=#0000ff]childNodes[/COLOR].[COLOR=#0000ff]length[/COLOR];
[COLOR=#0000ff]for[/COLOR] [COLOR=#000000]([/COLOR]i=[COLOR=#000080]0[/COLOR]; i<total; i++[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000ff]video[/COLOR][COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR] = [COLOR=#0000ff]xmlNode[/COLOR].[COLOR=#0000ff]childNodes[/COLOR][COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR].[COLOR=#0000ff]childNodes[/COLOR][COLOR=#000000][[/COLOR][COLOR=#000080]0[/COLOR][COLOR=#000000]][/COLOR].[COLOR=#0000ff]firstChild[/COLOR].[COLOR=#0000ff]nodeValue[/COLOR];
tag[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR] = [COLOR=#0000ff]xmlNode[/COLOR].[COLOR=#0000ff]childNodes[/COLOR][COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR].[COLOR=#0000ff]childNodes[/COLOR][COLOR=#000000][[/COLOR][COLOR=#000080]1[/COLOR][COLOR=#000000]][/COLOR].[COLOR=#0000ff]firstChild[/COLOR].[COLOR=#0000ff]nodeValue[/COLOR];
[COLOR=#000000]}[/COLOR]
ns.[COLOR=#0000ff]play[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#000000]}[/COLOR] [COLOR=#0000ff]else[/COLOR] [COLOR=#000000]{[/COLOR]
content = [COLOR=#ff0000]“file not loaded!”[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR]
xmlData = [COLOR=#000000]new[/COLOR] [COLOR=#0000ff]XML[/COLOR]COLOR=#000000[/COLOR];
xmlData.[COLOR=#0000ff]ignoreWhite[/COLOR] = [COLOR=#000000]true[/COLOR];
xmlData.[COLOR=#0000ff]onLoad[/COLOR] = loadXML;
xmlData.[COLOR=#0000ff]load[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#808080]/////////////////////////////////[/COLOR]
[COLOR=#000000]var[/COLOR] nc:[COLOR=#0000ff]NetConnection[/COLOR] = [COLOR=#000000]new[/COLOR] [COLOR=#0000ff]NetConnection[/COLOR]COLOR=#000000[/COLOR];
nc.[COLOR=#0000ff]connect[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#000000]var[/COLOR] ns:[COLOR=#0000ff]NetStream[/COLOR] = [COLOR=#000000]new[/COLOR] [COLOR=#0000ff]NetStream[/COLOR]COLOR=#000000[/COLOR];
ns.[COLOR=#0000ff]setBufferTime[/COLOR]COLOR=#000000[/COLOR];
myVideo.[COLOR=#0000ff]attachVideo[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#808080]//path = “videos/”;[/COLOR]
[COLOR=#808080]//ns.play(path+“part1.flv”);[/COLOR]
[COLOR=#808080]//ns.play(video[p]);[/COLOR]
ns.[COLOR=#0000ff]onStatus[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000ff]if[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#0000ff]object[/COLOR].[COLOR=#000080]code[/COLOR] == [COLOR=#ff0000]“NetStream.Play.Start”[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#000000]}[/COLOR] [COLOR=#0000ff]else[/COLOR] [COLOR=#0000ff]if[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#0000ff]object[/COLOR].[COLOR=#000080]code[/COLOR] == [COLOR=#ff0000]“NetStream.Play.Stop”[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000ff]loadMovieNum[/COLOR][COLOR=#000000]([/COLOR]tag[COLOR=#000000][[/COLOR]p[COLOR=#000000]][/COLOR], [COLOR=#000080]1[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#808080]//loadMovieNum(“logo.swf”, 1);[/COLOR]
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR];
[COLOR=#808080]*//////////////////////// *[/COLOR]
[/LEFT]
[/FONT]
Here’s my XML. the file is called ‘videos.xml’
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<programs>
<videos>
<video>/flvs/part1.flv</video>
<tag>logo.swf</tag>
</videos>
</programs>
Thanks!