all groups > flash actionscript > may 2005 >
You're in the

flash actionscript

group:

writing to a text file


writing to a text file mitcho
5/17/2005 12:00:00 AM
flash actionscript: i have a simple flash script that obtains numbers from a webpage and stores
them as variables..

can someone show me a script that will allow me to write a variable (which is
a number) to a text file.

and then i have a timer so that this variable will update every 5 mins, so i
will have to write it to the text file every 5 mins, so the script needs to be
able to clear the text file first and then write over it with the new variable?

any ideas?
Re: writing to a text file mitcho
5/17/2005 12:00:00 AM
david,
i did not mention the fact that i wish to embed the flash file in director
because it was irrelevant at the time.
i was hoping flash could write to a file and then i could use director to call
the file - but now i know that this is not possible with flash, so i mentioned
that i wished to embed the swf in director file in the hope that there is a way
to send variables to a director file.

i read up on FScommand() and i couldnt see anything there that would allow me
to send variables to a director file.

so is there no way that i can get my variables from within my flash file into
director file?
Re: writing to a text file apodkolinska
5/17/2005 12:00:00 AM
I have used Zinc v2 for this.

Re: writing to a text file mitcho
5/17/2005 12:00:00 AM
Re: writing to a text file apodkolinska
5/17/2005 12:00:00 AM
Re: writing to a text file apodkolinska
5/17/2005 12:00:00 AM
Yes! For a single item this will work perfectly... for a whole file of data, it's another story ;)
Re: writing to a text file mitcho
5/17/2005 12:00:00 AM
heres the thing, i get some numbers from a webpage using flash and php and
store them as variables in my flash file.

for example

var num1 = 500
var num2 = 452

i have these variables stored inside my swf.

i then embed my swf into a director file.... and i need to somehow parse these
two variables to my director file .. i thought the easiest way would be to
write the variables to a text file using flash and then access the text file
using director. is there an easier way to get these variables into the director
file if i cant write to txt using flash???


Re: writing to a text file mitcho
5/17/2005 12:00:00 AM
Originally posted by: apodkolinska
Yes! For a single item this will work perfectly... for a whole file of data,
it's another story ;)


as i said i have a few variables i want to write to a text file.
id like to write each variable to a seperate text file if possible.
can this be done with the sharedObject class you are talking about.... if so
how?
Re: writing to a text file David Stiller
5/17/2005 8:53:42 AM
[quoted text, click to view]

Look into the SharedObject class.


David
stiller (at) quip (dot) net
"Luck is the residue of good design."

Re: writing to a text file David Stiller
5/17/2005 10:10:43 AM
We went from "a simple flash script that obtains numbers from a webpage
and stores them as variables" to this ...

[quoted text, click to view]

So this is actually a question about how to pass variables into
Director. It may, in fact, have nothing to do with saving data to a text
file (which Flash cannot do, unlike Director).

Check out fscommand() and search that page for "lingo".


David
stiller (at) quip (dot) net
"Luck is the residue of good design."

Re: writing to a text file mitcho
5/18/2005 12:00:00 AM
changed the direction of my question and put it on director forums

Re: writing to a text file David Stiller
5/18/2005 9:50:07 AM
[quoted text, click to view]

It's entirely relevant. Mentioning the Director angle from the
beginning could have avoided your time wasted on the text file approach.

[quoted text, click to view]

That's probably not a bad idea. The ActionScript Language Reference
does mention this:

<quote>
Usage 3: The fscommand() function can send messages to Macromedia Director
that are interpreted by Lingo (Director's scripting language) as strings,
events, or executable Lingo code. If the message is a string or an event,
you must write the Lingo code to receive the message from the fscommand()
function and carry out an action in Director. For more information, see the
Director Support Center at www.macromedia.com/support/director.
</quote>

It's right in the fscommand entry. :)


David
stiller (at) quip (dot) net
"Luck is the residue of good design."

AddThis Social Bookmark Button