Call: (209) 560-6611

Store data using AS3, Flash

Date: November 8, 2014 Author: ang Category: Tutorials Tags: , , , Comments: 0

Below is a simple class that stores data to a file on the device. The script is in ActionScript3.

 Javascript |  copy code |? 
01
02
package  {
03
 
04
import flash.net.SharedObject;
05
 
06
public class MyClass extends MovieClip {
07
//create vars
08
var so:SharedObject = SharedObject.getLocal("highScore");//this variable keeps track of high scores
09
 
10
public function MyClass () {
11
//the consructor
12
so.data.highScore = 110;
13
trace("highscore: "+so.data.highScore); // this line traces the high score that was saved
14
}
15
 
16
)
17
 
18
)
19

Leave a Reply

Your email address will not be published. Required fields are marked *

Before you post, please prove you are sentient.

What is 4 multiplied by 2?

Before you post, please prove you are sentient.

What is that thing with fingers at the end of your arm (one word)?