Static classes are life savers for those who want a central data hubs where all shared variables are stored and accessed and modified. Some programmers think that this is dangerous since there is no real control over who gets to do what with the variables.. but for a scenario where several objects need to access the same data.. I can't think of better ways of doing so.
here's an example of a static class:
package com.packageName{
public class DataStore{
static var _DS:DataStore;
static var dataArray:Array;
public function DataStore(){
// write something here
}
public static function getInstance(): DataStore {
if (_DS == null) _DS = new DataStore();
return _DS;
}
public function doSomething(){
// write code here
}
}
}
and then to call the function doSomething from this class, this is the way it's called:
com.packageName.DataStore.getInstance().doSomething();