Results 1 to 10 of 10

Thread: Specifying a ModulaBase when using NetConnection.call() from Flash

  1. #1
    Join Date
    Jul 2012
    Posts
    14

    Default Specifying a ModulaBase when using NetConnection.call() from Flash

    Hello,
    Is it possible to specify a ModuleBase name when calling a function from Flash with NetConnection.call() method?

    I've tried this:
    __netConnection.call("ModuleBase1.testFunc", null);
    but Wowza gives this warning:
    WARN server comment - Missing function: ModuleBase1.testFunc

    The problem is that I have a function "testFunc" inside several ModuleBase classes.

    Thank you in advance.

  2. #2
    Join Date
    Sep 2011
    Posts
    1,934

    Default

    Hi
    Have you tried with the full class name?
    Example, (if your base class is "com.wowza.test1")
    ("com.wowza.test1.testFunc", null);
    Jason

  3. #3
    Join Date
    Jul 2012
    Posts
    14

    Default

    Hi Jason,
    Thank you for you answer!
    Yes, I have tried several combinations with no luck
    __netConnection.call("ModuleBase1.testFunc", null);
    __netConnection.call("ModuleBase1/testFunc", null);
    __netConnection.call("com.myProject.ModuleBase1.testFunc", null);
    __netConnection.call("com/myProject/ModuleBase1/testFunc", null);
    Adobe's AS3 reference says that I should use "/". Here is a small part of it about the command parameter:
    command:String A method specified in the form [objectPath/]method. For example, the someObject/doSomething command tells the remote server to call the clientObject.someObject.doSomething() method, with all the optional ... arguments parameters. If the object path is missing, clientObject.doSomething() is invoked on the remote server.
    But I guess this way works only for FMS.

  4. #4
    Join Date
    Sep 2011
    Posts
    1,934

    Default

    Hi
    I'm afraid I can't help you with this one, as a last ditch attempt I'd try :
    ("com.myProject.ModuleBase1/testFunc", null);
    If someone knows how this is done I'm sure they'll post in here to let you know.

    Jason

  5. #5

    Default

    Are you sure the AS3 docs you've quoted are suggesting using a different ModuleBase? It says: clientObject.someObject.doSomething() Where someObject is the path you specify. I take this to mean "clientObject" is the serverside "ModuleBase".

  6. #6
    Join Date
    Jul 2012
    Posts
    14

    Default

    Hi randall,
    Honestly, I am not sure that I perfectly understand what they say in this doc.
    If you need to see the full doc, you can find it here:
    http://help.adobe.com/en_US/FlashPla...on.html#call()

    I just wanted to say that I've tried using "/" but It doesn't work.

    My problem is that I have a method with name "testFunc" in 2 ModuleBase classes and because of this I need a way to specify which one I need.

  7. #7

    Default

    So, you have two different public functions with the same name, in classes that extend ModuleBase? Probably they will have to be different names. You can override a function such that the second function will be called instead of the first. Or you can overload a function if it has different parameters than the first, in which case both methods will be available, depending on the parameters you pass when the method is called.

  8. #8
    Join Date
    Sep 2011
    Posts
    1,934

    Default

    Hi
    Why not name one "testFunc1" and the other "testFunc2"?
    This would avoid this method completely.

    Jason

  9. #9
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    You don't refer to Module name or package path in the nc.call. You can only call a method name, and it has to have a signature exactly like the "doSomething" method in the example below:

    package test;
    
    import com.wowza.wms.amf.*;
    import com.wowza.wms.client.*;
    import com.wowza.wms.module.*;
    import com.wowza.wms.request.*;
    
    public class ModuleSoSomething extends ModuleBase {
    
    	public void doSomething(IClient client, RequestFunction function,
    			AMFDataList params) {
    		getLogger().info("doSomething");
    		sendResult(client, params, "Hello Wowza");
    	}
    
    }
    function doSomethingResult(returnStr:String)
    {
    	trace("doSomething: "+returnStr);
    }
    
    nc.call("doSomething", new Responder(doSomethingResult));
    Richard

  10. #10
    Join Date
    Jul 2012
    Posts
    14

    Default

    Thank you rrlanham,
    So It seems that I have to give different names for my functions .

Similar Threads

  1. NetConnection.call parameters not retrievable on server
    By kyanar in forum Server-side Modules and Code Samples Discussion
    Replies: 2
    Last Post: 02-18-2013, 09:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •