Question

I have created an App using an externall AS3 class file, and it works perfectly on a PC desktop (exported as a presentation file).

However, I now need to move the same app to work on a mobile Tablet (Android Device).

As I need to store information (user selected Playlist of Videos) I need the ability for the playlist to be saved (as this playlist has to play next time user enters the App on the mobile device.) I have been using the file.Reference to a txt doc to save the playlist, but I don't think that will work any more :-(.

I have done considerable research for this, but ultimately can't find the answers for these two questions

Will shard objects keep saved on Android Tablet device even if the app is closed 
and then restarted ?

 

If so , how to I create shared Objects specifically for Android tablet ?

I had look at http://www.adobe.com/devnet/flash/articles/saving_state_air_apps.html but it is for iPhone and is not specific.

I also Looked at this : SharedObject not working on AIR mobile but again, not a huge amount of help, and still dosn't answer my question about storing Shared Object when re-opening app.

I can't really use a SQL database because I would have to re-code everything in Flex which is different from the AS3 code I have already done.

I have done loads of research and hunting specific for Shared Objects in Android Device, but there is no clear cut tutorials etc. Perhaps its such a new thing people havent fully gotten around to it

Many thanks for all the help.

Was it helpful?

Solution

You can use SharedObject without problem.

From here you can see what is unsupported in air mobiles: link

OTHER TIPS

Check out the Adobe help page http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/SharedObject.html

Here some sample

private var mySo:SharedObject;

function test():void
{
     mySo = SharedObject.getLocal("application-name");
     mySo.data.savedValue = input.text;

     var flushStatus:String = null;
     try {
        flushStatus = mySo.flush(10000);
     } catch (error:Error) {
        trace("Error...Could not write SharedObject to disk\n");
     }

     if (flushStatus != null) {
        switch (flushStatus) {
           case SharedObjectFlushStatus.PENDING:
                trace("Requesting permission to save object...\n");
                mySo.addEventListener(NetStatusEvent.NET_STATUS, onFlushStatus);
                break;
           case SharedObjectFlushStatus.FLUSHED:
                trace("Value flushed to disk.\n");
                break;
        }
    }
}

private function onFlushStatus(event:NetStatusEvent):void {
        trace("User closed permission dialog...\n");
        switch (event.info.code) {
            case "SharedObject.Flush.Success":
                trace("User granted permission -- value saved.\n");
                break;
            case "SharedObject.Flush.Failed":
                trace("User denied permission -- value not saved.\n");
                break;
        }

        mySo.removeEventListener(NetStatusEvent.NET_STATUS, onFlushStatus);
    }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top