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 |