我有Firefox,Firebug,Flashbug和* .fla + * .as文件的flash widged。是否可以使用跟蹤槽作爲可變手錶等代碼進行調試?如何?如何在網頁中跟蹤ActionScript?
編輯
我有flasbug,可以看到trace命令的輸出。但是我需要像其他調試器一樣一步一步地進行調試,而且Flash Professional可以處理獨立的Flash電影。
我有Firefox,Firebug,Flashbug和* .fla + * .as文件的flash widged。是否可以使用跟蹤槽作爲可變手錶等代碼進行調試?如何?如何在網頁中跟蹤ActionScript?
編輯
我有flasbug,可以看到trace命令的輸出。但是我需要像其他調試器一樣一步一步地進行調試,而且Flash Professional可以處理獨立的Flash電影。
您可以簡單地使用Flash調試器。 :)見this article from Adobe。可以使用MonsterDebugger。
謝謝!我看到這篇文章,但並不理解它。像「遠程調試僅限於位於同一本地主機上的文件」這樣的短語讓我不安。如果它是同一個本地主機,什麼「遠程」字可以表示?同樣在這裏:「如果你將文件上傳到遠程服務器,你將無法遍歷代碼」。我需要這個:來自遠程服務器的跟蹤文件。 – 2012-02-27 17:28:58
1)這意味着你不能在調試器中調試東西,除非你在自己的機器上運行服務器。 2)你可以在任何地方使用跟蹤,而且你不需要調試器。您只需使用內容調試器Flash Player並啓用日誌記錄即可。看到這篇文章:http://jpauclair.net/2010/02/10/mmcfg-treasure – weltraumpirat 2012-02-28 11:31:19
或:使用MonsterDebugger;) – weltraumpirat 2012-02-28 11:32:00
我正在搞ExternalInterface
因爲我認爲可能有比我以前的方法更好的方式來訪問控制檯,我發現ExternalInterface.call
的第一個參數可以指定不僅僅是一個函數來調用。
我寫了這個功能使用JavaScript console
和trace
簡化到:
Console.log(...);
或者在條件編譯塊:
CONFIG::DEBUG {
Console.log(...);
}
/**
* @author zzzzBov <[email protected]>
* @version 0.1
* @since 2012-02-24
*/
package com.zzzzbov.debug {
import flash.external.ExternalInterface;
/**
* `com.zzzzbov.debug.Console` is a debugging tool to interface with web browsers' developer consoles.
*/
public class Console {
/**
* The hidden utility method to make `ExternalInterface` calls to JavaScript.
*
* @param type the type of console function that will be called
* @param args the array of arguments to pass to the console[type] function
*/
private static function console(type:String, args:Array = null):void {
//prevents an additional `null` from being passed as an argument when the second parameter is skipped
if (args === null) {
args = [];
}
//Checks that the ExternalInterface is available and that console[type] exists
if (ExternalInterface.available && ExternalInterface.call('function() {return !!(console && ("' + type + '" in console));}')) {
//calls the console[type] function with the provided arguments.
ExternalInterface.call.apply(ExternalInterface, ['console.'+type].concat(args));
} else {
//calls `trace` if console[type] isn't available
trace.apply(null, [type].concat(args));
}
}
/**
* Checks the truthiness of {@param expr}; if the assertion fails, it also prints out {@param args}.
*
* @param expr an expression to test
* @param args the message to print to the console
*/
public static function assert(expr:*, ... args):void {
console('assert', [expr].concat(args));
}
/**
* Clears the console of messages
*/
public static function clear():void {
console('clear');
}
/**
* Writes the number of times that count was executed. The {@param title} will be printed in addition to the count.
*
* Warning: No IE support
*
* @param title A title for a particular counter
*/
public static function count(title:String = null):void {
console('count', title != null ? [title] : []);
}
/**
* Writes the arguments to the console.
*
* Warning: No IE support.
*
* @param args the arguments to print in the console
*/
public static function debug(... args):void {
console('debug', args);
}
/**
* Prints an interactive listing of all properties on {@param obj}.
*
* @param obj the object to expand
*/
public static function dir(obj:*):void {
console('dir', [obj]);
}
/**
* Prints an XML source tree of an HTML or XML element.
*
* Warning: No IE support; source tree may not be fully supported.
*/
public static function dirxml(node:*):void {
console('dirxml', [node]);
}
/**
* Writes the arguments to the console as an error message.
*
* @param args the arguments to print in the console
*/
public static function error(... args):void {
console('error', args);
}
/**
* Writes a message to the console and opens a nested block for future console messages.
*
* Warning: No IE support. Call {@link #groupEnd()} to close the block.
*
* @param args the arguments to print in the console
*/
public static function group(... args):void {
console('group', args);
}
/**
* Writes a message to the console and opens a collapsed, nested block for future console messages.
*
* Warning: No IE support. Call {@link #groupEnd()} to close the block.
*
* @param args the arguments to print in the console
*/
public static function groupCollapsed(... args):void {
console('groupCollapsed', args);
}
/**
* Closes the block most recently opened by {@link #group(...)} or {@link #groupCollapsed(...)}.
*
* Warning: No IE support.
*/
public static function groupEnd():void {
console('groupEnd');
}
/**
* Writes the arguments to the console as an informational message.
*
* @param args the arguments to print in the console
*/
public static function info(... args):void {
console('info', args);
}
/**
* Writes the arguments to the console.
*
* The first argument may use a printf-like syntax for substituting subsequent arguments into a formatted message.
*
* @param args the arguments to print in the console
*/
public static function log(... args):void {
console('log', args);
}
/**
* Turns on the JavaScript profiler.
*
* Call {@link #profileEnd()} to stop profiling and print the profiler report.
*
* @param title the title to print in the header of the profile report
*/
public static function profile(title:String = null):void {
console('profile', title != null ? [title] : []);
}
/**
* Turns off the JavaScript profiler and prints the profiler report.
*/
public static function profileEnd():void {
console('profileEnd');
}
/**
* Creates a new timer with the given name.
*
* Warning: No IE support. Call {@link #timeEnd(name)} to stop the timer and print the elapsed time.
*
* @param name the name of the timer to start
*/
public static function time(name:String):void {
console('time', [name]);
}
/**
* Stops the timer with the provided name and prints the elapsed time to the console.
*
* Warning: No IE support. Call {@link #time(name)} to start a timer of a given name.
*
* @param name the name of the timer to stop
*/
public static function timeEnd(name:String):void {
console('timeEnd', [name]);
}
/**
* Writes the arguments to the console as a warning.
*
* @param args the arguments to print in the console
*/
public static function warn(... args):void {
console('warn', args);
}
}
}
讓我知道如果你發現任何問題,或有任何建議秒。
嘗試使用flashbug https://addons.mozilla.org/fr/firefox/addon/flashbug/ – mgraph 2012-02-24 16:29:27
後來我寫了一些代碼,掛鉤到'ExternalInterface'中以使用'console.log'和類似的,所以我不必爲閃存安裝一個單獨的插件。嵌入閃光燈時,您還需要設置'allowcriptaccess'參數。作爲一個警告,它涉及調用'eval'來初始化一個函數,以便我掛鉤到'console.log'。 – zzzzBov 2012-02-24 16:31:58