Hello.

I've been working with Shared Objects recently and this is what I've
found... btw, these are only my assumptions on how they work.  (local
only)

If the object doesn't exist, Flash creates an object in memory to use
while your app runs.  Nothing is written to disk until you close the app
or execute a flush.  If you flush the data, the object is written to the
disk.  However, if you update the object and flush again the memory
object is written to the disk again completely overwriting the current
disk object.

The problem I've run into is trying to have two files "share" the same
shared object.  I had File 1 create a shared object and write some data.
I then had File 2 update that shared object with some new data.  I then
tried to have File 1 read that updated data... but it didn't work.  I
even tried to have File 1 write more data to the object then tried to
re-read it back into the file, but that didn't work either.  In fact,
File 1 over wrote the entry that File 2 added to the object.

My assumption is that Flash only reads an object from disk once and
creates a copy in memory.  It updates the memory copy and only writes
the data back to disk upon closing the file or executing a flush.  Every
subsequent read references the memory copy and does not re-read the disk
version... so after the first read, updates are one-way - memory to
disk.

My workaround was to have File 1 create and manage my main shared object
then have File 2 create a temp shared object that I read into File 1 and
write the data to my main shared object... then deleting the temp shared
object from File 1.  This seems to be working fine as File 1 does the
deleting and will re-read the new temp object when it is created again.

In your example, if you only have 1 file managing the shared object, you
should be able to read the data property and iterate through the
parameters you added and assign them back to the textfields on some
event.

Hope this helps.

Again, these are just my observations.

gregb





-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of ktt
Sent: Monday, November 02, 2009 2:26 AM
To: Flash Coders List
Subject: [Flashcoders] Update TextFields after SharedObject was updated

Hello,

I have two TextFields and their data written to SharedObject. How to
update these TextFields after data was updated in SharedObject?
Could you recommend any good resource?

Regards,
Ktt


      
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to