NewAS
asked on
LoadVars - ASP to Flash Array
I have created a simple DataGrid and I am using the code below:
var content_lv:LoadVars = new LoadVars();
content_lv.onLoad = function(success:Boolean) {
if (success) {
UserGrid.addColumn("Title" );
UserGrid.dataProvider = content_lv.myGrid;
}
};
var fetch_content_lv:LoadVars = new LoadVars();
fetch_content_lv.name = content_t.text;
fetch_content_lv.sendAndLo ad("http://mydomain.com/search.asp?unitID=1&searchTV=book", content_lv, "POST");
My sample asp output looks like this:
myGrid={ID:"274", Title:"Book+1"},{ID:"275", Title:"Book+2"}
This output is the same as if I just cut and pasted the sample asp output and pasted like so into my actionsript:
var content_lv:LoadVars = new LoadVars();
content_lv.onLoad = function(success:Boolean) {
if (success) {
UserGrid.addColumn("Title" );
books = new Array(
{ID:"274", Title:"Book+1"},{ID:"275", Title:"Book+2"}
);
UserGrid.dataProvider = books;
}
};
var fetch_content_lv:LoadVars = new LoadVars();
fetch_content_lv.name = content_t.text;
fetch_content_lv.sendAndLo ad("http://mydomain.com/search.asp?unitID=1&searchTV=book", content_lv, "POST");
Obviously the cut and past isn't actually using the asp feed but it works and I think it is down to the use of quotes.
Does anyone know how to parse the ASP output to a Flash array to dynamically generate the DataGrid content?
Any help would be much appreciated.
var content_lv:LoadVars = new LoadVars();
content_lv.onLoad = function(success:Boolean) {
if (success) {
UserGrid.addColumn("Title"
UserGrid.dataProvider = content_lv.myGrid;
}
};
var fetch_content_lv:LoadVars = new LoadVars();
fetch_content_lv.name = content_t.text;
fetch_content_lv.sendAndLo
My sample asp output looks like this:
myGrid={ID:"274", Title:"Book+1"},{ID:"275",
This output is the same as if I just cut and pasted the sample asp output and pasted like so into my actionsript:
var content_lv:LoadVars = new LoadVars();
content_lv.onLoad = function(success:Boolean) {
if (success) {
UserGrid.addColumn("Title"
books = new Array(
{ID:"274", Title:"Book+1"},{ID:"275",
);
UserGrid.dataProvider = books;
}
};
var fetch_content_lv:LoadVars = new LoadVars();
fetch_content_lv.name = content_t.text;
fetch_content_lv.sendAndLo
Obviously the cut and past isn't actually using the asp feed but it works and I think it is down to the use of quotes.
Does anyone know how to parse the ASP output to a Flash array to dynamically generate the DataGrid content?
Any help would be much appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
var content_lv:LoadVars = new LoadVars();
content_lv.onLoad = function(success:Boolean) {
if (success) {
for (var i = 1; i<=31; i++) {
mydatagrid.addItem({ID:thi
};
};
};
var fetch_content_lv:LoadVars = new LoadVars();
fetch_content_lv.name = content_t.text;
fetch_content_lv.sendAndLo
var userListener = new Object();
userListener.change = function(event) {
trace(
"This ID: " + event.target.selectedItem.
" and the Title is: " + event.target.selectedItem.
);
};
mydatagrid.addEventListene
My sample ASP code:
If gObjRs.BOF and gObjRs.EOF Then
Else
Dim intRec, dataGrid
For intRec=1 To gObjRs.RecordCount
If Not gObjRs.EOF Then
dataGrid = dataGrid & "&ID" & intRec & "=" & gObjRs("book_ID") & "&Title" & intRec & "=" & gObjRs("book_title_TV") & ""
gObjRs.MoveNext
End If
Next
End If
Response.Write (dataGrid)
The above works like a charm, yippee.
Regards, NewAS.