# \[AS2\] saving and loading issues

**URL:** <https://forum.kirupa.com/t/as2-saving-and-loading-issues/313881>\
**Category:** flash\
**Created:** [September 13, 2010, 2:49am UTC](https://forum.kirupa.com/t/as2-saving-and-loading-issues/313881 "2010-09-13T02:49:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ozmafioso](https://avatars.discourse-cdn.com/v4/letter/o/9f8e36/32.png) [@Ozmafioso](https://forum.kirupa.com/u/Ozmafioso)\
**Post date:** [September 13, 2010, 2:49am UTC](https://forum.kirupa.com/t/as2-saving-and-loading-issues/313881/1 "2010-09-13T02:49:12Z")

</div>

I’m going through hell trying to get this save & load script to work, I’m sure it’s something stupid I’ve overlooked, but I don’t seem to be getting any where. Here’s what I’ve got:

This is the code for when the game loads (loading data):

```auto
onEnterFrame();
{
	var savefile = SharedObject.getLocal("od2game");
	ch1summonvar = savefile.data.ch1summon;
	ch1manipvar = savefile.data.ch1manip;
	if (ch1summonvar == 2)
	{
		_global.ch1summon = true;
		_root.gamedataloaded.gotoAndPlay(2);
	}
	else
	{
		_global.ch1summon = false;

	}
	if (ch1manipvar == 2)
	{
		_global.ch1manip = true;
		_root.gamedataloaded.gotoAndPlay(2);
	}
	else
	{
		_global.ch1manip = false;

	}
};

```

Here is the code for the save:

```auto
savefile.data.ch1manip = ch1manipvar;
savefile.flush();

```

and the other save is:

```auto
savefile.data.ch1summon = ch1summonvar;
savefile.flush();

```

So there are 2 points in the game where it should be saving, ch1summonvar & ch1manipvar = 2 before the save code, so that should make the save files as 2, correct? Where did I go wrong?
