# Save variable

**URL:** <https://forum.kirupa.com/t/save-variable/200370>\
**Category:** flash\
**Created:** [September 11, 2006, 7:01pm UTC](https://forum.kirupa.com/t/save-variable/200370 "2006-09-11T19:01:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![modelreject](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@modelreject](https://forum.kirupa.com/u/modelreject)\
**Post date:** [September 11, 2006, 7:01pm UTC](https://forum.kirupa.com/t/save-variable/200370/1 "2006-09-11T19:01:43Z")

</div>

Hi,  
Another question.  
I have this onPress function and what I’d like is to save the (snd.position/1000) to a variable so I can recall it at a later time on a keyPress action.  
This i swhat I have but the variable is defined locally within the fuction so am I right in thinking that I won’t be able to call it from a keyPress action?

scrubber\_mc.onPress = function() {  
if (!snd.loaded) {  
return (0);  
}  
var pos = this.\_xmouse/100;  
snd.position = Math.min(snd.\_sound.duration, pos\*snd.\_sound.duration/snd.loaded);  
if (snd.isPlaying) {  
snd.\_sound.start(snd.position/1000);  
var posMemory = snd.position/1000;  
trace(posMemory);  
}  
};

Thankyou,  
M
