上一篇文章介绍了如何将papervision3d作为组件添加到flex中。地址如下: 这篇文章倒过来,介绍如何将flex组件添加到papervision3d中。
layout="absolute"
applicationComplete="init3D()">
flex);
//end!!
view.camera.zoom = 10;
view.camera.focus = 100;
flexSkin = new MovieMaterial(myPanel, false, true, false);
flexSkin.doubleSided = true;
flexSkin.interactive = true;
thePlane = new Plane(flexSkin, myPanel.width, myPanel.height, 4, 4);
thePlane.useOwnContainer = true;
thePlane.filters = [new GlowFilter(0x00ff00, 1, 6, 6, 4, 2, false,
false)];
view.scene.addChild(thePlane);
addEventListener(Event.ENTER_FRAME, loop3D);
}
private function loop3D(e:Event):void {
if(view.camera != null) {
thePlane.rotationY++;
view.singleRender();
}
}
private function hit():void {
Alert.show("clicked!");
}
private function reset():void {
txtname.text = "";
txtpass.text = "";
}
]]>
flex" top="0" bottom="0" left="0" right="0"/>
代码中注释部分说明:
在application中添加myPanel,在界面上会出现两个myPanel,一个是通过mxml标签添加进去的,一个是作为材质加入到flexSkin的,所以要先隐藏掉通过mxml标签添加进去的myPanel,有两种方法:一是通过visible隐藏myPanel,一个方法是在application完成构建后先删除所有组件,然后重新添加需要的组件。
layout="absolute"
applicationComplete="init3D()">
flex);
//end!!
view.camera.zoom = 10;
view.camera.focus = 100;
flexSkin = new MovieMaterial(myPanel, false, true, false);
flexSkin.doubleSided = true;
flexSkin.interactive = true;
thePlane = new Plane(flexSkin, myPanel.width, myPanel.height, 4, 4);
thePlane.useOwnContainer = true;
thePlane.filters = [new GlowFilter(0x00ff00, 1, 6, 6, 4, 2, false,
false)];
view.scene.addChild(thePlane);
addEventListener(Event.ENTER_FRAME, loop3D);
}
private function loop3D(e:Event):void {
if(view.camera != null) {
thePlane.rotationY++;
view.singleRender();
}
}
private function hit():void {
Alert.show("clicked!");
}
private function reset():void {
txtname.text = "";
txtpass.text = "";
}
]]>
flex" top="0" bottom="0" left="0" right="0"/>
代码中注释部分说明:
在application中添加myPanel,在界面上会出现两个myPanel,一个是通过mxml标签添加进去的,一个是作为材质加入到flexSkin的,所以要先隐藏掉通过mxml标签添加进去的myPanel,有两种方法:一是通过visible隐藏myPanel,一个方法是在application完成构建后先删除所有组件,然后重新添加需要的组件。