My favorites | Sign in
Logo
                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package org.as3lib.kitchensync
{
import flash.display.DisplayObject;
import flash.errors.IllegalOperationError;

import org.as3lib.kitchensync.core.Synchronizer;


/**
* Gateway to the library. Initializes the entire system.
*
* @use KitchenSync.initialize(this, versionNumber);
* @since 1.2
* @author Mims H. Wright
* @see org.as3lib.kitchensync.core.Synchronizer
*/
public final class KitchenSync
{
/**
* The current version of the library. Use this to verify that the library is the
* version that your software expects.
*/
public static const VERSION:String = "1.6"
private static var _initialized:Boolean = false;

/**
* Initializes the timing core for KitchenSync. Must be called before using any actions.
*
* @param frameRateSeed must be a DisplayObject that is added to the display list.
* @param versionCheck a string for the version you think you're using. e.g. 1.2 This is recommended
* but not required. It will throw an error if you're using the wrong version of KS.
*/
public static function initialize(frameRateSeed:DisplayObject, versionCheck:String = VERSION):void
{

if (_initialized) {
// todo make this error optional.
throw new IllegalOperationError("KitchenSync has already been initialized.");
}
if (versionCheck != VERSION) {
throw new Error ("Version check failed. Please update to the correct version or to continue using this version (at your own risk) put the initialize() method inside a try{} block.");
}
var synchronizer:Synchronizer;
synchronizer = Synchronizer.getInstance();
synchronizer.frameRateSeed = frameRateSeed;
_initialized = true;
}

public function KitchenSync () {
throw Error ("There is no need to instantiate this class. use KitchenSync.initialize() instead");
}
}
}

Show details Hide details

Change log

r387 by mimshwright on Aug 29, 2008   Diff
added optional weak linking to
synchronizer
Go to: 
Project members, sign in to write a code review

Older revisions

r367 by mimshwright on Aug 06, 2008   Diff
updated version number and decided to
keep changes in R366
r338 by mimshwright on Jul 08, 2008   Diff
version 1.5
r290 by mimshwright on May 15, 2008   Diff
adding several v1.3 changes
All revisions of this file

File info

Size: 1845 bytes, 54 lines
Hosted by Google Code