-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStyleGuide.as
73 lines (65 loc) · 1.4 KB
/
StyleGuide.as
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// package PackageName
package
{
/**
* PackageName.ClassName
* Brief description of the class here
*
* @author John Doe
* @contact jd@email.com
*/
// Flash imports
import flash.geom.Vector3D;
// API imports
import com.gestureworks.objects.TouchObject;
// Local imports
import PackageName.MyMasterClass;
public class MyClass extends MyMasterClass
{
// This is a comment
// _lowerCamelCase
private var _myPrivateMemberVariable:int = 0;
// UpperCamelCase
public var MyGlobalMemberVariable:Number = 0.123;
// Constructor
public function MyClass(integer:int):void
{
_myPrivateMemberVariable = integer;
}
// Private/Protected member functions
private function addOne():int
{
_myPrivateMemberVariable++;
}
// Public member functions
public function PrintNumber():void
{
if (_myPrivateMemberVariable > 0)
{
trace("My positive number: " + _myPrivateMemberVariable);
}
else if (_myPrivateMemberVariable < 0)
{
trace("My negative number: " + _myPrivateMemberVariable);
}
else
{
trace("My number is zero");
}
}
public function GetNthFibbonacci(n:int):int
{
// current is set to 0
var current:int = Math.cos(Math.PI / 2);
var prev:int = 1;
var prevprev:int = 1;
for (var i:int = 2; i < n; i++)
{
current = prev + prevprev;
prevprev = prev;
prev = current;
}
return current;
}
}
}