如何使用 PaperVision3d 库等待 DAE 模型加载到闪存上?
我需要在闪存上制作一个加载程序或一个简单的标签,上面写着“等等,模型正在加载”。这是我加载模型的脚本的一部分,但我不知道如何控制加载过程,感谢您的帮助。
代码:
private function _onInit(e:Event):void {
_earth = new DAE();
_earth.load('model/hfarm.DAE');
_earth.scale = 0.3;
_earth.rotationX = 90;
_markerNode.addChild(_earth);
addEventListener(Event.ENTER_FRAME, _update);
}
以及整个代码:
package {
import flash.events.Event;
import org.papervision3d.objects.parsers.DAE;
[SWF(width=640, height=480, backgroundColor=0xCCCCCC, frameRate=30)]
public class Earth extends PV3DARApp {
private var _earth:DAE;
public function Earth() {
addEventListener(Event.INIT, _onInit);
init('Data/camera_para.dat', 'Data/flarlogo.pat');
}
private function _onInit(e:Event):void {
_earth = new DAE();
_earth.load('model/hfarm.DAE');
_earth.scale = 0.3;
_earth.rotationX = 90;
_markerNode.addChild(_earth);
addEventListener(Event.ENTER_FRAME, _update);
}
private function _update(e:Event):void {
//_earth.rotationZ -= 1
}
}
}
i need to make a loader on flash or a simple label who say "wait, the model is loading". This is the part of my script were i load the model, but i have no idea how to control the loading process, thanks for any help.
Code:
private function _onInit(e:Event):void {
_earth = new DAE();
_earth.load('model/hfarm.DAE');
_earth.scale = 0.3;
_earth.rotationX = 90;
_markerNode.addChild(_earth);
addEventListener(Event.ENTER_FRAME, _update);
}
And the whole code:
package {
import flash.events.Event;
import org.papervision3d.objects.parsers.DAE;
[SWF(width=640, height=480, backgroundColor=0xCCCCCC, frameRate=30)]
public class Earth extends PV3DARApp {
private var _earth:DAE;
public function Earth() {
addEventListener(Event.INIT, _onInit);
init('Data/camera_para.dat', 'Data/flarlogo.pat');
}
private function _onInit(e:Event):void {
_earth = new DAE();
_earth.load('model/hfarm.DAE');
_earth.scale = 0.3;
_earth.rotationX = 90;
_markerNode.addChild(_earth);
addEventListener(Event.ENTER_FRAME, _update);
}
private function _update(e:Event):void {
//_earth.rotationZ -= 1
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是可以做到的。粗略代码 ->
This can be done. Rough Code ->
如果 Papervision 有一个加载事件就好了,但我不这么认为。该模型有一个 .loaded 属性,因此它可能会检查每个帧以查看加载是否完成。
It would be nice if Papervision had a loading event but I don't believe so. The model has a .loaded property so perhaps it'll work to check that each frame to see if the load is complete.