-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathPopMenu1.as
More file actions
136 lines (113 loc) · 4.19 KB
/
PopMenu1.as
File metadata and controls
136 lines (113 loc) · 4.19 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
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
package
{
import flash.geom.Point;
import popForm.PopMenu;
import popForm.PopMenuContent;
import popForm.PopMenuDispatcher;
import popForm.PopMenuTypes;
public class PopMenu1 extends PopMenu
{
private static var ME1:PopMenu1 ;
private static var maxPageHeight:Number = 0;
private static var staticStageHeight:Number = 1024;
private static var contenty0:Number,
contenth0:Number,
titley0:Number;
public function PopMenu1()
{
super();
ME1 = this;
contenty0 = ME1.myContent.y ;
contenth0 = ME1.myContent.height0 ;
titley0 = ME1.titleContainerMC.y ;
}
/**This will makes popMneucontents to have dynamic height.<br>
* But the popMenu should not have css to repositioning*/
public static function makeHeightDynamic(newStageHieght:Number=1024,applicationStageSize:Number=1024):void
{
maxPageHeight = newStageHieght ;
staticStageHeight = applicationStageSize ;
}
public static function popUp(title:String='' , type:PopMenuTypes=null , content:PopMenuContent=null,closeOnTime:uint=0,onButtonSelects:Function = null,onClosedByTimer:Function=null,onClose:Function=null)
{
//trace('POP 1 MENU OPENED '+Math.random());
//ME1.popUp2(title, type, content,closeOnTime,onButtonSelects);
///↓
//ME1.y = 0 ;
ME1.myContent.localHeight(0);
trace('POP 2 MENU OPENED '+Math.random());
ME1.popUp2(title, type, content,closeOnTime,onButtonSelects,onClosedByTimer,onClose);
trace("ME2.myContent.height"+ME1.myContent.height+" ME2.myContent.height0"+contenth0);
ME1.myContent.y = contenty0;
if(maxPageHeight!=0 && ME1.myContent.height > contenth0)
{
var deltaY:Number = Math.max(0,ME1.myContent.height-contenth0) ;
trace("deltaY :"+deltaY+' > '+contenth0);
//ME1.y = y0-deltaY/2 ;
trace("ME2.y positino changed to : "+ME1.y);
trace("ME2.name ?? "+ME1.name);
var minVisibleYOnStage:Number = (maxPageHeight-staticStageHeight)/-2;
var maxVisibleYOnStage:Number = staticStageHeight+(maxPageHeight-staticStageHeight)/2;
var titlePoseBasedOnStage:Point = ME1.titleContainerMC.parent.localToGlobal(new Point(0,titley0-deltaY));
var acceptedData:Number = Math.max(titlePoseBasedOnStage.y,minVisibleYOnStage);
ME1.titleContainerMC.y = ME1.titleContainerMC.parent.globalToLocal(new Point(0,acceptedData)).y;
var contentPoseBasedOnStage:Point = ME1.myContent.parent.localToGlobal(new Point(0,contenty0-deltaY));
var accepdetDeltaForContent:Number = Math.max(contentPoseBasedOnStage.y,ME1.titleContainerMC.localToGlobal(new Point(0,ME1.titleContainerMC.height)).y);
var conentDeltaY:Number = ME1.myContent.parent.globalToLocal(new Point(0,accepdetDeltaForContent)).y ;
ME1.myContent.setY(conentDeltaY) ;
trace("conentDeltaY : "+conentDeltaY);
var contentHeightBasedOnStage:Point = ME1.myContent.parent.localToGlobal(new Point(0,ME1.myContent.y+contenth0+deltaY));
var maxAcceptableYForHeight:Number = Math.min(contentHeightBasedOnStage.y,maxVisibleYOnStage);
var maxAcceptableYOnContentArea:Point = ME1.myContent.parent.globalToLocal(new Point(0,maxAcceptableYForHeight));
trace("maxAcceptableYForHeight : "+maxAcceptableYForHeight);
trace("maxAcceptableYOnContentArea.y : "+maxAcceptableYOnContentArea);
trace("ME1.myContent.y : "+ME1.myContent.y);
ME1.myContent.localHeight((maxAcceptableYOnContentArea.y-ME1.myContent.y)-contenth0);
ME1.myContent.updateScrollheight();
}
}
public static function get popDispatcher():PopMenuDispatcher
{
return ME1.popDispatcher ;
}
public static function close()
{
if(ME1)
{
ME1.close();
}
}
/**this will tell if the popMenuIsOpen*/
public static function get isOpen():Boolean
{
return ME1.show ;
}
/**Returns the content width*/
public static function width():Number
{
if(ME1)
{
return ME1.getContentWidth();
}
return 0 ;
}
/**Returns the content height*/
public static function height():Number
{
if(ME1)
{
return ME1.getContentHeight();
}
return 0 ;
}
/**Returns true if the pop menu is exists*/
public static function isExists():Boolean
{
if(ME1==null)
{
return false ;
}
return true ;
}
}
}