pv3d 切换动作

http://www.sandy1219.com/3d/test6/TestPeopleMotion.html

<textarea cols="79" rows="18" name="code" class="c-sharp">package { import com.kvc.extend.papervision3d.PlaneGrid3D; import flash.events.Event; import org.aswing.AsWingManager; import org.aswing.BoxLayout; import org.aswing.JButton; import org.aswing.JFrame; import org.aswing.JTextField; import org.papervision3d.events.FileLoadEvent; import org.papervision3d.lights.PointLight3D; import org.papervision3d.materials.BitmapFileMaterial; import org.papervision3d.materials.utils.MaterialsList; import org.papervision3d.objects.special.DAEMC; import org.papervision3d.view.BasicView; public class TestPeopleMotion extends BasicView { public function TestPeopleMotion() { super(800,800,true,true); //this.stage.frameRate = 30 init3D(); } private var light:PointLight3D private var daeFile:DAEMC; private function init3D():void { AsWingManager.initAsStandard(this); light = new PointLight3D(true); light.z = -10000; light.y = 40000; light.x = 30000; scene.addChild(light); camera.focus = 60 ; camera.x = 1000; camera.y = 700; camera.z = -1000; loadAdeFile(); addButton(); addLoading(); startRendering() } private var walkBtn:JButton; private var talkBtn:JButton; private var jp:JFrame; private var jt:JTextField; private function addLoading():void { jp = new JFrame(this,'info',true); jp.setClosable(false); jp.setResizable(false); jp.setClosable(false); jp.setSizeWH(300,100); jp.setLocationXY(200,200); jt = new JTextField('加载模型数据中...'); jp.getContentPane().append(jt); jp.show(); } private function addButton():void { var jf:JFrame = new JFrame(); jf.setSizeWH(300,80) jf.getContentPane().setLayout(new BoxLayout()); jf.show(); walkBtn = new JButton('walk'); walkBtn.addActionListener(walkClick); jf.getContentPane().append(walkBtn); talkBtn = new JButton('talk'); talkBtn.addActionListener(talkClick); jf.getContentPane().append(talkBtn); } private function walkClick(e:Event):void { daeFile.gotoAndPlay('walk') } private function talkClick(e:Event):void { daeFile.gotoAndPlay('talk') } private function loadAdeFile():void { daeFile = new DAEMC(false,'song'); daeFile.fps = 15 ; daeFile.addEventListener(FileLoadEvent.LOAD_PROGRESS , onLoadProgress) daeFile.addEventListener(FileLoadEvent.LOAD_COMPLETE, onLoadComplete); daeFile.addEventListener(FileLoadEvent.ANIMATIONS_PROGRESS , parserXMLprogress) daeFile.addEventListener(FileLoadEvent.ANIMATIONS_COMPLETE , parserXMLcomplete) var _mat:MaterialsList = new MaterialsList({all:new BitmapFileMaterial('dae/casual04_m_25.png')}); daeFile.load("dae/peopleMotion.xml" , _mat ); scene.addChild(daeFile); daeFile.setFrameLabel(0, "walk"); daeFile.setFrameLabel(30, "talk"); daeFile.addFrameScript(29, loopWalk); daeFile.addFrameScript(420, loopTALK); } private function parserXMLprogress(e:FileLoadEvent):void { jt.setText('分析模型文件: ' + e.message + '%'); } private function onLoadProgress(e:FileLoadEvent):void { jt.setText('加载模型文件: ' + Math.floor(e.bytesLoaded/e.bytesTotal)*100 + '%'); } private function parserXMLcomplete(E:FileLoadEvent):void { jp.dispose(); } private function loopWalk(mod:DAEMC):void { daeFile.gotoAndPlay(0); } private function loopTALK(mod:DAEMC):void { daeFile.gotoAndPlay(30); } private function onLoadComplete(e:FileLoadEvent):void { //daeFile.y = -50 ; scene.addChild(new PlaneGrid3D()); } override protected function onRenderTick(event:Event=null):void { //daeFile.rotationY = viewport.mouseX / 2; super.onRenderTick(event); } } }</textarea>

你可能感兴趣的:(pv3d 切换动作)