2012-08-24 76 views
0

Edit02:为什么闪存崩溃是因为错误的距离导致程序将事件除以0--我发现自己的错误,但我的问题仍然是,有没有像crashreport,你可以添加/编辑?如何检测Adobe Flash崩溃原因?

编辑:我找到的bug在其设在这里

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

在一个点上它产生了错误的距离脚本,但这不是什么程序导致崩溃,我知道如何解决的bug但它仍然是有趣的如何添加功能检测闪电崩盘方面的原因

OLD: 嘿我目前正在测试的CS6的Flash演示,但一个函数总是杀死闪光灯和我没有得到任何错误信息,所以我的问题是。 ..我怎么能找到错误?

唯一的东西,我知道:当我调用某个功能(我贴在下面的)崩溃 - 它不崩溃的第一个电话......更像是在第三或第二

有任何添加debugEvents的方法或其他可以用来追踪错误的方法?

THX事先=)

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(); 
     } 

回答

2

我不知道你是什么意思它崩溃无一例外。你在浏览器中测试吗?如果是这样,那么你可以从这里下载并安装相应的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和更高版本中做到这一点。下面是关于它的Adobe文档: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 
     } 
    } 
} 
} 
+0

感谢的人有很好的帮助=)我调试内部闪存...没有做任何幻想作为内部使用闪光灯浏览器,但链接不错 – tschery

+0

很高兴你发现它很有用。如果Flash在上述任何方法中没有给出错误而崩溃,则通常是堆栈溢出或导致无穷大的某种操作。 – JcFx