Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi all I am working on a cd-rom c 2

Status
Not open for further replies.

ladycoder

Programmer
Jun 26, 2003
11
GB
Hi all
I am working on a cd-rom catalogue with shopping cart facility which basically adds slelected options from the swf file to a txt file in the same folder then uploads it to print off the list.
On my PC it works fine but I didint realise that the txt file would not be able to be written to if it is on a CD so I need a way to either collect the selections elsewise, or need to be able to save a txt file onto the users hard disk and then use that location ( need to know it) to loadup the variables later. Or possibly download the whole thing onto their hard disk in a folder by itself so it can work from there?
I dont want any third party tools and I cant pay for it so if there is any genius that can think of a way (I am using flash 5) i would like to know pls!!
thx
Shaf
 
There is a fscommand in Flash 5 that you can use in executables.

By putting this on a button it will save a text file called this and it will contain all the info that is in your dynamic text fields.

on (release) {
fscommand ("save", "this.txt");
}

Hope this helps.
 
Hi
I have been using
fscommand("Save","text.txt");
loadvariablenum("text.txt","0");
which worked fine when the txt file was in the same folder as the swf file.
I am now using the fscommand to save to program files:
fscommand("Save","C:\\Program Files\\text.txt");
quite successfully, but loadvariablenum can't read the file back which I need desperately.

Is there such a thing as:
fscommand("Read","C:\\Program Files\\text.txt");
or
fscommand("Load","C:\\Program Files\\text.txt");
at all? To rad the file back into the swf file?

If I can get the file read that would be everything i need with a sweet morrello cherry on the top.
THAT way I intend to write from a CDRom onto the users Program Files and read from it to make my shopping cart work.
Can you help?
thx
Shaf
Ps dont forget I amusing flash 5.

 
I have never worked with that but as far as I know one can use the local shared object to store little amounts of data. I just don't know if that is only possible when using the installed Flash-Player or if this is available when working with an exe-file on a CD too.


might be worth giving a look

regards

tektips.gif
 
How about...

loadVariablesNum("C:\\Program Files\\text.txt", 0);

Works for me!

Regards,

cubalibre2.gif
 
Using that I get:
Error opening URL "C:\Program Files\text2.txt"
popping up which I presume means it is not located and thus not opening it which is why I am not getting any data from the file,
How is it that I can write to the file but not read from it??
How crazy is that?
shaf
 
that should have read as text.txt -not text2.txt btw
Shaf
 
Well as I said works fine for me! Did you use the exact same syntax? Are you sure the file is there?



Regards,

cubalibre2.gif
 
ok heres the latest.
YES it does call up the contents of the file in the other folder.
However whats happening that is throwing me, is that when I had this all in one folder i could get the selections to be appended to the file from the diferent swf files that i had.
I just opened the file on the first frame, loaded up the variables then appended more selections them saved it again. This second bit was on a button.
So: select select select hit button, everything now on txt file.
thing is.
I am now not getting that appending action.
even though I have changed nothing but the location of the txt file.
I did a trace on the

loadVariablesNum ("C:\\Program Files\\text2.txt", 0);
in the first frame but it doesnt seem to be filling up the _root.selection variable. This is possibly why it is not then appending to anything.
can anyone help?

thx
Shaf
 
....its all gone quiet all of a sudden..
I assure you Iam not mad. I have tested and re-tested this and I am right.
When I first called up the swf file with 'loadVariablesNum' I could use this:

_root.selection = _root.selection add ", " add _root.temp;
fscommand ("Save", "text.txt");
loadVariablesNum ("text.txt", 0);

where temp was the new selection.
this gave me my accruing action.

Now- the txt file is in 'program files' ie a different place and I cannot open the txt file via my swf file. I seem to be ok writing to it but because I cant call the txt file contents it does not append - it replaces.
I made a test html file that can call the txt file and read it and I have given thought to having everything converted from SWF to html which I have tried but I lose button functionality. (Grr...)
is this the point where one gives up goes out to the cinema and buys a huge carton of popcorn and drowns their sorrows in an over priced cola?
Because thats what its come to for me.
Matrix here I come.
If anyone can solve this particular conundrum please let me know asap. I dont think this is a logic error on my behalf I think it is a limiting factor of the code. SO: if anyone has any bright alternatives to my approach dont be shy. I am not far of from completing it and would really like someone to help. I think something like adding another middle step might be involved but i cant think straight.
so to iterate:
swf files can write to only. an HTML file can only read out of,
and I need to read in swf so I can append.
If there is another way I can append ie: transfer the variable selection DIRECT to another swf file that would be heaven sent.


thanks
SHaf
 
Hope you enjoyed The Matrix!

Try this...

fscommand("Save","C:\\Program Files\\text.txt");

And...

loadVariablesNum ("file://C:/Program Files/text.txt",0);

Regards,

cubalibre2.gif
 


YABBA - DABBA - DOOOOOOOOOOO!!!!
OOOOOOOOOOOOOOH- YES!!!
IT LIVES!!!

Do you know what? I have been to 'hell' and back with this one- forget the 'Event Horizon' that was sissy girls pants compated to this!
I have trapesed around more forums than I can recollect and asked more people than was wise (if i wanted to keep my cool positive know all exterior) and got zip.

I really must thank you most profusely- i have tried this and it works but i am going to extensively test starting noon today as i have 'heaps' on my plate.
but <gushing> thank you!!!!!!!!!
oh and i never made it to matrix but I got to see Bruce Almighty and i am glad i did -made me laugh even though i had such a sour face even Homer Simpson sucking that lemon drop had nothing on me!
anyone that has seen that newscaster bit, talking gobbildy -gook will know wht I mean. I felt like that was me trying to explain my problem to the world!
after all this I hope it is ok on the extensive tests! I am sure it will be.

thanks ( in case I never mentioned it)
shaf
:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top