-
Notifications
You must be signed in to change notification settings - Fork 1
/
Копия aw3dContainer.mxml
42 lines (38 loc) · 1.27 KB
/
Копия aw3dContainer.mxml
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
<?xml version="1.0" encoding="utf-8"?>
<mx:UIComponent xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="100%" height="100%">
<fx:Script>
<![CDATA[
import away3d.containers.View3D;
import away3d.core.clip.RectangleClipping;
public var radius:Number = 0;
public var view:View3D;
override protected function createChildren():void
{
super.createChildren();
view = new View3D();
view.addEventListener(Event.ADDED_TO_STAGE, update); // Make sure the first frame is rendered
addChild(view);
}
override protected function updateDisplayList(unscaledWidth: Number, unscaledHeight: Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
update();
}
private function update(e:* = null):void
{
if (view.stage)
{
view.x = unscaledWidth / 2;
view.y = unscaledHeight / 2;
view.clipping = new RectangleClipping({minX: - unscaledWidth / 2, minY: - unscaledHeight / 2,
maxX: unscaledWidth / 2, maxY : unscaledHeight / 2});
radius = Math.sqrt(unscaledWidth * unscaledWidth + unscaledHeight * unscaledHeight) / 2;
view.render();
}
}
]]>
</fx:Script>
</mx:UIComponent>