FlashMX: traceObj

  • Pisike kasulik vidin mida debuggimisel kasutan.
    Kuvab välja kõik movie vms. objekti sees olevad väärtused(ka funktsioonid,movieclipid,objektid).

    Võtab vastu 1 parameetri, mis kui true- kuvab välja ka subobjektid ja nende subobjektid jne.

    Näide: mymovie on suvaline component.

    mymovie.traceObj()

    OUT:
    [trace]{
    [fun] setHEX = [type Function]
    [fun] setRGB = [type Function]
    [fun] loadjpg = [type Function]
    [num] width = 111
    [str] text = text
    [fun] onEnterFrame = [type Function]
    [OBJ] dataProvider {
    [num] lastSelected = 0
    [OBJ] keyListener {
    [MOV] boundingBox_mc
    [MOV] itemAsset
    }

    mymovie.traceObj(true)
    OUT:
    [trace]{
    [fun] setHEX = [type Function]
    [fun] setRGB = [type Function]
    [fun] loadjpg = [type Function]
    [num] width = 111
    [str] text = text
    [fun] onEnterFrame = [type Function]
    [OBJ] dataProvider {
    [fun] updateViews = [type Function]
    [fun] sortItemsBy = [type Function]
    [OBJ] items {
    [OBJ] 15 {
    [num] __ID__ = 15
    [str] label = Item15
    [str] data = data15
    }
    [OBJ] 14 {
    [num] __ID__ = 14
    [str] label = Item14
    [str] data = data14
    }
    [OBJ] 13 {
    [num] __ID__ = 13
    [str] label = Item13
    [str] data = data13
    }
    }
    }
    [num] lastSelected = 0
    [OBJ] keyListener {
    [fun] onKeyUp = [type Function]
    [fun] onKeyDown = [type Function]
    [MOV] controller
    }
    [MOV] boundingBox_mc
    [MOV] itemAsset
    }

    KOOD:
    Object.prototype.traceObj = function(allowsub,dec){
    var decal, a;
    for (a=0;a<dec;a++){
    decal+=" "
    }
    if (!arguments[1]){
    trace(decal+"[trace]{");
    }
    for (a in this){
    if(typeof this[a] == "movieclip"){
    trace(decal+" [MOV] "+a);
    }else if (typeof this[a] != "object"){
    trace(decal+" ["+(typeof this[a]).substr(0,3)+"] "+a+" = "+ this[a]);
    }else{
    trace(decal+" [OBJ] "+a+" {");
    if(allowsub) this[a].traceObj(true,dec+1);
    }
    }
    trace(decal+"}");
    }
    ASSetPropFlags(_global.Object.prototype,"traceObj",1,1);

    see tuleks siis soovitavalt eraldi .as failist includeda või niisama esimesse frame pasteda.
    Funktsioon on e-v arendatud http://proto.layer51.com/default.aspx ühelt traceEx käsult, ehk kulub kellelgi ära.

    21. juuni 2003 - 15:49:10 · Otselink

  • tabidega on ka output kood eraldatud, et oleks ilusam vaadata.
    source

    21. juuni 2003 - 15:52:18 · Otselink