actionscript-3 - 如何检测 Adob​​e Flash 崩溃原因?

标签 actionscript-3 debugging crash mesh vertex

Edit02:闪存崩溃的原因是因为错误的距离导致程序将某些内容除以 0 - 我自己发现了错误,但我的问题仍然是,是否有类似崩溃报告的东西可以添加/编辑?

编辑:我发现脚本中的错误位于此处

          if(baseVerticies[vertX]-boneObj.x < 0){
                distance = distance*-1;
            }

在某一时刻它会产生错误的距离,但这不是程序导致崩溃的原因,我知道如何解决这个错误,但如何添加功能来检测闪存崩溃原因仍然很有趣

老的:
嘿,我目前正在测试 CS6 Flash 演示,但一个功能总是会杀死 Flash,而且我没有收到任何错误消息,所以我的问题是......我怎样才能找到这个错误?

我唯一知道的事情:当我调用某个函数(我在下面发布的那个)时它会崩溃 - 它不会在第一次调用时崩溃......更像是在第三次或第二次调用

有没有办法添加 debugEvents 或其他有助于跟踪错误的东西?

提前谢谢 =)
public function rotateBone(boneObj : Bone, point : Point){
            //rotates the boneGrafik
            boneObj.rotation = (point.x+boneObj.old_rotation)/2;

            if(axis == "horizontal"){
                var firstV : int = selected_bone*(squares+1)*2;
                var lastV : int = selected_bone*(squares+1)*2 + squares*2;
                var radius : Number = Math.sqrt((verticies[lastV]-verticies[firstV])*(verticies[lastV]-verticies[firstV])+
                    (verticies[lastV+1]-verticies[firstV+1])*(verticies[lastV+1]-verticies[firstV+1]));

                //will be exectued for every single vertex
                for(var s = 0; s<=squares; s++){
                    var vertX : int = selected_bone * (squares+1) * 2 + s*2;

                    var distance : Number = Math.sqrt((verticies[vertX]-boneObj.x)*(verticies[vertX]-boneObj.x)+
                        (verticies[vertX+1]-boneObj.y)*(verticies[vertX+1]-boneObj.y));

                    //calculates Vector
                    var rads:Number = boneObj.rotation / 180 * Math.PI;
                    var p:Point = new Point();
                    p.x=Math.cos(rads);
                    p.y=Math.sin(rads);

                    //baseMesh is used in order to check if the vertex pos is positiv / negative
                    if(baseVerticies[vertX]-boneObj.x < 0){
                        distance = distance*-1;
                    }

                    verticies[vertX] =  boneObj.x +  p.x * radius * (distance/radius);
                    verticies[vertX+1] =  boneObj.y +  p.y * radius * (distance/radius);

                }
            }else if (axis == "vertical"){
                for(var r = 0; r<=rows; r++){
                    vertX = r * (squares+1) * 2 + selected_bone * 2;

                }
            }
            updateMesh();
        }

最佳答案

我不确定你的意思是它崩溃无一异常(exception)。你是在浏览器中测试吗?如果是这样,那么您可以从此处的列表中下载并安装相应的 Flash 调试器播放器:http://www.adobe.com/support/flashplayer/downloads.html

这应该会在 FlashPlayer 崩溃时为您提供一个错误窗口,其中将包含调试信息。它还将崩溃和调试数据写入日志文件。这里有更多信息:http://helpx.adobe.com/flash-player/kb/configure-debugger-version-flash-player.html

最后,如果您想捕获和处理其他未处理的异常,您可以在 FP10.1 及更高版本中执行此操作。以下是有关它的 Adob​​e 文档:http://help.adobe.com/en_US/FlashPlatform/beta/reference/actionscript/3/flash/events/UncaughtErrorEvent.html ,这是该页面的示例代码:

package
{
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.ErrorEvent;
import flash.events.UncaughtErrorEvent;
import flash.net.URLRequest;

public class LoaderUncaughtErrorEventExample extends Sprite
{
    private var ldr:Loader;

    public function LoaderUncaughtErrorEventExample()
    {
        ldr = new Loader();
        ldr.load(new URLRequest("child.swf"));
        ldr.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, uncaughtErrorHandler);
    }

    private function uncaughtErrorHandler(event:UncaughtErrorEvent):void
    {
        if (event.error is Error)
        {
            var error:Error = event.error as Error;
            // do something with the error
        }
        else if (event.error is ErrorEvent)
        {
            var errorEvent:ErrorEvent = event.error as ErrorEvent;
            // do something with the error
        }
        else
        {
            // a non-Error, non-ErrorEvent type was thrown and uncaught
        }
    }
}
}

关于actionscript-3 - 如何检测 Adob​​e Flash 崩溃原因?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12103133/

相关文章:

android - 打开应用后,ANDROID应用会停止崩溃,以提供消息 “HAS STOPPED WORKING”

actionscript-3 - AS3 麦克风隐私设置仅显示 3 个选项卡

arrays - 当像素阵列为小型可编辑文本 AS3 时,未生成 8 位 BMP 图像

node.js - 如何在 Node js 中使用源映射?

visual-studio - 以下模块是在启用优化或没有调试信息的情况下构建的

Android 应用程序在启动时崩溃

css - Spark 数据网格交替项颜色

apache-flex - 如何在 Flex 中直观地显示容器的 "break out"?

android - 使用 Eclipse 在 Android 上调试挂起 "Application is waiting for debugger to attach"

Android 应用程序在执行 if 语句时崩溃?