A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Saving in Flash Projector

  1. #1
    Junior Member
    Join Date
    Jun 2009
    Posts
    4

    Saving in Flash Projector

    A very simple question I believe, however, I've looked around and can't find the answer. I'll describe this as simple as I can:

    Let's just say in my flash CS4 file, I created a movie clip called "Stoplights." I have placed this movie clip multiple times on the main stage. I can click on the stop light and change the color from green, to yellow, to red. Remember, each of these are a movie clip. Now, I can alter any one of those movie clips, which they are independent of each other. Then I want to be able to save the projector file, so, when I open it later, I can view it exactly as I have left it. At this point, there is nothing else I can alter except for clicking on the stop light movie clip and changing the color. (Each color of the movie clip is a stop frame.)

    Sorry for over-explaining my situation. So, how can I do this. Also, it would be nice to create a new projector file every time I hit the "save" button. Thanks.

    heinsc

  2. #2
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    You can use a shared local object to store state information in Flash. The data is stored in an external file in the user's data directory, not with your EXE.

    With the help of a third party swf2exe tool you can save and load data anywhere you like. It's still an external file but the location will be under your control.

    The Scratch functions in SWF Studio are the only way let a projector modify itself and read that data back later. You won't find that functionality in any other swf2exe tool. Once you use Scratch.write to store data in the "scratch area" of your projector you can read it back any time, even if you move the EXE file to another machine. The data is inside the EXE.

  3. #3
    Junior Member
    Join Date
    Jun 2009
    Posts
    4

    Saving in Flash Projector

    Thanks for the info Northcode. So, if I created a save button in flash and used the ShareLocalObject code, it will save and external file somewhere else. Correct? I believe I've found the .sol file in the Macromedia library. So, is there a way for me to use this .sol file to open the projector file at the same frame that it was when I clicked the save button? Lastly, if I used SWF Studio, do I still need to deal with SOLs or does that program use some other code/function? Thanks again.

    heinsc

  4. #4
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    You don't need to know where the SOL file is, Flash will take care of that when you retrieve your object. So you can retrieve what you saved and reset your movie to whatever state you like.

    If you use SWF Studio you don't have to worry about SOL files etc, the data will be stored as part of the EXE file. That means you could give a copy of that EXE file to someone else and they would start at the same place too. You can't do that with SOL files

  5. #5
    Junior Member
    Join Date
    Jun 2009
    Posts
    4

    Saving in Flash Projector

    Thanks Northcode!!! I've progressed a quite a bit further. But, I have one last question!: With using SOs, there has to be a code for you to save the current frame that you're on. I've already used this:

    saving.onRelease = function () {
    myData = SharedObject.getLocal("myData")
    myData._currentframe.pond = pond;
    }
    loading.onRelease = function() {
    myData = SharedObject.getLocal("myData")
    pond = myData._currentframe.pond
    }

  6. #6
    Junior Member
    Join Date
    Jun 2009
    Posts
    4

    Saving in Flash Projector

    With the code above, I used it with an input text area and it saved and loaded correctly. However, I want to use a similar code to save and load the last frame of the movieclip that I was on when I closed the SWF. Thanks.

    heinsc

  7. #7
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    Just save the frame numer of the movieclip and when you reload it, do a mc.gotoAndPlay(lastFrame) to get back where you were instead of starting at the beginning.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center