|
-
I'm working with Flash and ASP, because I need to show some database query results in flash fields. Could you please explain to me how can I do? How can the asp page transmit the variables to the flash textboxes?
thanks
Antonio
-
hi there,
use the load/unload action (flash 4), and make sure u select "load variables into location". specify the path to ur ASP in the location box, and set the level to "0". this will load the results from ur asp into flashes _level0.
In ur ASP script, response write out the variables u want to be return to flash seperated with "&" ie.
Code:
&result1=item1&
&result2=item2&
u will prob need ur flash movie u loop over 2 frames until it finds the variables it's looking for, as this is the only way to know when they have finished loading.
Mike
-
THANKS!!
-
Problems
I tried all what you told me, but now I have a problem:
the result printed in the flash application is not the value of "item1", but just the word "item1".
I created a flash application with a textfield named result1, with all the specifications you wrote;
then I also created an asp file with the code you wrote following the declaration
item1= "hello"
but what I saw was a texrbox with the word "item1".
Then, what have I to do in order to print a variable value in a flash field?
-
Right Ok
If you hit the url of your asp directly by typing it into a browser you'll find it's returning something like this:
Code:
&result1=item1&
&result2=item2&
Where as it should be returning something like this:
Code:
&result1=hello&
&result2=hello again&
Although in your asp code u may have defined item1="hello", you need to make sure that when you response write the output, you evaluate item1 as a variable, and not just hardcode in &result=item1&.
My ASP skills are not great, and I don't have any examples to hand, but what you need to do is something along the lines of this:
Code:
<%
Dim item1
Dim item2
item1 = "hello"
item2 = "hello again"
response.write("&result1=" & item1 & "&")
response.write("&result2=" & item2 & "&")
%>
I'm pretty sure that's right, but don't take that too literally as it might not be the correct syntax. It should point u in the right direction though, and when u hit the url in your broswer u should see that in returns the right variables (which is exactly what flash will receive).
Hope that works ok.
Mike
-
OK!
OK! it works perfectly. That is what I needed. Actually I had tried to use the "response.write" command, but not with the right syntax (the fields remained blank).... Now, it's ok.
Thanks!!
-
word to the third power
hey, if you are sending alot of data to Flash, make sure it's fed in as one long nasty line (especially useful when returning record sets):
-----------------------------------------------------
&category1=foo&value1=fooVal&category2=foofriend&v alue2=fooFriendVal&category3=thisIsStupid&value3=m e&recordcount=3&done=yes
-----------------------------------------------------
This way you got an emulated array. You have the count of items so you can duplicate the appropriate number of movie clips to display the data in, and you got that last variables "done" which you can loop to check for it's value being "yes" so you know when ALL your variables have been loaded from the script page.
Sample Code:
-------------------------------------
loop=1;
do{
duplicateMovieClip("displayCategory","displayCateg ory" add loop, loop);
eval("displayCategory" add loop add ":textField") = eval("category" add loop);
duplicateMovieClip("displayValue","displayValue" add loop, loop);
eval("displayValue" add loop add ":textField") = eval("value" add loop);
setProperty("displayCategory" add loop,_x,0);
setProperty("displayValue" add loop,_x,200);
Yval = loop*20;
setProperty("displayCategory" add loop,_y,Yval);
setProperty("displayValue" add loop,_y,Yval);
} while (loop <= recordcount);
-------------------------------------
enjoy.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|