Hi Guys,

I've always been interested in lso's and I have some interesting code that
wraps up the ability to save and load named datasets to an lso. I'll post it
to  both here and that forum, as combined with various user cases shared
objects can be confusing and error prone.

The code could definitely still be improved (the key/data dictionary seems
like it could be made simpler or more elegant in particular), but it's
probably incubator worthy as is.  If folk would be interested in adding it
to the language formally and would be willing to discuss it and how it can
be improved and properly integrated, I'd be very willing to do the work of
improving it and writeing up a formal "how to use it" for the docs and
adding the remaining use case that it doesn't handle (when the user has
lso's disabled). But are folk interested in it? It's definitely usefull in
my mind, but also definitely flash player specific.

In an ideal world what this would enable would be either a dataset or a set
of datasets for the user's ephemeral view state (stuff that doesn't really
need to be saved on the server, but would be nice to maintain) Once the data
is retrieved, get the view state to reflect the data. Another thing it can
be used for is a local file system.

Here is a basic example of how to use it to save and load user data locally,
it is a pair of comboboxes. The first combobox is populated with a dataset
that has 4 items, the second has a dataset with only 1.

When you click on saveSelections it will save the dataset being used in the
first combobox to an lso, when you click on load selections it will load the
dataset from the lso into the second combobox.

You'll see that the second combobox starts off with one element and gets
populated with 4 items instead of 1 after the first comboboxes dataset has
been loaded into it.

What I am most curious about is this. When the second combobox has it's
dataset replaced with the lso's serialized data, what event or event
sequence in the combobox triggers the refreshing of the replicated visual
data? The reason I'd like to know is that I'd like to be sure that custom
things I create work in the same way.

Thanks for any thoughts,

-Cort




On 11/16/06, P T Withington <[EMAIL PROTECTED]> wrote:

This is the mechanism behind [dojo.storage](http://
manual.dojotoolkit.org/storage.html)

On 2006-11-16, at 12:04 EST, Henry Minsky wrote:

> I thought this thread from the forums might be of wider interest,
> regarding shared objects in flash
>
> ---------- Forwarded message ----------
> From: OpenLaszlo Developers Forums <[EMAIL PROTECTED]>
> Date: Nov 16, 2006 11:59 AM
> Subject: Reply to post 'solo deployment log issue'
> To: [EMAIL PROTECTED]
>
>
> Dear hqm,
>
> d~l has just replied to a thread you have subscribed to entitled -
> solo deployment log issue - in the LZX Coding Help forum of OpenLaszlo
> Developers Forums.
>
> This thread is located at:
> http://forum.openlaszlo.org//showthread.php?t=7830&goto=newpost
>
> Here is the message that has just been posted:
> ***************
> If you have PHP then of course you can store user data server side.
>
> But some SOLO apps run without server interaction and in this case
> SharedObjects can be useful.
>
> Shared Objects are "Flash cookies" which can be stored up to 100 kb in
> local store, without user permission, and with user permission above
> that size.
>
> SharedObject files have extension .SOL and can contain types: numbers,
> boolean, string, objects, arrays, XML, date, pointer.
>
> Here are some bookmarked links explaining SharedObjects.
>
> http://www.adobe.com/support/flash/action_scripts/local_shared_object/
>
> http://www.flash-db.com/Tutorials/saving/savingData.php?page=3
>
> http://www.kirupa.com/developer/actionscript/shared_objects.htm
>
> http://www.actionscripts.org/tutorials/intermediate/SharedObjects/
> index.shtml
>
> http://www.builderau.com.au/program/flash/soa/
> Create_powerful_Flash_applications_with_shared_objects/
> 0,339028413,320278036,00.htm
>
> ....
>
> To get an idea of where they SOL files are in your PC, install a
> SOL editor
>
> ....
>
> For Windows ..
>
> http://sourceforge.net/projects/soleditor
>
>
> For Linux/Mac/Windows ..
>
> http://solve.sourceforge.net/
>
> .....
>
> Here is an example in lzx code ..
>
>
> Code:
> ---------
> <canvas width="500" height="500" debug="true" >
>
> <!-- from this tutorial:- -->
> <!-- http://www.actionscripts.org/tutorials/intermediate/
> SharedObjects/index.shtml
> -->
>
> <script>
>
> function checkSO() {
>        // Does this client allow SharedObjects to be stored?
>        // Create a dummy SO and try to store it
>        mySO = SharedObject.getLocal("test");
>        if (!mySO.flush(1)) {
>                // SOs not allowed on this system!
>                // Prompt user to change settings
>                System.showSettings(1);
>                } else {
>                // SOs allowed
>                Debug.write("Your system allows SharedObjects");
>        }
> }
> checkSO();
>
> // ================================
>
> // Create an SO
> mySO = SharedObject.getLocal("test");
> // Add some important data
> mySO.data.stickAround = "I'll be here for years to come!";
> // Write the SO to the disk (I'm not checking for success here)
> mySO.flush();
> // Delete the SO
> delete mySO;
> // Reload the SO
> mySO = SharedObject.getLocal("test");
> // This time we're not adding any data, so when we write
> // our SO it should the old data be overwritten, right?
> mySO.flush();
> // Delete the SO
> delete mySO;
> // Load the SO back in once more,
> mySO = SharedObject.getLocal("test");
> // Scan the SO for values
> for (a in mySO.data) {
>        Debug.write(a+": "+mySO.data[a]);
> }
> // Wrong! The trace shows our old values all still exist!
>
> // ================================
>
> // System.showSettings(1); // show settings panel
>
> </script>
> </canvas>
> ---------
> After running this lzapp, check the SOL file using SOL edtor.
>
> This is a simple example. You can add XML content, objects, arrays.
>
> e.g. XML datasets can be written, after user changes.
> ***************
>
>
> There may be other replies also, but you will not receive any more
> notifications until you visit the forum again.
>
> All the best,
> OpenLaszlo Developers Forums
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Unsubscription information:
>
> To unsubscribe from this thread, please visit this page:
> http://forum.openlaszlo.org//subscription.php?
> do=removesubscription&type=thread&subscriptionid=15027&auth=9066dff550
> a4430f2689464efc9da7f2
>
> To unsubscribe from ALL threads, please visit this page:
> http://forum.openlaszlo.org//subscription.php?
> do=viewsubscription&folderid=all
>
>
> --
> Henry Minsky
> Software Architect
> [EMAIL PROTECTED]


Attachment: localcache.lzx
Description: application/lzx

Attachment: test-localcache2.lzx
Description: application/lzx

Reply via email to