Flash > ASP help
- Started
- Last post
- 23 Responses
- stewart
i try to save the content of a textbox in an online Flash website via asp script to a .txt document on my webserver:
but, there is something wrong with the as or asp code.
offline it shows the error text in the swf file, online it does nothing.any tips & tricks?
here is the zipped version with all the files:
http://www.vahk.nl/aspsave.ZIP
- UndoUndo0
have you set up yr dsn for the db?
- stewart0
the dsn for the db?
don't know.
i thought i found a nice way to do it without db/mdb stuff.
it's hosted on a NT server, that should be enough, isn't it?
- stewart0
even when use all absolute paths like http://www.vahk.nl/aspsave/save.… it does nothing.
- UndoUndo0
sorry you dont have a db do you!
I'd check which folder you are trying to write too. If it is on a windows server then their is usually a folder called data which has read, write and execute permissions. you will need to save and update the text file there.
- UndoUndo0
It gave me the error!
- unfittoprint0
as you can see, there's an error in line 7 [probably an include path].
- stewart0
or do i have to store the .txt document in the access-db folder on the NTserver?
- tfsmag0
PathFile = Server.MapPath("aspsave/text.txt...
is wrong, when you use server.mappath it has to be from the root directory. this means if the aspsave folder is in your root directory your statement should look like this.
PathFile = Server.MapPath("/aspsave/text.tx...
hope this helps, the rest of your code looks correct.
- mcmagic0
Not sure if this is much help because its not using asp but you can do exactly what you want here using php and flash using a tutorial from
tutorial files
http://www.flash-db.com/Tutorial…
hope it helps
- stewart0
okay!
now i discovered i have to let the aspscript save the txt document in the access-db server.
i think this is the only map that allows writing files like UndoUndo said.BUT!
how can i get these variables from the .txt file BACK in flash?the path is ../../access-db/text.txt but that doesn't work
- stewart0
...or do i also need another asp script to get the variables from the txt file (in the access-db folder) BACK into Flash??
because with new LoadVars() it doesn't seem to work.
- stewart0
i'm so close to the solution!
the ONLY thing i need to know is how i take variables from a txt file (in the db folder) via asp into the Flash textbox.
anyone?
- unfittoprint0
In php , the answer would be to use the fopen function to read the txt file, create a variable to hold the file's content and 'echo' it to the LoadVars object.
there must be a similar way with ASP.
- System-Idle0
you dont need to use a backend script to pull the data from a txt file (only with a database)
you can use loadvars.
you must call the text file (url) from flash as if calling it from the html page with yr swf file in.
- System-Idle0
actually use loadVariables
and a loop (onEnterFrame or sim)to give the data time to load
- stewart0
thanks System-Idle,
but the problem is that the .txt file i want to get the variable from, is saved in the access-db folder on the NT server.
i tried both loadVars and LoadVariables and that didn't work.
- unfittoprint0
fthe first thing u should is to test the asp paga alone.
does it write/echo anything?
something like:
myvar=texttexttexttextgood? next:
when sending to flash you should url encoded (bypass spaces, special characters...)
in a php file the code would look like:
echo "$myvar=".urlencode($txt);
good? next:
if everything is ok, then the problem should be with flash.
you should create an event for the loadVars objects, that will trigger a function to parse you variable.
myVars = new LoadVars();
myVars.onLoad = function(success){
if(success){
textBox.text = this.myvar;
} else {
textBox.text = "error!!",
}//load the var | no cache
myVars.load("myfile.asp?".Math.r...
- unfittoprint0
*typo alert*
- stewart0
unfit, you're correct.
you can see that this is working here:
if you would like to write and save something here
http://www.vahk.nl/aspsave/you can read the saved txt file here
http://www.vahk.nl/aspsave/load.…but now i have to put those values back into flash.
- unfittoprint0
instead of load try using send and load
http://www.macromedia.com/suppor…