|
|||
|
hello
i have a prom displaying the values of an array in Actionscript. here is the code of what i m doing in Ffish Script. Code:
getCatID = FlashPlayer.getVariable("firstSearch");
res = new Array();
subCat2 = conn.Execute("select * from customers where cat2 ='"+getCatID+"'");
var num_columns = subCat2.Fields.Count();
for (i = 0; i < num_columns; i++){
res[i] = subCat2.Fields[i];
}
FlashPlayer.putArray("_root.res", res);
pl guide. thanks in advance. : :![]() |
|
|||
|
thanks, now it displays the values
thanksbut what is happening is, the values displayed are only of the last one 'row' and not all the 'rows' in the database file. what i want is all the rows containing the search field (firstSearch) should be stored in the array and then displayed in ActionScript. just like the example in the "Samples - Database and reporting", where the data is displayed one by one, i like to display all at a time with the help of an array. i hope u understand what i m tring to say. can u pl suggest what to do?? |
|
|||
|
If you realy want to do this with arrays, you have to make a multidimensional array
Unfortunatly the putArray doesn't work with multidimensional arrays You could make a false array by joining the array element with a delimitator like "|" So to make this false array you can do like this in SWFkit Code:
getCatID = FlashPlayer.getVariable("firstSearch");
res = new Array();
subCat2 = conn.Execute("select * from customers where cat2 ='"+getCatID+"'");
num_columns = subCat2.Fields.Count();
var subCat2 = new ActiveXObject("ADODB.Recordset");
subCat2.open("select * from Vakken", conn, 1, 2);
subCat2.moveFirst();
while (!subCat2.eof()){
for (i = 0; i < num_columns; i++) {
res[i]+="|"
res[i] += subCat2.Fields[i];
subCat2.moveNext();
}
}
subCat2.close();
FlashPlayer.putArray("_root.res", res);
In flash you then have to split the strings into arrays like this (when you are sure the data has reached flash) Code:
for(i=0;i<res.length;i++){
res[i] = res[i].split("|")
}
Its a bit complex. The example in the sample section uses binddata and no arrays. It has fewer codes |
|
|||
|
sorry, some balast in the code
Code:
getCatID = FlashPlayer.getVariable("firstSearch");
res = new Array();
var subCat2 = new ActiveXObject("ADODB.Recordset");
subCat2 = conn.Execute("select * from customers where cat2 ='"+getCatID+"'");
num_columns = subCat2.Fields.Count();
subCat2.moveFirst();
while (!subCat2.eof()){
for (i = 0; i < num_columns; i++) {
res[i]+="|"
res[i] += subCat2.Fields[i].value;
subCat2.moveNext();
}
}
subCat2.close();
FlashPlayer.putArray("_root.res", res);
trace("res is " +res)
|
|
|||
![]() now its working. but it gives the correct answers only when the query is as follows Code:
conn.Execute("select names from customers where cat2 ='"+getCatID+"'");
??? if the query is as follows Code:
conn.Execute("select * from customers where cat2 ='"+getCatID+"'");
|
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|