I have complied my components into SWC and add it in Flash professional.
If I want debug this SWC components, how to do this ? trace()
and MMExecute()
seems invalid.
Thanks!
I have complied my components into SWC and add it in Flash professional.
If I want debug this SWC components, how to do this ? trace()
and MMExecute()
seems invalid.
Thanks!
you can say that SWC is one type of executable file of your library. it is generated after compiling the library(source code) and compiler removes all trace, comments and minimize the swc file size . so f you want to know about how's execution is going on in swc component. you have to implement log in it. to write a log, follow the step
private var _fs:FileStream = new FileStream();
protected function windowedapplication1_closeHandler(event:Even
t):void`
{
var prefsFile:File = File.desktopDirectory;
prefsFile = prefsFile.resolvePath("logfile.txt");
fs.open(prefsFile,FileMode.WRITE);
fs.writeUTFBytes(logString);
fs.close();
}`
3.Make another variable named logString, and contact string as you want to put a log
Example of this:
logString += 'onAttitones_creationCompleteHandler'+'\n';
this will write a logfile in desktop, file Name is logfile.txt
may this will help you
You can debug your compiled components by passing custom logger in them. Create interface ILoggable with only 2 methods: setLogger(logger: ILogger)
and log(value: *)
. Implement interface in desired components.
public function log(value:*):void{
if(_logger != null){
_logger.log(value);
}
}
public function setLogger(logger:ILogger):void {
_logger= logger;
}
Now you are free to use log(something)
in every interesting place of your component, but don't forget to assign logger:
//Create logger
logger = new TraceLogger();
//...
//Use it somewhere with components, that can produce logs
myComponent = new MyComponent();
myComponent.setLogger(logger);
Declare your epic trace logger somewhere in project:
public class TraceLogger implements ILogger{
public function log(value:*):void{
trace(value);
}
}