AlexisIsaac.net
Home
Wednesday, 07 January 2009
 
 
Main Menu
Home
News
Flash
Tools
Contact Us
Search
Main projects
FlashMidi
Newsflash
 
FLIDE PDF Print E-mail
Written by Alexis ISAAC   
Wednesday, 14 December 2005
FLIDE is a debugger for Flash applications built with the OpenSource compiler MTASC. It allows developpers to add breakpoints, inspect variables and pause a movie.

This program demonstrates the possibility to debug Flash movies without the Flash IDE.

To use it you have to :

  • include the net.alexisisaac.flide package into your project
  • launch the Flide.init() method.
  • configure MATSC to use net.alexisisaac.Flide.traceReplacer() as the trace function (add -trace net.alexisisaac.Flide.traceReplacer to the compilation command)

When you want to add a breakpoint you must add : trace({o:this}); if you are in a non static function and trace({o:null}); if you are in a static function.

Example :

import net.alexisisaac.flide.Flide; 
  class MyMainClass{
     function doSomething(a:Number):Number
    {
       var b:Number = a*Math.PI;
      trace({o:this)}; //<=== Breaks here
      b=b/180;
      return b; 
    } 
    static function  main()
     {
       Flide.init()
      var instance:MyMainClass = new MyMainClass();
      instance.doSomething(); 
    } 
  }

Download : 

  Download: here


MTASC modification proposal 

Warning : 

This is not the way to use FLIDE but a proposition to modify(hack) MTASC to use debugging tools. 

 It would be useful to create a hack for MTASC witch would :

  • Launch a specified method before each line containing code, passing the name of the current class, the name of the current file, the current line number and a list of local variables and their values. (non breaking breakpoint)
  • Launch another method with the same parameters on lines with breakpoint (the breakpoints could be defined in an external file or passed on the command line)

Exemple :

Original file :

class myClass{
    function myClass()
    {
      var a:Number;
      this.doSomething(0); 
      for (a=0;a<100;a++)
      { 
        this.doSomething(a);
      } 
      trace("end"); 
    }  
    function doSomething()
    {
      if(a>50)
      {
         trace("a>50");
      } 
    } 
  }
  •  Files as seen after compilation with parameters :
    • -trace debugClass.traceReplacer -non-breaking-breakpoint debugClass.nbBreakPoint -breakpoint debugClass.breakPoint -breakpoints-position myClass:5,14
  •  or with the breakpoints defined in an external file :
    • -trace debugClass.traceReplacer -non-breaking-breakpoint debugClass.nbBreakPoint -breakoint debugClass.breakPoint -breakpointlist breakpoints.bp
    • file breakpoints.bp: 
      • myClass:5,14
  • or with the breakpoints defined an external file for each class :
    • -trace debugClass.traceReplacer -non-breaking-breakpoints debugClass.nbBreakPoint -breakpoint debugClass.breakPoint -breakpointlist bp
    • file myClass.bp
      • 5
        14
class myClass{
    function myClass()
    {
      var a:Number;
      debugClass.breakPoint("myClass,"myClass.as",5,[{name:"a",value:a},{name:"this",value:this}]);
      this.doSomething(0); 
       debugClass.nbBreakPoint("myClass,"myClass.as",6,[{name:"a",value:a},{name:"this",value:this}]); 
      for (a=0;a<100;a++)
      { 
        debugClass.nbBreakPoint("myClass,"myClass.as",8,[{name:"a",value:a},{name:"this",value:this}]);   
        this.doSomething(a);
      } 
      debugClass.nbBreakPoint("myClass,"myClass.as",10,[{name:"a",value:a},{name:"this",value:this}]);  
      trace("end"); 
    }  
    function doSomething(val:Number)
    {
      debugClass.nbBreakPoint("myClass,"myClass.as",14,[{name:"val",value:val},{name:"this",value:this}]); 
       if(val>50)
      {
        debugClass.breakPoint("myClass,"myClass.as",16,[{name:"val",value:val},{name:"this",value:this}]);  
         trace("val>50");
      } 
    } 
  }

 

Screenshots : 

ImageImage

Comments

Only registered users can write comments.
Please login or register.

Powered by AkoComment 2.0!

Last Updated ( Tuesday, 20 December 2005 )
 
< Prev   Next >
 
Top! Top!