OverflowTest : SharedObject : Development Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Development » SharedObject »

 

OverflowTest


 
package
{
    import flash.display.Sprite;
    import flash.events.NetStatusEvent;
    import flash.net.SharedObject;
    import flash.net.SharedObjectFlushStatus;

    public class Main extends Sprite
    {
        protected var so:SharedObject = SharedObject.getLocal("storage");

        public function Main(){
            //request 1 MB up front
            if (so.flush(1024 1024== SharedObjectFlushStatus.PENDING)
            {
                so.addEventListener(NetStatusEvent.NET_STATUS, onUserAction);
                trace("User approval pending...");
            }
        }

        public function onUserAction(event:NetStatusEvent):void{
            so.removeEventListener(NetStatusEvent.NET_STATUS, onUserAction);
            switch (event.info.code)
            {
                case "SharedObject.Flush.Success":
                    trace("Accepted");
                    break;

                case "SharedObject.Flush.Failed":
                    trace("Denied");
                    //do error recovery
                    break;
            }
        }
    }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Development
» SharedObject