Skip to main content
Participating Frequently
August 12, 2009
Question

Directory listing SSAS

  • August 12, 2009
  • 1 reply
  • 763 views

Hey Adobe Forums,

I'm working on a project for a university and I need help. I need the main.asc file to return the current directory listing to a flash application.

Main.asc file:


application.onConnect = function( p_client)
{
....
     
     p_client.call("dirRcv", null, getDirectory("/"));
}

function getDirectory (theDirectory) {
     var currentDir = new File(theDirectory);
     var a = currentDir.list(function(name){return name;});
     return a;
}


Tracing a in main.asc returns the correct listing.

Client class:
public function dirRcv(d:Object):void {
     trace(d);
     for (var a in d)
     {
          trace(a);
     }
}

This returns:
[object Object],[object Object],[object Object]
0
1
2

for (var part in d) 
{ 
   trace(part + ": " + d[part]); 
}

returns
responds with

0: [object Object]
1: [object Object]
2: [object Object]

and appending .toString after d[part] returns

0: function Function() {}
1: function Function() {}
2: function Function() {}

Any help is appreciated, thanks.

    This topic has been closed for replies.

    1 reply

    BSchlenerAuthor
    Participating Frequently
    August 15, 2009

    I figured it out,

    for (var piece in result)

    {
       trace(result[piece].name);

    }

    This does not result in the full path as it does in the main.asc trace, it only shows /filename.flv.