Saving variable for later use (simple counter app)
Hi everyone! First I want to say I'm not very familiar with ac3.
I'm making a simple counter app, basically 1 buttons adds 1, another button adds 2 and another button adds 3. I have this variable (pts) that is the actuall data. What I want to do is to make it save the "pts" data so that its there the next time I open the file.
Here's what I have so far:
var pts:int=0
ptstxt.text = pts.toString();
//ptstxt is the text box that displays the pts value
but1.addEventListener(MouseEvent.CLICK, click_handler);
function click_handler(event_object:MouseEvent) {
pts += 1
trace(pts)
ptstxt.text = pts.toString();
}
//this button adds 1 to pts
but2.addEventListener(MouseEvent.CLICK, click_handler2);
function click_handler2(event_object:MouseEvent) {
pts += 2
trace(pts)
ptstxt.text = pts.toString();
}
//this button adds 2 to pts
I searched around and found that it would be for the best if I used the "shared object" but as my knowledge of ac3 isn't big I was unable to do it without help.
Also, would it be usable in an android app?
Looking forwad to a reply and thanks in advance.