flex 4.5安装调试 Logging API

来源:互联网 发布:mac如何保存gif 编辑:程序博客网 时间:2024/05/20 10:52

 

在做flex开发的时候,为了能够调试 需要安装的是flashplayerdebug版本,但是要是之前已经安装了其它版本,会提示安装不上, 发生题目上报的这个错误, 10的默认的安装目录是这个, 

1.C:\WINDOWS\system32\Macromed\Flash 首先需要的是点卸载的uninstall_activeX.exe

2.然后需要的是使用命令regsvr32 -u 注销到两个ocx的控件注册,然后把整个目录删除, 最后一步,删除注册表: 运行键入regedit 回车 hkey_local_machine->software->Macromdia->flashplyer->safeversions-> 删除掉10的键值, 再安装就没有问题了。。。。。。。。。。。。

3.安装两个flash player,

然后用chome浏览器chome://plugins

停用11.3

启用10.2即可

 

 

 

 

 

启用低版本的,而不是高版本的。

 注意:C:\Windows\system32\Macromed\Flash\NPSWF32.dll

 

试例代码,参考别人写的,附上:

<?xml version="1.0" encoding="utf-8"?>  <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"      xmlns:s="library://ns.adobe.com/flex/spark"  creationComplete="init()"     xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">  <fx:Declarations>  <!-- 将非可视元素(例如服务、值对象)放在此处 -->  </fx:Declarations>  <fx:Script>  <![CDATA[  import mx.logging.LogLogger;     import mx.logging.ILogger;     import mx.logging.Log;     import mx.logging.LogEventLevel;     import mx.logging.targets.TraceTarget;     public var logger:ILogger;     public function init():void{     var logTarget:TraceTarget = new TraceTarget();     logger = new LogLogger("testlog");     logTarget.filters = ["*"];     logTarget.level = LogEventLevel.ALL;     logTarget.includeCategory = true;     logTarget.includeDate = true;     logTarget.includeLevel = true;     logTarget.includeTime = true;     logTarget.addLogger(logger);     Log.addTarget(logTarget);     logger.info("It's the debug");   //trace("create complete");     }     public function clickBtn():void{     logger.debug("It's the debug");     logger.info("It's the info");     logger.warn("It's the warn");     logger.error("It's the error");     logger.fatal("It's the fatal");  //trace("ceshi dasdasd我来侧四下");  //trace("It's the first click on btn");     }     ]]>  </fx:Script>  <mx:Button id="btn" label="OK" click="clickBtn()"/>    </s:Application>  


就可以在在日志文件中打印以下日志了。

(续)