PDA

View Full Version : ASP->array->response.write->FLASH


rop65828
05-21-2002, 06:43 PM
ok i managed to create a Array with the names on it in ASP, now i want to pass them to flash
i know that in flash it should be something like this

set variable: "f_name" = eval ("name" & x)

am i right!?!?!?

And in ASP wath sould be the Response.Write like!?!?!?

snowedin
05-21-2002, 08:38 PM
I don't think you need to set the vars.
They are set when they are loaded.
I guess you could rename them, but why
not pass them with the proper names and
then just assign the var values.

If I pass this string from server to flash:
v0=test0&v1=test1&numRecords=2


Then in actions for frame foo you can say:

num=parseInt(numRecords);

for(i=0;i<num;i++){
duplicateMovieClip("textBox", "textBox" add i, i+1);
set("textBox"+i+".text", eval("v"+i));
setProperty ("textBox" add i, _x, someValue);
}

frame foo has a mc attached called 'textBox'
that is a dynamic text.

The result is 2 textboxes, called textBox0 and textBox1 which
say text0 and text1 respectively.

You can't pass the array from asp, so loop thru the array and assemble a string like the one at the top, and pass the string.

rop65828
05-23-2002, 02:42 AM
ok but i dont have a string i have a array... instead of doing

responsewrite("idx1=" &idx(1))
responsewrite("idx2=" &idx(2))
responsewrite("idx3=" &idx(3))
responsewrite("idxn=" &idx(n))

in ASP and in flash

load...
for (i=0;i<10;i++) {
idx(i)=bla bla...
}


wath should i do...

snowedin
05-23-2002, 03:13 AM
You have to assemble a string from your array.

Convert something like this to asp snytax -

for(i=0;i<array.length;i++) {
sendString = sendString. "&v" . i . "=" . array[i];
}

sendString= substr(sendString, 1); // remove the first character -
num = "&numRecords=" . array.length;
send = sendString . num;
echo "send";

Then proceed in flash as I described in last post.