Solved

send variables to a text file

Posted on 2003-10-27
19
360 Views
Last Modified: 2010-04-03
I know how to import variables from a text file into a flash file.
But I'd like to do the reverse ..then to send variables from an imput field inside my flash file to a text file on the distant server (in fact where my swf file is). And after that, this new created text file could be used by another swf file loading variables inside this text file.
0
Comment
Question by:yougy
  • 9
  • 6
  • 4
19 Comments
 
LVL 27

Expert Comment

by:negatyve
ID: 9629030
0
 

Author Comment

by:yougy
ID: 9629791
Thanks but I have a problem
I put the swf file in the root folder and also the pagina.asp (inetpub/wwwroot).
When I play the movie and fill in the input field and press the button, I suppose I need to play after the pagina.asp to create the text file. In fact, it's created but it is empty.
I tried also with php and it's the same. The text file is created with 'content=' written inside but no variable.
What's wrong ? Do I need to insert the 'object tag' (for the swf file) inside the pagina.asp. I don't think so.
Also I need in fact to send most than one variable (on different scenes and on different levels) to the text file AND I need to keep visible all datas inserted in those differents 'input fields' BEFORE I push the button sending all those variables to the text file.
Thanks in advance
0
 
LVL 27

Expert Comment

by:negatyve
ID: 9629827
>Also I need in fact to send most than one variable (on different scenes and on different levels) to the text file AND I need to keep
>visible all datas inserted in those differents 'input fields' BEFORE I push the button sending all those variables to the text file.

visible *where*?

(do you prefer a example with asp or php?)
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

Author Comment

by:yougy
ID: 9630096
To be well understood, I'm trying to developp a flash application in order to create 'swf file' from templates on my server...like this one :
http://www.jiwang.org/portal/modules/Flash_IntroBuilder/
I would like also a preview button and a save button saving the template (with his related text file and his variables) in a specific folder (named with the login of this user) not locally but on the server


I prefer to work with ASP but if you see the only solution with php, it's ok.
Thanks in advance.
0
 
LVL 27

Expert Comment

by:negatyve
ID: 9630641
>To be well understood, I'm trying to developp a flash application in order to create 'swf file' from templates on my server...like this one :

well, this board is about "help" with flash developing, not on "developing" them from scratch.. :)

my example should show you how you can write a variable inside a text file. but nothing stops you from joining thirteen variables in one unique string, and save it...
are you sure that the asp example create only an empty text file? Are you trying the example from an html page viewed by your web server?
0
 

Author Comment

by:yougy
ID: 9631857
the example is only to give information about my objectives but I didn'y expect from you all the application of course. ;)
My test was made on the same pc with IIS on it. In the wwwroot, I put an html page for the swf object called 'movie.html' and on the same level there is the pagina.asp.
Then I suppose firstly I have to play the html and after the asp page. But it doesn't work !
0
 
LVL 23

Expert Comment

by:Saqib Khan
ID: 9634825
negatyve  I tested your PHP Version and you have a problem in it.

 > loadVariablesNum("pagina.php", 0, "POST");
is Placed on the Button without any Event.

either put it in the button using event or place it on the MAIN Timeline.
0
 
LVL 27

Expert Comment

by:negatyve
ID: 9634892
wow, it was an oversight creating the two examples..
many thanks, adilkhan! :)
0
 

Author Comment

by:yougy
ID: 9637482
Any idea ?
0
 
LVL 23

Expert Comment

by:Saqib Khan
ID: 9637512
Did you fix the Error Suggested Above?
0
 

Author Comment

by:yougy
ID: 9638919
not yet.
But could you please tell me if the swf should be place on a first html page (or maybe an asp/php page) OR on your asp (php) page directly with the script suggested ?
0
 
LVL 23

Expert Comment

by:Saqib Khan
ID: 9639246
Nope.
SWF Could be plcaed on any HTML Page , Important Thing is the Path within Flash.

in Flash Put this on your Main TimeLine

 > loadVariablesNum("pagina.php", 0, "POST");
This is Where you Define Path.

But Make sure Swf  HTML file and pagina.php file are within Same folder. Flash will Automaticaly Load the Variables within the ASP/PHP file.
Also Make sure Files are saved under Your Server's  Root Directory so you can run Server Side Scripts.
0
 

Author Comment

by:yougy
ID: 9648587
I tried your solution an it'working with php BUT not with asp. I think there is a problem with asp.
0
 
LVL 27

Expert Comment

by:negatyve
ID: 9648623
>I tried your solution an it'working with php BUT not with asp. I think there is a problem with asp.

what problem?
0
 

Author Comment

by:yougy
ID: 9648944
It doesn't create a text file
0
 
LVL 27

Accepted Solution

by:
negatyve earned 500 total points
ID: 9648952
do you have write permission on that folder?
0
 

Author Comment

by:yougy
ID: 9649055
yes
0
 
LVL 23

Expert Comment

by:Saqib Khan
ID: 9650692
Did u use this function

fpath = Server.Mappath("f.txt")
if fso.FileExists(fpath) then

' write to file

else

'Create Text file

end if

???
0
 

Author Comment

by:yougy
ID: 9652398
I had only this example :

<%
Dim objFSO, objTextFile

Set objFSO = CreateObject("Scripting.FileSystemObject")

'choose one
'Set objTextFile = objFSO.CreateTextFile("C:\Inetpub\wwwroot\text.txt")
Set objTextFile = objFSO.CreateTextFile(Server.MapPath("text.txt"))

'Scrivo la prima riga di codice
objTextFile.WriteLine request("text_var")

'Chiudo il file e i vari oggetti/istanze
objTextFile.Close
Set objTextFile = Nothing
Set objFSO = Nothing
%>
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question