Jun 23 2003

I found this great actionscript class component:

Published by at 10:55 under Wayback Archive

I found this great actionscript class component: ATOMGAS FRSTreeClass. This cool AS class saved me lots of time; I was working on an application that grabs data from a database table with parent-child columns and I wanted to display that data in a nice Tree interface. Unfortunately the .setDataProvider() method of the FTree component did not do what I wanted it to do. I already started thinking about a way to create an XML document and then passing it on to the Tree using Greg Burch his XFTree component. Fortunately I found the ATOMGAS FRSTreeClass and it did exactly what I wanted it to do (in a very elegant way). If you want to populate a Tree with data from a recordset you should defenitely have a look at this component.

One response so far

One Response to “I found this great actionscript class component:”

  1. Yadviga says:

    I am trying to recreate this example with CF/MSAccess instead of PHP. But I get only Root note displayed. Any idea why this might happen ?

    1. Code in FLA:
    function Result() {
    this.onResult = function(rs) {
    var _frst = new FRSTreeClass(rs);
    //_frst.traceTree();
    var rootNode = _frst.toFUITreeNode();
    rootNode.setIsOpen(1);
    _root.my_tree.setRootNode(rootNode);
    };
    this.onStatus = function(error) {
    for (var i in error) {
    trace(i+”:”+error[i]+”
    “);
    _root.out += i+”:”+error[i]+”
    “;
    }
    };
    }

    _global.cfServer = NetServices.createGatewayConnection();
    var server = cfServer.getService(“CM_access.ExampleService”, new Result());

    //call a method
    server.getTree();

    2. code in CFC:



    SELECT table_id, parent_table_id, table_display_name
    FROM tree



    3. Changes made in FRSTree.as

    p.idField = “table_id”;

    /**
    @property parentIDField [string] the field (columnName) in the RecordSet indicating the uniqueID of parent
    change this according to your dataBase design
    */

    p.parentIDField = “parent_table_id”;

    /**
    @property labelField [string] the field (columnName) in the RecordSet indicating the label
    change this according to your dataBase design
    */
    p.labelField = “table_display_name”;

    Thanks,
    Yadviga