It is an error on your part as the function works fine...
code:
var MediaInfo = new Array();
function OnEvent_MyMediaChange(NewMedia){
MediaInfo = parseMedia(NewMedia);
for(i in MediaInfo){
Debug.Trace(i+" - "+MediaInfo[i]);
}
}
function parseMedia(Media) {
var mediaExp = /^\\0([a-z]+)\\0([0-1])\\0(.*)\\0(.*)\\0(.*)\\0(.*)\\0(.*)\\0$/i;
if(typeof(Media) == "string" && mediaExp.test(Media)) {
var arr = new Array();
arr['Type'] = RegExp.$1;
arr['Enabled'] = RegExp.$2;
arr['Format'] = RegExp.$3;
arr['Title'] = RegExp.$4;
arr['Artist'] = RegExp.$5;
arr['Album'] = RegExp.$6;
arr['ContentId'] = RegExp.$7;
Debug.Trace(arr);
return arr;
} else {
return false;
}
}
That works perfectly