上一篇文章介绍了如何将papervision3d作为组件添加到flex中。地址如下: 这篇文章倒过来,介绍如何将flex组件添加到papervision3d中。
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 = "";
}
]]>
height="171" borderStyle="solid" x="10" y="62">
height="135" backgroundColor="#000000">
flex" top="0" bottom="0" left="0" right="0"/>
代码中注释部分说明:
在application中添加myPanel,在界面上会出现两个myPanel,一个是通过mxml标签添加进去的,一个是作为材质加入到flexSkin的,所以要先隐藏掉通过mxml标签添加进去的myPanel,有两种方法:一是通过visible隐藏myPanel,一个方法是在application完成构建后先删除所有组件,然后重新添加需要的组件。
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 = "";
}
]]>
height="171" borderStyle="solid" x="10" y="62">
height="135" backgroundColor="#000000">
flex" top="0" bottom="0" left="0" right="0"/>
代码中注释部分说明:
在application中添加myPanel,在界面上会出现两个myPanel,一个是通过mxml标签添加进去的,一个是作为材质加入到flexSkin的,所以要先隐藏掉通过mxml标签添加进去的myPanel,有两种方法:一是通过visible隐藏myPanel,一个方法是在application完成构建后先删除所有组件,然后重新添加需要的组件。
Flex与Papervision3D组件互嵌
本文介绍如何将Flex组件嵌入到Papervision3D中,实现2D与3D交互体验。通过具体代码示例展示了如何设置Flex组件为材质,并将其作为平面对象添加到Papervision3D场景中。

60

被折叠的 条评论
为什么被折叠?



