Solved

Simple Flash MX 2004 Question

Posted on 2003-11-12
16
348 Views
Last Modified: 2010-08-05
Can you write flat files in MX 2004 pro ?  I need to introduce some type of logging capabilities.  I'll need to store some user session data in some type of collection object and then write it to a file.  Is this possible?  


Do collection objects exist?  If not.....is there any type of struct, enumeration, dictionary object, multi-dimensional array or anything of that nature to store my data during a user session?

thanks

knoxxx
0
Comment
Question by:JohnnyKnoxville
  • 7
  • 6
  • 3
16 Comments
 
LVL 5

Expert Comment

by:Calron
Comment Utility
You can't write files driectly from flash. There is something similar to cookies though:

http://www.macromedia.com/support/flash/action_scripts/local_shared_object/

If you need to write files you will have to go through php, asp, or something like that.
0
 
LVL 22

Expert Comment

by:rascalpants
Comment Utility
can you explain your project a little better...  It helps to know what you want to do...

but it seems that all you need to do is store some variables and then have them sent to a new file...


what will the new file be used for?  


rp
0
 

Author Comment

by:JohnnyKnoxville
Comment Utility
Im making educational software and need to track the user's progress, grade, response time, etc...

I was planning on writing this data to a file at the end of the assignment (or session).  If the user closes the program....I'll like to use some type of terminate event that I can store all the data prior to the app closing.  Then I can have another app that can control the reporting functionality.  How bout XML?  can I store all of the session data and write it to an XML file?  What about shared objects?  just learning as I go.  Not really familiar with flash.

thanks,

knoxxx
0
 
LVL 5

Expert Comment

by:Calron
Comment Utility
It depends whether you have your application online or if you are planning to have it executed locally. If you run it online you will have to go through php or asp no matter what, as you can't save files directly from flash. You can easily write some kind of script that will let you save an xml.
I would not wait until the application finishes, as there is no way to detect when a user closes the browser. You would have to continually update your file.

The same would be if you  run as an application. But there you will need a third party software that will let you save files. Have a look at:
http://www.multidmedia.com/software/flashstudio/
0
 

Author Comment

by:JohnnyKnoxville
Comment Utility
I will be running this as a standalone application.  What is meant by a projector?  Is this just the app window?  If Im running as a standalone app......cant I just store all of the data as shared objects?......and then send it to an XML document?  That way the data will persist even if the application is closed.  I suppose I could just log the data for reports when the user actually completes an exercise.  Im brand new so any help you can provide is greatly appreciated.  Im learning through tutorials as fast as I can. :)


thanks,

knoxxx
0
 
LVL 5

Expert Comment

by:Calron
Comment Utility
If you want to make a standalone application you will not be able to use shared objects. You will have to use a third party tool like the link I posted to be able to save files. You can save the files in whatever format you want (i.e. xml). The only drawback is that you will have a hard time finding such applications for mac if you needed it. The saaving after each exercise is a good idea.
0
 
LVL 22

Accepted Solution

by:
rascalpants earned 50 total points
Comment Utility
Calron,

that is incorrect!  a standalong application can use Shared Objects just like a SWF in a browser...

I created a simple example that acts like a timed trial for a software program...  it uses stored objects to save the time and date of the first time the app is run, and then each time it checks to see it the time has expired.

the user can easily change or delete this shared object, but most won't even know that you are using shared objects and they also probably don't even know where they are stored on their machine...


The only problem with shared objects is if you plan on storing more than just a small amount of data...  I don't know the maximum limit, but I know they are like cookies and don't hold too much...

---------------------------------------------------------

As for saving any information to an external file or creating an external file, it can't be done with flash alone...  There is no way to have Flash(by itself) store the variables to a text, xml, or database file.   You have to use a 3rd party application or server side code(run on a server)

You could use the following method for this project:

- after each question is answered, you can update the shared object, and this will save all of the data while the user is taking the exam

- a variable is set in the shared object that indicates all of the questions have been answered, and what ever else you need to store.

- then you would try to send the variables to a server side page on the web, and have the results processed there...  if the user is not currently connected, a message is displayed that says "Please connect to the web to submit your results"

- Each time the user opens up that application, they can choose to try and submit the previous exam, and the variables will again try to be sent...


-----------------------------------------------

There is no way to save variables to an external file, except for shared objects, so you cannot create anything unless you connect to a server to process the results...  once you do, you can use PHP to save the results as a text file, or a dynamically generated PDF, or what ever...


there is no other option unless you buy some 3rd party software like the onces mentioned above....


rp

0
 
LVL 5

Expert Comment

by:Calron
Comment Utility
That's good to know. I never even tried to used shared objects in standalone apps. I always thought that it wouldn't work....
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 22

Expert Comment

by:rascalpants
Comment Utility
someone on this board asked for a way to disable(after trial was over) a stand alone app, and the only way that I would think of was to use a shared object...

I would be glad to post that example if you want to see it...  it was originally written for a normal desktop computer, but I was able to use the same techniques for the Pocket PC as well...


rp
0
 
LVL 5

Expert Comment

by:Calron
Comment Utility
Yes, please post the example, it's always good to have such examples
0
 
LVL 22

Expert Comment

by:rascalpants
Comment Utility
here you go:

http://www.kcnewmedia.com   /dev/so.zip

this is the Pocket PC version, but it will work on a regular PC as well...

rp
0
 
LVL 22

Expert Comment

by:rascalpants
Comment Utility
PS.  take out the spaces in the above link...

I don't want the search engines to index my files...

rp
0
 
LVL 5

Expert Comment

by:Calron
Comment Utility
Thanks a lot, I'll be trying this out ... :)
0
 
LVL 22

Expert Comment

by:rascalpants
Comment Utility
Johnny K,

what is the status, man?

rp
0
 

Author Comment

by:JohnnyKnoxville
Comment Utility
Thanks rascalpants.  That was very informative.  I noticed that when you use an XML connector.  The parameter tab shows 'send' , 'receive', and 'send/receive'.  Wouldnt this allow me to send data to an XML document?  If not....it seems misleading.   Thanks for all of the help everyone.


knoxxx
0
 
LVL 22

Expert Comment

by:rascalpants
Comment Utility
you can receive the document, but there is no way to actually create a document...  

I am definately not the expert on Flash and XML integration, but from what I have read, this is the way it works...

rp
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
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.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

763 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