ActionScript 3, SharedObject crashing Flash CS IDE

Recently I met a problem when using SharedObjects caused Flash CS IDE simply to crash with an error.

I looked through the web and found not that much about the problem, however it still continued to cease working.

I my code I was creating several different SharedObjects, and connected them to different local data.

You see, here is the sample actionscript code from Flash Help Content:

package {
    public class SharedObject_flush {
        private var hostName:String = "yourDomain";
        private var username:String = "yourUsername";
        public function SharedObject_flush() {
            var mySo:SharedObject =
   = username;
            var flushResult:Object = mySo.flush();
            trace("flushResult: " + flushResult);
            trace(; // yourUsername

The samples in whole flash help system are pretty the same, only one shared object is used. And that’s exactly what confused me.

Getting back to this problem during the several days I finally found the reason.
For SharedObject.flush() not to crash you need to close previously created SharedObject.

close() is a method of SharedObject, but none of the code snippets of AS3 code has it listed.

Probably, I’m not that good at searching through the help, but still I couldn’t find a mention about close() call to be a must.
However, you must close any shared object before you need to use another one. Or simply come up with the only one sharedobject in your project.

It looks like if you create several instance of the above SharedObject_flush class you will result in crash 😉

Hope this will save a debugging time to someone.

Related articles:

Flash Tutorial, Using Shared Objects in ActionScript.

8 Responses to “ActionScript 3, SharedObject crashing Flash CS IDE”

  1. 1 Bart Claessens

    You actually saved me a lot of time 🙂
    My Flash IDE also crashed when I used sample code from the help file.

    .close() fixes the problem.

    I noticed I had to close the flash object every time with the .close() method, also when you are only reading from it.


  2. 2 Paul

    Bart, I’m glad that this info helped you 😉

  3. 3 samedi

    Thanks! I’ve found this info just in time to prevent a nervous breakdown!

  4. 4 Fred

    Thanks, you really saved my #ss!
    Big project, short on time, big trouble.
    Because of not closing the SO it somehow got corrupted (had worked for a day) and crashed both player and IDE every time I tried to access the SO.

    Fixed the code and used firefox-plugin to delete the corrupted SO.

    Seemed like flash also added some kind of ban on my so. Saw that file in objection also and deleted that too.
    Hope this helps someone.

    Thanks again.


  5. 5 PalMediC

    Thank you so much! It saved me so much debugging time !!!!


  6. 6 Pavel

    Wow thanks! Just having this problem..trying out…and the solution works! 🙂

  7. 7 Matt Perkins

    Saved me also! Thanks

  1. 1 Tutorial, ActionScript 3, Using Shared Objects | FlashDaWeb Blog

Leave a Reply