all groups > flash actionscript > september 2006 >
You're in the

flash actionscript

group:

Can not correctly Load data from external asp file?


Can not correctly Load data from external asp file? ricky1980
9/30/2006 1:57:40 PM
flash actionscript:
i have following actionscript in a frame:

myVars = new LoadVars();
myVars.onLoad = function(success){

if(success){
trace(this.peter);
trace(this.lastSiteVisited);
} else {
trace("false");
}
}
myVars.load("myData.asp");


and myData.asp

<% Response.Write "lastSiteVisited=hello&peter=345" %>

why it show the following trace result:

345"
undefined



Re: Can not correctly Load data from external asp file? kglad
9/30/2006 5:34:08 PM
Re: Can not correctly Load data from external asp file? ricky1980
10/1/2006 3:54:49 AM
[q][i]Originally posted by: [b][b]kglad[/b][/b][/i]
where is hello defined? if hello is supposed to be a string, it doesn't look
like one to your asp file.[/q]


The asp file should print out "lastSiteVisited=hello&peter=345"
The correct trace results should be 345 and hello.
But it shows 345" and undefined in the output window.
Could you know what is the problem ?

Thx

Ricky
Re: Can not correctly Load data from external asp file? kglad
10/1/2006 4:23:23 PM
yes, i just explained the problem in my above message. you think hello is a
string in your asp file, but your asp file thinks hello is a variable and that
variable is undefined. try:

<% Response.Write "lastSiteVisited='hello'&peter=345" %>
Re: Can not correctly Load data from external asp file? ggshow
10/2/2006 7:21:48 AM
your asp and actionscript are both correct, but please understand that asp is
server-side script, you should have it published on web server, but not loading
it locally.

<% Response.Write "lastSiteVisited=hello&peter=345" %>

look carefully, if you load it locally, you have 2 variables defined,

the 1st one is
"lastSiteVisited=hello

the 2nd one is
peter=345"

see?
your 1st variable is ----> "lastSiteVisited
with a quotation mark in front
your 2nd variable is peter, but its' value is -----> 345"
with a quotation mark behind

Re: Can not correctly Load data from external asp file? ggshow
10/2/2006 7:25:29 AM
if you load the asp file from server, flash receive the following string:
lastSiteVisited=hello&peter=345

but if you load it locally, flash receive the following string:
<% Response.Write "lastSiteVisited=hello&peter=345" %>

if you want to load it locally, you do not need to write asp file, just write
in a text file myData.txt the following line:
lastSiteVisited=hello&peter=345

then load it using:
myVars.load("myData.txt");

AddThis Social Bookmark Button