├── .gitignore ├── CameraDetection Documentation.docproj ├── CameraDetection.as3proj ├── CameraDetection.lxml ├── MediaPermissionsTest.as3proj ├── docs ├── MultiTest.html ├── MultiTestVerbose.html ├── Simple.html ├── all-classes.html ├── all-index-A.html ├── all-index-B.html ├── all-index-C.html ├── all-index-D.html ├── all-index-E.html ├── all-index-F.html ├── all-index-G.html ├── all-index-H.html ├── all-index-I.html ├── all-index-J.html ├── all-index-K.html ├── all-index-L.html ├── all-index-M.html ├── all-index-N.html ├── all-index-O.html ├── all-index-P.html ├── all-index-Q.html ├── all-index-R.html ├── all-index-S.html ├── all-index-T.html ├── all-index-U.html ├── all-index-V.html ├── all-index-W.html ├── all-index-X.html ├── all-index-Y.html ├── all-index-Z.html ├── appendixes.html ├── asdoc.js ├── class-list.html ├── class-summary.html ├── com │ └── gskinner │ │ └── utils │ │ ├── IDisposable.html │ │ ├── class-list.html │ │ └── package-detail.html ├── cookies.js ├── images │ ├── collapsed.gif │ ├── detailHeaderRule.jpg │ ├── detailSectionHeader.jpg │ ├── expanded.gif │ ├── inherit-arrow.gif │ ├── inheritedSummary.gif │ ├── logo.jpg │ ├── titleTableBottom.jpg │ ├── titleTableMiddle.jpg │ └── titleTableTop.jpg ├── index-list.html ├── index.html ├── ktu │ ├── events │ │ ├── CameraDetectionEvent.html │ │ ├── class-list.html │ │ └── package-detail.html │ └── media │ │ ├── CameraDetection.html │ │ ├── CameraDetectionResult.html │ │ ├── CameraDetectionVerbose.html │ │ ├── class-list.html │ │ └── package-detail.html ├── mxml-tags.html ├── package-detail.html ├── package-frame.html ├── package-list.html ├── package-summary.html ├── print.css ├── style.css └── title-bar.html ├── readme.textile └── src ├── MultiTest.as ├── PermissionsTest.as ├── Simple.as ├── ktu ├── events │ ├── CameraDetectionEvent.as │ └── MediaPermissionsEvent.as └── media │ ├── CameraChecker.as │ ├── CameraCheckerLogger.as │ ├── CameraDetection.as │ ├── CameraDetectionLogger.as │ ├── CameraDetectionResult.as │ ├── MediaPermissions.as │ └── MediaPermissionsResult.as └── tests ├── DialogArea.as ├── Output.as ├── PermissionTestAccordion.as ├── TestData.as └── TestWindow.as /.gitignore: -------------------------------------------------------------------------------- 1 | /obj 2 | /bin 3 | *.lxml -------------------------------------------------------------------------------- /CameraDetection Documentation.docproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | CameraDetection Docs 4 | D:\ktu\git\CameraDetection\src 5 | 6 | D:\ktu\git\CameraDetection\docs 7 | 1 8 | 9 | -------------------------------------------------------------------------------- /CameraDetection.as3proj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /CameraDetection.lxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | false 6 | false 7 | false 8 | true 9 | false 10 | false 11 | 12 | 13 | None 14 | -------------------------------------------------------------------------------- /MediaPermissionsTest.as3proj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /docs/MultiTest.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | MultiTest 9 | 10 | 11 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
PackageTop Level
Classpublic class MultiTest
InheritanceMultiTest Inheritance flash.display.Sprite
44 |

45 | This class is a test class to see how CameraDetection functions when an application tries to use the camera multiple times
46 |
47 | This is a document class.
48 |
49 |

50 |
51 |
52 |
53 | 54 |
55 |
Public Methods
56 | 57 | 58 | 59 | 60 | 61 | 66 | 67 |
 MethodDefined by
   62 |
63 | MultiTest()
64 |
65 |
MultiTest
68 |
69 | 73 |
74 | 75 |
Constructor detail
76 | 77 | 78 | 79 | 80 | 81 |
MultiTest()constructor
82 |
83 | public function MultiTest() 84 |
85 |
86 |
87 |
88 |
89 |

90 | 92 |
93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /docs/MultiTestVerbose.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | MultiTestVerbose 9 | 10 | 11 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
PackageTop Level
Classpublic class MultiTestVerbose
InheritanceMultiTestVerbose Inheritance flash.display.Sprite
44 |

45 | This class is a test class to see how CameraDetection functions when an application tries to use the camera multiple times
46 |
47 | This is a document class.
48 |
49 | This is verbose, with lots of output. 50 | I am currently trying to find out why its not working... 51 | Then, if waiting longer removes the blackout period. 52 | If not, then provide a way of solving that issue here. 53 |

54 |
55 |
56 |
57 | 58 |
59 |
Public Methods
60 | 61 | 62 | 63 | 64 | 65 | 70 | 71 | 72 | 77 | 78 |
 MethodDefined by
   66 | 68 |
69 |
MultiTestVerbose
   73 |
74 | output(str:String):void
75 |
76 |
MultiTestVerbose
79 |
80 | 84 |
85 | 86 |
Constructor detail
87 | 88 | 89 | 90 | 91 | 92 |
MultiTestVerbose()constructor
93 |
94 | public function MultiTestVerbose() 95 |
96 | 97 |
Method detail
98 | 99 | 100 | 101 | 102 | 103 |
output()method
104 |
105 | public function output(str:String):voidParameters 106 | 107 | 108 | 109 | 110 |
str:String
111 |
112 |
113 |
114 |
115 |
116 |

117 | 119 |
120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /docs/Simple.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Simple 9 | 10 | 11 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
PackageTop Level
Classpublic class Simple
InheritanceSimple Inheritance flash.display.Sprite
44 |

45 | This class is a simple example of how to use CameraDetection
46 |
47 | This is a document class.
48 |
49 | Very simple.
50 | Create an instance
 51 |     var cd:CameraDetection = new CameraDetection(stage);                 

52 | Add the event listener
 53 |     cd.addEventListener (CameraDetectionEvent.RESOLVE, onCameraResolve);             

54 | Write function onCameraResolve to handle the results
 55 |     function onCameraResolve (e:CameraDetectionEvent):void {
 56 |      switch (e.code) {
 57 |        case CameraDetectionResult.SUCCESS:
 58 |        case CameraDetectionResult.NO_PERMISSION:
 59 |        case CameraDetectionResult.NO_CAMERAS:
 60 |                                    
61 |

62 |
63 |
64 |
65 | 66 |
67 |
Public Methods
68 | 69 | 70 | 71 | 72 | 73 | 78 | 79 |
 MethodDefined by
   74 |
75 | Simple()
76 |
77 |
Simple
80 |
81 | 85 |
86 | 87 |
Constructor detail
88 | 89 | 90 | 91 | 92 | 93 |
Simple()constructor
94 |
95 | public function Simple() 96 |
97 |
98 |
99 |
100 |
101 |

102 | 104 |
105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /docs/all-classes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | All Classes - API Documentation 6 | 7 | 8 | 9 | 10 | 11 |

12 | All Classes 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 |
CameraDetection
CameraDetectionEvent
CameraDetectionResult
CameraDetectionVerbose
IDisposable
MultiTest
MultiTestVerbose
Simple
40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /docs/all-index-A.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | A Index 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
44 |

45 | 47 |
48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /docs/all-index-E.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | E Index 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
44 |

45 | 47 |
48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /docs/all-index-F.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | F Index 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
44 |

45 | 47 |
48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /docs/all-index-G.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | G Index 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
44 |

45 | 47 |
48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /docs/all-index-H.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | H Index 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
44 |

45 | 47 |
48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /docs/all-index-J.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | J Index 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
44 |

45 | 47 |
48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /docs/all-index-L.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | L Index 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
44 |

45 | 47 |
48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /docs/all-index-P.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | P Index 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
44 |

45 | 47 |
48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /docs/all-index-Q.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Q Index 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
44 |

45 | 47 |
48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /docs/all-index-U.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | U Index 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
44 |

45 | 47 |
48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /docs/all-index-V.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | V Index 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
44 |

45 | 47 |
48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /docs/all-index-W.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | W Index 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
44 |

45 | 47 |
48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /docs/all-index-X.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | X Index 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
44 |

45 | 47 |
48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /docs/appendixes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Appendixes 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 |
34 | 35 | 36 | 37 | 38 |
 AppendixDescription
39 |

40 | 42 |
43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /docs/class-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $$Global$$ - API Documentation 6 | 7 | 8 | 9 | 10 | 11 |

12 | Top Level 13 |

14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |
Classes
MultiTest
MultiTestVerbose
Simple
28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/class-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | All Classes 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 |

Documentation for classes includes syntax, usage information, and code samples for methods, properties, and event handlers and listeners for those APIs that belong to a specific class in ActionScript. The classes are listed alphabetically. If you are not sure to which class a certain method or property belongs, you can look it up in the Index.

34 |
35 | 36 | 37 | 38 | 39 | 40 | 44 | 45 | 46 | 51 | 52 | 53 | 63 | 64 | 65 | 69 | 70 | 71 | 75 | 76 | 77 | 83 | 84 | 85 | 91 | 92 | 93 | 99 | 100 |
 ClassPackageDescription
 CameraDetection 41 |
42 |
ktu.media 43 | CameraDetection searches all available Camera objects to find the first working Camera.
 CameraDetectionEvent 47 |
48 |
ktu.events 49 | A CameraDetection object dispatches a CameraDetectionEvent 50 |
 CameraDetectionResult 54 |
55 |
ktu.media 56 | 57 | Enumeration of possible results from using CameraDetection 58 | 59 | Used in conjunction with CameraDetectionEvent as the code property 60 | 61 | 62 |
 CameraDetectionVerbose 66 |
67 |
ktu.media 68 | CameraDetection searches all available Camera objects to find the first working Camera.
 IDisposable 72 |
73 |
com.gskinner.utils 74 | IDisposable by Grant Skinner.
 MultiTest 78 |
79 |
Top Level 80 | This class is a test class to see how CameraDetection functions when an application tries to use the camera multiple times
81 |
82 | This is a document class.
 MultiTestVerbose 86 |
87 |
Top Level 88 | This class is a test class to see how CameraDetection functions when an application tries to use the camera multiple times
89 |
90 | This is a document class.
 Simple 94 |
95 |
Top Level 96 | This class is a simple example of how to use CameraDetection
97 |
98 | This is a document class.
101 |

102 | 104 |
105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /docs/com/gskinner/utils/IDisposable.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | com.gskinner.utils.IDisposable 9 | 10 | 11 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
Packagecom.gskinner.utils
Interfacepublic interface IDisposable
ImplementorsCameraDetection, CameraDetectionVerbose
44 |

45 | IDisposable by Grant Skinner. June 21, 2006
46 | Visit www.gskinner.com/blog for documentation, updates and more free code.
47 |
48 | You may distribute this class freely, provided it is not modified in any way (including 49 | removing this header or changing the package path).
50 |
51 | Please contact info[at]gskinner[dot]com prior to distributing modified versions of this class. 52 |

53 |
54 |
55 |
56 | 57 |
58 |
Public Methods
59 | 60 | 61 | 62 | 63 | 64 | 71 | 72 |
 MethodDefined by
   65 |
66 | dispose():void
67 |
68 | implementation should perpare all objects for garbage collection 69 |
70 |
IDisposable
73 |
74 | 78 |
79 | 80 |
Method detail
81 | 82 | 83 | 84 | 85 | 86 |
dispose()method
87 |
88 | public function dispose():void

89 | implementation should perpare all objects for garbage collection 90 |

91 |
92 |
93 |
94 |
95 |

96 | 98 |
99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /docs/com/gskinner/utils/class-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.gskinner.utils - API Documentation 6 | 7 | 8 | 9 | 10 | 11 |

12 | Package com.gskinner.utils 13 |

14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
Interfaces
IDisposable
 
25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /docs/com/gskinner/utils/package-detail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | com.gskinner.utils Summary 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 |
34 |
35 | 36 |
Interfaces
37 | 38 | 39 | 40 | 41 | 42 | 44 | 45 |
 InterfaceDescription
 IDisposable 43 | IDisposable by Grant Skinner.
46 |

47 |
48 |

49 | 51 |
52 |
53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /docs/cookies.js: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // ADOBE SYSTEMS INCORPORATED 4 | // Copyright 2006-2007 Adobe Systems Incorporated 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Adobe permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | /** 13 | * Read the JavaScript cookies tutorial at: 14 | * http://www.netspade.com/articles/javascript/cookies.xml 15 | */ 16 | 17 | /** 18 | * Sets a Cookie with the given name and value. 19 | * 20 | * name Name of the cookie 21 | * value Value of the cookie 22 | * [expires] Expiration date of the cookie (default: end of current session) 23 | * [path] Path where the cookie is valid (default: path of calling document) 24 | * [domain] Domain where the cookie is valid 25 | * (default: domain of calling document) 26 | * [secure] Boolean value indicating if the cookie transmission requires a 27 | * secure transmission 28 | */ 29 | function setCookie(name, value, expires, path, domain, secure) 30 | { 31 | document.cookie= name + "=" + escape(value) + 32 | ((expires) ? "; expires=" + expires.toGMTString() : "") + 33 | ((path) ? "; path=" + path : "") + 34 | ((domain) ? "; domain=" + domain : "") + 35 | ((secure) ? "; secure" : ""); 36 | } 37 | 38 | /** 39 | * Gets the value of the specified cookie. 40 | * 41 | * name Name of the desired cookie. 42 | * 43 | * Returns a string containing value of specified cookie, 44 | * or null if cookie does not exist. 45 | */ 46 | function getCookie(name) 47 | { 48 | var dc = document.cookie; 49 | var prefix = name + "="; 50 | var begin = dc.indexOf("; " + prefix); 51 | if (begin == -1) 52 | { 53 | begin = dc.indexOf(prefix); 54 | if (begin != 0) return null; 55 | } 56 | else 57 | { 58 | begin += 2; 59 | } 60 | var end = document.cookie.indexOf(";", begin); 61 | if (end == -1) 62 | { 63 | end = dc.length; 64 | } 65 | return unescape(dc.substring(begin + prefix.length, end)); 66 | } 67 | 68 | /** 69 | * Deletes the specified cookie. 70 | * 71 | * name name of the cookie 72 | * [path] path of the cookie (must be same as path used to create cookie) 73 | * [domain] domain of the cookie (must be same as domain used to create cookie) 74 | */ 75 | function deleteCookie(name, path, domain) 76 | { 77 | if (getCookie(name)) 78 | { 79 | document.cookie = name + "=" + 80 | ((path) ? "; path=" + path : "") + 81 | ((domain) ? "; domain=" + domain : "") + 82 | "; expires=Thu, 01-Jan-70 00:00:01 GMT"; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /docs/images/collapsed.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cataclysmicrewind/CameraDetection/522cb551ffde4902a1cdfaa74e1f9e520f354a58/docs/images/collapsed.gif -------------------------------------------------------------------------------- /docs/images/detailHeaderRule.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cataclysmicrewind/CameraDetection/522cb551ffde4902a1cdfaa74e1f9e520f354a58/docs/images/detailHeaderRule.jpg -------------------------------------------------------------------------------- /docs/images/detailSectionHeader.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cataclysmicrewind/CameraDetection/522cb551ffde4902a1cdfaa74e1f9e520f354a58/docs/images/detailSectionHeader.jpg -------------------------------------------------------------------------------- /docs/images/expanded.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cataclysmicrewind/CameraDetection/522cb551ffde4902a1cdfaa74e1f9e520f354a58/docs/images/expanded.gif -------------------------------------------------------------------------------- /docs/images/inherit-arrow.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cataclysmicrewind/CameraDetection/522cb551ffde4902a1cdfaa74e1f9e520f354a58/docs/images/inherit-arrow.gif -------------------------------------------------------------------------------- /docs/images/inheritedSummary.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cataclysmicrewind/CameraDetection/522cb551ffde4902a1cdfaa74e1f9e520f354a58/docs/images/inheritedSummary.gif -------------------------------------------------------------------------------- /docs/images/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cataclysmicrewind/CameraDetection/522cb551ffde4902a1cdfaa74e1f9e520f354a58/docs/images/logo.jpg -------------------------------------------------------------------------------- /docs/images/titleTableBottom.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cataclysmicrewind/CameraDetection/522cb551ffde4902a1cdfaa74e1f9e520f354a58/docs/images/titleTableBottom.jpg -------------------------------------------------------------------------------- /docs/images/titleTableMiddle.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cataclysmicrewind/CameraDetection/522cb551ffde4902a1cdfaa74e1f9e520f354a58/docs/images/titleTableMiddle.jpg -------------------------------------------------------------------------------- /docs/images/titleTableTop.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cataclysmicrewind/CameraDetection/522cb551ffde4902a1cdfaa74e1f9e520f354a58/docs/images/titleTableTop.jpg -------------------------------------------------------------------------------- /docs/index-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Adobe Flex 2 Language Reference 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |

Index

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 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 |
AN
BO
CP
DQ
ER
FS
GT
HU
IV
JW
KX
LY
MZ
117 | 118 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Adobe Flex 2 Language Reference 8 | 9 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | <body> 46 | 47 | <h2>Frame Alert</h2> 48 | 49 | <p> 50 | This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. 51 | <br> 52 | Link to <a href="package-summary.html">Non-frame version.</a> 53 | 54 | </p> 55 | 56 | </body> 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /docs/ktu/events/class-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ktu.events - API Documentation 6 | 7 | 8 | 9 | 10 | 11 |

12 | Package ktu.events 13 |

14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
Classes
CameraDetectionEvent
22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /docs/ktu/events/package-detail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | ktu.events Summary 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 |
34 |
35 | 36 |
Classes
37 | 38 | 39 | 40 | 41 | 42 | 45 | 46 |
 ClassDescription
 CameraDetectionEvent 43 | A CameraDetection object dispatches a CameraDetectionEvent 44 |
47 |

48 |
49 |

50 | 52 |
53 |
54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /docs/ktu/media/CameraDetectionResult.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | ktu.media.CameraDetectionResult 9 | 10 | 11 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
Packagektu.media
Classpublic class CameraDetectionResult
41 |

42 | 43 | Enumeration of possible results from using CameraDetection 44 | 45 | Used in conjunction with CameraDetectionEvent as the code property 46 | 47 | 48 |

49 |
50 |
51 |
52 | 53 |
54 |
Public Constants
55 | 56 | 57 | 58 | 59 | 60 | 64 | 65 | 66 | 70 | 71 | 72 | 76 | 77 | 78 | 82 | 83 |
 ConstantDefined by
  NO_CAMERAS : String = "noCameras"
[static] 61 | code value for when no Cameras were found 62 |
63 |
CameraDetectionResult
  NO_PERMISSION : String = "noPermission"
[static] 67 | code value for when user denies permission to the Camera 68 |
69 |
CameraDetectionResult
  NO_SUCCESS : String = "noSuccess"
[static] 73 | code value for when at least one camera is found, but none work 74 |
75 |
CameraDetectionResult
  SUCCESS : String = "success"
[static] 79 | code value for when a Cameras was found that works 80 |
81 |
CameraDetectionResult
84 |
85 | 89 |
90 | 91 |
Constant detail
92 | 93 | 94 | 95 | 96 | 97 |
NO_CAMERASconstant
98 |
99 | public static const NO_CAMERAS:String = "noCameras"

100 | code value for when no Cameras were found 101 |

102 | 103 | 104 | 105 | 106 | 107 |
NO_PERMISSIONconstant 
108 |
109 | public static const NO_PERMISSION:String = "noPermission"

110 | code value for when user denies permission to the Camera 111 |

112 | 113 | 114 | 115 | 116 | 117 |
NO_SUCCESSconstant 
118 |
119 | public static const NO_SUCCESS:String = "noSuccess"

120 | code value for when at least one camera is found, but none work 121 |

122 | 123 | 124 | 125 | 126 | 127 |
SUCCESSconstant 
128 |
129 | public static const SUCCESS:String = "success"

130 | code value for when a Cameras was found that works 131 |

132 |
133 |
134 |
135 |
136 |

137 | 139 |
140 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /docs/ktu/media/class-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ktu.media - API Documentation 6 | 7 | 8 | 9 | 10 | 11 |

12 | Package ktu.media 13 |

14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |
Classes
CameraDetection
CameraDetectionResult
CameraDetectionVerbose
28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/ktu/media/package-detail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | ktu.media Summary 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 |
34 |
35 | 36 |
Classes
37 | 38 | 39 | 40 | 41 | 42 | 44 | 45 | 46 | 54 | 55 | 56 | 58 | 59 |
 ClassDescription
 CameraDetection 43 | CameraDetection searches all available Camera objects to find the first working Camera.
 CameraDetectionResult 47 | 48 | Enumeration of possible results from using CameraDetection 49 | 50 | Used in conjunction with CameraDetectionEvent as the code property 51 | 52 | 53 |
 CameraDetectionVerbose 57 | CameraDetection searches all available Camera objects to find the first working Camera.
60 |

61 |
62 |

63 | 65 |
66 |
67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /docs/mxml-tags.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | MXML Only Components - Adobe Flex 2 Language Reference 10 | 11 | 12 | 13 | 14 | 15 | 16 |

MXML Only Components

17 | 18 | <mx:Binding> 19 |
20 | 21 | <mx:Component> 22 |
23 | 24 | <mx:Metadata> 25 |
26 | 27 | <mx:Model> 28 |
29 | 30 | <mx:Script> 31 |
32 | 33 | <mx:Style> 34 |
35 | 36 | <mx:XML> 37 |
38 | 39 | <mx:XMLList> 40 |
41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /docs/package-detail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Top Level Constants and Functions Summary 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 |
34 |
35 | 36 |
Classes
37 | 38 | 39 | 40 | 41 | 42 | 46 | 47 | 48 | 52 | 53 | 54 | 58 | 59 |
 ClassDescription
 MultiTest 43 | This class is a test class to see how CameraDetection functions when an application tries to use the camera multiple times
44 |
45 | This is a document class.
 MultiTestVerbose 49 | This class is a test class to see how CameraDetection functions when an application tries to use the camera multiple times
50 |
51 | This is a document class.
 Simple 55 | This class is a simple example of how to use CameraDetection
56 |
57 | This is a document class.
60 |

61 |
62 |

63 | 65 |
66 |
67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /docs/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Adobe Flex 2 Language Reference 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | <body> 20 | 21 | <h2>Frame Alert</h2> 22 | 23 | <p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. 24 | <br> 25 | Link to<a href="package-summary.html">Non-frame version.</a> 26 | 27 | </p> 28 | 29 | </body> 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /docs/package-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Package List - API Documentation 6 | 7 | 8 | 9 | 10 | 11 | 12 |

13 | Packages 14 |

15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 26 | 27 | 28 | 31 | 32 | 33 | 34 | 35 |
Top Level
com.gskinner.utils 24 |
25 |
ktu.events 29 |
30 |
ktu.media
36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /docs/package-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | All Packages 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 |
34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 |
 PackageDescription
 Top Level 
 com.gskinner.utils 
 ktu.events 
 ktu.media 
51 |

52 | 54 |
55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /docs/print.css: -------------------------------------------------------------------------------- 1 | /* 2 | //////////////////////////////////////////////////////////////////////////////// 3 | // 4 | // ADOBE SYSTEMS INCORPORATED 5 | // Copyright 2005-2007 Adobe Systems Incorporated 6 | // All Rights Reserved. 7 | // 8 | // NOTICE: Adobe permits you to use, modify, and distribute this file 9 | // in accordance with the terms of the license agreement accompanying it. 10 | // 11 | //////////////////////////////////////////////////////////////////////////////// 12 | */ 13 | 14 | body { 15 | color: #000000; 16 | background: #ffffff; 17 | font-family: "Times New Roman", Times, serif; 18 | font-size: 12pt; 19 | } 20 | a { 21 | text-decoration: none; 22 | color: #000000; 23 | } 24 | pre { 25 | white-space: -moz-pre-wrap; /* Mozilla */ 26 | white-space: -pre-wrap; /* Opera 4-6 */ 27 | white-space: -o-pre-wrap; /* Opera 7 */ 28 | word-wrap: break-word; /* IE */ 29 | } 30 | .titleTableTopNav, .titleTableSubNav, .logoImage { 31 | display: none; 32 | } 33 | .packageFrame { 34 | display: none; 35 | } 36 | .titleTableSubTitle { 37 | font-weight: bold; 38 | } 39 | .classHeaderTableLabel { 40 | padding-right: 10px; 41 | vertical-align: top; 42 | } 43 | .showHideLinks { 44 | display: none; 45 | } 46 | html>body code { 47 | font-size: 10pt; 48 | } 49 | .summaryTableTitle, .detailSectionHeader { 50 | font-size: 14pt; 51 | font-weight: bold; 52 | padding-top: 15px; 53 | padding-bottom: 5px; 54 | } 55 | .summaryTable { 56 | border: 1px solid #000000; 57 | border-collapse: collapse; 58 | width: 100%; 59 | } 60 | .summaryTableDescription { 61 | padding-bottom: 20px; 62 | } 63 | .summaryTableSignatureCol, .summaryTableOwnerCol, .summaryTableLastCol, .summaryTableCol { 64 | border: 1px solid #000000; 65 | } 66 | .summaryTablePaddingCol { 67 | border: 1px solid #000000; 68 | border-right: 0px; 69 | } 70 | .summaryTableInheritanceCol, .summaryTableOperatorCol, .summaryTableStatementCol, .summaryTableSecondCol { 71 | border: 1px solid #000000; 72 | border-left: 0px; 73 | } 74 | .summaryTableLastCol { 75 | vertical-align: top; 76 | } 77 | .detailHeader { 78 | font-size: 13pt; 79 | padding-top: 100px; 80 | } 81 | .detailHeaderName { 82 | font-weight: bold; 83 | } 84 | .detailHeaderType { 85 | padding-left: 5px; 86 | } 87 | .detailHeaderRule { 88 | background: #FF0000; 89 | } 90 | .seeAlso { 91 | padding-bottom: 20px; 92 | margin-top: -20px; 93 | } 94 | .innertable { 95 | border-collapse: collapse; 96 | } 97 | .innertable td,.innertable th { 98 | border: 1px solid #000000; 99 | padding-left: 5px; 100 | padding-right: 5px; 101 | } 102 | .listing { 103 | font-size: 10pt; 104 | } 105 | .feedbackLink { 106 | display: none; 107 | } 108 | .copyright { 109 | font-size: 10pt; 110 | } -------------------------------------------------------------------------------- /docs/title-bar.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Adobe Flex 2 Language Reference 8 | 9 | 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 28 | 29 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 |
CameraDetection Docs 26 | All Packages | All Classes | Index | No Frames   27 | 30 |

31 |
 
 
51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /readme.textile: -------------------------------------------------------------------------------- 1 | 2 | 3 | h2. camera detection so you don't have to 4 | 5 | ever thought that dealing with Camera object in flash was easy? didn't think so. if you want to develop quality professional applications that utilize a Camera in flash prepare for some painful days. 6 | 7 | CameraDetection is a simple library that handles all of the hassle about dealing with Camera in flash (well as much as possible). integration is easy, 8 | 9 | 10 | *** 11 | 12 | *disclaimer:* although i am confident about the code i have written, i cannot guarantee it is bug free. 13 | it is difficult to test Camera since i only have access to a few. so please! find it in your developer blood pumping organ to use the Logger class so we can tell adobe what's up, and so i can make my code even better. 14 | 15 | *** 16 | 17 | 18 | h2. simple api 19 | 20 | * one event 21 | * all the situations handled 22 | * tell it to begin 23 | * wait 24 | 25 | 26 | 27 | h2. show me 28 | 29 | ok... here it is... the big dump 30 | 31 | i will be logging this usage 32 | 33 | h2. logging 34 | 35 | why log? 36 | 37 | 38 | h2. why 39 | 40 | let me tell you the problems 41 | 42 | dealing with permissions in as3 sucks. the events are flakey and it hurts to deal with. 43 | 44 | look at the wiki home page, i wrote something good there about the problems. 45 | 46 | however, this handles when the dialog opens, when it closes, when you get permission or get denied, and when a camera is found that works. this is great stuff 47 | 48 | -------------------------------------------------------------------------------- /src/PermissionsTest.as: -------------------------------------------------------------------------------- 1 | /** 2 | * author: ktu; [blog.cataclysmicrewind.com] 3 | * updated: 2012.10.06; 4 | * 5 | * This class is free to use and modify, however I request that the header (except example code), 6 | * and original package remain intact. 7 | * If you choose to modify it, please contact me before releasing the product. 8 | * [ktu_flash@cataclysmicrewind.com] 9 | * 10 | */ 11 | package { 12 | 13 | import com.bit101.components.Accordion; 14 | import com.bit101.components.Style; 15 | import com.bit101.components.Text; 16 | import com.bit101.components.VScrollBar; 17 | import flash.display.Sprite; 18 | import flash.events.Event; 19 | import flash.events.MouseEvent; 20 | import flash.events.NetStatusEvent; 21 | import flash.geom.Rectangle; 22 | import flash.media.Camera; 23 | import flash.media.Microphone; 24 | import ktu.events.MediaPermissionsEvent; 25 | import ktu.media.MediaPermissions; 26 | import ktu.media.MediaPermissionsResult; 27 | import tests.DialogArea; 28 | import tests.Output; 29 | import tests.PermissionTestAccordion; 30 | import tests.TestData; 31 | import tests.TestWindow; 32 | 33 | 34 | /** 35 | * This Document class is designed to test that the MediaPermissions object works like it should. 36 | * 37 | * 38 | * cases: 39 | * 40 | * remembered? - popup - choice = result 41 | * 42 | * false - quick - allow = granted 43 | * false - quick - deny = denied 44 | * false - security - allow = granted 45 | * false - security - deny = denied 46 | * true(allow) - quick - n/a = granted 47 | * true(allow) - security - allow = granted 48 | * true(allow) - security - deny = denied 49 | * true(deny) - quick - n/a = denied 50 | * true(deny) - security - allow = allow 51 | * true(deny) - security - deny = denied 52 | * true(deny) - security - close = denied 53 | * 54 | * 55 | * 56 | * 57 | * 58 | * 59 | * @author ktu 60 | */ 61 | public class PermissionsTest extends Sprite { 62 | private var output:Output; 63 | private var mediaPermissions:MediaPermissions; 64 | 65 | public function PermissionsTest(){ 66 | if (stage) 67 | init(); 68 | else 69 | addEventListener(Event.ADDED_TO_STAGE, init); 70 | } 71 | 72 | private function init(e:Event = null):void { 73 | removeEventListener(Event.ADDED_TO_STAGE, init); 74 | // 75 | //stage.addEventListener(MouseEvent.CLICK, onClick); 76 | Style.setStyle(Style.KTU); 77 | 78 | 79 | 80 | var accordion:PermissionTestAccordion = new PermissionTestAccordion(this, 20, 10); 81 | accordion.width = 170; 82 | accordion.height = 480; 83 | accordion.addEventListener("start", onStart); 84 | 85 | var accordionMask:Sprite = new Sprite(); 86 | accordionMask.graphics.beginFill(0); 87 | accordionMask.graphics.drawRect(0, 0, 170, 360); 88 | accordionMask.x = 20; 89 | accordionMask.y = 10; 90 | accordion.mask = accordionMask; 91 | 92 | var accordionSlider:VScrollBar = new VScrollBar(this, 10, 10); 93 | accordionSlider.height = 360; 94 | accordionSlider.setThumbPercent(360 / accordion.height); 95 | accordionSlider.setSliderParams(0, 1, 0); 96 | accordionSlider.addEventListener(Event.CHANGE, function(e:Event):void { 97 | accordion.y = 10 - (120 * accordionSlider.value); 98 | }); 99 | 100 | var dialogArea:DialogArea = new DialogArea(this, 200, 121); 101 | dialogArea.setSize(215, 138); 102 | 103 | output = new Output(this, 200, 121+138+10); 104 | output.setSize(215 + 190, 101); 105 | 106 | var accordionInstructions:Text = new Text(this, 200, 10, "legend:\nrememberd? False, True(Allow/Deny)\ndialog? Quick or Privacy\nUser Action? Allow/Deny/Close/n/a" ); 107 | accordionInstructions.setSize(215, 91); 108 | 109 | 110 | } 111 | 112 | private function onStart(e:NetStatusEvent):void { 113 | output.log("start clicked"); 114 | mediaPermissions = new MediaPermissions(stage); 115 | mediaPermissions.mode = e.info.mode; 116 | output.log("mode = MediaPermissions." + (mediaPermissions.mode == MediaPermissions.QUICK_ACCESS ? "QUICK_ACCESS" : "PRIVACY_DIALOG")); 117 | mediaPermissions.addEventListener(MediaPermissionsEvent.RESOLVE, onPermissionsResolve); 118 | mediaPermissions.addEventListener(MediaPermissionsEvent.DIALOG_STATUS, onDialogStatus); 119 | mediaPermissions.getPermission(Camera); 120 | } 121 | 122 | private function onPermissionsResolve(e:MediaPermissionsEvent):void { 123 | if (e.remembered) output.log("user 'remembered' their decision"); 124 | var log:String = "MediaPermissionsResult."; 125 | switch (e.code) { 126 | case MediaPermissionsResult.GRANTED : 127 | log += "GRANTED"; 128 | break; 129 | case MediaPermissionsResult.DENIED: 130 | log += "DENIED"; 131 | break; 132 | case MediaPermissionsResult.NO_DEVICE: 133 | log += "NO_DEVICE"; 134 | break; 135 | } 136 | output.log(log); 137 | } 138 | private function onDialogStatus(e:MediaPermissionsEvent):void { 139 | if (mediaPermissions.mode == MediaPermissions.QUICK_ACCESS) { 140 | if (e.code == MediaPermissionsResult.DIALOG_OPEN) { 141 | output.log("MediaPermissionsResult.DIALOG_OPEN - quick access"); 142 | output.log("waiting for user input"); 143 | } else { 144 | output.log("MediaPermissionsResult.DIALOG_CLOSED - quick access"); 145 | } 146 | } else { 147 | if (e.code == MediaPermissionsResult.DIALOG_OPEN) { 148 | output.log("MediaPermissionsResult.DIALOG_OPEN - privacy dialog"); 149 | output.log("waiting for user input"); 150 | } else { 151 | output.log("MediaPermissionsResult.DIALOG_CLOSED - privacy dialog"); 152 | } 153 | } 154 | } 155 | } 156 | } -------------------------------------------------------------------------------- /src/Simple.as: -------------------------------------------------------------------------------- 1 | /** 2 | * * File: Simple.as; 3 | * Author: Ktu; [blog.cataclysmicrewind.com] 4 | * Updated: 12.17.10; 5 | * 6 | * This class is free to use and modify, however I request that the header (except example code), 7 | * and original package remain intact. 8 | * If you choose to modify it, please contact me before releasing the product. 9 | * [ktu_flash@cataclysmicrewind.com] 10 | * 11 | * 12 | * 13 | * This is a document class for a swf. 14 | * This swf is meant for Always Compile in FlashDevelop 15 | * 16 | * This is the same code as the simple example.fla 17 | * 18 | * I did this for testing, because really, who uses the IDE anymore except for assets? 19 | * 20 | * 21 | */ 22 | package { 23 | 24 | import flash.media.Camera; 25 | import ktu.events.CameraDetectionEvent; 26 | import ktu.events.MediaPermissionsEvent; 27 | import ktu.media.CameraChecker; 28 | import ktu.media.CameraDetection; 29 | import ktu.media.CameraDetectionResult; 30 | import ktu.media.MediaPermissions; 31 | import ktu.media.MediaPermissionsResult; 32 | 33 | import flash.display.Sprite; 34 | import flash.events.Event; 35 | import flash.media.Video; 36 | 37 | /** 38 | * 39 | * This class is a simple example of how to use CameraDetection
40 | *
41 | * This is a document class.
42 | *
43 | * Very simple.
44 | * Create an instance
45 | * var cd:CameraDetection = new CameraDetection(stage);
46 | * Add the event listener
47 | * cd.addEventListener (CameraDetectionEvent.RESOLVE, onCameraResolve);
48 | * Write function onCameraResolve to handle the results
49 | * function onCameraResolve (e:CameraDetectionEvent):void { 50 | * switch (e.code) { 51 | * case CameraDetectionResult.SUCCESS: 52 | * case CameraDetectionResult.NO_SUCCESS: 53 | * case CameraDetectionResult.NO_PERMISSION: 54 | * case CameraDetectionResult.NO_CAMERAS: 55 | * 56 | */ 57 | public class Simple extends Sprite { 58 | 59 | private var video:Video; 60 | private var cd:CameraDetection; 61 | 62 | 63 | public function Simple() { 64 | if (stage) init (); 65 | else addEventListener (Event.ADDED_TO_STAGE, init); 66 | } 67 | 68 | private function init (e:Event = null):void { 69 | if (e) removeEventListener (Event.ADDED_TO_STAGE, init); 70 | // entry point 71 | video = new Video(); 72 | addChild(video); 73 | 74 | cd = new CameraDetection (stage); 75 | cd.secLengthToCheck = 5; 76 | cd.addEventListener (CameraDetectionEvent.RESOLVE, onResolve); 77 | cd.addEventListener(MediaPermissionsEvent.DIALOG_STATUS, onDialogStatus); 78 | cd.begin(video); 79 | 80 | } 81 | private function onDialogStatus (e:MediaPermissionsEvent):void { 82 | if (e.code == MediaPermissionsResult.DIALOG_OPEN) { 83 | trace("dialog opened"); 84 | } else if (e.code == MediaPermissionsResult.DIALOG_CLOSED) { 85 | trace("dialog closed"); 86 | } 87 | } 88 | private function onResolve(e:CameraDetectionEvent):void { 89 | switch (e.code) { 90 | case CameraDetectionResult.SUCCESS : 91 | trace("got a camera!!!"); 92 | video.attachCamera(e.camera); 93 | break; 94 | case CameraDetectionResult.NO_PERMISSION : 95 | trace("Camera access denied"); 96 | break; 97 | case CameraDetectionResult.NO_CAMERAS : 98 | trace("There are no cameras connected to the computer"); 99 | break; 100 | case CameraDetectionResult.NO_SUCCESS: 101 | trace("there was at least one camera, but none worked!!"); 102 | } 103 | } 104 | } 105 | 106 | } -------------------------------------------------------------------------------- /src/ktu/events/CameraDetectionEvent.as: -------------------------------------------------------------------------------- 1 | /** 2 | * author: ktu; [blog.cataclysmicrewind.com] 3 | * updated: 2012.10.06; 4 | * 5 | * This class is free to use and modify, however I request that the header (except example code), 6 | * and original package remain intact. 7 | * If you choose to modify it, please contact me before releasing the product. 8 | * [ktu_flash@cataclysmicrewind.com] 9 | * 10 | */ 11 | package ktu.events { 12 | 13 | import flash.events.Event; 14 | import flash.media.Camera; 15 | import flash.media.Video; 16 | 17 | /** 18 | * 19 | * A CameraDetection object dispatches a CameraDetectionEvent 20 | * 21 | * 22 | */ 23 | public class CameraDetectionEvent extends Event { 24 | 25 | /** 26 | * event value for when CameraDetection has completed its process 27 | */ 28 | public static const RESOLVE :String = "cameraResolved"; 29 | 30 | 31 | private var _camera:Camera; 32 | private var _video:Video; 33 | /** 34 | * returns the camera associated with the event 35 | */ 36 | public function get camera():Camera { return _camera; } 37 | 38 | 39 | private var _code:String; 40 | /** 41 | * String code associated with the event 42 | */ 43 | public function get code():String { return _code; } 44 | 45 | 46 | 47 | 48 | private var _remembered:Boolean; 49 | /** 50 | * Specifies whether the user had remembered their permission settings from a previous session 51 | */ 52 | public function get remembered():Boolean { return _remembered; } 53 | 54 | public function get video():Video { return _video; } 55 | /** 56 | * Constructor 57 | * 58 | * @param type 59 | * @param camera 60 | * @param code 61 | * @param bubbles 62 | * @param cancelable 63 | */ 64 | public function CameraDetectionEvent (type:String, camera:Camera = null, code:String = null, video:Video = null, remembered:Boolean = false, bubbles:Boolean = false, cancelable:Boolean = false ):void { 65 | _camera = camera; 66 | _code = code; 67 | _video = video; 68 | _remembered = remembered; 69 | super (type, bubbles, cancelable); 70 | } 71 | } 72 | } -------------------------------------------------------------------------------- /src/ktu/events/MediaPermissionsEvent.as: -------------------------------------------------------------------------------- 1 | /** 2 | * author: ktu; [blog.cataclysmicrewind.com] 3 | * updated: 2012.10.06; 4 | * 5 | * This class is free to use and modify, however I request that the header (except example code), 6 | * and original package remain intact. 7 | * If you choose to modify it, please contact me before releasing the product. 8 | * [ktu_flash@cataclysmicrewind.com] 9 | * 10 | */ 11 | package ktu.events { 12 | 13 | import flash.events.Event; 14 | 15 | /** 16 | * 17 | * A MediaPermissions object dispatches a MediaPermissionEvent 18 | * 19 | * 20 | */ 21 | public class MediaPermissionsEvent extends Event { 22 | 23 | /** 24 | * event value for when CameraDetection has completed its process 25 | */ 26 | public static const RESOLVE :String = "mediaPermissionsResolved"; 27 | 28 | public static const DIALOG_STATUS :String = "mediaPermissionsDialogStatus"; 29 | 30 | 31 | private var _code:String; 32 | /** 33 | * String code associated with the event 34 | */ 35 | public function get code():String { return _code; } 36 | 37 | 38 | 39 | 40 | private var _remembered:Boolean; 41 | /** 42 | * Specifies whether the user had remembered their permission settings from a previous session 43 | */ 44 | public function get remembered():Boolean { return _remembered; } 45 | /** 46 | * Constructor 47 | * 48 | * @param type 49 | * @param camera 50 | * @param code 51 | * @param bubbles 52 | * @param cancelable 53 | */ 54 | public function MediaPermissionsEvent (type:String, code:String = null, remembered:Boolean = false, bubbles:Boolean = false, cancelable:Boolean = false ):void { 55 | _code = code; 56 | _remembered = remembered; 57 | super (type, bubbles, cancelable); 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /src/ktu/media/CameraCheckerLogger.as: -------------------------------------------------------------------------------- 1 | /** 2 | * author: ktu; [blog.cataclysmicrewind.com] 3 | * updated: 2012.10.06; 4 | * 5 | * This class is free to use and modify, however I request that the header (except example code), 6 | * and original package remain intact. 7 | * If you choose to modify it, please contact me before releasing the product. 8 | * [ktu_flash@cataclysmicrewind.com] 9 | * 10 | */ 11 | package ktu.media { 12 | 13 | import flash.events.TimerEvent; 14 | import flash.media.Camera; 15 | import flash.media.Video; 16 | import flash.utils.getTimer; 17 | /** 18 | * 19 | * this class will track and hold onto all important information while checking a camera... 20 | * 21 | * tick delay 22 | * timer repeat Count 23 | * 24 | * camera name 25 | * num ticks till past activity init 26 | * each tick: 27 | * activity reading 28 | * fps reading 29 | * 30 | * ... 31 | * @author ktu 32 | */ 33 | public class CameraCheckerLogger extends CameraChecker { 34 | 35 | protected var _log:Object = { }; 36 | public function get log():Object { return _log; } 37 | 38 | 39 | public function CameraCheckerLogger(){ 40 | 41 | } 42 | 43 | override public function check(camera:Camera, video:Video = null):void { 44 | _log.name = camera.name 45 | _log.startTime = getTimer(); 46 | _log.timerDelay = _timerDelay; 47 | _log.timerRepeatCount = _timerRepeatCount; 48 | _log.minTimesGood = _minTimesGood; 49 | _log.cameraActivityInitCompleteTick = -1; 50 | _log.cameraActivityAverage = -1; 51 | _log.cameraFPSAverage = -1; 52 | _log.ticks = []; 53 | _log.completeFired = false; 54 | _log.dispatched = false; 55 | super.check(camera, video); 56 | } 57 | 58 | override protected function tickCheckCamera(e:TimerEvent):void { 59 | if (e.type == TimerEvent.TIMER) { 60 | // add averages to log 61 | _log.ticks[_timer.currentCount] = {activity: _camera.activityLevel, fps: _camera.fps, activityInit: _camActivityInit } 62 | } else { 63 | _log.completeFired = true; 64 | } 65 | super.tickCheckCamera(e); 66 | } 67 | 68 | override protected function dispatch(result:String):void { 69 | _log.completeTime = getTimer(); 70 | _log.dispatched = result; 71 | super.dispatch(result); 72 | } 73 | 74 | } 75 | 76 | } -------------------------------------------------------------------------------- /src/ktu/media/CameraDetectionLogger.as: -------------------------------------------------------------------------------- 1 | /** 2 | * author: ktu; [blog.cataclysmicrewind.com] 3 | * updated: 2012.10.06; 4 | * 5 | * This class is free to use and modify, however I request that the header (except example code), 6 | * and original package remain intact. 7 | * If you choose to modify it, please contact me before releasing the product. 8 | * [ktu_flash@cataclysmicrewind.com] 9 | * 10 | */ 11 | package ktu.media { 12 | 13 | import flash.display.Stage; 14 | import flash.media.Camera; 15 | import flash.media.Video; 16 | import flash.system.Capabilities; 17 | import flash.utils.getTimer; 18 | import ktu.events.CameraDetectionEvent; 19 | 20 | 21 | /** 22 | * 23 | * @author ktu 24 | */ 25 | public class CameraDetectionLogger extends CameraDetection3 { 26 | 27 | private var _log:Object = { }; 28 | public function get log():Object { return _log; } 29 | 30 | public function CameraDetectionLogger() { 31 | super(); 32 | _cCheck = new CameraCheckerLogger(); 33 | _log.os = Capabilities.os; 34 | _log.version = Capabilities.version; 35 | _log.playerType = Capabilities.playerType; 36 | _log.isDebugger = Capabilities.isDebugger; 37 | } 38 | 39 | override public function begin(stage:Stage, customVideo:Video = null):void { 40 | _log.start = getTimer(); 41 | _log.cameras = Camera.names; 42 | _log.camerasChecked = []; 43 | super.begin(stage, customVideo); 44 | } 45 | override public function dispose():void { 46 | _log.disposed = true; 47 | super.dispose(); 48 | } 49 | override protected function havePermissions():void { 50 | super.havePermissions(); 51 | _log.defaultCamera = _defaultCameraName; 52 | } 53 | override protected function onCChecker(e:CameraDetectionEvent):void { 54 | _log.camerasChecked.push(CameraCheckerLogger(_cCheck).log); 55 | super.onCChecker(e); 56 | } 57 | override protected function dispatch(result:String, camera:Camera = null, video:Video = null):void { 58 | _log.end = getTimer(); 59 | _log.result = result; 60 | super.dispatch(result, camera, video); 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /src/ktu/media/CameraDetectionResult.as: -------------------------------------------------------------------------------- 1 | /** 2 | * author: ktu; [blog.cataclysmicrewind.com] 3 | * updated: 2012.10.06; 4 | * 5 | * This class is free to use and modify, however I request that the header (except example code), 6 | * and original package remain intact. 7 | * If you choose to modify it, please contact me before releasing the product. 8 | * [ktu_flash@cataclysmicrewind.com] 9 | * 10 | */ 11 | package ktu.media { 12 | 13 | /** 14 | * Enumeration of possible results from using CameraDetection 15 | * 16 | * Used in conjunction with CameraDetectionEvent as the code property 17 | */ 18 | public class CameraDetectionResult { 19 | 20 | /** 21 | * code value for when no Cameras were found 22 | */ 23 | public static const NO_CAMERAS :String = "noCameras"; 24 | /** 25 | * code value for when user denies permission to the Camera 26 | */ 27 | public static const NO_PERMISSION :String = "noPermission"; 28 | /** 29 | * code value for when at least one camera is found, but none work 30 | */ 31 | public static const NO_SUCCESS :String = "noSuccess"; 32 | /** 33 | * code value for when a Cameras was found that works 34 | */ 35 | public static const SUCCESS :String = "success"; 36 | } 37 | } -------------------------------------------------------------------------------- /src/ktu/media/MediaPermissionsResult.as: -------------------------------------------------------------------------------- 1 | /** 2 | * author: ktu; [blog.cataclysmicrewind.com] 3 | * updated: 2012.10.06; 4 | * 5 | * This class is free to use and modify, however I request that the header (except example code), 6 | * and original package remain intact. 7 | * If you choose to modify it, please contact me before releasing the product. 8 | * [ktu_flash@cataclysmicrewind.com] 9 | * 10 | */ 11 | package ktu.media { 12 | 13 | /** 14 | * Enumeration of possible results from using MediaPermissions 15 | * 16 | * Used in conjunction with MediaPermissionsEvent as the code property 17 | */ 18 | public class MediaPermissionsResult { 19 | 20 | /** 21 | * value for when permission is granted to use media 22 | */ 23 | static public const GRANTED:String = "granted"; 24 | /** 25 | * value for when permission is denied to use media 26 | */ 27 | static public const DENIED:String = "denied"; 28 | /** 29 | * value for when there are no devices to use on the machine 30 | */ 31 | static public const NO_DEVICE:String = "noDevice"; 32 | /** 33 | * value for when a dialog is opened 34 | */ 35 | static public const DIALOG_OPEN:String = "dialogOpen"; 36 | /** 37 | * value for when a dialog is closed 38 | */ 39 | static public const DIALOG_CLOSED:String = "dialogClosed"; 40 | } 41 | } -------------------------------------------------------------------------------- /src/tests/DialogArea.as: -------------------------------------------------------------------------------- 1 | package tests { 2 | import com.bit101.components.Panel; 3 | import com.bit101.components.Text; 4 | import flash.display.DisplayObjectContainer; 5 | import flash.text.TextFormat; 6 | import flash.text.TextFormatAlign; 7 | 8 | 9 | /** 10 | * ... 11 | * @author ktu 12 | */ 13 | public class DialogArea extends Panel { 14 | 15 | private var text:Text; 16 | 17 | public function DialogArea(parent:DisplayObjectContainer = null, xpos:Number = 0, ypos:Number = 0){ 18 | super(parent, xpos, ypos); 19 | } 20 | 21 | override protected function addChildren():void { 22 | super.addChildren(); 23 | // add text and center that shit 24 | text = new Text(content, 0, 0, "dialog pops up here\n\nbelow is the output from MediaPermissions"); 25 | text.height = 22; 26 | text.textField.autoSize = "left"; 27 | text.textField.defaultTextFormat = new TextFormat(null, 20, null, true, null, null, null, null, TextFormatAlign.CENTER); 28 | } 29 | 30 | override public function setSize(w:Number, h:Number):void { 31 | super.setSize(w, h); 32 | text.y = (h / 2) - (text.height / 2); 33 | text.x = (w / 2) - (text.width / 2); 34 | text.width = 185; 35 | text.height = 60 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /src/tests/Output.as: -------------------------------------------------------------------------------- 1 | package tests { 2 | import com.bit101.components.Panel; 3 | import com.bit101.components.PushButton; 4 | import com.bit101.components.Text; 5 | import com.bit101.components.VScrollBar; 6 | import flash.display.DisplayObjectContainer; 7 | import flash.events.Event; 8 | 9 | 10 | /** 11 | * ... 12 | * @author ktu 13 | */ 14 | public class Output extends Panel { 15 | 16 | public var text:Text; 17 | public var scrollBar:VScrollBar; 18 | public var clear:PushButton; 19 | 20 | public function Output(parent:DisplayObjectContainer = null, xpos:Number = 0, ypos:Number = 0){ 21 | super(parent, xpos, ypos); 22 | 23 | } 24 | 25 | override protected function addChildren():void { 26 | super.addChildren(); 27 | 28 | text = new Text(content); 29 | //text.width = 205 + 190; 30 | //text.height = 101; 31 | text.editable = false; 32 | scrollBar = new VScrollBar(content); 33 | //scrollBar.x = 205 + 190; 34 | //scrollBar.height = 101; 35 | 36 | clear = new PushButton(content, 205 + 190 - 60-10, 0, "clear", function (e:Event):void { text.text = ""; } ); 37 | clear.width = 60; 38 | } 39 | override public function setSize(w:Number, h:Number):void { 40 | super.setSize(w, h); 41 | text.width = w - scrollBar.width; 42 | text.height = h; 43 | scrollBar.x = w - scrollBar.width 44 | scrollBar.height = h; 45 | clear.x = w - scrollBar.width - clear.width; 46 | } 47 | public function log(msg:String):void { 48 | text.textField.appendText(msg + "\n"); 49 | text.textField.scrollV = text.textField.maxScrollV; 50 | scrollBar.setSliderParams(1, text.textField.maxScrollV, text.textField.maxScrollV); 51 | scrollBar.setThumbPercent(text.textField.numLines / text.textField.maxScrollV); 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /src/tests/PermissionTestAccordion.as: -------------------------------------------------------------------------------- 1 | package tests { 2 | import com.bit101.components.Accordion; 3 | import com.bit101.components.Style; 4 | import com.bit101.components.VBox; 5 | import com.bit101.components.Window; 6 | import flash.display.DisplayObjectContainer; 7 | import flash.events.Event; 8 | import flash.events.NetStatusEvent; 9 | 10 | 11 | /** 12 | * this accordion contains all of the tests... when a test's start is clicked, an event is dispatched to say which one and the data for the test 13 | * aka the expected response 14 | * 15 | * 16 | * 17 | * @author ktu 18 | */ 19 | public class PermissionTestAccordion extends Accordion { 20 | 21 | public function PermissionTestAccordion(parent:DisplayObjectContainer = null, xpos:Number = 0, ypos:Number = 0){ 22 | super(parent, xpos, ypos); 23 | 24 | } 25 | 26 | override protected function addChildren():void { 27 | _vbox = new VBox(this); 28 | _vbox.spacing = 0; 29 | 30 | _windows = new Array(); 31 | 32 | // loop through and create all of the test Windows 33 | var td:Array = TestData.data; 34 | for(var i:int = 0; i < td.length; i++) { 35 | var window:TestWindow = new TestWindow(_vbox, 0, 0); 36 | window.setData(td[i]); 37 | window.grips.visible = false; 38 | window.draggable = false; 39 | window.addEventListener(Event.SELECT, onWindowSelect); 40 | window.addEventListener("start", function (e:NetStatusEvent):void { dispatchEvent(e); } ); 41 | if (i != 0) window.minimized = true; 42 | window.titleColor = i % 2 == 0 ? Style.LIST_DEFAULT : Style.LIST_ALTERNATE; 43 | window.color = i % 2 == 0 ? Style.LIST_DEFAULT : Style.LIST_ALTERNATE; 44 | _windows.push(window); 45 | } 46 | } 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /src/tests/TestData.as: -------------------------------------------------------------------------------- 1 | package tests { 2 | 3 | 4 | /** 5 | * ... 6 | * @author ktu 7 | */ 8 | public class TestData { 9 | 10 | 11 | static public var data:Array = [ 12 | { 13 | title: "F - Q - A", 14 | description: "\"remember\" checkbox is NOT selected.\n\nuse the quick access dialog\n\nuser clicks allow\n\nmediaPermissions should return 'granted'", 15 | instructions: "click start\n\nselect allow", 16 | expectation: "granted", 17 | mode: "quickAccess" 18 | }, { 19 | title: "F - Q - D", 20 | description: "\"remember\" checkbox is NOT selected.\n\nuse the quick access dialog\n\nuser clicks deny\n\nmediaPermissions should return 'denied'", 21 | instructions: "click start\n\nselect deny", 22 | expectation: "denied", 23 | mode: "quickAccess" 24 | }, { 25 | title: "F - P - A", 26 | description: "\"remember\" checkbox is NOT selected.\n\nuse the privacy dialog\n\nuser clicks allow\n\nmediaPermissions should return 'granted'", 27 | instructions: "click start\n\nselect deny\n\nclick close", 28 | expectation: "denied", 29 | mode: "privacyDialog" 30 | }, { 31 | title: "F - P - D", 32 | description: "\"remember\" checkbox is NOT selected.\n\nuse the privacy dialog\n\nuser clicks deny\n\nmediaPermissions should return 'denied'", 33 | instructions: "click start\n\nselect deny\n\n click close", 34 | expectation: "denied", 35 | mode: "privacyDialog" 36 | }, { 37 | title: "F - P - C", 38 | description: "\"remember\" checkbox is NOT selected.\n\nuse the privacy dialog\n\nuser clicks close\n\nmediaPermissions should return 'denied'", 39 | instructions: "click start\n\nselect deny\n\n click close", 40 | expectation: "denied", 41 | mode: "privacyDialog" 42 | }, { 43 | title: "T(A) - Q - N/A", 44 | description: "\"remember\" checkbox IS selected with allow.\n\nuse the quick access dialog\n\nuser does nothing\n\nmediaPermissions should return 'granted'", 45 | instructions: "click start\n\ndo nothing", 46 | expectation: "granted", 47 | mode: "quickAccess" 48 | }, { 49 | title: "T(A) - P - A", 50 | description: "\"remember\" checkbox IS selected with allow.\n\nuse the privacy dialog\n\nuser clicks allow\n\nmediaPermissions should return 'granted'", 51 | instructions: "click start\n\nselect allow (even though already selected)", 52 | expectation: "granted", 53 | mode: "privacyDialog" 54 | }, { 55 | title: "T(A) - P - D", 56 | description: "\"remember\" checkbox IS selected with allow.\n\nuse the privacy dialog\n\nuser clicks allow\n\nmediaPermissions should return 'denied'", 57 | instructions: "click start\n\nclick deny", 58 | expectation: "denied", 59 | mode: "privacyDialog" 60 | }, { 61 | title: "T(A) - P - C", 62 | description: "\"remember\" checkbox IS selected with allow.\n\nuse the privacy dialog\n\nuser clicks close\n\nmediaPermissions should return 'granted'", 63 | instructions: "click start\n\nclick close", 64 | expectation: "granted", 65 | mode: "privacyDialog" 66 | }, { 67 | title: "T(D) - Q - N/A", 68 | description: "\"remember\" checkbox IS selected with deny.\n\nuse the quick access dialog\n\nuser does nothing\n\nmediaPermissions should return 'denied'", 69 | instructions: "click start\n\ndo nothing", 70 | expectation: "granted", 71 | mode: "quickAccess" 72 | }, { 73 | title: "T(D) - P - A", 74 | description: "\"remember\" checkbox IS selected with deny.\n\nuse the privacy dialog\n\nuser clicks allow\n\nmediaPermissions should return 'granted'", 75 | instructions: "click start\n\nselect allow (even though already selected)", 76 | expectation: "granted", 77 | mode: "privacyDialog" 78 | }, { 79 | title: "T(D) - P - D", 80 | description: "\"remember\" checkbox IS selected with deny.\n\nuse the privacy dialog\n\nuser clicks allow\n\nmediaPermissions should return 'denied'", 81 | instructions: "click start\n\nclick deny", 82 | expectation: "denied", 83 | mode: "privacyDialog" 84 | }, { 85 | title: "T(D) - P - C", 86 | description: "\"remember\" checkbox IS selected with deny.\n\nuse the privacy dialog\n\nuser clicks close\n\nmediaPermissions should return 'denied'", 87 | instructions: "click start\n\nclick close", 88 | expectation: "denied", 89 | mode: "privacyDialog" 90 | } 91 | ] 92 | 93 | } 94 | 95 | } -------------------------------------------------------------------------------- /src/tests/TestWindow.as: -------------------------------------------------------------------------------- 1 | package tests { 2 | import com.bit101.components.PushButton; 3 | import com.bit101.components.Style; 4 | import com.bit101.components.Text; 5 | import com.bit101.components.Window; 6 | import flash.display.DisplayObjectContainer; 7 | import flash.events.MouseEvent; 8 | import flash.events.NetStatusEvent; 9 | import flash.text.TextFormat; 10 | 11 | 12 | /** 13 | * 14 | * Each test window has: 15 | * 16 | * Description & Instruction buttons 17 | * 18 | * toggle text in box. has scroll bar if neccessary 19 | * 20 | * start button 21 | * 22 | * [expected result] 23 | * 24 | * @author ktu 25 | */ 26 | public class TestWindow extends Window { 27 | 28 | private var _data:Object; 29 | 30 | public var description:PushButton; 31 | public var instructions:PushButton; 32 | public var text:Text; 33 | public var start:PushButton; 34 | 35 | public function TestWindow(parent:DisplayObjectContainer = null, xpos:Number = 0, ypos:Number = 0, title:String = "Window"){ 36 | super(parent, xpos, ypos, title); 37 | width = 170; 38 | height = 240 + 20; // height of titleBar 39 | } 40 | 41 | override protected function addChildren():void { 42 | super.addChildren(); 43 | 44 | _titleLabel.mouseEnabled = false; 45 | _titleLabel.textField.defaultTextFormat = new TextFormat(null, null, null, true); 46 | 47 | //_titleBar.buttonMode = true; 48 | //_titleBar.mouseChildren = true; 49 | 50 | description = new PushButton(_panel, 5, 10, "description", onButtonClick); 51 | description.width = 80; 52 | description.height = 20; 53 | description.toggle = true; 54 | description.upColor = Style.BUTTON_DOWN; 55 | description.downColor = Style.BUTTON_FACE; 56 | instructions = new PushButton(_panel, 85, 10, "instructions", onButtonClick); 57 | instructions.width = 80; 58 | instructions.height = 20; 59 | instructions.toggle = true; 60 | instructions.upColor = Style.BUTTON_DOWN; 61 | instructions.downColor = Style.BUTTON_FACE; 62 | text = new Text(_panel, 5, 40); 63 | text.width = 160; 64 | text.height = 140; 65 | text.selectable = false; 66 | text.editable = false; 67 | start = new PushButton(_panel, 50, 207 - 20, "start", onButtonClick); 68 | start.width = 60; 69 | start.height = 25; 70 | } 71 | 72 | override public function get draggable():Boolean { return super.draggable; } 73 | override public function set draggable(value:Boolean):void { _draggable = value; } 74 | 75 | public function setData(data:Object):void { 76 | _data = data; 77 | title = data.title; 78 | text.text = data.description; 79 | description.selected = true; 80 | } 81 | 82 | 83 | 84 | protected function onButtonClick(e:MouseEvent):void { 85 | if (e.target == description) { 86 | if (description.selected == false) { 87 | description.selected = true; 88 | } 89 | //description.toggle = true; 90 | instructions.selected = false; 91 | text.text = _data.description; 92 | } else if (e.target == instructions) { 93 | if (instructions.selected == false) { 94 | instructions.selected = true; 95 | } 96 | description.selected = false; 97 | //instructions.toggle = true; 98 | text.text = _data.instructions + "\n\nexpectation: " + _data.expectation; 99 | } else { 100 | // pushed start, dispatch 101 | dispatchEvent(new NetStatusEvent("start", false, false, _data)); 102 | } 103 | } 104 | } 105 | } --------------------------------------------------------------------------------