Solved

send variables to a text file

Posted on 2003-10-27
19
358 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
 

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:adilkhan
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 23

Expert Comment

by:adilkhan
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:adilkhan
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:adilkhan
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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 …
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

708 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now