0

我正在使用它来显示调用堆栈:

throw new Error("show me");

但我想打印一个更长(更深)的堆栈,因为当前的堆栈没有显示我需要什么。

4

2 回答 2

1

如果您没有看到更多内容Error.getStackTrace(),可能是因为堆栈中没有更多内容。除了 [Render] 等私人内部播放器调用外。

查看调用堆栈中最深的项,它可能是某种事件处理程序。如果是这样,您将无法深入挖掘。

于 2012-08-27T15:00:53.210 回答
0

您可以将堆栈跟踪作为字符串获取并将其记录到文件中或在文本字段中显示。

var e:Error = new Error();
var trace:String = e.getStackTrace();

someTextField.text = trace;

编辑:使用 Flash Develop 我抛出了一个错误,并且能够看到超过 17 个堆栈跟踪步骤:

Error
    at Main/func14()[C:\Users\SGU\Desktop\barisu\misc\flex4test\src\Main.mxml:100]
    at Main/func13()[C:\Users\SGU\Desktop\barisu\misc\flex4test\src\Main.mxml:93]
    at Main/func12()[C:\Users\SGU\Desktop\barisu\misc\flex4test\src\Main.mxml:88]
    at Main/func11()[C:\Users\SGU\Desktop\barisu\misc\flex4test\src\Main.mxml:83]
    at Main/func10()[C:\Users\SGU\Desktop\barisu\misc\flex4test\src\Main.mxml:78]
    at Main/func9()[C:\Users\SGU\Desktop\barisu\misc\flex4test\src\Main.mxml:73]
    at Main/func8()[C:\Users\SGU\Desktop\barisu\misc\flex4test\src\Main.mxml:68]
    at Main/func7()[C:\Users\SGU\Desktop\barisu\misc\flex4test\src\Main.mxml:63]
    at Main/func6()[C:\Users\SGU\Desktop\barisu\misc\flex4test\src\Main.mxml:58]
    at Main/func5()[C:\Users\SGU\Desktop\barisu\misc\flex4test\src\Main.mxml:53]
    at Main/func4()[C:\Users\SGU\Desktop\barisu\misc\flex4test\src\Main.mxml:49]
    at Main/func3()[C:\Users\SGU\Desktop\barisu\misc\flex4test\src\Main.mxml:44]
    at Main/func2()[C:\Users\SGU\Desktop\barisu\misc\flex4test\src\Main.mxml:39]
    at Main/func1()[C:\Users\SGU\Desktop\barisu\misc\flex4test\src\Main.mxml:34]
    at Main/onCreationComplete()[C:\Users\SGU\Desktop\barisu\misc\flex4test\src\Main.mxml:29]
    at Main/___Main_Application1_creationComplete()[C:\Users\SGU\Desktop\barisu\misc\flex4test\src\Main.mxml:5]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:13152]
    at mx.core::UIComponent/set initialized()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:1818]
    at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:842]
    at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1180]
于 2012-08-27T13:58:32.737 回答