scratch – Blame information for rev 73
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
73 | office | 1 | In this version of SoundJS, class definitions reside in a "createjs" namespace by default. |
2 | |||
3 | For example, instead of playing a sound like this: |
||
4 | var foo = SoundJS.play(id); |
||
5 | |||
6 | You will need to reach into the createjs namespace: |
||
7 | var bar = createjs.SoundJS.play(id); |
||
8 | |||
9 | This functionality is configurable though. You can easily shortcut the namespace or get rid of it completely. |
||
10 | |||
11 | To shortcut the namespace, just point a different variable at createjs it is loaded: |
||
12 | <script src="easeljs.js"></script> |
||
13 | <script> |
||
14 | var c = createjs; // creates a reference to the createjs namespace in "c" |
||
15 | var foo = new c.Shape(); |
||
16 | </script> |
||
17 | |||
18 | To remove the namespace, just point the createjs variable at the window before loading the libraries: |
||
19 | <script> |
||
20 | var createjs = window; // sets window as the createjs namespace (the object the classes will be defined in) |
||
21 | </script> |
||
22 | <script src="easeljs.js"></script> |
||
23 | |||
24 | This will also make CreateJS libraries compatible with old content that did not use a namespace, such as the output from the Flash Pro Toolkit for CreateJS v1.0. |