浏览器运行flash反编译调试代码

 1    import flash.external.ExternalInterface;
 2    import flash.globalization.DateTimeFormatter;
 3    import flash.globalization.LocaleID;
 4    import flash.utils.getQualifiedClassName;
 5    
 6    import mx.utils.StringUtil;
 7    
 8  public static function log(classobject:Object,str:String,... rest):void{
 9            if(ExternalInterface.available){
10                ExternalInterface.marshallExceptions=true;
11                var dtf:DateTimeFormatter = new DateTimeFormatter(LocaleID.DEFAULT);
12                dtf.setDateTimePattern("yyyy-MM-dd HH:mm:ss.");
13                var currDate:Date = new Date();
14                var currDateStr:String = dtf.format(currDate) + (currDate.milliseconds + 1000).toString().substr(1);
15                var stackTrace:Boolean=false;
16                if(stackTrace){
17                    ExternalInterface.call("console.group","FlashLog: "+currDateStr+" "+getQualifiedClassName(classobject).replace("::","."));
18                    ExternalInterface.call("console.info",StringUtil.substitute(str,rest));
19                    ExternalInterface.call("console.info",new Error('StackTrace').getStackTrace());
20                    ExternalInterface.call("console.groupEnd");
21                }else{
22                    ExternalInterface.call("console.info",currDateStr+" "+StringUtil.substitute(str,rest));
23                }
24            }
25        }

 

posted @ 2020-03-09 16:42  今夜通宵  阅读(461)  评论(0编辑  收藏  举报