| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Problem passing variables from asp to flash (load object)
Hi all,
I'm creating a website that needs to read some urls from a database into flash, and so I decideded to use asp and access 2007. At the moment everything works when I do dummy runs: >Asp gets the information form the database and prints out to a window >Flash takes the urls from a text file and adds it to some buttons. This would all be good and well if thats what I needed for my app to work, but the problem is that the movie should be reading the urls from the window which the asp file outputs. I've used Code:
countryInfo.load("http://127.0.0.1:8180/database_2.asp",countryInfo,"GET");
Which goes to the url in arg 1 to read the info into the load object (arg2). Arg 3 is just the type of loading ( to post variables to another place or get them from a place). There are no errors and I tested this function using: Code:
countryInfo.onLoad = function(success:Boolean):Void
{
if (success)
{
trace(countryInfo.toString());
}
else
{
//outputs if cant connect to database
trace("Error connecting to server.");
}
Which after a few debugging runs printed out success so I know it connects to the asp file. However...the urls didnt go to my buttons so I converted the loading object into a string in flash (using countryInfo.tostring()) so that I could see what was being sent back, and I tested the flash file with a text file then the asp file to make sure. I have different outputs for the text file (which works) to the web file (which doesnt)... The load object from the text file looks like this: ausUrl=null&onLoad=%5Btype%20Function%5D and the web one looks like this: %0D%0A%0D%0AausUrl=null%20%20%0D%0A%20%20&onLoad=%5Btype%20Function%5D I think the problem is that the flash file cant read the variable from the web load object (underlined). This is because the flash looks for a matching variable name, separating the name from the value using '=' and separating each variable from another using '&'. In the text load object its easy cos the variables are formatted correctly and so flash evaluates a match, but in the web load object has all of this %0D%0A%0D%0A noise which I dont know how to omit... If I cant get rid of that then flash assumes its all part of the variable name on the left side of the '=' and that on the right ( before the '&') its the value. So if Im looking for a match for ausUrl=null I wont get it because its like this: %0D%0A%0D%0AausUrl=null%20%20%0D%0A%20%20 how does one get rid of the noise?? Any help much appreciated as my boss is breathing down my neck ![]() |
|
#2
|
|||
|
|||
|
Hi to anyone who was reading i figured out what was wrong:
When you send a variable to flash from asp you need to use the Response.Write method. The problem was that flash must read data from an external file in a certain format I was getting lots of %%% because I needed to put an '&' infront of the variable that I sent from the asp file like this : 1) response.write "&variable=" & var1 but I wrote it in the asp file like this: 2) response.write "variable=" & var1 Doing this (1) gets rid of all of the %%% business because flash reads the '&' as an indicator to the next variable. Hope that was useful for anyone having the same probs ![]() |
![]() |
| Viewing: ASP Free Forums > Web Design > Multimedia > Flash Pro 8 and Asp probs |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|