flash data integration:
I can't find a way to fix this.
1. The scenario: A web service is reading the nodes of an XML file and
represting them into arrays.
2. A Flash UI is binding to these webservice methods (which return arrays) to
Actionscript arrays.
------
Here is the code:
1. The XML structure:
<songs>
<song><label>Song1</label><data>mp3/song1.mp3</data></song>
<song><label>Song2</label><data>mp3/song2.mp3</data></song>
</songs>
2. The webservice method:
[WebMethod(Description = "Get the song title", CacheDuration = 1)]
public String[] GetMp3SongLabel() {
ArrayList Mp3SongLabel_arraylist = new ArrayList();
XmlTextReader reader = new
XmlTextReader(http://localhost/mp3/mp3.xml");
reader.WhitespaceHandling = WhitespaceHandling.None;
while (reader.Read()) {
if (reader.Name == "label") {
Mp3SongLabel_arraylist.Add(reader.ReadString());
}
}
reader.Close();
String[] Mp3SongLabel_array = (String[])
Mp3SongLabel_arraylist.ToArray(typeof(String));
return Mp3SongLabel_array;
}
3. The AS code:
import mx.services.WebService;
//creating the webservice
var Mp3Player_service:WebService = new
WebService("http://localhost/Mp3WebService.asmx?wsdl");
Mp3Player_service.onFault = function(fault) {
//show "Can't find the XML file"
Main.Mp3Player.Status_txt.text = "Can't find the XML file";
classes.GlobalClass.Mp3PlayerStatusText_str = Main.Mp3Player.Status_txt.text;
//trace the actual WebService error, generated automatically from Flash Player
trace(fault.faultstring);
}
var SongLabel_array:Array = new Array(Mp3Player_service.GetMp3SongLabel());
trace(SongLabel_array.length);
The Problem:
-> the trace function returns 1 as a length. The webservice method itself
bound to a aspx page returns the actual array. Similar binding to an
actionscript array doesn't do anything.
Any Solution?
------
Note: Please no examples and links for Flash Remoting, FlashOrb, etc. And no
examples with WebServiceConnector and visual binding.
I would appreciate pure code, in pure developer's way. If anyone could help,
will be great
------
Thanks,
Dimitar