Skip to main content
May 12, 2010
Question

GetFile method

  • May 12, 2010
  • 1 reply
  • 727 views

Hi,

I'm making exercises from here http://www.adobe.com/devnet/flashmediaserver/articles/video_sharing_web_app.html and on 4th page Jens Loeffler asking to create main.asc file with following code:

     application.onConnect = function(clObj) {
         this.acceptConnection(clObj);
     }

     Client.prototype.getFiles = function() {
         var fileList = new File("/streams/_defInst_/");
         var temp = fileList.list();
         return temp;
     }

I did it,  and when start application FMS is showing me error: Sending error message: Method not found (getFiles). Do you know why? What is wrong with this method?

thank you.

Lukasz

    This topic has been closed for replies.

    1 reply

    Adobe Employee
    May 13, 2010

    Hi,

    I think you need to have client side script which will make nc.call() to that method getFiles() declared on server and then handler to handle the return value:

    Client side script :

    connectURL.text = "rtmp://<fms_server_ip>/test";
    function connect(){
    nc = new NetConnection();
    nc.onStatus = function(info){
      trace(info.code);
      if(info.code == "NetConnection.Connect.Success"){
       var responder:Object = new Object();
       responder.onResult = function(result){
        for (i in result){
         trace(result.name);
        }
       };
       nc.call("getFiles", responder, null);
      }
      }
    trace(connectURL.text);
    nc.connect(connectURL.text);
    }

    starter.onPress = function(){
    connect();
    }

    Server side script :

    application.onConnect = function(clObj) {
        this.acceptConnection(clObj);
    }

    Client.prototype.getFiles = function() {
        var fileList = new File("/streams/_definst_/");
        var temp = fileList.list();
        return temp;
    }


      
    Regards,

    Amit

    May 13, 2010

    Hi,

    on the client side I have following code:

    private function onConnect(status:Object) : void {
                    catchVideos();
                }


    private function netStatusHandler(event:NetStatusEvent):void {
                    if(event.info.code == "NetConnection.Connect.Success"){
                        previewWindow.registerConnection(nc);
                        catchVideos();
                    }
                }


    public function catchVideos():void {
                     var nc_responder:Responder = new Responder(getMediaList,null);
                     nc.call("getFiles",nc_responder);
                 }


    public function getMediaList(list:Object):void {
                   metaData = list;
                    var mediaList:Array = new Array();
                    for(var items:String in list) {
                        if (typeof(list[items]) == "object") {
                            mediaList.push({label:items.split(".",1)});
                        }   
                    }
                    videoList = new ArrayCollection(mediaList);
                 }

    and still have the same error

    I do not know what is going on. Any idea?

    Lukasz

    May 15, 2010

    anybody....