calc(device.normal ? stagewidth * 0.4 : stagewidth * 0.4)
calc(device.normal ? stageheight * 0.6 : stageheight * 0.6)
makes no sense
you calculate parameter using stagewidth/height onstart
but onresize the stagewidth/height are changed
|
Source code
|
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
|
<action name="mystart" autorun="onstart">
calc(myparam, device.normal ? 0.6 : 0.4);
trace('myparam=', myparam);
// --> desktop+tablet 0.6, mobile 0.4
addlayer(mylayer);
set(layer[mylayer],
type=container,
keep=true,
visible=true,
bgcolor=0x2D3E50,
bgalpha=1.0,
x=0,
y=0,
zorder=999,
align=center,
edge=center);
</action>
<events name="myevents" keep="true" onresize="myonresize();" />
<action name="myonresize">
calc(layer[mylayer].width, stagewidth * myparam);
calc(layer[mylayer].height, stageheight * myparam);
trace('width=',layer[mylayer].width,' height=',layer[mylayer].height);
</action>
|
ps.
set(a, get(b)) --> copy(a, b);
set(a, calc(b+c)); --> calc(a, b+c):
pps.
kyldlrbfgmbq pwbmkexehanv ufmorfxpbamv

--> why are you doing this?