# Save Button

**URL:** https://forum.kirupa.com/t/save-button/204851
**Category:** flash
**Created:** [October 24, 2006, 1:36am UTC](https://forum.kirupa.com/t/save-button/204851 "2006-10-24T01:36:57Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![silverneo188](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@silverneo188](https://forum.kirupa.com/u/silverneo188)
#### Post date: [October 24, 2006, 1:36am UTC](https://forum.kirupa.com/t/save-button/204851/1 "2006-10-24T01:36:57Z")

</div>

I am clueless on how to make a save button, does anyone know how to make a save button?  
It’s for my button clicker game.

---

<div class="post-metadata">

### Author: ![Jeff\_Wheeler](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@Jeff\_Wheeler](https://forum.kirupa.com/u/Jeff_Wheeler)
#### Post date: [October 24, 2006, 1:56am UTC](https://forum.kirupa.com/t/save-button/204851/2 "2006-10-24T01:56:25Z")

</div>

Uh, the same way you make any other button. I suppose then you could start sending your content to save to PHP into a db.

---

<div class="post-metadata">

### Author: ![silverneo188](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@silverneo188](https://forum.kirupa.com/u/silverneo188)
#### Post date: [October 24, 2006, 2:41am UTC](https://forum.kirupa.com/t/save-button/204851/3 "2006-10-24T02:41:53Z")

</div>

I have no idea how to create a database, Im running a school laptop and I don’t have coldfusion. Can you also help me with that?  
I have no idea on how to make flash send data to a php either (I know i’m a noob)

---

<div class="post-metadata">

### Author: ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)
#### Post date: [October 24, 2006, 3:27am UTC](https://forum.kirupa.com/t/save-button/204851/4 "2006-10-24T03:27:07Z")

</div>

This easiest way would to use the SharedObject object, it’s like a cookie but for Flash. Here is simple example which counts the number of times you have pressed the mouse. If you close the Flash Player and re-open it, the counting will continue where you left off. Press any key to reset the count.

```auto
//access the savedData SharedObject, if it doesn't exist this method will create it
this.soData = SharedObject.getLocal("savedData");
//if the clicks property is undefined, ie hasn't been created . . .
if(this.soData.data.clicks == undefined) {
	//. . . set it to 0
	this.soData.data.clicks = 0;
}

//onMouseDOwn
this.onMouseDown = function():Void {
	//output the incremented clicks variable
	trace(++this.soData.data.clicks);
}

//add this as a listener to the Key class
Key.addListener(this);
this.onKeyDown = function():Void {
	//reset the clicks property to 0
	this.soData.data.clicks = 0;
}

```

---

<div class="post-metadata">

### Author: ![Jeff\_Wheeler](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@Jeff\_Wheeler](https://forum.kirupa.com/u/Jeff_Wheeler)
#### Post date: [October 24, 2006, 3:37am UTC](https://forum.kirupa.com/t/save-button/204851/5 "2006-10-24T03:37:09Z")

</div>

That works too… 😛

If you’re still interested in learning more about MySQL and Flash, you might want to follow this guide:

[http://forums.creativecow.net/cgi-bin/new\_page\_wrapper.cgi?forumid=1&page=http://www.creativecow.net/articles/brimelow\_lee/php\_mysql/index.html](http://forums.creativecow.net/cgi-bin/new_page_wrapper.cgi?forumid=1&page=http://www.creativecow.net/articles/brimelow_lee/php_mysql/index.html)

---

<div class="post-metadata">

### Author: ![silverneo188](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@silverneo188](https://forum.kirupa.com/u/silverneo188)
#### Post date: [October 24, 2006, 3:42am UTC](https://forum.kirupa.com/t/save-button/204851/6 "2006-10-24T03:42:02Z")

</div>

won’t work(the second post above me with the AS) go to my site (in my sig) and look on the main page you will see the flash to the left.  
I visit another part of my site and then go back but it sets the counter back to zero.  
Am I supposed to put the AS on the button or stage?
