Solved

Simple Flash MX 2004 Question

Posted on 2003-11-12
16
382 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
  • 3
16 Comments
 
LVL 5

Expert Comment

by:Calron
ID: 9739676
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
ID: 9739963
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
ID: 9743301
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Expert Comment

by:Calron
ID: 9745835
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
ID: 9745873
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
ID: 9745903
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
ID: 9748140
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
ID: 9748182
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
 
LVL 22

Expert Comment

by:rascalpants
ID: 9748264
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
ID: 9748299
Yes, please post the example, it's always good to have such examples
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 9748739
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
ID: 9748746
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
ID: 9748769
Thanks a lot, I'll be trying this out ... :)
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 9748989
Johnny K,

what is the status, man?

rp
0
 

Author Comment

by:JohnnyKnoxville
ID: 9750425
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
ID: 9750675
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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
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 motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
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.

749 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