forked from arpit/openpyro
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAbstractLayout.as
More file actions
68 lines (55 loc) · 1.28 KB
/
AbstractLayout.as
File metadata and controls
68 lines (55 loc) · 1.28 KB
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
package org.openPyro.layout
{
import flash.display.DisplayObject;
public class AbstractLayout
{
public function AbstractLayout()
{
}
protected var _initY:Number = 0;
protected var _initX:Number = 0;
/**
* Sets the initial x position of the layout.All further
* calculations of x positions are based on that
* initial position
*/
public function set initX(n:Number):void{
_initX = n;
}
/**
* @private
*/
public function get initX():Number{
return _initX;
}
/**
* Sets the initial y position of the layout.All further
* calculations of y positions are based on that
* initial position
*/
public function set initY(n:Number):void{
_initY = n;
}
/**
* @private
*/
public function get initY():Number{
return _initY;
}
protected var layoutDescriptors:Array
public function calculatePositions(children:Array):Array{
if(children.length == 0 ) return [] ;
layoutDescriptors = [];
return layoutDescriptors;
}
public function layout(children:Array):void
{
calculatePositions(children);
for each(var descriptor:LayoutDescriptor in layoutDescriptors){
var child:DisplayObject = descriptor.target;
child.x = descriptor.x;
child.y = descriptor.y;
}
}
}
}