Game Development Reference
In-Depth Information
static public const FRAME_TITLE:String = " title " ;
static public const FRAME_HOW_TO_PLAY:String = " howtoplay " ;
static public const FRAME_GAME:String = " game " ;
static public const FRAME_LEADERBOARD:String = " leaderboard " ;
static public const FRAME_RESULTS:String = " results " ;
static private var _gameData:SharedObject;
public function MarbleRunner()
{
stop();
addEventListener(Event.ADDED_TO_STAGE, onAdded
ToStage, false, 0, true);
addEventListener(EVENT_NAVIGATE, onNavigate,
false, 0, true);
}
private function onAddedToStage(e:Event):void
{
loadGameData();
gotoAndStop(FRAME_TITLE);
}
private function onNavigate(e:DataEvent):void
{
gotoAndStop(e.data);
}
static public function get gameData():SharedObject
{
return _gameData;
}
static public function loadGameData():void
{
if (_gameData)
return;
_gameData = SharedObject.getLocal(
"
MarbleRunner
"
);
}
static public function saveGameData(level:int, score:int):
void
{
if (!_gameData)
loadGameData();
_gameData.data.level = level;
Search Nedrilad ::




Custom Search