thanks,
I'll check it out.
Anyway I found a way, fixing slightly the web service code as:
[WebMethod(Description = "Get the song title", CacheDuration = 1)]
public String[] GetMp3SongLabel() {
ArrayList Mp3SongLabel_arraylist = new ArrayList();
int i = 0;
String[] my_array = new String[10];
XmlTextReader reader = new XmlTextReader(Mp3Dir + "mp3.xml");
reader.WhitespaceHandling = WhitespaceHandling.None;
while (reader.Read()) {
if (reader.Name == "label") {
//Mp3SongLabel_arraylist.Add(reader.ReadString());
my_array = reader.ReadString();
i++;
}
}
reader.Close();
//String[] Mp3SongLabel_array = (String[])
Mp3SongLabel_arraylist.ToArray(typeof(String));
//return Mp3SongLabel_array;
return my_array;
}
-------------------
And then I found another solution, beautiful to be injected directly in a
Flash DataSet, and then used the dataset objects freely everywhere around the
UI. The XML should be changed so to include attributes, as: <song label=""
data="" />.
And then you can create directly array of objects, bind them in Flash in a
DataSet and play around with them in arrays, objects, or whatever you like
format.
Could be of help to someone, as .NET webservice examples are really limited
(for now):
public class Song {
public String label;
public String data;
}
public class myWebService : System.Web.Services.WebService {
public myWebService() {
}
[WebMethod(Description = "Get the songs as objects with properties",
CacheDuration = 1)]
public Song[] GetMp3Songs() {
Song[] Songs_array = new Song[10];
int i = 0;
XmlTextReader reader = new XmlTextReader(Mp3Dir + "mp31.xml");
reader.WhitespaceHandling = WhitespaceHandling.None;
while (reader.Read()) {
if (reader.Name == "Song") {
Songs_array = new Song();
Songs_array.label = reader.GetAttribute(0).ToString();
Songs_array.data = reader.GetAttribute(1).ToString();
i++;
}
}
reader.Close();
return Songs_array;
}
}